From 50cda0d1b7c6061cccb89389f44f9173026a678b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 25 Oct 2017 12:11:53 -0400 Subject: Re-arrange the 2.0 desktop sources (QML + associated C++ files). Also another checkpoint commit with some of the QML desktop stuff (have a working context menu, wallpapers not working yet though) --- .../src-desktop/src-cpp/RootDesktopObject.h | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h new file mode 100644 index 00000000..dd7c7ab3 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h @@ -0,0 +1,54 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// 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 +//=========================================== +#ifndef _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H +#define _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H +#include +#include + +#include "ScreenObject.h" + +class RootDesktopObject : public QObject{ + Q_OBJECT + //Define all the QML Properties here (interface between QML and the C++ methods below) + Q_PROPERTY( QList screens READ screens NOTIFY screensChanged) + +public: + //main contructor/destructor + RootDesktopObject(QObject *parent = 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(); + + //QML Read Functions + QList screens(); + + //QML Access Functions + Q_INVOKABLE void logout(); + Q_INVOKABLE void lockscreen(); + Q_INVOKABLE void mousePositionChanged(); +private: + QList s_objects; + +public slots: + void updateScreens(); //rescan/update screen objects + void ChangeWallpaper(QString screen, QString); + +private slots: + +signals: + void screensChanged(); + void startLogout(); + void mouseMoved(); + void lockScreen(); + +}; +#endif -- cgit From 31e8c393ea88c99f43817bb91d35355015597e4b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 16 Nov 2017 13:19:48 -0500 Subject: Another attempt to fix the Repeater of objects issue in Lumina 2. --- .../core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h index dd7c7ab3..786d90e2 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h @@ -30,6 +30,7 @@ public: //QML Read Functions QList screens(); + Q_INVOKABLE ScreenObject* screen(QString id); //QML Access Functions Q_INVOKABLE void logout(); -- cgit From d626a9ab0dd8d9ca8c4d6c69a6693acebb8e1f1a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 16 Nov 2017 15:16:02 -0500 Subject: Get the Iteration over objects working for Lumina 2 (wallpapers). QML Note: The "Repeater" class cannot iterate over objects, just items. To work around this, provide a QStringList instead of a QList, and implement a callback function to return the Object* based on the String ID. --- .../lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h index 786d90e2..ba586701 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h @@ -16,7 +16,7 @@ class RootDesktopObject : public QObject{ Q_OBJECT //Define all the QML Properties here (interface between QML and the C++ methods below) - Q_PROPERTY( QList screens READ screens NOTIFY screensChanged) + Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged) public: //main contructor/destructor @@ -29,7 +29,7 @@ public: static RootDesktopObject* instance(); //QML Read Functions - QList screens(); + QStringList screens(); Q_INVOKABLE ScreenObject* screen(QString id); //QML Access Functions -- cgit