diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index 3f01cc466..456507a46 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -30,7 +30,7 @@ Item{ id: manager readonly property Item common: commonOptions - readonly property Item explicit: explicitOptions.active ? explicitOptions.item : emptyExplicitOptions + readonly property Item explicit: explicitOptions.item Options.Common { id: commonOptions @@ -38,12 +38,17 @@ Item{ Loader{ id: explicitOptions - active: commonOptions.indicatorStyle === Latte.Types.LatteIndicator - source: "options/Latte.qml" + active: true + source: { + if (commonOptions.indicatorStyle === Latte.Types.LatteIndicator) { + return "options/Latte.qml"; + } else if (commonOptions.indicatorStyle === Latte.Types.PlasmaIndicator) { + return "options/Plasma.qml"; + } + + return "options/Latte.qml"; + } } - Item { - id: emptyExplicitOptions - } } diff --git a/containment/package/contents/ui/indicators/options/Latte.qml b/containment/package/contents/ui/indicators/options/Latte.qml index 25c38a66d..42bdec406 100644 --- a/containment/package/contents/ui/indicators/options/Latte.qml +++ b/containment/package/contents/ui/indicators/options/Latte.qml @@ -25,6 +25,8 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte Item{ + readonly property string styleName: "Latte" + readonly property bool dotsOnActive: plasmoid.configuration.dotsOnActive readonly property bool multiColorEnabled: plasmoid.configuration.threeColorsWindows readonly property int activeIndicatorType: plasmoid.configuration.activeIndicatorType diff --git a/containment/package/contents/ui/indicators/options/Plasma.qml b/containment/package/contents/ui/indicators/options/Plasma.qml index bb29671e1..08f9cdcfa 100644 --- a/containment/package/contents/ui/indicators/options/Plasma.qml +++ b/containment/package/contents/ui/indicators/options/Plasma.qml @@ -25,6 +25,8 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte Item{ + readonly property string styleName: "Plasma" + readonly property bool usePlasmaTabsStyle: !commonOptions.indicatorsForApplets } diff --git a/liblatte2/qml/indicators/LatteIndicator.qml b/liblatte2/qml/indicators/LatteIndicator.qml index cccafe312..8dbbcebac 100644 --- a/liblatte2/qml/indicators/LatteIndicator.qml +++ b/liblatte2/qml/indicators/LatteIndicator.qml @@ -36,13 +36,13 @@ Item{ readonly property real factor: 0.08 readonly property int size: factor * options.currentIconSize - readonly property int extraMaskThickness: options.common.reversedEnabled && options.explicit.glowEnabled ? 1.7 * (factor * options.maxIconSize) : 0 + readonly property int extraMaskThickness: reversedEnabled && glowEnabled ? 1.7 * (factor * options.maxIconSize) : 0 property real textColorBrightness: ColorizerTools.colorBrightness(theme.textColor) property color isActiveColor: theme.buttonFocusColor property color minimizedColor: { - if (options.explicit.multiColorEnabled) { + if (multiColorEnabled) { return (textColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7)); } @@ -50,6 +50,23 @@ Item{ } property color notActiveColor: options.isMinimized ? minimizedColor : isActiveColor + //! Common Options + readonly property bool reversedEnabled: options.common ? options.common.reversedEnabled : false + + //! Explicit Options + readonly property bool explicitOptionsEnabled: options.explicit + && options.explicit.hasOwnProperty("styleName") + && options.explicit.styleName === "Latte" + + readonly property bool dotsOnActive: explicitOptionsEnabled ? options.explicit.dotsOnActive : true + readonly property bool multiColorEnabled: explicitOptionsEnabled ? options.explicit.multiColorEnabled : false + readonly property int activeIndicatorType: explicitOptionsEnabled ? options.explicit.activeIndicatorType : Latte.Types.LineIndicator + //!glow options + readonly property bool glowEnabled: explicitOptionsEnabled ? options.explicit.glowEnabled : true + readonly property bool glow3D: explicitOptionsEnabled ? options.explicit.glow3D : false + readonly property int glowOption: explicitOptionsEnabled ? options.explicit.glowOption : Latte.Types.GlowAll + readonly property real glowOpacity: explicitOptionsEnabled ? options.explicit.glowOpacity : 0.35 + /*Rectangle{ anchors.fill: parent border.width: 1 @@ -83,24 +100,24 @@ Item{ basicColor: options.isActive || (options.isGroup && options.hasShown) ? indicatorRoot.isActiveColor : indicatorRoot.notActiveColor size: indicatorRoot.size - glow3D: options.explicit.glow3D + glow3D: glow3D animation: Math.max(1.65*3*units.longDuration,options.durationTime*3*units.longDuration) location: plasmoid.location - glowOpacity: options.explicit.glowOpacity + glowOpacity: indicatorRoot.glowOpacity contrastColor: options.shadowColor attentionColor: theme.negativeTextColor roundCorners: true showAttention: options.inAttention showGlow: { - if (options.explicit.glowEnabled && (options.explicit.glowOption === Latte.Types.GlowAll || showAttention )) + if (glowEnabled && (glowOption === Latte.Types.GlowAll || showAttention )) return true; - else if (options.explicit.glowEnabled && options.explicit.glowOption === Latte.Types.GlowOnlyOnActive && options.hasActive) + else if (glowEnabled && glowOption === Latte.Types.GlowOnlyOnActive && options.hasActive) return true; else return false; } - showBorder: options.explicit.glowEnabled && options.explicit.glow3D + showBorder: glowEnabled && glow3D property int stateWidth: options.isGroup ? indicatorRoot.width - secondPoint.width : indicatorRoot.width - spacer.width property int stateHeight: options.isGroup ? indicatorRoot.height - secondPoint.height : indicatorRoot.width - spacer.height @@ -120,12 +137,12 @@ Item{ else height = indicatorRoot.size; - if(vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator) + if(vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator) height = stateHeight; else height = indicatorRoot.size; - if(!vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator) + if(!vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator) width = stateWidth; else width = indicatorRoot.size; @@ -134,26 +151,26 @@ Item{ onIsActiveChanged: { - if (options.explicit.activeIndicatorType === Latte.Types.LineIndicator) + if (activeIndicatorType === Latte.Types.LineIndicator) activeAndReverseAnimation.start(); } onScaleFactorChanged: { - if(!activeAndReverseAnimation.running && !vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator){ + if(!activeAndReverseAnimation.running && !vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator){ width = stateWidth; } - else if (!activeAndReverseAnimation.running && vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator){ + else if (!activeAndReverseAnimation.running && vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator){ height = stateHeight; } } onStateWidthChanged:{ - if(!activeAndReverseAnimation.running && !vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator) + if(!activeAndReverseAnimation.running && !vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator) width = stateWidth; } onStateHeightChanged:{ - if(!activeAndReverseAnimation.running && vertical && isActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator) + if(!activeAndReverseAnimation.running && vertical && isActive && activeIndicatorType === Latte.Types.LineIndicator) height = stateHeight; } @@ -173,7 +190,7 @@ Item{ id: activeAndReverseAnimation target: firstPoint property: plasmoid.formFactor === PlasmaCore.Types.Vertical ? "height" : "width" - to: options.hasActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator + to: options.hasActive && activeIndicatorType === Latte.Types.LineIndicator ? (plasmoid.formFactor === PlasmaCore.Types.Vertical ? firstPoint.stateHeight : firstPoint.stateWidth) : indicatorRoot.size duration: firstPoint.animationTime easing.type: Easing.InQuad @@ -194,18 +211,18 @@ Item{ height: width size: indicatorRoot.size - glow3D: options.explicit.glow3D + glow3D: glow3D animation: Math.max(1.65*3*units.longDuration,options.durationTime*3*units.longDuration) location: plasmoid.location - glowOpacity: options.explicit.glowOpacity + glowOpacity: indicatorRoot.glowOpacity contrastColor: options.shadowColor - showBorder: options.explicit.glowEnabled && options.explicit.glow3D + showBorder: glowEnabled && glow3D basicColor: state2Color roundCorners: true - showGlow: options.explicit.glowEnabled && options.explicit.glowOption === Latte.Types.GlowAll - visible: ( options.isGroup && ((options.explicit.dotsOnActive && options.explicit.activeIndicatorType === Latte.Types.LineIndicator) - || options.explicit.activeIndicatorType === Latte.Types.DotIndicator + showGlow: glowEnabled && glowOption === Latte.Types.GlowAll + visible: ( options.isGroup && ((dotsOnActive && activeIndicatorType === Latte.Types.LineIndicator) + || activeIndicatorType === Latte.Types.DotIndicator || !options.hasActive) )? true: false //when there is no active window @@ -218,8 +235,8 @@ Item{ states: [ State { name: "left" - when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !options.common.reversedEnabled) || - (plasmoid.location === PlasmaCore.Types.RightEdge && options.common.reversedEnabled)) + when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.RightEdge && reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -229,8 +246,8 @@ Item{ }, State { name: "bottom" - when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !options.common.reversedEnabled) || - (plasmoid.location === PlasmaCore.Types.TopEdge && options.common.reversedEnabled)) + when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.TopEdge && reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -240,8 +257,8 @@ Item{ }, State { name: "top" - when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !options.common.reversedEnabled) || - (plasmoid.location === PlasmaCore.Types.BottomEdge && options.common.reversedEnabled)) + when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.BottomEdge && reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -251,8 +268,8 @@ Item{ }, State { name: "right" - when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !options.common.reversedEnabled) || - (plasmoid.location === PlasmaCore.Types.LeftEdge && options.common.reversedEnabled)) + when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.LeftEdge && reversedEnabled)) AnchorChanges { target: mainIndicatorElement diff --git a/plasmoid/package/contents/ui/indicators/Manager.qml b/plasmoid/package/contents/ui/indicators/Manager.qml index 3f01cc466..b711b2e9f 100644 --- a/plasmoid/package/contents/ui/indicators/Manager.qml +++ b/plasmoid/package/contents/ui/indicators/Manager.qml @@ -30,16 +30,14 @@ Item{ id: manager readonly property Item common: commonOptions - readonly property Item explicit: explicitOptions.active ? explicitOptions.item : emptyExplicitOptions + readonly property Item explicit: explicitOptions Options.Common { id: commonOptions } - Loader{ - id: explicitOptions - active: commonOptions.indicatorStyle === Latte.Types.LatteIndicator - source: "options/Latte.qml" + Options.Latte { + id : explicitOptions } Item { diff --git a/plasmoid/package/contents/ui/indicators/options/Common.qml b/plasmoid/package/contents/ui/indicators/options/Common.qml index 1b487a494..4925d5478 100644 --- a/plasmoid/package/contents/ui/indicators/options/Common.qml +++ b/plasmoid/package/contents/ui/indicators/options/Common.qml @@ -28,7 +28,6 @@ Item{ id: common readonly property bool indicatorsEnabled: true - readonly property bool indicatorsForApplets: plasmoid.configuration.indicatorsForApplets readonly property bool reversedEnabled: plasmoid.configuration.reverseLinesPosition readonly property int indicatorStyle: Latte.Types.LatteIndicator diff --git a/plasmoid/package/contents/ui/indicators/options/Latte.qml b/plasmoid/package/contents/ui/indicators/options/Latte.qml index 76bacd217..19149fd31 100644 --- a/plasmoid/package/contents/ui/indicators/options/Latte.qml +++ b/plasmoid/package/contents/ui/indicators/options/Latte.qml @@ -25,6 +25,8 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte Item{ + readonly property string styleName: "Latte" + readonly property bool dotsOnActive: plasmoid.configuration.dotsOnActive readonly property bool multiColorEnabled: plasmoid.configuration.threeColorsWindows readonly property int activeIndicatorType: Latte.Types.LineIndicator