diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp index 39dc30c1..07d4e463 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -14,6 +14,7 @@ // === PUBLIC === RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){ updateScreens(); //make sure the internal list is updated right away + connect(this, SIGNAL(changePanels(QStringList)), this, SLOT(setPanels(QStringList)) ); } RootDesktopObject::~RootDesktopObject(){ @@ -87,6 +88,41 @@ void RootDesktopObject::setPanels(QList<PanelObject*> list){ emit panelsChanged(); } +void RootDesktopObject::setPanels(QStringList ids){ + //Make this thread-safe for object creation + if(this->thread() != QThread::currentThread()){ + //use internal signal/slot combo to change threads + this->emit changePanels(ids); + return; + } + + //Get the current bounding rectangle for the session + QRect total; + for(int i=0; i<s_objects.length(); i++){ + total = total.united(s_objects[i]->geometry()); + } + //First update/remove any current panel objects + bool change = false; + for(int i=0; i<panel_objects.length(); i++){ + if(ids.contains(panel_objects[i]->name()) ){ + ids.removeAll(panel_objects[i]->name()); //already handled + panel_objects[i]->syncWithSettings(total); + }else{ + panel_objects.takeAt(i)->deleteLater(); + i--; + change = true; //list changed + } + } + //Now create any new panel objects as needed + for(int i=0; i<ids.length(); i++){ + PanelObject *tmp = new PanelObject(ids[i], this); + tmp->syncWithSettings(total); + panel_objects << tmp; + change = true; //list changed + } + if(change){ emit panelsChanged(); } +} + void RootDesktopObject::setWindows(QList<NativeWindowObject*> list){ window_objects = list; emit windowsChanged(); |