diff options
author | Ken Moore <ken@ixsystems.com> | 2017-10-13 16:25:18 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-10-13 16:25:18 -0400 |
commit | d04f35ab9b827085d1cbee0bc2f7cae7787557ef (patch) | |
tree | 36a40cc20324aee82f4d2944cb2b54161522491c | |
parent | Another checkpoint commit - almost ready to start running tests with QML for ... (diff) | |
download | lumina-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.
-rw-r--r-- | src-qt5/core/libLumina/LDesktopUtils.pri | 1 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootSubWindow-animations.cpp (renamed from src-qt5/core/libLumina/RootSubWindow-animations.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootSubWindow.cpp (renamed from src-qt5/core/libLumina/RootSubWindow.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootSubWindow.h (renamed from src-qt5/core/libLumina/RootSubWindow.h) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootWindow-mgmt.cpp (renamed from src-qt5/core/libLumina/RootWindow-mgmt.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootWindow.cpp (renamed from src-qt5/core/libLumina/RootWindow.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootWindow.h (renamed from src-qt5/core/libLumina/RootWindow.h) | 0 | ||||
-rw-r--r-- | src-qt5/core/libLumina/obsolete/RootWindow.pri (renamed from src-qt5/core/libLumina/RootWindow.pri) | 0 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 9 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/global-includes.h | 9 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/global-objects.h | 4 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/lumina-desktop.pro | 10 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp | 33 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h | 32 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri | 8 | ||||
-rw-r--r-- | src-qt5/src-cpp/Desktop.pri | 11 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeEmbedWidget.cpp (renamed from src-qt5/core/libLumina/NativeEmbedWidget.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeEmbedWidget.h (renamed from src-qt5/core/libLumina/NativeEmbedWidget.h) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeEventFilter.cpp (renamed from src-qt5/core/libLumina/NativeEventFilter.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeEventFilter.h (renamed from src-qt5/core/libLumina/NativeEventFilter.h) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeKeyToQt.cpp (renamed from src-qt5/core/libLumina/NativeKeyToQt.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeWindow.cpp (renamed from src-qt5/core/libLumina/NativeWindow.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeWindow.h (renamed from src-qt5/core/libLumina/NativeWindow.h) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeWindow.pri (renamed from src-qt5/core/libLumina/NativeWindow.pri) | 1 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeWindowSystem.cpp (renamed from src-qt5/core/libLumina/NativeWindowSystem.cpp) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/NativeWindowSystem.h (renamed from src-qt5/core/libLumina/NativeWindowSystem.h) | 0 | ||||
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.cpp | 30 | ||||
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.h | 11 | ||||
-rw-r--r-- | src-qt5/src-cpp/ScreenObject.cpp | 30 | ||||
-rw-r--r-- | src-qt5/src-cpp/ScreenObject.h | 40 | ||||
-rw-r--r-- | src-qt5/src-qml/RootDesktop.qml | 6 | ||||
-rw-r--r-- | src-qt5/src-qml/src-qml.pri | 4 | ||||
-rw-r--r-- | src-qt5/src-qml/src-qml.qrc | 2 |
33 files changed, 183 insertions, 58 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.pri b/src-qt5/core/libLumina/LDesktopUtils.pri index 80bbcfa8..fcacc586 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.pri +++ b/src-qt5/core/libLumina/LDesktopUtils.pri @@ -5,3 +5,4 @@ INCLUDEPATH *= ${PWD} #Now the other dependendies of it include(LUtils.pri) +include(LuminaThemes.pri) diff --git a/src-qt5/core/libLumina/RootSubWindow-animations.cpp b/src-qt5/core/libLumina/obsolete/RootSubWindow-animations.cpp index efab20fe..efab20fe 100644 --- a/src-qt5/core/libLumina/RootSubWindow-animations.cpp +++ b/src-qt5/core/libLumina/obsolete/RootSubWindow-animations.cpp diff --git a/src-qt5/core/libLumina/RootSubWindow.cpp b/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp index 5040f2f9..5040f2f9 100644 --- a/src-qt5/core/libLumina/RootSubWindow.cpp +++ b/src-qt5/core/libLumina/obsolete/RootSubWindow.cpp diff --git a/src-qt5/core/libLumina/RootSubWindow.h b/src-qt5/core/libLumina/obsolete/RootSubWindow.h index 598298e2..598298e2 100644 --- a/src-qt5/core/libLumina/RootSubWindow.h +++ b/src-qt5/core/libLumina/obsolete/RootSubWindow.h diff --git a/src-qt5/core/libLumina/RootWindow-mgmt.cpp b/src-qt5/core/libLumina/obsolete/RootWindow-mgmt.cpp index 24ea639b..24ea639b 100644 --- a/src-qt5/core/libLumina/RootWindow-mgmt.cpp +++ b/src-qt5/core/libLumina/obsolete/RootWindow-mgmt.cpp diff --git a/src-qt5/core/libLumina/RootWindow.cpp b/src-qt5/core/libLumina/obsolete/RootWindow.cpp index 705297be..705297be 100644 --- a/src-qt5/core/libLumina/RootWindow.cpp +++ b/src-qt5/core/libLumina/obsolete/RootWindow.cpp diff --git a/src-qt5/core/libLumina/RootWindow.h b/src-qt5/core/libLumina/obsolete/RootWindow.h index c5cd44a0..c5cd44a0 100644 --- a/src-qt5/core/libLumina/RootWindow.h +++ b/src-qt5/core/libLumina/obsolete/RootWindow.h diff --git a/src-qt5/core/libLumina/RootWindow.pri b/src-qt5/core/libLumina/obsolete/RootWindow.pri index 9426b6b4..9426b6b4 100644 --- a/src-qt5/core/libLumina/RootWindow.pri +++ b/src-qt5/core/libLumina/obsolete/RootWindow.pri diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index bace2dbe..cc754005 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -129,15 +129,15 @@ void LSession::setupSession(){ QList<QScreen*> scrns= QApplication::screens(); for(int i=0; i<scrns.length(); i++){ qDebug() << " --- Load Wallpaper for Screen:" << scrns[i]->name(); - Lumina::ROOTWIN->ChangeWallpaper(scrns[i]->name(), RootWindow::Stretch, LOS::LuminaShare()+"desktop-background.jpg"); + RootDesktopObject::instance()->ChangeWallpaper(scrns[i]->name(), LOS::LuminaShare()+"desktop-background.jpg"); } - Lumina::ROOTWIN->start(); + //Lumina::ROOTWIN->start(); Lumina::NWS->setRoot_numberOfWorkspaces(QStringList() << "one" << "two"); Lumina::NWS->setRoot_currentWorkspace(0); if(DEBUG){ qDebug() << " - Create Desktop Context Menu"; } - DesktopContextMenu *cmenu = new DesktopContextMenu(Lumina::ROOTWIN); + /*DesktopContextMenu *cmenu = new DesktopContextMenu(Lumina::ROOTWIN); connect(cmenu, SIGNAL(showLeaveDialog()), this, SLOT(StartLogout()) ); - cmenu->start(); + cmenu->start();*/ //desktopFiles = QDir(QDir::homePath()+"/Desktop").entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs, QDir::Name | QDir::IgnoreCase | QDir::DirsFirst); //updateDesktops(); @@ -229,6 +229,7 @@ void LSession::setupGlobalConnections(){ connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::NWS, SLOT(RegisterVirtualRoot(WId)) ); connect(Lumina::ROOTWIN, SIGNAL(RootResized(QRect)), Lumina::NWS, SLOT(setRoot_desktopGeometry(QRect)) ); connect(Lumina::ROOTWIN, SIGNAL(MouseMoved()), Lumina::SS, SLOT(newInputEvent()) ); + connect(Lumina::ROOTWIN, SIGNAL(startLogout()), this, SLOT(StartLogout()) ); //Native Window Class connections connect(Lumina::NEF, SIGNAL(WindowCreated(WId)), Lumina::NWS, SLOT(NewWindowDetected(WId))); diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index ae57ac08..91604362 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -55,7 +55,13 @@ #include <QJsonArray> #include <QJsonDocument> #include <QQuickView> +#include <QQmlContext> +#include <QQmlEngine> +#include <QQuickImageProvider> +// C++ Backend classes for QML interface +#include <RootDesktopObject.h> +#include <ScreenObject.h> // libLumina includes #include <LuminaX11.h> @@ -66,7 +72,6 @@ #include <LDesktopUtils.h> #include <LuminaSingleApplication.h> #include <DesktopSettings.h> -#include <RootWindow.h> #include <ExternalProcess.h> #include <NativeWindow.h> #include <NativeWindowSystem.h> @@ -74,8 +79,6 @@ #include <XDGMime.h> #include <LIconCache.h> -// Standard C includes -#include <unistd.h> //Setup any global defines (no classes or global objects: use "global-objects.h" for that) diff --git a/src-qt5/core/lumina-desktop-unified/global-objects.h b/src-qt5/core/lumina-desktop-unified/global-objects.h index 0c990dc6..c204587f 100644 --- a/src-qt5/core/lumina-desktop-unified/global-objects.h +++ b/src-qt5/core/lumina-desktop-unified/global-objects.h @@ -25,8 +25,12 @@ #include "src-screensaver/LScreenSaver.h" //#include "src-WM/LWindowManager.h" +#include <RootWindow.h> #include "LSession.h" +// Standard C includes +#include <unistd.h> + //Any special defines for settings/testing #define ANIMTIME 80 //animation time in milliseconds diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro index 6b9ee876..21e46b22 100644 --- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro @@ -16,18 +16,13 @@ TARGET = lumina-desktop-unified target.path = $${L_BINDIR} #include all the special classes from the Lumina tree -include(../libLumina/ResizeMenu.pri) include(../libLumina/LDesktopUtils.pri) #includes LUtils and LOS include(../libLumina/LuminaXDG.pri) -#include(../libLumina/LuminaX11.pri) include(../libLumina/LuminaSingleApplication.pri) -include(../libLumina/LuminaThemes.pri) include(../libLumina/DesktopSettings.pri) -include(../libLumina/RootWindow.pri) include(../libLumina/ExternalProcess.pri) -include(../libLumina/NativeWindow.pri) +include(../../src-cpp/NativeWindow.pri) include(../libLumina/XDGMime.pri) -include(../libLumina/LIconCache.pri) include(../../src-cpp/plugins-screensaver.pri) @@ -45,8 +40,7 @@ SOURCES += main.cpp \ HEADERS += global-includes.h \ global-objects.h \ LSession.h \ - BootSplash.h \ - JsonMenu.h + BootSplash.h FORMS += BootSplash.ui diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp new file mode 100644 index 00000000..c0710bbc --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp @@ -0,0 +1,33 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootWindow.h" + +RootWindow::RootWindow(){ + root_win = QWindow::fromWinId( QX11Info::appRootWindow() ); // + root_view = new QQuickView(root_win); //make it a child of the root window + root_obj = RootDesktopObject::instance(); + syncRootSize(); + connect(root_win, SIGNAL(widthChanged(int)), this, SLOT(syncRootSize()) ); + connect(root_win, SIGNAL(heightChanged(int)),this, SLOT(syncRootSize()) ); + //Now setup the QQuickView + root_view->setResizeMode(QQuickView::SizeRootObjectToView); + root_view->engine()->rootContext()->setContextProperty("RootObject", root_obj); + root_view->setSource(QUrl("qrc:///qml/RootDesktop")); + root_view->show(); +} + +RootWindow::~RootWindow(){ + root_view->deleteLater(); + root_obj->deleteLater(); +} + +void RootWindow::syncRootSize(){ + if(root_win->width() != root_view->width() || root_win->height() != root_view->height()){ + root_view->setGeometry(0, 0, root_win->width(), root_win->height() ); + emit RootResized(root_view->geometry()); + } +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h new file mode 100644 index 00000000..1050ba21 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h @@ -0,0 +1,32 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_DESKTOP_ROOT_WINDOW_H +#define _LUMINA_DESKTOP_ROOT_WINDOW_H +#include <global-includes.h> + +class RootWindow : public QObject{ + Q_OBJECT +private: + QWindow *root_win; + QQuickView *root_view; + RootDesktopObject *root_obj; + +public: + RootWindow(); + ~RootWindow(); + +public slots: + void syncRootSize(); + +signals: + void startLogout(); + void RegisterVirtualRoot(WId); + void RootResized(QRect); + void MouseMoved(); +}; + +#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri index 75aef8a6..25aa02b7 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri @@ -1,6 +1,8 @@ -SOURCES *= $${PWD}/ContextMenu.cpp +SOURCES *= $${PWD}/RootWindow.cpp -HEADERS *= $${PWD}/ContextMenu.h +HEADERS *= $${PWD}/RootWindow.h #update the includepath so we can just #include as needed without paths -INCLUDEPATH *= ${PWD} +INCLUDEPATH *= $${PWD} + +include(../../../src-cpp/Desktop.pri) diff --git a/src-qt5/src-cpp/Desktop.pri b/src-qt5/src-cpp/Desktop.pri index c7da397d..dff6646c 100644 --- a/src-qt5/src-cpp/Desktop.pri +++ b/src-qt5/src-cpp/Desktop.pri @@ -1,9 +1,12 @@ QT *= gui qml quick -SOURCES *= RootDesktopObject.cpp +SOURCES *= $${PWD}/RootDesktopObject.cpp \ + $${PWD}/ScreenObject.cpp -HEADERS *= RootDesktopObject.h \ - ScreenObject.h +HEADERS *= $${PWD}/RootDesktopObject.h \ + $${PWD}/ScreenObject.h -include(../src-qml/src-qml.pri) +INCLUDEPATH *= $${PWD} + +include($${PWD}/../src-qml/src-qml.pri) diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.cpp b/src-qt5/src-cpp/NativeEmbedWidget.cpp index 57b6edde..57b6edde 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.cpp +++ b/src-qt5/src-cpp/NativeEmbedWidget.cpp diff --git a/src-qt5/core/libLumina/NativeEmbedWidget.h b/src-qt5/src-cpp/NativeEmbedWidget.h index 16bb46dc..16bb46dc 100644 --- a/src-qt5/core/libLumina/NativeEmbedWidget.h +++ b/src-qt5/src-cpp/NativeEmbedWidget.h diff --git a/src-qt5/core/libLumina/NativeEventFilter.cpp b/src-qt5/src-cpp/NativeEventFilter.cpp index c13c1fc8..c13c1fc8 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.cpp +++ b/src-qt5/src-cpp/NativeEventFilter.cpp diff --git a/src-qt5/core/libLumina/NativeEventFilter.h b/src-qt5/src-cpp/NativeEventFilter.h index a3be3ef1..a3be3ef1 100644 --- a/src-qt5/core/libLumina/NativeEventFilter.h +++ b/src-qt5/src-cpp/NativeEventFilter.h diff --git a/src-qt5/core/libLumina/NativeKeyToQt.cpp b/src-qt5/src-cpp/NativeKeyToQt.cpp index 06056be7..06056be7 100644 --- a/src-qt5/core/libLumina/NativeKeyToQt.cpp +++ b/src-qt5/src-cpp/NativeKeyToQt.cpp diff --git a/src-qt5/core/libLumina/NativeWindow.cpp b/src-qt5/src-cpp/NativeWindow.cpp index 02cc001e..02cc001e 100644 --- a/src-qt5/core/libLumina/NativeWindow.cpp +++ b/src-qt5/src-cpp/NativeWindow.cpp diff --git a/src-qt5/core/libLumina/NativeWindow.h b/src-qt5/src-cpp/NativeWindow.h index 67436259..67436259 100644 --- a/src-qt5/core/libLumina/NativeWindow.h +++ b/src-qt5/src-cpp/NativeWindow.h diff --git a/src-qt5/core/libLumina/NativeWindow.pri b/src-qt5/src-cpp/NativeWindow.pri index c906d6fd..c2ac0137 100644 --- a/src-qt5/core/libLumina/NativeWindow.pri +++ b/src-qt5/src-cpp/NativeWindow.pri @@ -2,7 +2,6 @@ # Files QT *= x11extras LIBS *= -lc -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-image -lxcb-composite -lxcb-damage -lxcb-util -lxcb-keysyms -lXdamage -#QT *= -lxcb-render -lxcb-render-util SOURCES *= $${PWD}/NativeWindow.cpp \ $${PWD}/NativeWindowSystem.cpp \ diff --git a/src-qt5/core/libLumina/NativeWindowSystem.cpp b/src-qt5/src-cpp/NativeWindowSystem.cpp index e8e9655a..e8e9655a 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.cpp +++ b/src-qt5/src-cpp/NativeWindowSystem.cpp diff --git a/src-qt5/core/libLumina/NativeWindowSystem.h b/src-qt5/src-cpp/NativeWindowSystem.h index b67ecc94..b67ecc94 100644 --- a/src-qt5/core/libLumina/NativeWindowSystem.h +++ b/src-qt5/src-cpp/NativeWindowSystem.h 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 === diff --git a/src-qt5/src-cpp/RootDesktopObject.h b/src-qt5/src-cpp/RootDesktopObject.h index b706bcb6..0c280c2a 100644 --- a/src-qt5/src-cpp/RootDesktopObject.h +++ b/src-qt5/src-cpp/RootDesktopObject.h @@ -6,10 +6,13 @@ //=========================================== // This is the base C++ object that is used to pass information to the QML "RootDesktop" object //=========================================== -#ifndef _LUMINA_DESKTOP_ROOT_DESKTOP_OBJECT_H -#define _LUMINA_DESKTOP_ROOT_DESKTOP_OBJECT_H +#ifndef _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H +#define _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H +#include <QObject> +#include <QList> #include "ScreenObject.h" + class RootDesktopObject : public QObject{ Q_OBJECT //Define all the QML Properties here (interface between QML and the C++ methods below) @@ -20,7 +23,7 @@ public: RootDesktopObject(QObject *parent = 0); ~RootDesktopObject(); - static void RegisterType(){ qmlRegisterType<RootDesktopObject>("Lumina.Backend.RootDesktopObject",2,0, "RootDesktopObject"); + static void RegisterType(); //primary interface to fetch the current instance of the class (so only one is running at any given time) static RootDesktopObject* instance(); @@ -36,11 +39,13 @@ private: public slots: void updateScreens(); //rescan/update screen objects + void ChangeWallpaper(QString screen, QString); private slots: signals: void screensChanged(); + void startLogout(); }; #endif diff --git a/src-qt5/src-cpp/ScreenObject.cpp b/src-qt5/src-cpp/ScreenObject.cpp new file mode 100644 index 00000000..354b4cba --- /dev/null +++ b/src-qt5/src-cpp/ScreenObject.cpp @@ -0,0 +1,30 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "ScreenObject.h" +#include <QQmlEngine> + +ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ + bg_screen = scrn; +} + +void ScreenObject::RegisterType(){ + qmlRegisterType<ScreenObject>("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); +} + +QString ScreenObject::name(){ return bg_screen->name(); } +QString ScreenObject::background(){ return bg; } +int ScreenObject::x(){ return bg_screen->geometry().x(); } +int ScreenObject::y(){ return bg_screen->geometry().y(); } +int ScreenObject::width(){ return bg_screen->geometry().width(); } +int ScreenObject::height(){ return bg_screen->geometry().height(); } + +void ScreenObject::setBackground(QString fileOrColor){ + if(bg!=fileOrColor){ + bg = fileOrColor; + emit backgroundChanged(); + } +} diff --git a/src-qt5/src-cpp/ScreenObject.h b/src-qt5/src-cpp/ScreenObject.h index 49f266c3..5cb16bfc 100644 --- a/src-qt5/src-cpp/ScreenObject.h +++ b/src-qt5/src-cpp/ScreenObject.h @@ -4,12 +4,15 @@ // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== -// This is the base C++ object that is used to pass information to the QML "RootDesktop" object +// This is the base C++ object that is used to pass Screen/Wallpaper info to the QML classes //=========================================== -#ifndef _LUMINA_DESKTOP_ROOT_DESKTOP_OBJECT_H -#define _LUMINA_DESKTOP_ROOT_DESKTOP_OBJECT_H +#ifndef _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H +#define _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H +#include <QObject> +#include <QString> +#include <QScreen> -class ScreenObject : public QObject{ +class ScreenObject : public QObject { Q_OBJECT Q_PROPERTY( QString name READ name ) Q_PROPERTY( QString background READ background NOTIFY backgroundChanged) @@ -22,29 +25,24 @@ private: QScreen *bg_screen; QString bg; -public - ScreenObject(QScreen *scrn, QObject *parent = 0) : QObject(parent){ - bg_screen = scrn; - } +public: + ScreenObject(QScreen *scrn = 0, QObject *parent = 0); - static void RegisterType(){ qmlRegisterType<RootDesktopObject>("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); + static void RegisterType(); - QString name(){ return bg_screen->name(); } - QString background(){ return bg; } - int x(){ return bg_screen->geometry().x(); } - int y(){ return bg_screen->geometry().y(); } - int width(){ return bg_screen->geometry().width(); } - int height(){ return bg_screen->geometry().height(); } + QString name(); + QString background(); + int x(); + int y(); + int width(); + int height(); public slots: - void setBackground(QString fileOrColor){ - if(bg!=fileOrColor){ - bg = fileOrColor; - emit backgroundChanged(); - } - } + void setBackground(QString fileOrColor); signals: void backgroundChanged(); void geomChanged(); }; + +#endif diff --git a/src-qt5/src-qml/RootDesktop.qml b/src-qt5/src-qml/RootDesktop.qml index 0003366b..b9d62894 100644 --- a/src-qt5/src-qml/RootDesktop.qml +++ b/src-qt5/src-qml/RootDesktop.qml @@ -22,12 +22,12 @@ import Lumina.Backend.RootDesktopObject 2.0 import Lumina.Backend.ScreenObject 2.0 Rectangle { - id: RootCanvas + id: rootCanvas color: "black" //Setup the right-click context menu MouseArea { - anchors.fill: RootCanvas + anchors.fill: rootCanvas acceptedButton: Qt.RightButton onClicked: { contextMenu.open() } } @@ -51,7 +51,7 @@ Rectangle { Repeater{ model: RootObject.screens AnimatedImage { - id: modelData.name + id: ("screen_"+modelData.name) asynchronous: true clip: true source: modelData.background diff --git a/src-qt5/src-qml/src-qml.pri b/src-qt5/src-qml/src-qml.pri index bcdd439d..43af4b5a 100644 --- a/src-qt5/src-qml/src-qml.pri +++ b/src-qt5/src-qml/src-qml.pri @@ -3,7 +3,7 @@ QT *= quick qml lupdate_only{ - SOURCES *= RootDesktop.qml + SOURCES *= $${PWD}/RootDesktop.qml } -RESOURCES *= src-qml.qrc +RESOURCES *= $${PWD}/src-qml.qrc diff --git a/src-qt5/src-qml/src-qml.qrc b/src-qt5/src-qml/src-qml.qrc index 41f9d54b..5bedb4a5 100644 --- a/src-qt5/src-qml/src-qml.qrc +++ b/src-qt5/src-qml/src-qml.qrc @@ -1,5 +1,5 @@ <RCC> - <qresource prefix="QML"> + <qresource prefix="qml"> <file alias="RootDesktop">RootDesktop.qml</file> </qresource> </RCC> |