diff options
14 files changed, 102 insertions, 52 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 426b91b4..e1251c01 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -230,6 +230,7 @@ void LSession::setupGlobalConnections(){ connect(Lumina::ROOTWIN, SIGNAL(RootResized(QRect)), Lumina::NWS, SLOT(setRoot_desktopGeometry(QRect)) ); connect(RootDesktopObject::instance(), SIGNAL(mouseMoved()), Lumina::SS, SLOT(newInputEvent()) ); connect(RootDesktopObject::instance(), SIGNAL(startLogout()), this, SLOT(StartLogout()) ); + connect(RootDesktopObject::instance(), SIGNAL(lockScreen()), Lumina::SS, SLOT(LockScreenNow()) ); //Native Window Class connections connect(Lumina::NEF, SIGNAL(WindowCreated(WId)), Lumina::NWS, SLOT(NewWindowDetected(WId))); diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp index 2aac6f3e..0cfa4e6b 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp @@ -25,7 +25,7 @@ RootWindow::~RootWindow(){ } void RootWindow::start(){ - root_view->setSource(QUrl("qrc:///qml/RootDesktop")); + root_view->setSource(QUrl("qrc:///qml/RootDesktop.qml")); root_win->show(); root_view->show(); } 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 25aa02b7..e4c4faeb 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/desktop.pri @@ -1,3 +1,5 @@ +QT *= gui widgets qml quick + SOURCES *= $${PWD}/RootWindow.cpp HEADERS *= $${PWD}/RootWindow.h @@ -5,4 +7,5 @@ HEADERS *= $${PWD}/RootWindow.h #update the includepath so we can just #include as needed without paths INCLUDEPATH *= $${PWD} -include(../../../src-cpp/Desktop.pri) +include($${PWD}/src-cpp/src-cpp.pri) +include($${PWD}/src-qml/src-qml.pri) diff --git a/src-qt5/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp index d151653b..9842712e 100644 --- a/src-qt5/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -40,6 +40,10 @@ void RootDesktopObject::logout(){ emit startLogout(); } +void RootDesktopObject::lockscreen(){ + emit lockScreen(); +} + void RootDesktopObject::mousePositionChanged(){ emit mouseMoved(); } @@ -59,6 +63,9 @@ void RootDesktopObject::updateScreens(){ for(int i=0; i<s_objects.length(); i++){ s_objects[i]->deleteLater(); } s_objects = tmp; emit screensChanged(); + for(int i=0; i<s_objects.length(); i++){ + s_objects[i]->emit geomChanged(); + } } void RootDesktopObject::ChangeWallpaper(QString screen, QString value){ diff --git a/src-qt5/src-cpp/RootDesktopObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h index 4bc568d3..dd7c7ab3 100644 --- a/src-qt5/src-cpp/RootDesktopObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h @@ -33,6 +33,7 @@ public: //QML Access Functions Q_INVOKABLE void logout(); + Q_INVOKABLE void lockscreen(); Q_INVOKABLE void mousePositionChanged(); private: QList<ScreenObject*> s_objects; @@ -47,6 +48,7 @@ signals: void screensChanged(); void startLogout(); void mouseMoved(); + void lockScreen(); }; #endif diff --git a/src-qt5/src-cpp/ScreenObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp index 354b4cba..4c1d6189 100644 --- a/src-qt5/src-cpp/ScreenObject.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp @@ -6,6 +6,7 @@ //=========================================== #include "ScreenObject.h" #include <QQmlEngine> +#include <QDebug> ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ bg_screen = scrn; @@ -16,7 +17,7 @@ void ScreenObject::RegisterType(){ } QString ScreenObject::name(){ return bg_screen->name(); } -QString ScreenObject::background(){ return bg; } +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(); } int ScreenObject::width(){ return bg_screen->geometry().width(); } diff --git a/src-qt5/src-cpp/ScreenObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h index 5cb16bfc..8076f1ae 100644 --- a/src-qt5/src-cpp/ScreenObject.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h @@ -30,12 +30,12 @@ public: static void RegisterType(); - QString name(); - QString background(); - int x(); - int y(); - int width(); - int height(); + Q_INVOKABLE QString name(); + Q_INVOKABLE QString background(); + Q_INVOKABLE int x(); + Q_INVOKABLE int y(); + Q_INVOKABLE int width(); + Q_INVOKABLE int height(); public slots: void setBackground(QString fileOrColor); diff --git a/src-qt5/src-cpp/Desktop.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri index dff6646c..33b699da 100644 --- a/src-qt5/src-cpp/Desktop.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri @@ -1,6 +1,3 @@ - -QT *= gui qml quick - SOURCES *= $${PWD}/RootDesktopObject.cpp \ $${PWD}/ScreenObject.cpp @@ -9,4 +6,3 @@ HEADERS *= $${PWD}/RootDesktopObject.h \ INCLUDEPATH *= $${PWD} -include($${PWD}/../src-qml/src-qml.pri) 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 new file mode 100644 index 00000000..e5bac0b5 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml @@ -0,0 +1,36 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +import Lumina.Backend.RootDesktopObject 2.0 + +Menu { + id: contextMenu + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside + MenuItem { + text: "Lock Screen" + onTriggered: { + RootObject.lockscreen() + } + } + + 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" + } + onTriggered: { + RootObject.logout() + } + } + } diff --git a/src-qt5/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml index a2576f2e..a1a9164f 100644 --- a/src-qt5/src-qml/RootDesktop.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml @@ -17,9 +17,9 @@ //=========================================== import QtQuick 2.2 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.0 -import "." +import "." as QML import Lumina.Backend.RootDesktopObject 2.0 import Lumina.Backend.ScreenObject 2.0 @@ -33,9 +33,9 @@ Rectangle { anchors.fill: rootCanvas acceptedButtons: Qt.RightButton onClicked: { - //contextMenu.x = mouseX - //contextMenu.y = mouseY - contextMenu.popup() + contextMenu.x = mouseX + contextMenu.y = mouseY + contextMenu.open() } onPositionChanged: { RootObject.mousePositionChanged() @@ -43,36 +43,15 @@ Rectangle { } //Create the context menu itself - Menu { - id: contextMenu - //closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - MenuItem { - text: "Logout" - iconName: "system-logout" - /*indicator: Image{ - asynchronous: true - //autoTransform: true - source: "image://theme/system-logout" - }*/ - onTriggered: { - RootObject.logout() - //contextMenu.close() - } - } - } + QML.ContextMenu { id: contextMenu } //Setup the wallpapers Repeater{ model: RootObject.screens - AnimatedImage { - asynchronous: true - clip: true - source: modelData.background - x: modelData.x - y: modelData.y + QML.WallpaperImage{ + //console.log( modelData.name() ) + object: modelData z: 0+index - width: modelData.width - height: modelData.height } } } 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 new file mode 100644 index 00000000..4d39b0b8 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml @@ -0,0 +1,25 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +import Lumina.Backend.ScreenObject 2.0 + +AnimatedImage { + //C++ backend object + property ScreenObject object + + //Normal geometries/placements + asynchronous: true + clip: true + source: object.background + x: object.x + y: object.y + width: object.width + height: object.height + } diff --git a/src-qt5/src-qml/src-qml.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri index 43af4b5a..99905253 100644 --- a/src-qt5/src-qml/src-qml.pri +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri @@ -1,9 +1,7 @@ #Show the QML files to lupdate for translation purposes - not for the actual build - -QT *= quick qml - lupdate_only{ - SOURCES *= $${PWD}/RootDesktop.qml + SOURCES *= $${PWD}/RootDesktop.qml \ + $${PWD}/ContextMenu.qml } RESOURCES *= $${PWD}/src-qml.qrc diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc new file mode 100644 index 00000000..ebdcc606 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="qml"> + <file>RootDesktop.qml</file> + <file>ContextMenu.qml</file> + <file>WallpaperImage.qml</file> + </qresource> +</RCC> diff --git a/src-qt5/src-qml/src-qml.qrc b/src-qt5/src-qml/src-qml.qrc deleted file mode 100644 index 5bedb4a5..00000000 --- a/src-qt5/src-qml/src-qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="qml"> - <file alias="RootDesktop">RootDesktop.qml</file> - </qresource> -</RCC> |