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. --- .../src-desktop/src-cpp/RootDesktopObject.cpp | 7 +++++++ .../lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h | 1 + .../lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp | 2 +- .../lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml | 2 +- .../lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml | 3 ++- 5 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src-qt5/core') 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..ee15c9c2 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 @@ -36,6 +36,13 @@ QList RootDesktopObject::screens(){ return s_objects; } +ScreenObject* RootDesktopObject::screen(QString id){ + for(int i=0; iname()==id){ return s_objects[i]; } + } + return 0; +} + 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 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(); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp index 4c1d6189..7b84882e 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp @@ -16,7 +16,7 @@ void ScreenObject::RegisterType(){ qmlRegisterType("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); } -QString ScreenObject::name(){ return bg_screen->name(); } +QString ScreenObject::name(){ return bg_screen->name().replace("-","_"); } QString ScreenObject::background(){ qDebug() << "Got Background:" << bg_screen->name() << bg << bg_screen->geometry(); return bg; } int ScreenObject::x(){ return bg_screen->geometry().x(); } int ScreenObject::y(){ return bg_screen->geometry().y(); } 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..6b341fee 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 @@ -50,7 +50,7 @@ Rectangle { model: RootObject.screens QML.WallpaperImage{ //console.log( modelData.name() ) - object: modelData + screen_id: modelData.name() 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..97357617 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 @@ -12,7 +12,8 @@ import Lumina.Backend.ScreenObject 2.0 AnimatedImage { //C++ backend object - property ScreenObject object + property text screen_id + property ScreenObject object: RootObject.screen(screen_id) //Normal geometries/placements asynchronous: true -- cgit