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.
pull/2/head
Michail Vourlakos 7 years ago
parent 451512192c
commit 24c9751f2e

@ -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<frozenTasks.length; ++i) {
if (frozenTasks[i].id === identifier) {
@ -265,4 +264,68 @@ Item {
frozenTasks.push({id: identifier, mScale: scale});
}
}
//! SEPARATORS functions
// update the registered separators
// launcherUrl, no = add/update separator
// launcherUrl, -1 = remove separator
function setSeparator(launcher, taskIndex) {
var currentPos = separatorArrayPos(launcher);
var updated = false;
if (currentPos === -1 && taskIndex >=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<separators.length; ++i) {
if (separators[i].launcherUrl === launcher)
return i;
}
return res;
}
function availableLowerIndex(from) {
var next = from;
while (separators.indexOf(next) !== -1 || hidden.indexOf(next) !== -1)
next = next - 1;
return next;
}
function availableHigherIndex(from) {
var next = from;
while (separators.indexOf(next) !== -1 || hidden.indexOf(next) !== -1)
next = next + 1;
return next;
}
function isSeparator(launcher){
return (launcher.indexOf("latte-separator")!==-1 && launcher.indexOf(".desktop")!==1);
}
}

@ -203,6 +203,7 @@ Item {
signal draggingFinished();
signal presentWindows(variant winIds);
signal requestLayout;
signal separatorsUpdated();
signal signalActionsBlockHiding(int value);
signal signalAnimationsNeedBothAxis(int value);
signal signalAnimationsNeedLength(int value);
@ -531,20 +532,6 @@ Item {
groupMode: TaskManager.TasksModel.GroupApplications
sortMode: TaskManager.TasksModel.SortManual
function checkSeparator() {
var hasSep = false;
for(var i=0; i<launcherList.length; ++i){
var rec1 = launcherList[i];
if (rec1.indexOf("latte-separator.desktop") >= 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;

@ -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 /////

Loading…
Cancel
Save