diff --git a/containment/package/contents/ui/applet/indicators/LatteIndicator.qml b/containment/package/contents/ui/applet/indicators/LatteIndicator.qml index f4a1965d2..04e687694 100644 --- a/containment/package/contents/ui/applet/indicators/LatteIndicator.qml +++ b/containment/package/contents/ui/applet/indicators/LatteIndicator.qml @@ -27,7 +27,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.latte 0.2 as Latte Item{ - id:glowFrame + id:indicatorRoot width: !root.isVertical ? parent.width : size height: root.isVertical ? parent.height : size @@ -48,10 +48,10 @@ Item{ id:activePoint anchors.centerIn: parent + size: indicatorRoot.size basicColor: theme.buttonFocusColor roundCorners: true showGlow: root.showGlow - glow3D: root.glow3D animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration) location: plasmoid.location @@ -59,8 +59,8 @@ Item{ contrastColor: root.appShadowColorSolid opacity:{ - if ( (!vertical && width <= glowFrame.size && !appletItem.isActive) - || (vertical && height <= glowFrame.size && !appletItem.isActive)) + if ( (!vertical && width <= indicatorRoot.size && !appletItem.isActive) + || (vertical && height <= indicatorRoot.size && !appletItem.isActive)) return 0; return 1; @@ -69,27 +69,27 @@ Item{ property bool vertical: root.isVertical property int animationTime: root.durationTime * (1.2*units.longDuration) - property int stateWidth: root.activeIndicatorType === Latte.Types.DotIndicator ? glowFrame.size : glowFrame.width - property int stateHeight: root.activeIndicatorType === Latte.Types.DotIndicator ? glowFrame.size : glowFrame.height + property int stateWidth: root.activeIndicatorType === Latte.Types.DotIndicator ? indicatorRoot.size : indicatorRoot.width + property int stateHeight: root.activeIndicatorType === Latte.Types.DotIndicator ? indicatorRoot.size : indicatorRoot.height property real scaleFactor: wrapper.zoomScale function updateInitialSizes(){ - if(glowFrame){ + if(indicatorRoot){ if(vertical) - width = glowFrame.size; + width = indicatorRoot.size; else - height = glowFrame.size; + height = indicatorRoot.size; if(vertical && appletItem.isActive) height = stateHeight; else - height = glowFrame.size; + height = indicatorRoot.size; if(!vertical && appletItem.isActive) width = stateWidth; else - width = glowFrame.size; + width = indicatorRoot.size; } } @@ -135,7 +135,7 @@ Item{ id: activeAndReverseAnimation target: activePoint property: root.isVertical ? "height" : "width" - to: !appletItem.isActive ? (root.isVertical ? activePoint.stateHeight : activePoint.stateWidth) : glowFrame.size + to: !appletItem.isActive ? (root.isVertical ? activePoint.stateHeight : activePoint.stateWidth) : indicatorRoot.size duration: activePoint.animationTime easing.type: Easing.InQuad @@ -150,7 +150,7 @@ Item{ (plasmoid.location === PlasmaCore.Types.RightEdge && root.reverseLinesPosition)) AnchorChanges { - target: glowFrame + target: indicatorRoot anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter; top:undefined; bottom:undefined; left:parent.left; right:undefined;} } @@ -161,7 +161,7 @@ Item{ (plasmoid.location === PlasmaCore.Types.TopEdge && root.reverseLinesPosition)) AnchorChanges { - target: glowFrame + target: indicatorRoot anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter; top:undefined; bottom:parent.bottom; left:undefined; right:undefined;} } @@ -172,7 +172,7 @@ Item{ (plasmoid.location === PlasmaCore.Types.BottomEdge && root.reverseLinesPosition)) AnchorChanges { - target: glowFrame + target: indicatorRoot anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter; top:parent.top; bottom:undefined; left:undefined; right:undefined;} } @@ -183,7 +183,7 @@ Item{ (plasmoid.location === PlasmaCore.Types.LeftEdge && root.reverseLinesPosition)) AnchorChanges { - target: glowFrame + target: indicatorRoot anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter; top:undefined; bottom:undefined; left:undefined; right:parent.right;} } diff --git a/liblatte2/qml/GlowPoint.qml b/liblatte2/qml/GlowPoint.qml index 21880e7ca..01a7820a1 100644 --- a/liblatte2/qml/GlowPoint.qml +++ b/liblatte2/qml/GlowPoint.qml @@ -37,6 +37,8 @@ Item{ property int animation: 250 property int location: PlasmaCore.Types.BottomEdge + property int size: 10 + property real glowOpacity: 0.75 property color attentionColor: "red" @@ -62,8 +64,8 @@ Item{ rows: isHorizontal ? 1 : 0 columns: isVertical ? 1 : 0 - property int halfCorner: 3*glowFrame.size - property int fullCorner: 6*glowFrame.size + property int halfCorner: 3*glowItem.size + property int fullCorner: 6*glowItem.size Item { id: firstGlowCorner @@ -112,8 +114,8 @@ Item{ Item { id:mainGlowPart - width: isHorizontal ? glowItem.width - glowFrame.size : mainGlow.fullCorner - height: isHorizontal ? mainGlow.fullCorner : glowItem.height - glowFrame.size + width: isHorizontal ? glowItem.width - glowItem.size : mainGlow.fullCorner + height: isHorizontal ? mainGlow.fullCorner : glowItem.height - glowItem.size LinearGradient { anchors.fill: parent @@ -299,7 +301,7 @@ Item{ height: isHorizontal ? shadow : Math.max(mainGlowPart.height, shadow) radius: isHorizontal ? height/2 : width/2 - property int shadow: glowFrame.size / 3 + property int shadow: glowItem.size / 3 color: glowItem.contrastColorAlpha opacity: 0.2 diff --git a/plasmoid/package/contents/ui/task/IconItem.qml b/plasmoid/package/contents/ui/task/IconItem.qml index 9caa7e239..071cc96f6 100644 --- a/plasmoid/package/contents/ui/task/IconItem.qml +++ b/plasmoid/package/contents/ui/task/IconItem.qml @@ -595,8 +595,8 @@ Item{ Connections{ target: taskItem - onShowAttentionChanged:{ - if (!taskItem.showAttention && newWindowAnimation.running && taskItem.inAttentionAnimation) { + onInAttentionChanged:{ + if (!taskItem.inAttention && newWindowAnimation.running && taskItem.inAttentionAnimation) { newWindowAnimation.pause(); fastRestoreAnimation.start(); } diff --git a/plasmoid/package/contents/ui/task/TaskItem.qml b/plasmoid/package/contents/ui/task/TaskItem.qml index 06b0a9a52..c74c6ea61 100644 --- a/plasmoid/package/contents/ui/task/TaskItem.qml +++ b/plasmoid/package/contents/ui/task/TaskItem.qml @@ -96,8 +96,10 @@ MouseArea{ property bool hasActive: isActive property bool hasMinimized: (IsGroupParent === true) ? subWindows.hasMinimized : isMinimized property bool hasShown: (IsGroupParent === true) ? subWindows.hasShown : !isMinimized - property bool inAddRemoveAnimation: true + property bool inAttention: isDemandingAttention && plasmoid.status === PlasmaCore.Types.RequiresAttentionStatus ? true : false + /*animations flags*/ property bool inAnimation: true + property bool inAddRemoveAnimation: true property bool inAttentionAnimation: false property bool inBlockingAnimation: false property bool inBouncingAnimation: false @@ -127,8 +129,6 @@ MouseArea{ property bool pressed: false property bool wheelIsBlocked: false - readonly property bool showAttention: isDemandingAttention && plasmoid.status === PlasmaCore.Types.RequiresAttentionStatus ? - true : false property int animationTime: root.durationTime * 1.2 * units.shortDuration property int badgeIndicator: 0 //it is used from external apps @@ -424,6 +424,7 @@ MouseArea{ } */ Loader { + id: indicatorLoader anchors.bottom: (root.position === PlasmaCore.Types.BottomPositioned) ? parent.bottom : undefined anchors.top: (root.position === PlasmaCore.Types.TopPositioned) ? parent.top : undefined anchors.left: (root.position === PlasmaCore.Types.LeftPositioned) ? parent.left : undefined @@ -438,9 +439,37 @@ MouseArea{ active: root.activeIndicator !== Latte.Types.NoneIndicator /* Indicators Properties in order use them*/ + readonly property bool isTask: true + readonly property bool isApplet: false + + readonly property alias isLauncher: taskItem.isLauncher + readonly property alias isStartup: taskItem.isStartup + readonly property alias isWindow: taskItem.isWindow + + readonly property bool isActive: taskItem.hasActive || (root.showPreviews && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) + readonly property alias isGroup: taskItem.isGroupParent + readonly property alias isMinimized: taskItem.isMinimized + readonly property alias inAttention: taskItem.inAttention - readonly property alias isActive: taskItem.isActive readonly property alias hasActive: taskItem.hasActive + readonly property alias hasMinimized: taskItem.hasMinimized + readonly property alias hasShown: taskItem.hasShown + + readonly property int iconSize: root.iconSize + readonly property int durationTime: root.durationTime + readonly property real scaleFactor: wrapper.mScale + readonly property color shadowColor: root.appShadowColorSolid + + readonly property bool dotsOnActive: root.dotsOnActive + readonly property bool multiColorEnabled: root.threeColorsWindows + readonly property bool reversedEnabled: root.reverseLinesPosition + readonly property int activeIndicatorType: root.activeIndicatorType + + //!glow options + readonly property bool glowEnabled: root.showGlow + readonly property int glowOption: root.glowOption + readonly property real glowOpacity: root.glowOpacity + readonly property bool glow3D: root.glow3D sourceComponent: { switch (root.indicatorStyle) { diff --git a/plasmoid/package/contents/ui/task/Wrapper.qml b/plasmoid/package/contents/ui/task/Wrapper.qml index d468b42db..23ff006a3 100644 --- a/plasmoid/package/contents/ui/task/Wrapper.qml +++ b/plasmoid/package/contents/ui/task/Wrapper.qml @@ -105,12 +105,12 @@ Item{ signal runLauncherAnimation(); - Rectangle{ + /* Rectangle{ anchors.fill: parent border.width: 1 border.color: "green" color: "transparent" - } + }*/ Behavior on mScale { enabled: !root.globalDirectRender || inMimicParabolicAnimation diff --git a/plasmoid/package/contents/ui/task/indicators/LatteIndicator.qml b/plasmoid/package/contents/ui/task/indicators/LatteIndicator.qml index 6710a9b3d..8ea14f6b7 100644 --- a/plasmoid/package/contents/ui/task/indicators/LatteIndicator.qml +++ b/plasmoid/package/contents/ui/task/indicators/LatteIndicator.qml @@ -28,14 +28,26 @@ import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.latte 0.2 as Latte +import "../../../code/ColorizerTools.js" as ColorizerTools + Item{ id: indicatorRoot - property int size: 0.075*root.iconSize + property int size: 0.08 * rootItem.iconSize + + property real textColorBrightness: ColorizerTools.colorBrightness(theme.textColor) property color isActiveColor: theme.buttonFocusColor - property color minimizedColor: root.threeColorsWindows ? root.minimizedDotColor : isActiveColor - property color notActiveColor: taskItem.hasMinimized ? minimizedColor : isActiveColor + property color minimizedColor: { + if (rootItem.multiColorEnabled) { + return (textColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7)); + } + + return isActiveColor; + } + property color notActiveColor: rootItem.isMinimized ? minimizedColor : isActiveColor + + property Item rootItem: parent /*Rectangle{ anchors.fill: parent @@ -59,41 +71,38 @@ Item{ id:firstPoint visible: ( !IsLauncher ) ? true: false - basicColor: IsActive===true || (taskItem.isGroupParent && taskItem.hasShown) ? indicatorRoot.isActiveColor : indicatorRoot.notActiveColor + basicColor: rootItem.isActive || (rootItem.isGroup && rootItem.hasShown) ? indicatorRoot.isActiveColor : indicatorRoot.notActiveColor - glow3D: root.glow3D - animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration) + size: indicatorRoot.size + glow3D: rootItem.glow3D + animation: Math.max(1.65*3*units.longDuration,rootItem.durationTime*3*units.longDuration) location: plasmoid.location - glowOpacity: root.glowOpacity - contrastColor: root.appShadowColorSolid - attentionColor: colorScopePalette.negativeTextColor + glowOpacity: rootItem.glowOpacity + contrastColor: rootItem.shadowColor + attentionColor: theme.negativeTextColor roundCorners: true - showAttention: taskItem.showAttention + showAttention: rootItem.inAttention showGlow: { - if (root.showGlow && (root.glowOption === Latte.Types.GlowAll || showAttention )) + if (rootItem.glowEnabled && (rootItem.glowOption === Latte.Types.GlowAll || showAttention )) return true; - else if (root.showGlow && root.glowOption === Latte.Types.GlowOnlyOnActive && taskItem.hasActive) + else if (rootItem.glowEnabled && rootItem.glowOption === Latte.Types.GlowOnlyOnActive && rootItem.hasActive) return true; else return false; } - showBorder: root.showGlow && root.glow3D - - // opacity: (!taskItem.hasActive && root.showPreviews - // && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) ? 0.4 : 1 + showBorder: rootItem.glowEnabled && rootItem.glow3D - property int stateWidth: taskItem.isGroupParent ? indicatorRoot.width - secondPoint.width : indicatorRoot.width - spacer.width - property int stateHeight: taskItem.isGroupParent ? indicatorRoot.height - secondPoint.height : indicatorRoot.width - spacer.height + property int stateWidth: rootItem.isGroup ? indicatorRoot.width - secondPoint.width : indicatorRoot.width - spacer.width + property int stateHeight: rootItem.isGroup ? indicatorRoot.height - secondPoint.height : indicatorRoot.width - spacer.height - property int animationTime: root.durationTime* (0.7*units.longDuration) + property int animationTime: rootItem.durationTime* (0.7*units.longDuration) - property bool isActive: taskItem.hasActive - || (root.showPreviews && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) + property bool isActive: rootItem.hasActive || rootItem.isActive - property bool vertical: root.vertical + property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical - property real scaleFactor: wrapper.mScale + property real scaleFactor: rootItem.scaleFactor function updateInitialSizes(){ if(indicatorRoot){ @@ -102,12 +111,12 @@ Item{ else height = indicatorRoot.size; - if(vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator) + if(vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator) height = stateHeight; else height = indicatorRoot.size; - if(!vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator) + if(!vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator) width = stateWidth; else width = indicatorRoot.size; @@ -116,27 +125,26 @@ Item{ onIsActiveChanged: { - // if(taskItem.hasActive || windowsPreviewDlg.visible) - if (root.activeIndicatorType === Latte.Types.LineIndicator) + if (rootItem.activeIndicatorType === Latte.Types.LineIndicator) activeAndReverseAnimation.start(); } onScaleFactorChanged: { - if(!activeAndReverseAnimation.running && !root.vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator){ + if(!activeAndReverseAnimation.running && !vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator){ width = stateWidth; } - else if (!activeAndReverseAnimation.running && root.vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator){ + else if (!activeAndReverseAnimation.running && vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator){ height = stateHeight; } } onStateWidthChanged:{ - if(!activeAndReverseAnimation.running && !vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator) + if(!activeAndReverseAnimation.running && !vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator) width = stateWidth; } onStateHeightChanged:{ - if(!activeAndReverseAnimation.running && vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator) + if(!activeAndReverseAnimation.running && vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator) height = stateHeight; } @@ -145,20 +153,19 @@ Item{ Component.onCompleted: { updateInitialSizes(); - root.onIconSizeChanged.connect(updateInitialSizes); + rootItem.onIconSizeChanged.connect(updateInitialSizes); } Component.onDestruction: { - root.onIconSizeChanged.disconnect(updateInitialSizes); + rootItem.onIconSizeChanged.disconnect(updateInitialSizes); } NumberAnimation{ id: activeAndReverseAnimation target: firstPoint - property: root.vertical ? "height" : "width" - to: (taskItem.hasActive && root.activeIndicatorType === Latte.Types.LineIndicator) - || (root.showPreviews && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) - ? (root.vertical ? firstPoint.stateHeight : firstPoint.stateWidth) : indicatorRoot.size + property: plasmoid.formFactor === PlasmaCore.Types.Vertical ? "height" : "width" + to: rootItem.hasActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator + ? (plasmoid.formFactor === PlasmaCore.Types.Vertical ? firstPoint.stateHeight : firstPoint.stateWidth) : indicatorRoot.size duration: firstPoint.animationTime easing.type: Easing.InQuad @@ -177,32 +184,33 @@ Item{ width: visible ? indicatorRoot.size : 0 height: width - glow3D: root.glow3D - animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration) + size: indicatorRoot.size + glow3D: rootItem.glow3D + animation: Math.max(1.65*3*units.longDuration,rootItem.durationTime*3*units.longDuration) location: plasmoid.location - glowOpacity: root.glowOpacity - contrastColor: root.appShadowColorSolid - showBorder: root.showGlow && root.glow3D + glowOpacity: rootItem.glowOpacity + contrastColor: rootItem.shadowColor + showBorder: rootItem.glowEnabled && rootItem.glow3D - basicColor: state2Color //taskItem.hasActive ? state2Color : state1Color + basicColor: state2Color roundCorners: true - showGlow: root.showGlow && root.glowOption === Latte.Types.GlowAll - visible: ( taskItem.isGroupParent && ((root.dotsOnActive && root.activeIndicatorType === Latte.Types.LineIndicator) - || root.activeIndicatorType === Latte.Types.DotIndicator - || !taskItem.hasActive) )? true: false + showGlow: rootItem.glowEnabled && rootItem.glowOption === Latte.Types.GlowAll + visible: ( rootItem.isGroup && ((rootItem.dotsOnActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator) + || rootItem.activeIndicatorType === Latte.Types.DotIndicator + || !rootItem.hasActive) )? true: false //when there is no active window - property color state1Color: taskItem.hasShown ? indicatorRoot.isActiveColor : indicatorRoot.minimizedColor + property color state1Color: rootItem.hasShown ? indicatorRoot.isActiveColor : indicatorRoot.minimizedColor //when there is active window - property color state2Color: taskItem.hasMinimized ? indicatorRoot.minimizedColor : indicatorRoot.isActiveColor + property color state2Color: rootItem.hasMinimized ? indicatorRoot.minimizedColor : indicatorRoot.isActiveColor } } states: [ State { name: "left" - when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !root.reverseLinesPosition) || - (plasmoid.location === PlasmaCore.Types.RightEdge && root.reverseLinesPosition)) + when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !rootItem.reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.RightEdge && rootItem.reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -212,8 +220,8 @@ Item{ }, State { name: "bottom" - when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !root.reverseLinesPosition) || - (plasmoid.location === PlasmaCore.Types.TopEdge && root.reverseLinesPosition)) + when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !rootItem.reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.TopEdge && rootItem.reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -223,8 +231,8 @@ Item{ }, State { name: "top" - when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !root.reverseLinesPosition) || - (plasmoid.location === PlasmaCore.Types.BottomEdge && root.reverseLinesPosition)) + when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !rootItem.reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.BottomEdge && rootItem.reversedEnabled)) AnchorChanges { target: mainIndicatorElement @@ -234,8 +242,8 @@ Item{ }, State { name: "right" - when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !root.reverseLinesPosition) || - (plasmoid.location === PlasmaCore.Types.LeftEdge && root.reverseLinesPosition)) + when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !rootItem.reversedEnabled) || + (plasmoid.location === PlasmaCore.Types.LeftEdge && rootItem.reversedEnabled)) AnchorChanges { target: mainIndicatorElement