From b2aa7038a956d92cc3f924b0fd262762f68e2917 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 16 Jan 2021 13:23:13 +0200 Subject: [PATCH] plasmoid:expose AppletAbilities container item --use a single central Item in order to provide the various applet abilities for consumption from the user --- plasmoid/package/contents/code/tools.js | 2 +- .../package/contents/ui/AppletAbilities.qml | 94 +++++++++ plasmoid/package/contents/ui/ContextMenu.qml | 20 +- .../contents/ui/TasksExtendedManager.qml | 2 +- .../package/contents/ui/abilities/Indexer.qml | 26 ++- .../ui/indicators/styles/LatteIndicator.qml | 8 +- plasmoid/package/contents/ui/main.qml | 185 +++++++----------- .../contents/ui/task/indicator/Bridge.qml | 4 +- .../contents/ui/taskslayout/MouseHandler.qml | 4 +- .../ui/taskslayout/ScrollEdgeShadows.qml | 12 +- .../ui/taskslayout/ScrollOpacityMask.qml | 2 +- .../ui/taskslayout/ScrollableList.qml | 18 +- 12 files changed, 220 insertions(+), 157 deletions(-) create mode 100644 plasmoid/package/contents/ui/AppletAbilities.qml diff --git a/plasmoid/package/contents/code/tools.js b/plasmoid/package/contents/code/tools.js index a74e7ed81..8635c2b36 100644 --- a/plasmoid/package/contents/code/tools.js +++ b/plasmoid/package/contents/code/tools.js @@ -122,7 +122,7 @@ function insertIndexAt(above, x, y) { } else { var distance = root.vertical ? y : x; //var step = root.vertical ? LayoutManager.taskWidth() : LayoutManager.taskHeight(); - var step = metrics.totals.length; + var step = appletAbilities.metrics.totals.length; var stripe = Math.ceil(distance / step); /* if (stripe === LayoutManager.calculateStripes()) { diff --git a/plasmoid/package/contents/ui/AppletAbilities.qml b/plasmoid/package/contents/ui/AppletAbilities.qml new file mode 100644 index 000000000..7c0a5592e --- /dev/null +++ b/plasmoid/package/contents/ui/AppletAbilities.qml @@ -0,0 +1,94 @@ +/* +* Copyright 2021 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.plasmoid 2.0 + +import org.kde.latte.core 0.2 as LatteCore +import org.kde.latte.abilities.client 0.1 as ClientAbility + +import "abilities" as Ability + +Item { + id: _abilityContainer + + property Item bridge: null + property Item layout: null + property QtObject tasksModel: null + + readonly property alias animations: _animations + readonly property alias debug: _debug + readonly property alias indexer: _indexer + readonly property alias launchers: _launchers + readonly property alias metrics: _metrics + readonly property alias parabolic: _parabolic + readonly property alias shortcuts: _shortcuts + readonly property alias requires: _requires + readonly property alias userRequests: _userRequests + + Ability.Animations { + id: _animations + bridge: _abilityContainer.bridge + } + + ClientAbility.Debug { + id: _debug + bridge: _abilityContainer.bridge + } + + Ability.Indexer { + id: _indexer + bridge: _abilityContainer.bridge + layout: _abilityContainer.layout + } + + Ability.Launchers { + id: _launchers + bridge: _abilityContainer.bridge + layout: _abilityContainer.layout + tasksModel: _abilityContainer.tasksModel + } + + Ability.Metrics { + id: _metrics + bridge: _abilityContainer.bridge + } + + Ability.ParabolicEffect { + id: _parabolic + bridge: _abilityContainer.bridge + layout: _abilityContainer.layout + } + + Ability.PositionShortcuts { + id: _shortcuts + bridge: _abilityContainer.bridge + } + + ClientAbility.Requirements{ + id: _requires + bridge: _abilityContainer.bridge + } + + Ability.UserRequests { + id: _userRequests + bridge: _abilityContainer.bridge + } +} diff --git a/plasmoid/package/contents/ui/ContextMenu.qml b/plasmoid/package/contents/ui/ContextMenu.qml index 96893ec76..012ed11fb 100644 --- a/plasmoid/package/contents/ui/ContextMenu.qml +++ b/plasmoid/package/contents/ui/ContextMenu.qml @@ -718,9 +718,9 @@ PlasmaComponents.ContextMenu { onClicked: { if (tasksModel.launcherPosition(get(atm.LauncherUrlWithoutIcon)) !== -1) { - launchers.removeLauncher(get(atm.LauncherUrl)); + appletAbilities.launchers.removeLauncher(get(atm.LauncherUrl)); } else { - launchers.addLauncher(get(atm.LauncherUrl)) + appletAbilities.launchers.addLauncher(get(atm.LauncherUrl)) } } } @@ -763,9 +763,9 @@ PlasmaComponents.ContextMenu { result.clicked.connect( function() { if (result.checked) { - launchers.addLauncherToActivity(url,id); + appletAbilities.launchers.addLauncherToActivity(url,id); } else { - launchers.removeLauncherFromActivity(url, id); + appletAbilities.launchers.removeLauncherFromActivity(url, id); } } ); @@ -813,7 +813,7 @@ PlasmaComponents.ContextMenu { icon: "window-unpin" onClicked: { - launchers.removeLauncher(get(atm.LauncherUrlWithoutIcon)); + appletAbilities.launchers.removeLauncher(get(atm.LauncherUrlWithoutIcon)); } } @@ -835,9 +835,9 @@ PlasmaComponents.ContextMenu { var pos=visualParent.itemIndex; if (!visualParent.tailItemIsSeparator) { - launchers.addInternalSeparatorAtPos(pos); + appletAbilities.launchers.addInternalSeparatorAtPos(pos); } else { - launchers.addInternalSeparatorAtPos(pos+1); + appletAbilities.launchers.addInternalSeparatorAtPos(pos+1); } } } @@ -851,9 +851,9 @@ PlasmaComponents.ContextMenu { onClicked: { if (visualParent.tailItemIsSeparator) { - launchers.removeInternalSeparatorAtPos(visualParent.itemIndex - 1); + appletAbilities.launchers.removeInternalSeparatorAtPos(visualParent.itemIndex - 1); } else if (visualParent.headItemIsSeparator) { - launchers.removeInternalSeparatorAtPos(visualParent.itemIndex + 1); + appletAbilities.launchers.removeInternalSeparatorAtPos(visualParent.itemIndex + 1); } } } @@ -947,7 +947,7 @@ PlasmaComponents.ContextMenu { icon: "window-close" onClicked: { - if (parabolic.factor.zoom>1) { + if (appletAbilities.parabolic.factor.zoom>1) { delayWindowRemovalTimer.modelIndex = menu.modelIndex; delayWindowRemovalTimer.start(); } else { diff --git a/plasmoid/package/contents/ui/TasksExtendedManager.qml b/plasmoid/package/contents/ui/TasksExtendedManager.qml index 90035556f..ca2ff6198 100644 --- a/plasmoid/package/contents/ui/TasksExtendedManager.qml +++ b/plasmoid/package/contents/ui/TasksExtendedManager.qml @@ -343,7 +343,7 @@ Item { //! Connections Connections { - target: launchers + target: appletAbilities.launchers onLauncherInRemoving: tasksExtManager.addToBeRemovedLauncher(launcherUrl); onLauncherInAdding: tasksExtManager.addToBeAddedLauncher(launcherUrl); onLauncherInMoving: tasksExtManager.addLauncherToBeMoved(launcherUrl, pos); diff --git a/plasmoid/package/contents/ui/abilities/Indexer.qml b/plasmoid/package/contents/ui/abilities/Indexer.qml index 6f0e2d50c..03d44824e 100644 --- a/plasmoid/package/contents/ui/abilities/Indexer.qml +++ b/plasmoid/package/contents/ui/abilities/Indexer.qml @@ -28,22 +28,28 @@ ClientAbility.Indexer { id: _indexer property Item layout: null - readonly property bool tailAppletIsSeparator: isActive ? bridge.indexer.tailAppletIsSeparator : false - readonly property bool headAppletIsSeparator: isActive ? bridge.indexer.headAppletIsSeparator : false - property bool updateIsBlocked: false - - property int visibleItemsCount: 0 property int itemsCount: 0 /*is needed to be set from consumer developer in order to avoid binding loops warnings*/ - property int firstVisibleItemIndex: -1 - property int lastVisibleItemIndex: -1 + readonly property bool tailAppletIsSeparator: isActive ? bridge.indexer.tailAppletIsSeparator : false + readonly property bool headAppletIsSeparator: isActive ? bridge.indexer.headAppletIsSeparator : false readonly property bool isReady: (layout && layout.children.length >= itemsCount) && !updateIsBlocked readonly property int maxIndex: 99999 + readonly property alias visibleItemsCount: _privates.visibleItemsCount + readonly property alias firstVisibleItemIndex: _privates.firstVisibleItemIndex + readonly property alias lastVisibleItemIndex: _privates.lastVisibleItemIndex + + QtObject { + id: _privates + property int firstVisibleItemIndex: -1 + property int lastVisibleItemIndex: -1 + property int visibleItemsCount: 0 + } + Binding { - target: _indexer + target: _privates property: "firstVisibleItemIndex" when: isReady value: { @@ -63,7 +69,7 @@ ClientAbility.Indexer { } Binding { - target: _indexer + target: _privates property: "lastVisibleItemIndex" when: isReady value: { @@ -86,7 +92,7 @@ ClientAbility.Indexer { } Binding { - target: _indexer + target: _privates property: "visibleItemsCount" value: { var count = 0; diff --git a/plasmoid/package/contents/ui/indicators/styles/LatteIndicator.qml b/plasmoid/package/contents/ui/indicators/styles/LatteIndicator.qml index a790af5bc..8f11c9024 100644 --- a/plasmoid/package/contents/ui/indicators/styles/LatteIndicator.qml +++ b/plasmoid/package/contents/ui/indicators/styles/LatteIndicator.qml @@ -107,7 +107,8 @@ LatteComponents.IndicatorItem{ size: root.size glow3D: glow3D - animation: Math.max(1.65*3*animations.duration.large,indicator.durationTime*3*animations.duration.large) + animation: Math.max(1.65 * 3 * appletAbilities.animations.duration.large, + 3 * indicator.durationTime * appletAbilities.animations.duration.large) location: plasmoid.location glowOpacity: root.glowOpacity contrastColor: indicator.shadowColor @@ -128,7 +129,7 @@ LatteComponents.IndicatorItem{ property int stateWidth: indicator.isGroup ? root.width - secondPoint.width : root.width - spacer.width property int stateHeight: indicator.isGroup ? root.height - secondPoint.height : root.width - spacer.height - property int animationTime: indicator.durationTime* (0.7*animations.duration.large) + property int animationTime: indicator.durationTime* (0.7 * appletAbilities.animations.duration.large) property bool isActive: indicator.hasActive || indicator.isActive @@ -222,7 +223,8 @@ LatteComponents.IndicatorItem{ size: root.size glow3D: glow3D - animation: Math.max(1.65*3*animations.duration.large,indicator.durationTime*3*animations.duration.large) + animation: Math.max(1.65 * 3 * appletAbilities.animations.duration.large, + 3 * indicator.durationTime * appletAbilities.animations.duration.large) location: plasmoid.location glowOpacity: root.glowOpacity contrastColor: indicator.shadowColor diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index d90970b67..2df191987 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -100,11 +100,11 @@ Item { property int tasksStarting: 0 ///Don't use Math.floor it adds one pixel in animations and creates glitches - property int widthMargins: root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges - property int heightMargins: !root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthEdges + property int widthMargins: root.vertical ? appletAbilities.metrics.totals.thicknessEdges : appletAbilities.metrics.totals.lengthEdges + property int heightMargins: !root.vertical ? appletAbilities.metrics.totals.thicknessEdges : appletAbilities.metrics.totals.lengthEdges - property int internalWidthMargins: root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings - property int internalHeightMargins: !root.vertical ? metrics.totals.thicknessEdges : metrics.totals.lengthPaddings + property int internalWidthMargins: root.vertical ? appletAbilities.metrics.totals.thicknessEdges : appletAbilities.metrics.totals.lengthPaddings + property int internalHeightMargins: !root.vertical ? appletAbilities.metrics.totals.thicknessEdges : appletAbilities.metrics.totals.lengthPaddings property real textColorBrightness: ColorizerTools.colorBrightness(themeTextColor) @@ -125,13 +125,7 @@ Item { property Item dragSource: null property Item tasksExtendedManager: _tasksExtendedManager - readonly property alias animations: _animations - readonly property alias debug: _debug - readonly property alias indexer: _indexer - readonly property alias launchers: _launchers - readonly property alias metrics: _metrics - readonly property alias parabolic: _parabolic - readonly property alias shortcuts: _shortcuts + readonly property alias appletAbilities: _appletAbilities readonly property alias containsDrag: mouseHandler.containsDrag readonly property bool dragAreaEnabled: latteView ? (root.dragSource !== null @@ -208,7 +202,7 @@ Item { readonly property real currentPanelOpacity: latteView ? latteView.currentPanelTransparency / 100 : 1 - property int appShadowSize: latteView ? latteView.appShadowSize : Math.ceil(0.12*metrics.iconSize) + property int appShadowSize: latteView ? latteView.appShadowSize : Math.ceil(0.12*appletAbilities.metrics.iconSize) property string appShadowColor: latteView ? latteView.appShadowColor : "#ff080808" property string appShadowColorSolid: latteView ? latteView.appShadowColorSolid : "#ff080808" @@ -423,7 +417,7 @@ Item { //! triggered together. if (containsMouse) { hidePreviewWinTimer.stop(); - parabolic.setDirectRenderingEnabled(false); + appletAbilities.parabolic.setDirectRenderingEnabled(false); } else { hide(7.3); } @@ -522,14 +516,14 @@ Item { Timer{ id: delayWindowRemovalTimer //this is the animation time needed in order for tasks to restore their zoom first - interval: 7 * (animations.speedFactor.current * animations.duration.small) + interval: 7 * (appletAbilities.animations.speedFactor.current * appletAbilities.animations.duration.small) property var modelIndex onTriggered: { tasksModel.requestClose(delayWindowRemovalTimer.modelIndex) - if (debug.timersEnabled) { + if (appletAbilities.debug.timersEnabled) { console.log("plasmoid timer: delayWindowRemovalTimer called..."); } } @@ -543,7 +537,7 @@ Item { root.publishTasksGeometries(); activityInfo.previousActivity = activityInfo.currentActivity; - if (debug.timersEnabled) { + if (appletAbilities.debug.timersEnabled) { console.log("plasmoid timer: activityChangeDelayer called..."); } } @@ -584,11 +578,11 @@ Item { property bool anyTaskDemandsAttentionInValidTime: false function updateLaunchersList(){ - if (latteView && !launchers.inUniqueGroup()) { - if (launchers.inLayoutGroup()) { + if (latteView && !appletAbilities.launchers.inUniqueGroup()) { + if (appletAbilities.launchers.inLayoutGroup()) { console.log("Tasks: Applying LAYOUT Launchers List..."); tasksModel.launcherList = latteView.viewLayout.launchers; - } else if (launchers.inGlobalGroup()) { + } else if (appletAbilities.launchers.inGlobalGroup()) { console.log("Tasks: Applying GLOBAL Launchers List..."); tasksModel.launcherList = latteView.universalSettings.launchers; } @@ -626,10 +620,10 @@ Item { //var loadedLaunchers = ActivitiesTools.restoreLaunchers(); ActivitiesTools.importLaunchersToNewArchitecture(); - if (viewLayout && latteView.universalSettings && !launchers.inUniqueGroup()) { - if (launchers.inLayoutGroup()) { + if (viewLayout && latteView.universalSettings && !appletAbilities.launchers.inUniqueGroup()) { + if (appletAbilities.launchers.inLayoutGroup()) { launcherList = latteView.viewLayout.launchers; - } else if (launchers.inGlobalGroup()) { + } else if (appletAbilities.launchers.inGlobalGroup()) { launcherList = latteView.universalSettings.launchers; } } else { @@ -795,71 +789,38 @@ Item { id: _tasksExtendedManager } - Ability.Animations { - id: _animations + AppletAbilities { + id: _appletAbilities bridge: latteBridge - } - - ClientAbility.Debug { - id: _debug - bridge: latteBridge - } - - Ability.Indexer { - id: _indexer - bridge: latteBridge - layout: icList.contentItem - itemsCount: tasksModel.count - updateIsBlocked: root.inDraggingPhase - } - - Ability.Launchers { - id: _launchers - bridge: latteBridge - group: plasmoid.configuration.launchersGroup layout: icList.contentItem tasksModel: tasksModel - syncer.isBlocked: inDraggingPhase - syncer.layoutName: viewLayoutName - } - Ability.Metrics { - id: _metrics - bridge: latteBridge - } + indexer.itemsCount: tasksModel.count + indexer.updateIsBlocked: root.inDraggingPhase - Ability.ParabolicEffect { - id: _parabolic - bridge: latteBridge - itemsCount: tasksModel.count - layout: icList.contentItem - local.isEnabled: factor.zoom > 1 - local.restoreZoomIsBlocked: root.contextMenu || windowsPreviewDlg.containsMouse - } + launchers.group: plasmoid.configuration.launchersGroup + launchers.syncer.isBlocked: inDraggingPhase + launchers.syncer.layoutName: viewLayoutName - Ability.PositionShortcuts { - id: _shortcuts - bridge: latteBridge - isStealingGlobalPositionShortcuts: plasmoid.configuration.isPreferredForPositionShortcuts + parabolic.itemsCount: tasksModel.count + parabolic.local.isEnabled: parabolic.factor.zoom > 1 + parabolic.local.restoreZoomIsBlocked: root.contextMenu || windowsPreviewDlg.containsMouse - onDisabledIsStealingGlobalPositionShortcuts: { - plasmoid.configuration.isPreferredForPositionShortcuts = false; + shortcuts.isStealingGlobalPositionShortcuts: plasmoid.configuration.isPreferredForPositionShortcuts + + requires.activeIndicatorEnabled: false + requires.lengthMarginsEnabled: false + requires.latteSideColoringEnabled: false + requires.screenEdgeMarginSupported: true + + Connections { + target: _appletAbilities.shortcuts + + onDisabledIsStealingGlobalPositionShortcuts: { + plasmoid.configuration.isPreferredForPositionShortcuts = false; + } } - } - ClientAbility.Requirements{ - id: _requires - bridge: latteBridge - - activeIndicatorEnabled: false - lengthMarginsEnabled: false - latteSideColoringEnabled: false - screenEdgeMarginSupported: true - } - - Ability.UserRequests { - id: _userRequests - bridge: latteBridge } Component{ @@ -871,7 +832,7 @@ Item { tasksModel.anyTaskDemandsAttentionInValidTime = false; destroy(); - if (debug.timersEnabled) { + if (appletAbilities.debug.timersEnabled) { console.log("plasmoid timer: attentionTimer called..."); } } @@ -896,15 +857,15 @@ Item { anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined - width: root.vertical ? 1 : 2 * metrics.iconSize - height: root.vertical ? 2 * metrics.iconSize : 1 + width: root.vertical ? 1 : 2 * appletAbilities.metrics.iconSize + height: root.vertical ? 2 * appletAbilities.metrics.iconSize : 1 color: "red" x: (root.location === PlasmaCore.Types.LeftEdge) ? neededSpace : parent.width - neededSpace y: (root.location === PlasmaCore.Types.TopEdge) ? neededSpace : parent.height - neededSpace visible: plasmoid.configuration.zoomHelper - property int neededSpace: parabolic.factor.zoom*metrics.totals.length + property int neededSpace: appletAbilities.parabolic.factor.zoom*appletAbilities.metrics.totals.length } Item{ @@ -920,11 +881,11 @@ Item { width: ( icList.orientation === Qt.Horizontal ) ? icList.width + spacing : smallSize height: ( icList.orientation === Qt.Vertical ) ? icList.height + spacing : smallSize - property int spacing: latteBridge ? 0 : metrics.iconSize / 2 - property int smallSize: Math.max(0.10 * metrics.iconSize, 16) + property int spacing: latteBridge ? 0 : appletAbilities.metrics.iconSize / 2 + property int smallSize: Math.max(0.10 * appletAbilities.metrics.iconSize, 16) Behavior on opacity{ - NumberAnimation { duration: animations.speedFactor.current*animations.duration.large } + NumberAnimation { duration: appletAbilities.animations.speedFactor.current * appletAbilities.animations.duration.large } } /// plasmoid's default panel @@ -941,7 +902,7 @@ Item { verticalTileMode: BorderImage.Stretch Behavior on opacity{ - NumberAnimation { duration: animations.speedFactor.current*animations.duration.large } + NumberAnimation { duration: appletAbilities.animations.speedFactor.current * appletAbilities.animations.duration.large } } } @@ -987,7 +948,7 @@ Item { plasmoid.configuration.panelSize + belower.width Behavior on opacity{ - NumberAnimation { duration: animations.speedFactor.current*animations.duration.large } + NumberAnimation { duration: appletAbilities.animations.speedFactor.current * appletAbilities.animations.duration.large } } @@ -1017,8 +978,8 @@ Item { visible: root.dragAreaEnabled - property int maxThickness: (parabolic.isHovered || windowPreviewIsShown || animations.hasThicknessAnimation) ? - metrics.mask.thickness.zoomedForItems : metrics.mask.thickness.normalForItems + property int maxThickness: (appletAbilities.parabolic.isHovered || windowPreviewIsShown || appletAbilities.animations.hasThicknessAnimation) ? + appletAbilities.metrics.mask.thickness.zoomedForItems : appletAbilities.metrics.mask.thickness.normalForItems function onlyLaunchersInDroppedList(list){ return list.every(function (item) { @@ -1029,7 +990,7 @@ Item { onUrlsDropped: { //! inform synced docks for new dropped launchers if (onlyLaunchersInDroppedList(urls)) { - launchers.addDroppedLaunchers(urls); + appletAbilities.launchers.addDroppedLaunchers(urls); return; } @@ -1082,10 +1043,10 @@ Item { when: latteView && !latteView.maskManager.inRelocationHiding value: { if (latteView) { - return animations.hasThicknessAnimation ? metrics.mask.thickness.zoomed : metrics.mask.thickness.normal; + return appletAbilities.animations.hasThicknessAnimation ? appletAbilities.metrics.mask.thickness.zoomed : appletAbilities.metrics.mask.thickness.normal; } - return metrics.totals.thickness * parabolic.factor.zoom; + return appletAbilities.metrics.totals.thickness * appletAbilities.parabolic.factor.zoom; } } @@ -1120,14 +1081,14 @@ Item { boundsBehavior: Flickable.StopAtBounds orientation: plasmoid.formFactor === PlasmaCore.Types.Vertical ? Qt.Vertical : Qt.Horizontal delegate: Task.TaskItem{ - animations: _animations - debug: _debug - indexer: _indexer - launchers: _launchers - metrics: _metrics - parabolic: _parabolic - requires: _requires - shortcuts: _shortcuts + animations: appletAbilities.animations + debug: appletAbilities.debug + indexer: appletAbilities.indexer + launchers: appletAbilities.launchers + metrics: appletAbilities.metrics + parabolic: appletAbilities.parabolic + requires: appletAbilities.requires + shortcuts: appletAbilities.shortcuts } property int currentSpot : -1000 @@ -1142,7 +1103,7 @@ Item { //more of a trouble moveDisplaced: Transition { - NumberAnimation { properties: "x,y"; duration: animations.speedFactor.current*animations.duration.large; easing.type: Easing.Linear } + NumberAnimation { properties: "x,y"; duration: appletAbilities.animations.speedFactor.current * appletAbilities.animations.duration.large; easing.type: Easing.Linear } } ///this transition can not be used with dragging !!!! I breaks @@ -1200,13 +1161,13 @@ Item { LatteComponents.AddingArea { id: newDroppedLauncherVisual - width: root.vertical ? metrics.totals.thickness : scrollableList.width - height: root.vertical ? scrollableList.height : metrics.totals.thickness + width: root.vertical ? appletAbilities.metrics.totals.thickness : scrollableList.width + height: root.vertical ? scrollableList.height : appletAbilities.metrics.totals.thickness visible: backgroundOpacity > 0 - radius: metrics.iconSize/10 + radius: appletAbilities.metrics.iconSize/10 backgroundOpacity: root.dropNewLauncher && mouseHandler.onlyLaunchers && (root.dragSource == null)? 0.75 : 0 - duration: animations.speedFactor.current + duration: appletAbilities.animations.speedFactor.current title: i18n("Tasks Area") @@ -1224,7 +1185,7 @@ Item { PropertyChanges { target: newDroppedLauncherVisual - anchors{ topMargin:0; bottomMargin:0; leftMargin:metrics.margin.screenEdge; rightMargin:0;} + anchors{ topMargin:0; bottomMargin:0; leftMargin: appletAbilities.metrics.margin.screenEdge; rightMargin:0;} } }, State { @@ -1239,7 +1200,7 @@ Item { PropertyChanges { target: newDroppedLauncherVisual - anchors{ topMargin:0; bottomMargin:0; leftMargin:0; rightMargin:metrics.margin.screenEdge;} + anchors{ topMargin:0; bottomMargin:0; leftMargin:0; rightMargin: appletAbilities.metrics.margin.screenEdge;} } }, State { @@ -1254,7 +1215,7 @@ Item { PropertyChanges { target: newDroppedLauncherVisual - anchors{ topMargin:metrics.margin.screenEdge; bottomMargin:0; leftMargin:0; rightMargin:0;} + anchors{ topMargin: appletAbilities.metrics.margin.screenEdge; bottomMargin:0; leftMargin:0; rightMargin:0;} } }, State { @@ -1271,7 +1232,7 @@ Item { PropertyChanges { target: newDroppedLauncherVisual - anchors{ topMargin:0; bottomMargin:metrics.margin.screenEdge; leftMargin:0; rightMargin:0;} + anchors{ topMargin:0; bottomMargin: appletAbilities.metrics.margin.screenEdge; leftMargin:0; rightMargin:0;} } } ] @@ -1289,7 +1250,7 @@ Item { onTriggered: { root.publishTasksGeometries(); - if (debug.timersEnabled) { + if (appletAbilities.debug.timersEnabled) { console.log("plasmoid timer: iconGeometryTimer called..."); } } @@ -1343,12 +1304,12 @@ Item { //// functions function activateTaskAtIndex(index) { // This is called with Meta+number shortcuts by plasmashell when Tasks are in a plasma panel. - shortcuts.sglActivateEntryAtIndex(index); + appletAbilities.shortcuts.sglActivateEntryAtIndex(index); } function newInstanceForTaskAtIndex(index) { // This is called with Meta+Alt+number shortcuts by plasmashell when Tasks are in a plasma panel. - shortcuts.sglNewInstanceForEntryAtIndex(index); + appletAbilities.shortcuts.sglNewInstanceForEntryAtIndex(index); } function getBadger(identifier) { diff --git a/plasmoid/package/contents/ui/task/indicator/Bridge.qml b/plasmoid/package/contents/ui/task/indicator/Bridge.qml index 711d73fe8..94f3c830c 100644 --- a/plasmoid/package/contents/ui/task/indicator/Bridge.qml +++ b/plasmoid/package/contents/ui/task/indicator/Bridge.qml @@ -66,8 +66,8 @@ Item { readonly property real panelOpacity: root.currentPanelOpacity readonly property color shadowColor: root.appShadowColorSolid - readonly property bool animationsEnabled: taskIsValid ? taskItem.animations.active : animations.active - readonly property real durationTime: taskIsValid ? taskItem.animations.speedFactor.current : animations.speedFactor.current + readonly property bool animationsEnabled: taskIsValid ? taskItem.animations.active : appletAbilities.animations.active + readonly property real durationTime: taskIsValid ? taskItem.animations.speedFactor.current : appletAbilities.animations.speedFactor.current readonly property bool progressVisible: wrapper.progressVisible /*since 0.9.2*/ readonly property real progress: wrapper.progress /*since 0.9.2*/ diff --git a/plasmoid/package/contents/ui/taskslayout/MouseHandler.qml b/plasmoid/package/contents/ui/taskslayout/MouseHandler.qml index 7bc607626..1b78fd221 100644 --- a/plasmoid/package/contents/ui/taskslayout/MouseHandler.qml +++ b/plasmoid/package/contents/ui/taskslayout/MouseHandler.qml @@ -210,9 +210,9 @@ Item { if (droppingSeparator) { droppingSeparator = false; if (hoveredItem && hoveredItem.itemIndex >=0){ - launchers.addInternalSeparatorAtPos(hoveredItem.itemIndex); + appletAbilities.launchers.addInternalSeparatorAtPos(hoveredItem.itemIndex); } else { - launchers.addInternalSeparatorAtPos(0); + appletAbilities.launchers.addInternalSeparatorAtPos(0); } return; } diff --git a/plasmoid/package/contents/ui/taskslayout/ScrollEdgeShadows.qml b/plasmoid/package/contents/ui/taskslayout/ScrollEdgeShadows.qml index c034b70e6..2744c2765 100644 --- a/plasmoid/package/contents/ui/taskslayout/ScrollEdgeShadows.qml +++ b/plasmoid/package/contents/ui/taskslayout/ScrollEdgeShadows.qml @@ -26,8 +26,8 @@ Item { id: shadowsContainer opacity: 0.4 - readonly property int gradientLength: metrics.iconSize / 3 - readonly property int thickness: metrics.backgroundThickness + readonly property int gradientLength: appletAbilities.metrics.iconSize / 3 + readonly property int thickness: appletAbilities.metrics.backgroundThickness readonly property color appliedColor: root.appShadowColorSolid property Item flickable @@ -81,7 +81,7 @@ Item { } PropertyChanges { target: shadowsContainer - anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin: 0; anchors.bottomMargin: metrics.margin.screenEdge; + anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin: 0; anchors.bottomMargin: appletAbilities.metrics.margin.screenEdge; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; } }, @@ -106,7 +106,7 @@ Item { } PropertyChanges { target: shadowsContainer - anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin: metrics.margin.screenEdge; anchors.bottomMargin:0; + anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin: appletAbilities.metrics.margin.screenEdge; anchors.bottomMargin:0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; } }, @@ -131,7 +131,7 @@ Item { } PropertyChanges { target: shadowsContainer - anchors.leftMargin: metrics.margin.screenEdge; anchors.rightMargin:0; anchors.topMargin: 0; anchors.bottomMargin:0; + anchors.leftMargin: appletAbilities.metrics.margin.screenEdge; anchors.rightMargin:0; anchors.topMargin: 0; anchors.bottomMargin:0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; } }, @@ -156,7 +156,7 @@ Item { } PropertyChanges { target: shadowsContainer - anchors.leftMargin: 0; anchors.rightMargin: metrics.margin.screenEdge; anchors.topMargin: 0; anchors.bottomMargin:0; + anchors.leftMargin: 0; anchors.rightMargin: appletAbilities.metrics.margin.screenEdge; anchors.topMargin: 0; anchors.bottomMargin:0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; } } diff --git a/plasmoid/package/contents/ui/taskslayout/ScrollOpacityMask.qml b/plasmoid/package/contents/ui/taskslayout/ScrollOpacityMask.qml index 3c669168c..45b67ab54 100644 --- a/plasmoid/package/contents/ui/taskslayout/ScrollOpacityMask.qml +++ b/plasmoid/package/contents/ui/taskslayout/ScrollOpacityMask.qml @@ -24,7 +24,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore Item { - readonly property int gradientLength: metrics.iconSize / 3 + readonly property int gradientLength: appletAbilities.metrics.iconSize / 3 LinearGradient { id: firstGradient diff --git a/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml b/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml index dccded7db..1b8d9745d 100644 --- a/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml +++ b/plasmoid/package/contents/ui/taskslayout/ScrollableList.qml @@ -56,10 +56,10 @@ Flickable{ readonly property int scrollFirstPos: 0 readonly property int scrollLastPos: contentsExtraSpace - readonly property int scrollStep: metrics.totals.length * 3.5 + readonly property int scrollStep: appletAbilities.metrics.totals.length * 3.5 readonly property int currentPos: !root.vertical ? contentX : contentY - readonly property int autoScrollTriggerLength: metrics.iconSize + metrics.totals.lengthEdge + readonly property int autoScrollTriggerLength: appletAbilities.metrics.iconSize + appletAbilities.metrics.totals.lengthEdge readonly property int alignment: { if (root.location === PlasmaCore.Types.LeftEdge) { @@ -140,18 +140,18 @@ Flickable{ if (!root.vertical) { if (cP.x < 0) { - distance = Math.abs(cP.x - metrics.iconSize); + distance = Math.abs(cP.x - appletAbilities.metrics.iconSize); decreasePosWithStep(distance); } else if ((cP.x+task.width) > scrollableList.width) { - distance = Math.abs(cP.x - scrollableList.width + task.width + metrics.iconSize); + distance = Math.abs(cP.x - scrollableList.width + task.width + appletAbilities.metrics.iconSize); increasePosWithStep(distance); } } else { if (cP.y < 0) { - distance = Math.abs(cP.y - metrics.iconSize); + distance = Math.abs(cP.y - appletAbilities.metrics.iconSize); decreasePosWithStep(distance); } else if ((cP.y+task.height) > scrollableList.height) { - distance = Math.abs(cP.y - scrollableList.height + task.height + metrics.iconSize); + distance = Math.abs(cP.y - scrollableList.height + task.height + appletAbilities.metrics.iconSize); increasePosWithStep(distance); } } @@ -176,7 +176,7 @@ Flickable{ var cP = task.mapToItem(scrollableList, 0, 0); - var localStep = horizontalAnimation.running || verticalAnimation.running ? 3.5 * metrics.totals.length : metrics.totals.length; + var localStep = horizontalAnimation.running || verticalAnimation.running ? 3.5 * appletAbilities.metrics.totals.length : appletAbilities.metrics.totals.length; if (!root.vertical) { if (currentPos !== scrollFirstPos && cP.x < autoScrollTriggerLength) { @@ -213,7 +213,7 @@ Flickable{ Behavior on contentX { NumberAnimation { id: horizontalAnimation - duration: animations.speedFactor.current*4.1*animations.duration.large + duration: appletAbilities.animations.speedFactor.current*4.1*appletAbilities.animations.duration.large easing.type: Easing.OutQuad } } @@ -221,7 +221,7 @@ Flickable{ Behavior on contentY { NumberAnimation { id: verticalAnimation - duration: animations.speedFactor.current*4.1*animations.duration.large + duration: appletAbilities.animations.speedFactor.current*4.1*appletAbilities.animations.duration.large easing.type: Easing.OutQuad } }