aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-cpp/RootDesktopObject.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-10-13 16:25:18 -0400
committerKen Moore <ken@ixsystems.com>2017-10-13 16:25:18 -0400
commitd04f35ab9b827085d1cbee0bc2f7cae7787557ef (patch)
tree36a40cc20324aee82f4d2944cb2b54161522491c /src-qt5/src-cpp/RootDesktopObject.cpp
parentAnother checkpoint commit - almost ready to start running tests with QML for ... (diff)
downloadlumina-d04f35ab9b827085d1cbee0bc2f7cae7787557ef.tar.gz
lumina-d04f35ab9b827085d1cbee0bc2f7cae7787557ef.tar.bz2
lumina-d04f35ab9b827085d1cbee0bc2f7cae7787557ef.zip
Another checkpoint commit for Lumina 2
Almost have the QML-based desktop canvas working - still tracking down some QML syntax issues.
Diffstat (limited to 'src-qt5/src-cpp/RootDesktopObject.cpp')
-rw-r--r--src-qt5/src-cpp/RootDesktopObject.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/src-qt5/src-cpp/RootDesktopObject.cpp b/src-qt5/src-cpp/RootDesktopObject.cpp
index 088c88b7..e7873991 100644
--- a/src-qt5/src-cpp/RootDesktopObject.cpp
+++ b/src-qt5/src-cpp/RootDesktopObject.cpp
@@ -5,9 +5,13 @@
// See the LICENSE file for full details
//===========================================
#include "RootDesktopObject.h"
+#include <QQmlEngine>
+#include <QApplication>
+#include <QScreen>
+
// === PUBLIC ===
-RootDesktopObject::RootDesktopObject(QObject *parent = 0){
+RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){
updateScreens(); //make sure the internal list is updated right away
}
@@ -15,14 +19,24 @@ RootDesktopObject::~RootDesktopObject(){
}
-static RootDesktopObject* RootDesktopObject::instance(){
+void RootDesktopObject::RegisterType(){
+ qmlRegisterType<RootDesktopObject>("Lumina.Backend.RootDesktopObject", 2, 0, "RootDesktopObject");
+ //Also register any types that are needed by this class
+ ScreenObject::RegisterType();
+}
+
+RootDesktopObject* RootDesktopObject::instance(){
static RootDesktopObject* r_obj = new RootDesktopObject();
return r_obj;
}
//QML Read Functions
-QList<QScreen*> RootDesktopObject::screens(){
- return ;
+QList<ScreenObject*> RootDesktopObject::screens(){
+ return s_objects;
+}
+
+void RootDesktopObject::logout(){
+ emit startLogout();
}
// === PUBLIC SLOTS ===
@@ -32,7 +46,7 @@ void RootDesktopObject::updateScreens(){
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(s_objects[j]->name()==scrns[i]->name()){ found = true; tmp << s_objects.takeAt(j); }
}
if(!found){ tmp << new ScreenObject(scrns[i], this); }
}
@@ -41,4 +55,10 @@ void RootDesktopObject::updateScreens(){
s_objects = tmp;
}
+void RootDesktopObject::ChangeWallpaper(QString screen, QString value){
+ for(int i=0; i<s_objects.length(); i++){
+ if(s_objects[i]->name()==screen){ s_objects[i]->setBackground(value); break; }
+ }
+}
+
// === PRIVATE ===
bgstack15