diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index bad081c46..1d7e71e4e 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -32,6 +32,7 @@ import org.kde.latte 0.2 as Latte import "colorizer" as Colorizer import "communicator" as Communicator +import "indicators" as Indicators Item { id: appletItem @@ -82,9 +83,9 @@ Item { property bool startEdge: (index === layoutsContainer.startLayout.beginIndex) || (index === layoutsContainer.mainLayout.beginIndex) || (index === layoutsContainer.endLayout.beginIndex) //applet is in ending edge property bool endEdge: plasmoid.configuration.panelPosition !== Latte.Types.Justify ? (index === layoutsContainer.mainLayout.beginIndex + layoutsContainer.mainLayout.count - 1)&&(layoutsContainer.mainLayout.count>1) : - (((index === layoutsContainer.startLayout.beginIndex+layoutsContainer.startLayout.count-2)&&(layoutsContainer.startLayout.count>2)) - ||((index === layoutsContainer.mainLayout.beginIndex+layoutsContainer.mainLayout.count-2)&&(layoutsContainer.mainLayout.count>2)) - ||((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1))) + (((index === layoutsContainer.startLayout.beginIndex+layoutsContainer.startLayout.count-2)&&(layoutsContainer.startLayout.count>2)) + ||((index === layoutsContainer.mainLayout.beginIndex+layoutsContainer.mainLayout.count-2)&&(layoutsContainer.mainLayout.count>2)) + ||((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1))) property int animationTime: root.durationTime* (1.2 *units.shortDuration) // 70 property int hoveredIndex: layoutsContainer.hoveredIndex @@ -530,12 +531,25 @@ Item { Loader{ anchors.fill: parent active: (root.activeIndicator === Latte.Types.AllIndicator - || (root.activeIndicator === Latte.Types.InternalsIndicator && communicator.overlayLatteIconIsActive)) + || (root.activeIndicator === Latte.Types.InternalsIndicator && communicator.overlayLatteIconIsActive)) && communicator.activeIndicatorEnabled - sourceComponent: Item{ - anchors.fill: parent - ActiveIndicator{} + sourceComponent: root.indicatorStyle===Latte.Types.PlasmaIndicator ? plasmaStyleIndicator : latteStyleIndicator + + Component { + id: latteStyleIndicator + Item{ + anchors.fill: parent + Indicators.LatteIndicator{} + } + } + + Component { + id: plasmaStyleIndicator + Item{ + anchors.fill: parent + Indicators.PlasmaIndicator {} + } } } diff --git a/containment/package/contents/ui/applet/ActiveIndicator.qml b/containment/package/contents/ui/applet/indicators/LatteIndicator.qml similarity index 100% rename from containment/package/contents/ui/applet/ActiveIndicator.qml rename to containment/package/contents/ui/applet/indicators/LatteIndicator.qml diff --git a/containment/package/contents/ui/applet/indicators/PlasmaIndicator.qml b/containment/package/contents/ui/applet/indicators/PlasmaIndicator.qml new file mode 100644 index 000000000..6b64f9b62 --- /dev/null +++ b/containment/package/contents/ui/applet/indicators/PlasmaIndicator.qml @@ -0,0 +1,74 @@ +/* +* Copyright 2019 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.0 + +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.latte 0.2 as Latte + +PlasmaCore.FrameSvgItem { + id: frame + anchors.fill: parent + + imagePath: "widgets/tasks" + + property bool isActive: (appletItem.isExpanded + && communicator.overlayLatteIconIsActive + && !appletItem.isSystray + && applet.pluginName !== root.plasmoidName + && applet.pluginName !== "org.kde.activeWindowControl" + && applet.pluginName !== "org.kde.plasma.appmenu") + + + property string basePrefix: "" + + prefix: taskPrefix(basePrefix) + + function taskPrefix(prefix) { + var effectivePrefix; + + switch (plasmoid.location) { + case PlasmaCore.Types.LeftEdge: + effectivePrefix = "west-" + prefix; + break; + case PlasmaCore.Types.TopEdge: + effectivePrefix = "north-" + prefix; + break; + case PlasmaCore.Types.RightEdge: + effectivePrefix = "east-" + prefix; + break; + default: + effectivePrefix = "south-" + prefix; + } + return [effectivePrefix, prefix]; + } + + states: [ + State { + name: "active" + when: frame.isActive + + PropertyChanges { + target: frame + basePrefix: "focus" + } + } + ] +} diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index d8435ae05..dec18d914 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -161,8 +161,6 @@ DragDrop.DropArea { property alias hoveredIndex: layoutsContainer.hoveredIndex property alias directRenderDelayerIsRunning: directRenderDelayerForEnteringTimer.running - property int activeIndicator: plasmoid.configuration.activeIndicator - property int actionsBlockHiding: 0 //actions that block hiding property int animationsNeedBothAxis:0 //animations need space in both axes, e.g zooming a task @@ -335,7 +333,8 @@ DragDrop.DropArea { //! for that value between 0.04 - 0.5 of iconSize, this way 100% iconMargin means //! equal to the iconSize property int iconMargin: Math.ceil( ((0.5 * (plasmoid.configuration.iconMargin))/100) * iconSize) - property int statesLineSize: activeIndicator === Latte.Types.NoneIndicator ? 0 : Math.ceil( root.iconSize/13 ) + property int statesLineSize: activeIndicator === Latte.Types.NoneIndicator || indicatorStyle !== Latte.Types.LatteIndicator ? + 0 : Math.ceil( root.iconSize/13 ) ///FIXME: I can't remember why this is needed, maybe for the anchorings!!! In order for the Double Layout to not mess the anchorings... //property int layoutsContainer.mainLayoutPosition: !plasmoid.immutable ? Latte.Types.Center : (root.isVertical ? Latte.Types.Top : Latte.Types.Left) @@ -402,7 +401,10 @@ DragDrop.DropArea { readonly property bool hasInternalSeparator: latteApplet ? latteApplet.hasInternalSeparator : false + property int activeIndicator: plasmoid.configuration.activeIndicator + property int indicatorStyle: plasmoid.configuration.indicatorStyle property int activeIndicatorType: plasmoid.configuration.activeIndicatorType + property int animationStep: { if (!universalSettings || universalSettings.mouseSensitivity === Latte.Types.HighSensitivity) { return 1; diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 01c7d48c0..e240f270c 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -176,6 +176,7 @@ Item { property alias windowPreviewIsShown: windowsPreviewDlg.visible property int activeIndicator: latteView ? latteView.activeIndicator : Latte.Types.AllIndicator + property int indicatorStyle: latteView ? latteView.indicatorStyle : Latte.Types.LatteIndicator property int activeIndicatorType: latteView ? latteView.activeIndicatorType : Latte.Types.LineIndicator property int animationStep: latteView ? latteView.animationStep : 1 property int directRenderAnimationTime: latteView ? latteView.directRenderAnimationTime : 0 diff --git a/plasmoid/package/contents/ui/task/IconItem.qml b/plasmoid/package/contents/ui/task/IconItem.qml index 846753af9..5ab7676f1 100644 --- a/plasmoid/package/contents/ui/task/IconItem.qml +++ b/plasmoid/package/contents/ui/task/IconItem.qml @@ -31,7 +31,7 @@ import org.kde.kquickcontrolsaddons 2.0 as KQuickControlAddons import org.kde.latte 0.2 as Latte import "animations" as TaskAnimations - +import "indicators" as Indicators //I am using KQuickControlAddons.QIconItem even though onExit it triggers the following error //QObject::~QObject: Timers cannot be stopped from another thread @@ -108,6 +108,12 @@ Item{ onTempColorChanged: tempColor.a = 0.35; } + Loader { + anchors.fill: parent + active: root.activeIndicator !== Latte.Types.NoneIndicator && root.indicatorStyle === Latte.Types.PlasmaIndicator + sourceComponent: Indicators.PlasmaIndicator{} + } + TitleTooltipParent{ id: titleTooltipParent thickness: (root.zoomFactor * root.realSize) + root.statesLineSize diff --git a/plasmoid/package/contents/ui/task/Wrapper.qml b/plasmoid/package/contents/ui/task/Wrapper.qml index da3e97cd8..685bcd5cd 100644 --- a/plasmoid/package/contents/ui/task/Wrapper.qml +++ b/plasmoid/package/contents/ui/task/Wrapper.qml @@ -152,6 +152,7 @@ Item{ || (((root.position === PlasmaCore.Types.BottomPositioned) || (root.position === PlasmaCore.Types.RightPositioned)) && root.reverseLinesPosition) ) && !root.disableAllWindowsFunctionality + && root.indicatorStyle === Latte.Types.LatteIndicator && root.activeIndicator !== Latte.Types.NoneIndicator visible: active @@ -220,7 +221,9 @@ Item{ id: secondIndicator active: !firstIndicator.active && !root.disableAllWindowsFunctionality + && root.indicatorStyle === Latte.Types.LatteIndicator && root.activeIndicator !== Latte.Types.NoneIndicator + visible: active sourceComponent: Component{ diff --git a/plasmoid/package/contents/ui/task/indicators/PlasmaIndicator.qml b/plasmoid/package/contents/ui/task/indicators/PlasmaIndicator.qml new file mode 100644 index 000000000..2bbbcba98 --- /dev/null +++ b/plasmoid/package/contents/ui/task/indicators/PlasmaIndicator.qml @@ -0,0 +1,93 @@ +/* +* Copyright 2019 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.0 + +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.latte 0.2 as Latte + +PlasmaCore.FrameSvgItem { + id: frame + anchors.fill: parent + + imagePath: "widgets/tasks" + + property string basePrefix: "normal" + + prefix: taskPrefix(basePrefix) + + function taskPrefix(prefix) { + var effectivePrefix; + + switch (plasmoid.location) { + case PlasmaCore.Types.LeftEdge: + effectivePrefix = "west-" + prefix; + break; + case PlasmaCore.Types.TopEdge: + effectivePrefix = "north-" + prefix; + break; + case PlasmaCore.Types.RightEdge: + effectivePrefix = "east-" + prefix; + break; + default: + effectivePrefix = "south-" + prefix; + } + return [effectivePrefix, prefix]; + } + + states: [ + State { + name: "launcher" + when: taskItem.isLauncher + + PropertyChanges { + target: frame + basePrefix: "" + } + }, + State { + name: "attention" + when: taskItem.isDemandingAttention + + PropertyChanges { + target: frame + basePrefix: "attention" + } + }, + State { + name: "minimized" + when: taskItem.isMinimized + + PropertyChanges { + target: frame + basePrefix: "minimized" + } + }, + State { + name: "active" + when: taskItem.isActive + + PropertyChanges { + target: frame + basePrefix: "focus" + } + } + ] +}