diff options
author | Ken Moore <ken@ixsystems.com> | 2018-01-11 14:47:08 -0800 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-01-11 14:47:08 -0800 |
commit | 35a425977ca313e608950cdc25c7df727e47251d (patch) | |
tree | 4b44496622a8b3b5166355e3b24e97c2c0a0a7ff /src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp | |
parent | Get a lot more of the Native Window embed routine up and running. Actually us... (diff) | |
download | lumina-35a425977ca313e608950cdc25c7df727e47251d.tar.gz lumina-35a425977ca313e608950cdc25c7df727e47251d.tar.bz2 lumina-35a425977ca313e608950cdc25c7df727e47251d.zip |
Get the panels all setup and functional.
The screen-dependent panels need to be moved to the RootDesktop QML object so the z-ordering is respected (panels on top), but other than that it seems to be working fine.
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp index 1b22c450..c754906d 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp @@ -10,6 +10,7 @@ ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ bg_screen = scrn; + connect(this, SIGNAL(changePanels(QStringList)), this, SLOT(setPanels(QStringList)) ); } void ScreenObject::RegisterType(){ @@ -40,6 +41,37 @@ void ScreenObject::setPanels(QList<PanelObject*> list){ emit panelsChanged(); } +void ScreenObject::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; + } + + //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(bg_screen->geometry()); + }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(bg_screen->geometry()); + panel_objects << tmp; + change = true; //list changed + } + if(change){ emit panelsChanged(); } +} + + //QML Read Functions QStringList ScreenObject::panels(){ //qDebug() << "Request Panels:" << panel_objects.length(); |