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-qt5/core/lumina-desktop-unified/LSession.cpp | 1 + .../src-desktop/RootWindow.cpp | 2 +- .../lumina-desktop-unified/src-desktop/desktop.pri | 5 +- .../src-desktop/src-cpp/RootDesktopObject.cpp | 77 +++++++++++++++++++++ .../src-desktop/src-cpp/RootDesktopObject.h | 54 +++++++++++++++ .../src-desktop/src-cpp/ScreenObject.cpp | 31 +++++++++ .../src-desktop/src-cpp/ScreenObject.h | 48 +++++++++++++ .../src-desktop/src-cpp/src-cpp.pri | 8 +++ .../src-desktop/src-qml/ContextMenu.qml | 36 ++++++++++ .../src-desktop/src-qml/RootDesktop.qml | 57 ++++++++++++++++ .../src-desktop/src-qml/WallpaperImage.qml | 25 +++++++ .../src-desktop/src-qml/src-qml.pri | 7 ++ .../src-desktop/src-qml/src-qml.qrc | 7 ++ src-qt5/src-cpp/Desktop.pri | 12 ---- src-qt5/src-cpp/RootDesktopObject.cpp | 70 ------------------- src-qt5/src-cpp/RootDesktopObject.h | 52 --------------- src-qt5/src-cpp/ScreenObject.cpp | 30 --------- src-qt5/src-cpp/ScreenObject.h | 48 ------------- src-qt5/src-qml/RootDesktop.qml | 78 ---------------------- src-qt5/src-qml/src-qml.pri | 9 --- src-qt5/src-qml/src-qml.qrc | 5 -- 21 files changed, 356 insertions(+), 306 deletions(-) create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.h create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/ContextMenu.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/WallpaperImage.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc delete mode 100644 src-qt5/src-cpp/Desktop.pri delete mode 100644 src-qt5/src-cpp/RootDesktopObject.cpp delete mode 100644 src-qt5/src-cpp/RootDesktopObject.h delete mode 100644 src-qt5/src-cpp/ScreenObject.cpp delete mode 100644 src-qt5/src-cpp/ScreenObject.h delete mode 100644 src-qt5/src-qml/RootDesktop.qml delete mode 100644 src-qt5/src-qml/src-qml.pri delete mode 100644 src-qt5/src-qml/src-qml.qrc (limited to 'src-qt5') 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/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp new file mode 100644 index 00000000..9842712e --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/RootDesktopObject.cpp @@ -0,0 +1,77 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "RootDesktopObject.h" +#include +#include +#include + +#include + +// === PUBLIC === +RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){ + updateScreens(); //make sure the internal list is updated right away +} + +RootDesktopObject::~RootDesktopObject(){ + +} + +void RootDesktopObject::RegisterType(){ + qmlRegisterType("Lumina.Backend.RootDesktopObject", 2, 0, "RootDesktopObject"); + //Also register any types that are needed by this class + ScreenObject::RegisterType(); +} + +RootDesktopObject* RootDesktopObject::instance(){ + static RootDesktopObject* r_obj = new RootDesktopObject(); + return r_obj; +} + +//QML Read Functions +QList RootDesktopObject::screens(){ + return s_objects; +} + +void RootDesktopObject::logout(){ + emit startLogout(); +} + +void RootDesktopObject::lockscreen(){ + emit lockScreen(); +} + +void RootDesktopObject::mousePositionChanged(){ + emit mouseMoved(); +} + +// === PUBLIC SLOTS === +void RootDesktopObject::updateScreens(){ + QList scrns = QApplication::screens(); + QList tmp; //copy of the internal array initially + for(int i=0; iname()==scrns[i]->name()){ found = true; tmp << s_objects.takeAt(j); } + } + if(!found){ tmp << new ScreenObject(scrns[i], this); } + } + //Delete any leftover objects + for(int i=0; ideleteLater(); } + s_objects = tmp; + emit screensChanged(); + for(int i=0; iemit geomChanged(); + } +} + +void RootDesktopObject::ChangeWallpaper(QString screen, QString value){ + for(int i=0; iname()==screen){ s_objects[i]->setBackground(value); break; } + } +} + +// === PRIVATE === 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 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 new file mode 100644 index 00000000..4c1d6189 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.cpp @@ -0,0 +1,31 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "ScreenObject.h" +#include +#include + +ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ + bg_screen = scrn; +} + +void ScreenObject::RegisterType(){ + qmlRegisterType("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); +} + +QString ScreenObject::name(){ return bg_screen->name(); } +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(); } +int ScreenObject::height(){ return bg_screen->geometry().height(); } + +void ScreenObject::setBackground(QString fileOrColor){ + if(bg!=fileOrColor){ + bg = fileOrColor; + emit backgroundChanged(); + } +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h new file mode 100644 index 00000000..8076f1ae --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/ScreenObject.h @@ -0,0 +1,48 @@ +//=========================================== +// 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 Screen/Wallpaper info to the QML classes +//=========================================== +#ifndef _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H +#define _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H +#include +#include +#include + +class ScreenObject : public QObject { + Q_OBJECT + Q_PROPERTY( QString name READ name ) + Q_PROPERTY( QString background READ background NOTIFY backgroundChanged) + Q_PROPERTY( int x READ x NOTIFY geomChanged) + Q_PROPERTY( int y READ y NOTIFY geomChanged) + Q_PROPERTY( int width READ width NOTIFY geomChanged) + Q_PROPERTY( int height READ height NOTIFY geomChanged) + +private: + QScreen *bg_screen; + QString bg; + +public: + ScreenObject(QScreen *scrn = 0, QObject *parent = 0); + + static void RegisterType(); + + 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); + +signals: + void backgroundChanged(); + void geomChanged(); +}; + +#endif diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri new file mode 100644 index 00000000..33b699da --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-cpp/src-cpp.pri @@ -0,0 +1,8 @@ +SOURCES *= $${PWD}/RootDesktopObject.cpp \ + $${PWD}/ScreenObject.cpp + +HEADERS *= $${PWD}/RootDesktopObject.h \ + $${PWD}/ScreenObject.h + +INCLUDEPATH *= $${PWD} + 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/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml new file mode 100644 index 00000000..a1a9164f --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/RootDesktop.qml @@ -0,0 +1,57 @@ +//=========================================== +// 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 QML script the launches/controls the desktop interface itself +//=========================================== +// NOTE: This needs to be paired/used with the corresponding C++ class: RootDesktopObject +// Which should be added as the "RootObject" context property to the QML engine +//------------------ +// Example Code: +// RootDesktopObject *rootobj = new RootDesktopObject(); +// QQuickView *root = new QQuickView(); +// root->setResizeMode(QQuickView::SizeRootObjectToView); +// root->engine()->rootContext()->setContextProperty("RootObject", rootobj); +//=========================================== +import QtQuick 2.2 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +import "." as QML + +import Lumina.Backend.RootDesktopObject 2.0 +import Lumina.Backend.ScreenObject 2.0 + +Rectangle { + id: rootCanvas + color: "black" + + //Setup the right-click context menu + MouseArea { + anchors.fill: rootCanvas + acceptedButtons: Qt.RightButton + onClicked: { + contextMenu.x = mouseX + contextMenu.y = mouseY + contextMenu.open() + } + onPositionChanged: { + RootObject.mousePositionChanged() + } + } + + //Create the context menu itself + QML.ContextMenu { id: contextMenu } + + //Setup the wallpapers + Repeater{ + model: RootObject.screens + QML.WallpaperImage{ + //console.log( modelData.name() ) + object: 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 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/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 new file mode 100644 index 00000000..99905253 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri @@ -0,0 +1,7 @@ +#Show the QML files to lupdate for translation purposes - not for the actual build +lupdate_only{ + 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 @@ + + + RootDesktop.qml + ContextMenu.qml + WallpaperImage.qml + + diff --git a/src-qt5/src-cpp/Desktop.pri b/src-qt5/src-cpp/Desktop.pri deleted file mode 100644 index dff6646c..00000000 --- a/src-qt5/src-cpp/Desktop.pri +++ /dev/null @@ -1,12 +0,0 @@ - -QT *= gui qml quick - -SOURCES *= $${PWD}/RootDesktopObject.cpp \ - $${PWD}/ScreenObject.cpp - -HEADERS *= $${PWD}/RootDesktopObject.h \ - $${PWD}/ScreenObject.h - -INCLUDEPATH *= $${PWD} - -include($${PWD}/../src-qml/src-qml.pri) diff --git a/src-qt5/src-cpp/RootDesktopObject.cpp b/src-qt5/src-cpp/RootDesktopObject.cpp deleted file mode 100644 index d151653b..00000000 --- a/src-qt5/src-cpp/RootDesktopObject.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//=========================================== -// Lumina-desktop source code -// Copyright (c) 2017, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "RootDesktopObject.h" -#include -#include -#include - -#include - -// === PUBLIC === -RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){ - updateScreens(); //make sure the internal list is updated right away -} - -RootDesktopObject::~RootDesktopObject(){ - -} - -void RootDesktopObject::RegisterType(){ - qmlRegisterType("Lumina.Backend.RootDesktopObject", 2, 0, "RootDesktopObject"); - //Also register any types that are needed by this class - ScreenObject::RegisterType(); -} - -RootDesktopObject* RootDesktopObject::instance(){ - static RootDesktopObject* r_obj = new RootDesktopObject(); - return r_obj; -} - -//QML Read Functions -QList RootDesktopObject::screens(){ - return s_objects; -} - -void RootDesktopObject::logout(){ - emit startLogout(); -} - -void RootDesktopObject::mousePositionChanged(){ - emit mouseMoved(); -} - -// === PUBLIC SLOTS === -void RootDesktopObject::updateScreens(){ - QList scrns = QApplication::screens(); - QList tmp; //copy of the internal array initially - for(int i=0; iname()==scrns[i]->name()){ found = true; tmp << s_objects.takeAt(j); } - } - if(!found){ tmp << new ScreenObject(scrns[i], this); } - } - //Delete any leftover objects - for(int i=0; ideleteLater(); } - s_objects = tmp; - emit screensChanged(); -} - -void RootDesktopObject::ChangeWallpaper(QString screen, QString value){ - for(int i=0; iname()==screen){ s_objects[i]->setBackground(value); break; } - } -} - -// === PRIVATE === diff --git a/src-qt5/src-cpp/RootDesktopObject.h b/src-qt5/src-cpp/RootDesktopObject.h deleted file mode 100644 index 4bc568d3..00000000 --- a/src-qt5/src-cpp/RootDesktopObject.h +++ /dev/null @@ -1,52 +0,0 @@ -//=========================================== -// 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 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(); - -}; -#endif diff --git a/src-qt5/src-cpp/ScreenObject.cpp b/src-qt5/src-cpp/ScreenObject.cpp deleted file mode 100644 index 354b4cba..00000000 --- a/src-qt5/src-cpp/ScreenObject.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//=========================================== -// Lumina-desktop source code -// Copyright (c) 2017, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "ScreenObject.h" -#include - -ScreenObject::ScreenObject(QScreen *scrn, QObject *parent) : QObject(parent){ - bg_screen = scrn; -} - -void ScreenObject::RegisterType(){ - qmlRegisterType("Lumina.Backend.ScreenObject",2,0, "ScreenObject"); -} - -QString ScreenObject::name(){ return bg_screen->name(); } -QString ScreenObject::background(){ 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(); } -int ScreenObject::height(){ return bg_screen->geometry().height(); } - -void ScreenObject::setBackground(QString fileOrColor){ - if(bg!=fileOrColor){ - bg = fileOrColor; - emit backgroundChanged(); - } -} diff --git a/src-qt5/src-cpp/ScreenObject.h b/src-qt5/src-cpp/ScreenObject.h deleted file mode 100644 index 5cb16bfc..00000000 --- a/src-qt5/src-cpp/ScreenObject.h +++ /dev/null @@ -1,48 +0,0 @@ -//=========================================== -// 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 Screen/Wallpaper info to the QML classes -//=========================================== -#ifndef _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H -#define _LUMINA_DESKTOP_SCREEN_DESKTOP_OBJECT_H -#include -#include -#include - -class ScreenObject : public QObject { - Q_OBJECT - Q_PROPERTY( QString name READ name ) - Q_PROPERTY( QString background READ background NOTIFY backgroundChanged) - Q_PROPERTY( int x READ x NOTIFY geomChanged) - Q_PROPERTY( int y READ y NOTIFY geomChanged) - Q_PROPERTY( int width READ width NOTIFY geomChanged) - Q_PROPERTY( int height READ height NOTIFY geomChanged) - -private: - QScreen *bg_screen; - QString bg; - -public: - ScreenObject(QScreen *scrn = 0, QObject *parent = 0); - - static void RegisterType(); - - QString name(); - QString background(); - int x(); - int y(); - int width(); - int height(); - -public slots: - void setBackground(QString fileOrColor); - -signals: - void backgroundChanged(); - void geomChanged(); -}; - -#endif diff --git a/src-qt5/src-qml/RootDesktop.qml b/src-qt5/src-qml/RootDesktop.qml deleted file mode 100644 index a2576f2e..00000000 --- a/src-qt5/src-qml/RootDesktop.qml +++ /dev/null @@ -1,78 +0,0 @@ -//=========================================== -// 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 QML script the launches/controls the desktop interface itself -//=========================================== -// NOTE: This needs to be paired/used with the corresponding C++ class: RootDesktopObject -// Which should be added as the "RootObject" context property to the QML engine -//------------------ -// Example Code: -// RootDesktopObject *rootobj = new RootDesktopObject(); -// QQuickView *root = new QQuickView(); -// root->setResizeMode(QQuickView::SizeRootObjectToView); -// root->engine()->rootContext()->setContextProperty("RootObject", rootobj); -//=========================================== -import QtQuick 2.2 -import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 - -import "." - -import Lumina.Backend.RootDesktopObject 2.0 -import Lumina.Backend.ScreenObject 2.0 - -Rectangle { - id: rootCanvas - color: "black" - - //Setup the right-click context menu - MouseArea { - anchors.fill: rootCanvas - acceptedButtons: Qt.RightButton - onClicked: { - //contextMenu.x = mouseX - //contextMenu.y = mouseY - contextMenu.popup() - } - onPositionChanged: { - RootObject.mousePositionChanged() - } - } - - //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() - } - } - } - - //Setup the wallpapers - Repeater{ - model: RootObject.screens - AnimatedImage { - asynchronous: true - clip: true - source: modelData.background - x: modelData.x - y: modelData.y - z: 0+index - width: modelData.width - height: modelData.height - } - } -} diff --git a/src-qt5/src-qml/src-qml.pri b/src-qt5/src-qml/src-qml.pri deleted file mode 100644 index 43af4b5a..00000000 --- a/src-qt5/src-qml/src-qml.pri +++ /dev/null @@ -1,9 +0,0 @@ -#Show the QML files to lupdate for translation purposes - not for the actual build - -QT *= quick qml - -lupdate_only{ - SOURCES *= $${PWD}/RootDesktop.qml -} - -RESOURCES *= $${PWD}/src-qml.qrc 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 @@ - - - RootDesktop.qml - - -- cgit