diff --git a/containment/package/contents/ui/applet/indicator/Bridge.qml b/containment/package/contents/ui/applet/indicator/Bridge.qml index 48435d3d..6724997d 100644 --- a/containment/package/contents/ui/applet/indicator/Bridge.qml +++ b/containment/package/contents/ui/applet/indicator/Bridge.qml @@ -1,97 +1,98 @@ /* * 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.7 import org.kde.latte 0.2 as Latte Item{ id: indicatorBridge anchors.fill: parent property bool appletIsValid: true readonly property bool active: appletIsValid && ((indicators.isEnabled && appletItem.communicatorAlias.activeIndicatorEnabled && indicators.enabledForApplets) || (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive)) /* Indicators Properties in order use them*/ readonly property bool isTask: false readonly property bool isApplet: true + readonly property bool isEmptySpace: false /*since 0.9.3*/ readonly property bool isLauncher: false readonly property bool isStartup: false readonly property bool isWindow: false readonly property bool isActive: appletIsValid ? appletItem.isActive : false readonly property bool isGroup: false readonly property bool isHovered: appletIsValid ? appletMouseArea.containsMouse : false readonly property bool isMinimized: false readonly property bool isPressed: appletIsValid ? appletMouseArea.pressed : false readonly property bool inAttention: false readonly property bool inRemoving: false readonly property bool isSquare: appletIsValid ? appletItem.isSquare : true readonly property bool hasActive: isActive readonly property bool hasMinimized: false readonly property bool hasShown: false readonly property int windowsCount: 0 readonly property int windowsMinimizedCount: 0 readonly property int currentIconSize: root.iconSize readonly property int maxIconSize: root.maxIconSize readonly property real scaleFactor: appletIsValid ? appletItem.wrapperAlias.zoomScale : 1 readonly property real panelOpacity: root.currentPanelOpacity readonly property color shadowColor: root.appShadowColorSolid readonly property bool animationsEnabled: root.animationsEnabled readonly property real durationTime: root.durationTime readonly property bool progressVisible: false /*since 0.9.2*/ readonly property real progress: 0 /*since 0.9.2*/ readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets readonly property QtObject palette: colorizerManager.applyTheme //!icon colors property color iconBackgroundColor: { if (appletIsValid) { return isSquare ? appletItem.wrapperAlias.overlayIconLoader.backgroundColor : colorizerManager.buttonFocusColor; } return "black"; } property color iconGlowColor:{ if (appletIsValid) { return isSquare ? appletItem.wrapperAlias.overlayIconLoader.glowColor : colorizerManager.focusGlowColor; } return "white"; } //! grouped options readonly property Item shared: indicators readonly property QtObject configuration: indicators.configuration readonly property QtObject resources: indicators.resources } diff --git a/containment/package/contents/ui/applet/indicator/Loader.qml b/containment/package/contents/ui/applet/indicator/Loader.qml index 91e8e732..8373d8ae 100644 --- a/containment/package/contents/ui/applet/indicator/Loader.qml +++ b/containment/package/contents/ui/applet/indicator/Loader.qml @@ -1,75 +1,75 @@ /* * 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.7 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte Loader { id: indicatorLoader anchors.bottom: (plasmoid.location === PlasmaCore.Types.BottomEdge) ? parent.bottom : undefined anchors.top: (plasmoid.location === PlasmaCore.Types.TopEdge) ? parent.top : undefined anchors.left: (plasmoid.location === PlasmaCore.Types.LeftEdge) ? parent.left : undefined anchors.right: (plasmoid.location === PlasmaCore.Types.RightEdge) ? parent.right : undefined anchors.horizontalCenter: root.isHorizontal ? parent.horizontalCenter : undefined anchors.verticalCenter: root.isVertical ? parent.verticalCenter : undefined active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) sourceComponent: { if (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) { return indicators.plasmaStyleComponent; } return indicators.indicatorComponent; } - width: root.isHorizontal && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) ? + width: root.isHorizontal && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) && canBeHovered ? appletItem.wrapperAlias.width - 2*appletItem.wrapperAlias.zoomScale*root.lengthExtMargin : appletItem.wrapperAlias.width - height: root.isVertical && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) ? + height: root.isVertical && !(root.inFullJustify && atScreenEdge /*Fitt's Law*/ && !isSquare) && canBeHovered ? appletItem.wrapperAlias.height - 2*appletItem.wrapperAlias.zoomScale*root.lengthExtMargin : appletItem.wrapperAlias.height readonly property bool locked: appletItem.lockZoom || root.zoomFactor === 1 property real visualLockedWidth: root.iconSize + root.internalWidthMargins property real visualLockedHeight: root.iconSize + root.internalHeightMargins //! Communications !// property Item level Connections { target: appletItem enabled: indicators.info.needsMouseEventCoordinates onMousePressed: { var fixedPos = indicatorLoader.mapFromItem(appletItem, x, y); level.mousePressed(Math.round(fixedPos.x), Math.round(fixedPos.y), button); } onMouseReleased: { var fixedPos = indicatorLoader.mapFromItem(appletItem, x, y); level.mouseReleased(Math.round(fixedPos.x), Math.round(fixedPos.y), button); } } } diff --git a/containment/package/contents/ui/layouts/EnvironmentActions.qml b/containment/package/contents/ui/layouts/EnvironmentActions.qml index b071a520..90e5b470 100644 --- a/containment/package/contents/ui/layouts/EnvironmentActions.qml +++ b/containment/package/contents/ui/layouts/EnvironmentActions.qml @@ -1,252 +1,269 @@ /* * 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.7 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.latte 0.2 as Latte import "loaders" as Loaders +import "indicator" as Indicator +import "../applet/indicator" as AppletIndicator Loader { id: environmentLoader sourceComponent: MouseArea{ id: mainArea width: { if (root.isHorizontal) { return useAllLayouts ? root.maxLength : root.realPanelLength; } else { return root.isHovered ? (root.iconSize + root.thickMargins)*root.zoomFactor : (root.iconSize + root.thickMargins) } } height: { if (root.isVertical) { return useAllLayouts ? root.maxLength : root.realPanelLength; } else { return root.isHovered ? (root.iconSize + root.thickMargins)*root.zoomFactor : (root.iconSize + root.thickMargins) } } hoverEnabled: true readonly property bool useAllLayouts: panelUserSetAlignment === Latte.Types.Justify && !root.inConfigureAppletsMode property int lastPressX: -1 property int lastPressY: -1 onContainsMouseChanged: { if (root.mouseInHoverableArea()) { root.stopCheckRestoreZoomTimer(); } else { root.initializeHoveredIndexes(); root.startCheckRestoreZoomTimer() } } onPressed: { if (!root.dragActiveWindowEnabled) { return; } if (selectedWindowsTracker.lastActiveWindow.canBeDragged()) { lastPressX = mouse.x; lastPressY = mouse.y; dragWindowTimer.start(); } } onReleased: { lastPressX = -1; lastPressY = -1; } onPositionChanged: { if (!root.dragActiveWindowEnabled) { return; } var stepX = Math.abs(lastPressX-mouse.x); var stepY = Math.abs(lastPressY-mouse.y); var threshold = 5; var tryDrag = mainArea.pressed && (stepX>threshold || stepY>threshold); if ( tryDrag && selectedWindowsTracker.lastActiveWindow.canBeDragged()) { dragWindowTimer.stop(); activateDragging(); } } onDoubleClicked: { if (!root.dragActiveWindowEnabled) { return; } dragWindowTimer.stop(); selectedWindowsTracker.lastActiveWindow.requestToggleMaximized(); } onWheel: { if (root.scrollAction === Latte.Types.ScrollNone) { root.emptyAreasWheel(wheel); return; } var delta = 0; if (wheel.angleDelta.y>=0 && wheel.angleDelta.x>=0) { delta = Math.max(wheel.angleDelta.y, wheel.angleDelta.x); } else { delta = Math.min(wheel.angleDelta.y, wheel.angleDelta.x); } var angle = delta / 8; if (angle>10) { if (root.scrollAction === Latte.Types.ScrollDesktops) { latteView.windowsTracker.switchToPreviousVirtualDesktop(); } else if (root.scrollAction === Latte.Types.ScrollActivities) { latteView.windowsTracker.switchToPreviousActivity(); } else if (tasksLoader.active) { tasksLoader.item.activateNextPrevTask(true); } } else if (angle<-10) { if (root.scrollAction === Latte.Types.ScrollDesktops) { latteView.windowsTracker.switchToNextVirtualDesktop(); } else if (root.scrollAction === Latte.Types.ScrollActivities) { latteView.windowsTracker.switchToNextActivity(); } else if (tasksLoader.active) { tasksLoader.item.activateNextPrevTask(false); } } } Loaders.Tasks{ id: tasksLoader } function activateDragging(){ selectedWindowsTracker.requestMoveLastWindow(mainArea.mouseX, mainArea.mouseY); mainArea.lastPressX = -1; mainArea.lastPressY = -1; } //! Timers Timer { id: dragWindowTimer interval: 500 onTriggered: { if (mainArea.pressed && selectedWindowsTracker.lastActiveWindow.canBeDragged()) { mainArea.activateDragging(); } } } + //! Background Indicator + Indicator.Bridge{ + id: indicatorBridge + } + + //! Indicator Back Layer + Indicator.Loader{ + id: indicatorBackLayer + level: AppletIndicator.LevelOptions { + id: backLevelOptions + isBackground: true + bridge: indicatorBridge + } + } + states:[ State { name: "bottom" when: (plasmoid.location === PlasmaCore.Types.BottomEdge) AnchorChanges { target: mainArea anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined} } }, State { name: "top" when: (plasmoid.location === PlasmaCore.Types.TopEdge) AnchorChanges { target: mainArea anchors{ top:parent.top; bottom:undefined; left:undefined; right:undefined; horizontalCenter:parent.horizontalCenter; verticalCenter:undefined} } }, State { name: "left" when: (plasmoid.location === PlasmaCore.Types.LeftEdge) AnchorChanges { target: mainArea anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined; horizontalCenter:undefined; verticalCenter:parent.verticalCenter} } }, State { name: "right" when: (plasmoid.location === PlasmaCore.Types.RightEdge) AnchorChanges { target: mainArea anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right; horizontalCenter:undefined; verticalCenter:parent.verticalCenter} } } ] } states:[ State { name: "bottom" when: (plasmoid.location === PlasmaCore.Types.BottomEdge) AnchorChanges { target: environmentLoader anchors{ top:undefined; bottom: _mainLayout.bottom; left:undefined; right:undefined; horizontalCenter: _mainLayout.horizontalCenter; verticalCenter:undefined} } }, State { name: "top" when: (plasmoid.location === PlasmaCore.Types.TopEdge) AnchorChanges { target: environmentLoader anchors{ top: _mainLayout.top; bottom:undefined; left:undefined; right:undefined; horizontalCenter: _mainLayout.horizontalCenter; verticalCenter:undefined} } }, State { name: "left" when: (plasmoid.location === PlasmaCore.Types.LeftEdge) AnchorChanges { target: environmentLoader anchors{ top:undefined; bottom:undefined; left: _mainLayout.left; right:undefined; horizontalCenter:undefined; verticalCenter: _mainLayout.verticalCenter} } }, State { name: "right" when: (plasmoid.location === PlasmaCore.Types.RightEdge) AnchorChanges { target: environmentLoader anchors{ top:undefined; bottom:undefined; left:undefined; right: _mainLayout.right; horizontalCenter:undefined; verticalCenter: _mainLayout.verticalCenter} } } ] } diff --git a/containment/package/contents/ui/applet/indicator/Bridge.qml b/containment/package/contents/ui/layouts/indicator/Bridge.qml similarity index 61% copy from containment/package/contents/ui/applet/indicator/Bridge.qml copy to containment/package/contents/ui/layouts/indicator/Bridge.qml index 48435d3d..41f2cf5f 100644 --- a/containment/package/contents/ui/applet/indicator/Bridge.qml +++ b/containment/package/contents/ui/layouts/indicator/Bridge.qml @@ -1,97 +1,79 @@ /* * 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.7 import org.kde.latte 0.2 as Latte Item{ id: indicatorBridge anchors.fill: parent - property bool appletIsValid: true - - readonly property bool active: appletIsValid && - ((indicators.isEnabled - && appletItem.communicatorAlias.activeIndicatorEnabled - && indicators.enabledForApplets) - || (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive)) + readonly property bool active: true /* Indicators Properties in order use them*/ readonly property bool isTask: false - readonly property bool isApplet: true + readonly property bool isApplet: false + readonly property bool isEmptySpace: true /*since 0.9.3*/ readonly property bool isLauncher: false readonly property bool isStartup: false readonly property bool isWindow: false - readonly property bool isActive: appletIsValid ? appletItem.isActive : false + readonly property bool isActive: false readonly property bool isGroup: false - readonly property bool isHovered: appletIsValid ? appletMouseArea.containsMouse : false + readonly property bool isHovered: false readonly property bool isMinimized: false - readonly property bool isPressed: appletIsValid ? appletMouseArea.pressed : false + readonly property bool isPressed: mainArea.pressed readonly property bool inAttention: false readonly property bool inRemoving: false - readonly property bool isSquare: appletIsValid ? appletItem.isSquare : true + readonly property bool isSquare: false - readonly property bool hasActive: isActive + readonly property bool hasActive: false readonly property bool hasMinimized: false readonly property bool hasShown: false readonly property int windowsCount: 0 readonly property int windowsMinimizedCount: 0 readonly property int currentIconSize: root.iconSize readonly property int maxIconSize: root.maxIconSize - readonly property real scaleFactor: appletIsValid ? appletItem.wrapperAlias.zoomScale : 1 + readonly property real scaleFactor: 1 readonly property real panelOpacity: root.currentPanelOpacity readonly property color shadowColor: root.appShadowColorSolid readonly property bool animationsEnabled: root.animationsEnabled readonly property real durationTime: root.durationTime readonly property bool progressVisible: false /*since 0.9.2*/ readonly property real progress: 0 /*since 0.9.2*/ readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets readonly property QtObject palette: colorizerManager.applyTheme //!icon colors - property color iconBackgroundColor: { - if (appletIsValid) { - return isSquare ? appletItem.wrapperAlias.overlayIconLoader.backgroundColor : colorizerManager.buttonFocusColor; - } - - return "black"; - } - - property color iconGlowColor:{ - if (appletIsValid) { - return isSquare ? appletItem.wrapperAlias.overlayIconLoader.glowColor : colorizerManager.focusGlowColor; - } - - return "white"; - } + property color iconBackgroundColor: "brown" + property color iconGlowColor: "pink" //! grouped options readonly property Item shared: indicators readonly property QtObject configuration: indicators.configuration readonly property QtObject resources: indicators.resources } diff --git a/containment/package/contents/ui/layouts/indicator/Loader.qml b/containment/package/contents/ui/layouts/indicator/Loader.qml new file mode 100644 index 00000000..5d6bd5ad --- /dev/null +++ b/containment/package/contents/ui/layouts/indicator/Loader.qml @@ -0,0 +1,43 @@ +/* +* 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.7 + +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.latte 0.2 as Latte + +Loader { + id: indicatorLoader + anchors.fill: parent + + active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) + sourceComponent: indicators.indicatorComponent + + //! Communications !// + + property Item level + + Connections { + target: mainArea + enabled: indicators.info.needsMouseEventCoordinates + onPressed: level.mousePressed(mouse.x, mouse.y, mouse.button); + onMouseReleased: level.mouseReleased(mouse.x, mouse.y, mouse.button); + } +} diff --git a/plasmoid/package/contents/ui/task/indicator/Bridge.qml b/plasmoid/package/contents/ui/task/indicator/Bridge.qml index f92e11c6..e66dadf6 100644 --- a/plasmoid/package/contents/ui/task/indicator/Bridge.qml +++ b/plasmoid/package/contents/ui/task/indicator/Bridge.qml @@ -1,91 +1,92 @@ /* * 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.7 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte import "../../indicators/options" as TaskIndicator Item { id: indicatorBridge property bool taskIsValid: true readonly property bool active: indicators ? indicators.isEnabled : false readonly property bool locked: taskIsValid ? (inAttentionAnimation || inNewWindowAnimation) : false /* Indicators Properties in order for indicators to use them*/ readonly property bool isTask: true readonly property bool isApplet: false + readonly property bool isEmptySpace: false /*since 0.9.3*/ readonly property bool isLauncher: taskIsValid ? taskItem.isLauncher : true readonly property bool isStartup: taskIsValid ? taskItem.isStartup : false readonly property bool isWindow: taskIsValid ? taskItem.isWindow : false readonly property bool isActive: taskIsValid ? (taskItem.hasActive || (root.showPreviews && (taskItem.isWindow || taskItem.isGroupParent) && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) ) : false readonly property bool isGroup: taskIsValid ? taskItem.isGroupParent : false readonly property bool isHovered: taskIsValid ? taskItem.containsMouse : false readonly property bool isMinimized: taskIsValid ? taskItem.isMinimized : false readonly property bool isPressed: taskIsValid ? taskItem.pressed : false readonly property bool inAttention: taskIsValid ? taskItem.inAttention : false readonly property bool inRemoving: taskIsValid ? taskItem.inRemoveStage : false readonly property bool isSquare: true readonly property bool hasActive: taskIsValid ? taskItem.hasActive : false readonly property bool hasMinimized: taskIsValid? taskItem.hasMinimized : false readonly property bool hasShown: taskIsValid ? taskItem.hasShown : false readonly property int windowsCount: taskIsValid ? taskItem.windowsCount : 0 readonly property int windowsMinimizedCount: taskIsValid ? taskItem.windowsMinimizedCount : 0 readonly property int currentIconSize: root.iconSize readonly property int maxIconSize: root.maxIconSize readonly property real scaleFactor: taskIsValid ? taskItem.wrapperAlias.mScale : 1 readonly property real panelOpacity: root.currentPanelOpacity readonly property color shadowColor: root.appShadowColorSolid readonly property bool animationsEnabled: root.animationsEnabled readonly property real durationTime: root.durationTime readonly property bool progressVisible: wrapper.progressVisible /*since 0.9.2*/ readonly property real progress: wrapper.progress /*since 0.9.2*/ readonly property bool usePlasmaTabsStyle: false readonly property variant svgs: indicators ? indicators.svgs : [] readonly property QtObject palette: enforceLattePalette ? latteBridge.palette.applyTheme : theme //!icon colors property color iconBackgroundColor: taskIsValid ? taskItem.wrapperAlias.backgroundColor : "black" property color iconGlowColor: taskIsValid ? taskItem.wrapperAlias.glowColor : "white" //! grouped options readonly property Item shared: indicators ? indicators : emptyOptions readonly property QtObject configuration: indicators ? indicators.configuration : null readonly property QtObject resources: indicators ? indicators.resources : null Item{id: emptyOptions} }