diff options
author | Ken Moore <ken@ixsystems.com> | 2017-10-12 13:51:47 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-10-12 13:51:47 -0400 |
commit | 34bac34d5d1e7d95120ab745e2be42dd3cdccef5 (patch) | |
tree | bbae0a401a7146ccf93d56949a9eb237857b2005 /src-qt5/src-cpp/RootDesktopObject.cpp | |
parent | Tinker with the color divisions in "Warp" a bit - ensure more even distributi... (diff) | |
download | lumina-34bac34d5d1e7d95120ab745e2be42dd3cdccef5.tar.gz lumina-34bac34d5d1e7d95120ab745e2be42dd3cdccef5.tar.bz2 lumina-34bac34d5d1e7d95120ab745e2be42dd3cdccef5.zip |
Add the beginnings of the root desktop QML system. Not finished yet.
Diffstat (limited to 'src-qt5/src-cpp/RootDesktopObject.cpp')
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src-qt5/src-cpp/RootDesktopObject.cpp b/src-qt5/src-cpp/RootDesktopObject.cpp new file mode 100644 index 00000000..088c88b7 --- /dev/null +++ b/src-qt5/src-cpp/RootDesktopObject.cpp @@ -0,0 +1,44 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootDesktopObject.h" + +// === PUBLIC === +RootDesktopObject::RootDesktopObject(QObject *parent = 0){ + updateScreens(); //make sure the internal list is updated right away +} + +RootDesktopObject::~RootDesktopObject(){ + +} + +static RootDesktopObject* RootDesktopObject::instance(){ + static RootDesktopObject* r_obj = new RootDesktopObject(); + return r_obj; +} + +//QML Read Functions +QList<QScreen*> RootDesktopObject::screens(){ + return ; +} + +// === PUBLIC SLOTS === +void RootDesktopObject::updateScreens(){ + QList<QScreen*> scrns = QApplication::screens(); + QList<ScreenObject*> tmp; //copy of the internal array initially + for(int i=0; i<scrns.length(); i++){ + bool found = false; + for(int j=0; j<s_objects.length() && !found; j++){ + if(s_objects[j].name()==scrns.name()){ found = true; tmp << s_objects.takeAt(j); } + } + if(!found){ tmp << new ScreenObject(scrns[i], this); } + } + //Delete any leftover objects + for(int i=0; i<s_objects.length(); i++){ s_objects[i]->deleteLater(); } + s_objects = tmp; +} + +// === PRIVATE === |