diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-desktop')
6 files changed, 30 insertions, 22 deletions
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 9842712e..60cf56c3 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 @@ -32,8 +32,19 @@ RootDesktopObject* RootDesktopObject::instance(){ } //QML Read Functions -QList<ScreenObject*> RootDesktopObject::screens(){ - return s_objects; +QStringList RootDesktopObject::screens(){ + qDebug() << "Request Screens:" << s_objects.length(); + QStringList names; + for(int i=0; i<s_objects.length(); i++){ names << s_objects[i]->name(); } + return names; +} + +ScreenObject* RootDesktopObject::screen(QString id){ + qDebug() << "Got Screen Request:" << id; + for(int i=0; i<s_objects.length(); i++){ + if(s_objects[i]->name()==id){ return s_objects[i]; } + } + return 0; } void RootDesktopObject::logout(){ 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..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<ScreenObject*> screens READ screens NOTIFY screensChanged) + Q_PROPERTY( QStringList screens READ screens NOTIFY screensChanged) public: //main contructor/destructor @@ -29,7 +29,8 @@ public: static RootDesktopObject* instance(); //QML Read Functions - QList<ScreenObject*> screens(); + QStringList screens(); + Q_INVOKABLE ScreenObject* screen(QString id); //QML Access Functions Q_INVOKABLE void logout(); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml index e5bac0b5..4ab8e156 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml @@ -6,15 +6,15 @@ //=========================================== import QtQuick 2.2 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 +import QtQuick.Controls 1 import Lumina.Backend.RootDesktopObject 2.0 Menu { id: contextMenu - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside MenuItem { text: "Lock Screen" + iconName: "system-lock-screen" onTriggered: { RootObject.lockscreen() } @@ -22,13 +22,7 @@ Menu { MenuItem { text: "Logout" - //iconName: "system-log-out" - indicator: Image{ - asynchronous: true - //autoTransform: true - //source: "image://theme/system-logout" - source: "file:///usr/local/share/icons/material-design-light/scalable/actions/system-log-out.svg" - } + iconName: "system-log-out" onTriggered: { RootObject.logout() } 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 a1a9164f..e0381e23 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 @@ -17,7 +17,7 @@ //=========================================== import QtQuick 2.2 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 +import QtQuick.Controls 1 import "." as QML @@ -33,9 +33,10 @@ Rectangle { anchors.fill: rootCanvas acceptedButtons: Qt.RightButton onClicked: { - contextMenu.x = mouseX + /*contextMenu.x = mouseX contextMenu.y = mouseY - contextMenu.open() + contextMenu.open() */ + contextMenu.popup() } onPositionChanged: { RootObject.mousePositionChanged() @@ -43,14 +44,13 @@ Rectangle { } //Create the context menu itself - QML.ContextMenu { id: contextMenu } + QML.ContextMenu { id: contextMenu } //Setup the wallpapers Repeater{ model: RootObject.screens QML.WallpaperImage{ - //console.log( modelData.name() ) - object: modelData + screen_id: modelData z: 0+index } } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml index 4d39b0b8..1b44963f 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml @@ -6,13 +6,14 @@ //=========================================== import QtQuick 2.2 import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 +import QtQuick.Controls 1 import Lumina.Backend.ScreenObject 2.0 AnimatedImage { //C++ backend object - property ScreenObject object + property string screen_id + property ScreenObject object: RootObject.screen(screen_id) //Normal geometries/placements asynchronous: true diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri index 99905253..fed18e02 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri @@ -1,7 +1,8 @@ #Show the QML files to lupdate for translation purposes - not for the actual build lupdate_only{ SOURCES *= $${PWD}/RootDesktop.qml \ - $${PWD}/ContextMenu.qml + $${PWD}/ContextMenu.qml \ + $${PWD}/WallpaperImage.qml } RESOURCES *= $${PWD}/src-qml.qrc |