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 import "canvas" as CanvasComponent
Item{ Loader {
id: root 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 property string appChosenShadowColor: {
readonly property bool isHorizontal: !isVertical 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 // default shadow color
property int panelAlignment: plasmoid.configuration.alignment return "080808";
}
readonly property real appliedOpacity: imageTiler.opacity property string appShadowColorSolid: "#" + appChosenShadowColor
readonly property real maxOpacity: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive ?
1 : plasmoid.configuration.editBackgroundOpacity
property real offset: { //// BEGIN OF Behaviors
if (root.isHorizontal) { Behavior on offset {
return width * (plasmoid.configuration.offset/100); NumberAnimation {
} else { id: offsetAnimation
return height * (plasmoid.configuration.offset/100) duration: animationSpeed
easing.type: Easing.OutCubic
}
} }
} //// END OF Behaviors
property string appChosenShadowColor: { Item {
if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) { id: graphicsSystem
var strC = String(theme.textColor); readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software)
return strC.indexOf("#") === 0 ? strC.substr(1) : strC; && (GraphicsInfo.api !== GraphicsInfo.Unknown)
} else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
return plasmoid.configuration.shadowColor;
} }
// default shadow color Image{
return "080808"; id: imageTiler
} anchors.fill: parent
opacity: root.maxOpacity
property string appShadowColorSolid: "#" + appChosenShadowColor fillMode: Image.Tile
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
//// BEGIN OF Behaviors
Behavior on offset { Behavior on opacity {
NumberAnimation { NumberAnimation {
id: offsetAnimation duration: 0.8 * root.animationSpeed
duration: animationSpeed easing.type: Easing.OutCubic
easing.type: Easing.OutCubic }
}
} }
}
//// END OF Behaviors
Item { MouseArea {
id: graphicsSystem id: editBackMouseArea
readonly property bool isAccelerated: (GraphicsInfo.api !== GraphicsInfo.Software) anchors.fill: imageTiler
&& (GraphicsInfo.api !== GraphicsInfo.Unknown) visible: !plasmoid.configuration.inConfigureAppletsMode
} hoverEnabled: true
Image{ property bool wheelIsBlocked: false;
id: imageTiler readonly property double opacityStep: 0.1
anchors.fill: parent readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage",
opacity: root.maxOpacity "You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100))
fillMode: Image.Tile
source: latteView.layout ? latteView.layout.background : "../images/canvas/blueprint.jpg"
Behavior on opacity { onWheel: {
NumberAnimation { processWheel(wheel);
duration: 0.8 * root.animationSpeed
easing.type: Easing.OutCubic
} }
}
}
MouseArea {
id: editBackMouseArea
anchors.fill: imageTiler
visible: !plasmoid.configuration.inConfigureAppletsMode
hoverEnabled: true
property bool wheelIsBlocked: false; function processWheel(wheel) {
readonly property double opacityStep: 0.1 if (wheelIsBlocked) {
readonly property string tooltip: i18nc("opacity for background under edit mode, %0% is opacity percentage", return;
"You can use mouse wheel to change background opacity of %0%").arg(Math.round(plasmoid.configuration.editBackgroundOpacity * 100)) }
onWheel: { wheelIsBlocked = true;
processWheel(wheel); scrollDelayer.start();
}
var angle = wheel.angleDelta.y / 8;
function processWheel(wheel) { if (angle > 10) {
if (wheelIsBlocked) { plasmoid.configuration.editBackgroundOpacity = Math.min(100, plasmoid.configuration.editBackgroundOpacity + opacityStep)
return; } else if (angle < -10) {
plasmoid.configuration.editBackgroundOpacity = Math.max(0, plasmoid.configuration.editBackgroundOpacity - opacityStep)
}
} }
wheelIsBlocked = true; //! A timer is needed in order to handle also touchpads that probably
scrollDelayer.start(); //! 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; interval: 80
onTriggered: editBackMouseArea.wheelIsBlocked = false;
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)
} }
} }
//! A timer is needed in order to handle also touchpads that probably PlasmaComponents.Button {
//! send too many signals very fast. This way the signals per sec are limited. anchors.fill: editBackMouseArea
//! The user needs to have a steady normal scroll in order to not opacity: 0
//! notice a annoying delay tooltip: editBackMouseArea.tooltip
Timer{
id: scrollDelayer
interval: 80
onTriggered: editBackMouseArea.wheelIsBlocked = false;
} }
}
PlasmaComponents.Button { //! Settings Overlay
anchors.fill: editBackMouseArea CanvasComponent.SettingsOverlay {
opacity: 0 id: settingsOverlay
tooltip: editBackMouseArea.tooltip 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 import "../controls" as LatteExtraControls
FocusScope { Loader {
id: dialog active: plasmoid && plasmoid.configuration && latteView
width: typeSettings.width + units.smallSpacing * 4 sourceComponent: FocusScope {
height: typeSettings.height + units.smallSpacing * 4 id: dialog
Layout.minimumWidth: width
Layout.minimumHeight: height
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
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{ property bool panelIsVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
id: backgroundFrameSvgItem
anchors.fill: parent
imagePath: "dialogs/background"
enabledBorders: viewConfig.enabledBorders
onEnabledBordersChanged: viewConfig.updateEffects() PlasmaCore.FrameSvgItem{
Component.onCompleted: viewConfig.updateEffects() id: backgroundFrameSvgItem
} anchors.fill: parent
imagePath: "dialogs/background"
enabledBorders: viewConfig.enabledBorders
onEnabledBordersChanged: viewConfig.updateEffects()
Component.onCompleted: viewConfig.updateEffects()
}
LatteExtraControls.TypeSelection{ LatteExtraControls.TypeSelection{
id: typeSettings id: typeSettings
anchors.centerIn: parent anchors.centerIn: parent
Component.onCompleted: forceActiveFocus(); Component.onCompleted: forceActiveFocus();
Keys.onPressed: { Keys.onPressed: {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
primaryConfigView.hideConfigWindow(); primaryConfigView.hideConfigWindow();
}
} }
} }
} }

Loading…
Cancel
Save