Loaders for all dock settings windows

--this way we make sure that plasmoid and latteView
objects are always available to them when needed
work/spdx
Michail Vourlakos 4 years ago
parent 55d0dde551
commit cbe9a588b8

@ -28,126 +28,129 @@ import org.kde.latte.private.containment 0.1 as LatteContainment
import "canvas" as CanvasComponent
Item{
id: root
Loader {
active: plasmoid && plasmoid.configuration && latteView
sourceComponent: Item{
id: root
readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool isHorizontal: !isVertical
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? 500 : 0
property int panelAlignment: plasmoid.configuration.alignment
readonly property real appliedOpacity: imageTiler.opacity
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
1 : plasmoid.configuration.editBackgroundOpacity
property real offset: {
if (root.isHorizontal) {
return width * (plasmoid.configuration.offset/100);
} else {
return height * (plasmoid.configuration.offset/100)
}
}
readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool isHorizontal: !isVertical
property string appChosenShadowColor: {
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
var strC = String(theme.textColor);
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
return plasmoid.configuration.shadowColor;
}
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? 500 : 0
property int panelAlignment: plasmoid.configuration.alignment
// default shadow color
return "080808";
}
readonly property real appliedOpacity: imageTiler.opacity
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
1 : plasmoid.configuration.editBackgroundOpacity
property string appShadowColorSolid: "#" + appChosenShadowColor
property real offset: {
if (root.isHorizontal) {
return width * (plasmoid.configuration.offset/100);
} else {
return height * (plasmoid.configuration.offset/100)
//// BEGIN OF Behaviors
Behavior on offset {
NumberAnimation {
id: offsetAnimation
duration: animationSpeed
easing.type: Easing.OutCubic
}
}
}
//// END OF Behaviors
property string appChosenShadowColor: {
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
var strC = String(theme.textColor);
return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
return plasmoid.configuration.shadowColor;
Item {
id: graphicsSystem
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
&& (GraphicsInfo.api !== GraphicsInfo.Unknown)
}
// default shadow color
return "080808";
}
property string appShadowColorSolid: "#" + appChosenShadowColor
//// BEGIN OF Behaviors
Behavior on offset {
NumberAnimation {
id: offsetAnimation
duration: animationSpeed
easing.type: Easing.OutCubic
Image{
id: imageTiler
anchors.fill: parent
opacity: root.maxOpacity
fillMode: Image.Tile
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationSpeed
easing.type: Easing.OutCubic
}
}
}
}
//// END OF Behaviors
Item {
id: graphicsSystem
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
&& (GraphicsInfo.api !== GraphicsInfo.Unknown)
}
MouseArea {
id: editBackMouseArea
anchors.fill: imageTiler
visible: !plasmoid.configuration.inConfigureAppletsMode
hoverEnabled: true
Image{
id: imageTiler
anchors.fill: parent
opacity: root.maxOpacity
fillMode: Image.Tile
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
property bool wheelIsBlocked: false;
readonly property double opacityStep: 0.1
readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage",
"You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100))
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationSpeed
easing.type: Easing.OutCubic
onWheel: {
processWheel(wheel);
}
}
}
MouseArea {
id: editBackMouseArea
anchors.fill: imageTiler
visible: !plasmoid.configuration.inConfigureAppletsMode
hoverEnabled: true
property bool wheelIsBlocked: false;
readonly property double opacityStep: 0.1
readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage",
"You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100))
function processWheel(wheel) {
if (wheelIsBlocked) {
return;
}
onWheel: {
processWheel(wheel);
}
wheelIsBlocked = true;
scrollDelayer.start();
var angle = wheel.angleDelta.y / 8;
function processWheel(wheel) {
if (wheelIsBlocked) {
return;
if (angle > 10) {
plasmoid.configuration.editBackgroundOpacity = Math.min(100, plasmoid.configuration.editBackgroundOpacity + opacityStep)
} else if (angle < -10) {
plasmoid.configuration.editBackgroundOpacity = Math.max(0, plasmoid.configuration.editBackgroundOpacity - opacityStep)
}
}
wheelIsBlocked = true;
scrollDelayer.start();
//! A timer is needed in order to handle also touchpads that probably
//! send too many signals very fast. This way the signals per sec are limited.
//! The user needs to have a steady normal scroll in order to not
//! notice a annoying delay
Timer{
id: scrollDelayer
var angle = wheel.angleDelta.y / 8;
if (angle > 10) {
plasmoid.configuration.editBackgroundOpacity = Math.min(100, plasmoid.configuration.editBackgroundOpacity + opacityStep)
} else if (angle < -10) {
plasmoid.configuration.editBackgroundOpacity = Math.max(0, plasmoid.configuration.editBackgroundOpacity - opacityStep)
interval: 80
onTriggered: editBackMouseArea.wheelIsBlocked = false;
}
}
//! A timer is needed in order to handle also touchpads that probably
//! send too many signals very fast. This way the signals per sec are limited.
//! The user needs to have a steady normal scroll in order to not
//! notice a annoying delay
Timer{
id: scrollDelayer
interval: 80
onTriggered: editBackMouseArea.wheelIsBlocked = false;
PlasmaComponents.Button {
anchors.fill: editBackMouseArea
opacity: 0
tooltip: editBackMouseArea.tooltip
}
}
PlasmaComponents.Button {
anchors.fill: editBackMouseArea
opacity: 0
tooltip: editBackMouseArea.tooltip
}
//! Settings Overlay
CanvasComponent.SettingsOverlay {
id: settingsOverlay
anchors.fill: parent
//! Settings Overlay
CanvasComponent.SettingsOverlay {
id: settingsOverlay
anchors.fill: parent
}
}
}

@ -35,38 +35,41 @@ import org.kde.latte.core 0.2 as LatteCore
import "../controls" as LatteExtraControls
FocusScope {
id: dialog
Loader {
active: plasmoid && plasmoid.configuration && latteView
width: typeSettings.width + units.smallSpacing * 4
height: typeSettings.height + units.smallSpacing * 4
Layout.minimumWidth: width
Layout.minimumHeight: height
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
sourceComponent: FocusScope {
id: dialog
property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
width: typeSettings.width + units.smallSpacing * 4
height: typeSettings.height + units.smallSpacing * 4
Layout.minimumWidth: width
Layout.minimumHeight: height
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
PlasmaCore.FrameSvgItem{
id: backgroundFrameSvgItem
anchors.fill: parent
imagePath: "dialogs/background"
enabledBorders: viewConfig.enabledBorders
property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
onEnabledBordersChanged: viewConfig.updateEffects()
Component.onCompleted: viewConfig.updateEffects()
}
PlasmaCore.FrameSvgItem{
id: backgroundFrameSvgItem
anchors.fill: parent
imagePath: "dialogs/background"
enabledBorders: viewConfig.enabledBorders
onEnabledBordersChanged: viewConfig.updateEffects()
Component.onCompleted: viewConfig.updateEffects()
}
LatteExtraControls.TypeSelection{
id: typeSettings
anchors.centerIn: parent
LatteExtraControls.TypeSelection{
id: typeSettings
anchors.centerIn: parent
Component.onCompleted: forceActiveFocus();
Component.onCompleted: forceActiveFocus();
Keys.onPressed: {
if (event.key === Qt.Key_Escape) {
primaryConfigView.hideConfigWindow();
Keys.onPressed: {
if (event.key === Qt.Key_Escape) {
primaryConfigView.hideConfigWindow();
}
}
}
}

Loading…
Cancel
Save