From 24c9751f2e60a9eaf8c1fade6e1e25ccce3ff6e2 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 13 Nov 2017 21:01:08 +0200 Subject: [PATCH] initial architecture for multiple int.separators --make the single separator old architecture to work correctly with the new multiple internal separators architecture. Many things need to be updated in order for this to work but lets make one step at a time. --- .../package/contents/ui/ParabolicManager.qml | 75 +++++++++++++++++-- plasmoid/package/contents/ui/main.qml | 18 +---- .../package/contents/ui/task/TaskDelegate.qml | 13 +++- 3 files changed, 80 insertions(+), 26 deletions(-) diff --git a/plasmoid/package/contents/ui/ParabolicManager.qml b/plasmoid/package/contents/ui/ParabolicManager.qml index 3e4cb2d04..c3dc2a109 100644 --- a/plasmoid/package/contents/ui/ParabolicManager.qml +++ b/plasmoid/package/contents/ui/ParabolicManager.qml @@ -37,12 +37,9 @@ Item { //(id, mScale) property variant frozenTasks: [] - onInternalSeparatorPosChanged: { - if (internalSeparatorPos>-1) - hasInternalSeparator = true; - else - hasInternalSeparator = false; - } + //the internal separators in the form + //(launcherUrl, index) + property variant separators: [] //!this is used in order to update the index when the signal is for applets //!outside the latte plasmoid @@ -233,6 +230,8 @@ Item { return false; } + //! Frozen Tasks functions + function getFrozenTask(identifier) { for(var i=0; i=0){ + //add that separator + separators.push({launcherUrl: launcher, index: taskIndex}); + updated = true; + } else if (currentPos>-1 && taskIndex === -1) { + //remove that separator + separators.splice(currentPos,1); + updated = true; + } else if (currentPos>-1 && taskIndex>-1 && separators[currentPos].index !== taskIndex) { + //update that separator + separators[currentPos].index = taskIndex; + updated = true; + } + + if (updated) { + hasInternalSeparator = separators.length > 0; + internalSeparatorPos = hasInternalSeparator ? separators[0].index : -1; + root.separatorsUpdated(); + } + } + + function separatorArrayPos(launcher) { + var res = -1; + + for (var i=0; i= 0) { - hasSep = true; - break; - } - } - - if (!hasSep) - parabolicManager.internalSeparatorPos = -1; - } - function updateLaunchersList(){ if (latteDock.universalSettings && (latteDock.launchersGroup === Latte.Dock.LayoutLaunchers @@ -578,7 +565,6 @@ Item { } else { plasmoid.configuration.launchers59 = launcherList; } - checkSeparator(); } } @@ -625,8 +611,6 @@ Item { icList.model = tasksModel; tasksStarting = count; - checkSeparator(); - ///Plasma 5.9 enforce grouping at all cases if (Latte.WindowSystem.frameworksVersion >= 335104) { groupingWindowTasksThreshold = -1; diff --git a/plasmoid/package/contents/ui/task/TaskDelegate.qml b/plasmoid/package/contents/ui/task/TaskDelegate.qml index 1d741ee7d..e9c845787 100644 --- a/plasmoid/package/contents/ui/task/TaskDelegate.qml +++ b/plasmoid/package/contents/ui/task/TaskDelegate.qml @@ -147,9 +147,8 @@ MouseArea{ if (modelLauncherUrl !== "") launcherUrl = modelLauncherUrl; - if (modelLauncherUrl.indexOf("latte-separator.desktop")>=0){ + if (parabolicManager.isSeparator(modelLauncherUrl)){ isSeparator = true; - parabolicManager.internalSeparatorPos = index; } else { isSeparator = false; } @@ -543,7 +542,7 @@ MouseArea{ lastValidTimer.start(); if (isSeparator){ - parabolicManager.internalSeparatorPos = itemIndex; + parabolicManager.setSeparator(launcherUrl, itemIndex); } } @@ -571,6 +570,14 @@ MouseArea{ checkWindowsStates(); } + onIsSeparatorChanged: { + if (isSeparator) { + parabolicManager.setSeparator(launcherUrl, itemIndex); + } else { + parabolicManager.setSeparator(launcherUrl, -1); + } + } + onLauncherUrlChanged: updateBadge(); ////// End of Values Changes /////