From 70a95acc3d3cae25fd99a027d932960cce819299 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 20 Dec 2017 00:28:17 -0500 Subject: Setup the RootDesktopObject to start providing NativeWindow objects to the QML interface. --- .../src-desktop/src-cpp/RootDesktopObject.cpp | 21 +++++++++++++++++++++ .../src-desktop/src-cpp/RootDesktopObject.h | 10 +++++++++- .../src-desktop/src-qml/RootDesktop.qml | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp index c1652ba6..5750ac2d 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -65,11 +65,32 @@ PanelObject* RootDesktopObject::panel(QString id){ return 0; } +QStringList RootDesktopObject::windows(){ + //qDebug() << "Request Panels:" << panel_objects.length(); + QStringList names; + for(int i=0; iid()); } + return names; +} + +NativeWindow* RootDesktopObject::window(QString id){ + //qDebug() << "Got Panel Request:" << id; + WId chk = id.toInt(); //numerical ID's in this case + for(int i=0; iid()==chk){ return window_objects[i]; } + } + return 0; +} + void RootDesktopObject::setPanels(QList list){ panel_objects = list; emit panelsChanged(); } +void RootDesktopObject::setWindows(QList list){ + window_objects = list; + emit windowsChanged(); +} + void RootDesktopObject::logout(){ emit startLogout(); } 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 93beb6e4..838b5f7d 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 @@ -10,6 +10,7 @@ #define _LUMINA_DESKTOP_QML_BACKEND_ROOT_DESKTOP_OBJECT_H #include #include +#include #include "ScreenObject.h" @@ -18,6 +19,7 @@ class RootDesktopObject : public QObject{ //Define all the QML Properties here (interface between QML and the C++ methods below) Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged) Q_PROPERTY( QStringList panels READ panels NOTIFY panelsChanged) + Q_PROPERTY( QStringList windows READ windows NOTIFY windowsChanged); public: //main contructor/destructor @@ -30,12 +32,15 @@ public: static RootDesktopObject* instance(); //QML Read Functions - QStringList screens(); + Q_INVOKABLE QStringList screens(); Q_INVOKABLE ScreenObject* screen(QString id); Q_INVOKABLE QStringList panels(); Q_INVOKABLE PanelObject* panel(QString id); + Q_INVOKABLE QStringList windows(); + Q_INVOKABLE NativeWindow* window(QString id); void setPanels(QList list); + void setWindows(QList list); //QML Access Functions Q_INVOKABLE void logout(); @@ -45,6 +50,7 @@ public: private: QList s_objects; QList panel_objects; + QList window_objects; public slots: void updateScreens(); //rescan/update screen objects @@ -55,6 +61,8 @@ private slots: signals: void screensChanged(); void panelsChanged(); + void windowsChanged(); + void startLogout(); void mouseMoved(); void lockScreen(); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml index beecb848..c564ee42 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml @@ -46,7 +46,7 @@ Rectangle { //Create the context menu itself QML.ContextMenu { id: contextMenu } - //Setup the wallpapers + //Setup the screens/wallpapers Repeater{ model: RootObject.screens QML.Screen{ -- cgit