diff options
Diffstat (limited to 'src-qt5/src-cpp/RootDesktopObject.cpp')
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.cpp | 30 |
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 === |