diff options
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 8 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/LSession.cpp | 12 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp | 21 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h | 2 | ||||
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.cpp | 6 | ||||
-rw-r--r-- | src-qt5/src-cpp/RootDesktopObject.h | 3 | ||||
-rw-r--r-- | src-qt5/src-qml/RootDesktop.qml | 40 |
7 files changed, 63 insertions, 29 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index ab1000ab..fdf51a11 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -664,11 +664,11 @@ LFileInfo::LFileInfo(){ LFileInfo::LFileInfo(QString filepath){ //overloaded contructor this->setFile(filepath); loadExtraInfo(); -} +} LFileInfo::LFileInfo(QFileInfo info){ //overloaded contructor this->swap(info); //use the given QFileInfo without re-loading it loadExtraInfo(); -} +} //Functions for accessing the extra information // -- Return the mimetype for the file @@ -683,7 +683,7 @@ QString LFileInfo::iconfile(){ return icon; }else{ if(!mime.isEmpty()){ - QString tmp = mime; + QString tmp = mime; tmp.replace("/","-"); return tmp; }else if(this->isExecutable()){ @@ -696,7 +696,7 @@ QString LFileInfo::iconfile(){ // -- Check if this is an XDG desktop file bool LFileInfo::isDesktopFile(){ if(desk==0){ return false; } - return (!desk->filePath.isEmpty()); + return (!desk->filePath.isEmpty()); } // -- Allow access to the XDG desktop data structure diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index cc754005..426b91b4 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -104,7 +104,7 @@ void LSession::setupSession(){ splash.showScreen("user"); if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();} //checkUserFiles(); //adds these files to the watcher as well - + Lumina::ROOTWIN->start(); //Initialize the internal variables //DESKTOPS.clear(); @@ -116,7 +116,6 @@ void LSession::setupSession(){ if(DEBUG){ qDebug() << " - Populate App List:" << timer->elapsed();} Lumina::APPLIST->updateList(); //appmenu = new AppMenu(); - splash.showScreen("menus"); //if(DEBUG){ qDebug() << " - Init SettingsMenu:" << timer->elapsed();} //settingsmenu = new SettingsMenu(); @@ -129,12 +128,13 @@ void LSession::setupSession(){ QList<QScreen*> scrns= QApplication::screens(); for(int i=0; i<scrns.length(); i++){ qDebug() << " --- Load Wallpaper for Screen:" << scrns[i]->name(); - RootDesktopObject::instance()->ChangeWallpaper(scrns[i]->name(), LOS::LuminaShare()+"desktop-background.jpg"); + RootDesktopObject::instance()->ChangeWallpaper(scrns[i]->name(),QUrl::fromLocalFile(LOS::LuminaShare()+"desktop-background.jpg").toString() ); } - //Lumina::ROOTWIN->start(); Lumina::NWS->setRoot_numberOfWorkspaces(QStringList() << "one" << "two"); Lumina::NWS->setRoot_currentWorkspace(0); + if(DEBUG){ qDebug() << " - Create Desktop Context Menu"; } + /*DesktopContextMenu *cmenu = new DesktopContextMenu(Lumina::ROOTWIN); connect(cmenu, SIGNAL(showLeaveDialog()), this, SLOT(StartLogout()) ); cmenu->start();*/ @@ -228,8 +228,8 @@ void LSession::setupGlobalConnections(){ //Root window connections connect(Lumina::ROOTWIN, SIGNAL(RegisterVirtualRoot(WId)), Lumina::NWS, SLOT(RegisterVirtualRoot(WId)) ); connect(Lumina::ROOTWIN, SIGNAL(RootResized(QRect)), Lumina::NWS, SLOT(setRoot_desktopGeometry(QRect)) ); - connect(Lumina::ROOTWIN, SIGNAL(MouseMoved()), Lumina::SS, SLOT(newInputEvent()) ); - connect(Lumina::ROOTWIN, SIGNAL(startLogout()), this, SLOT(StartLogout()) ); + connect(RootDesktopObject::instance(), SIGNAL(mouseMoved()), Lumina::SS, SLOT(newInputEvent()) ); + connect(RootDesktopObject::instance(), SIGNAL(startLogout()), this, SLOT(StartLogout()) ); //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 c0710bbc..2aac6f3e 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.cpp @@ -6,7 +6,7 @@ //=========================================== #include "RootWindow.h" -RootWindow::RootWindow(){ +RootWindow::RootWindow() : QObject(){ root_win = QWindow::fromWinId( QX11Info::appRootWindow() ); // root_view = new QQuickView(root_win); //make it a child of the root window root_obj = RootDesktopObject::instance(); @@ -16,8 +16,7 @@ RootWindow::RootWindow(){ //Now setup the QQuickView root_view->setResizeMode(QQuickView::SizeRootObjectToView); root_view->engine()->rootContext()->setContextProperty("RootObject", root_obj); - root_view->setSource(QUrl("qrc:///qml/RootDesktop")); - root_view->show(); + RootDesktopObject::RegisterType(); //make sure object classes are registered with the QML subsystems } RootWindow::~RootWindow(){ @@ -25,9 +24,21 @@ RootWindow::~RootWindow(){ root_obj->deleteLater(); } +void RootWindow::start(){ + root_view->setSource(QUrl("qrc:///qml/RootDesktop")); + root_win->show(); + root_view->show(); +} + void RootWindow::syncRootSize(){ - if(root_win->width() != root_view->width() || root_win->height() != root_view->height()){ - root_view->setGeometry(0, 0, root_win->width(), root_win->height() ); + //qDebug() << "Sync Root Size:" << root_win->width() << root_win->height() << root_view->geometry(); + QList<QScreen*> screens = QApplication::screens(); + QRect unif; + for(int i=0; i<screens.length(); i++){ unif = unif.united(screens[i]->geometry()); } + if(unif.width() != root_view->width() || unif.height() != root_view->height()){ + root_view->setGeometry(0, 0, unif.width(), unif.height() ); emit RootResized(root_view->geometry()); } + root_obj->updateScreens(); + //qDebug() << " - after:" << root_view->geometry(); } diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h index 1050ba21..ba489465 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/RootWindow.h @@ -19,6 +19,8 @@ public: RootWindow(); ~RootWindow(); + void start(); + public slots: void syncRootSize(); diff --git a/src-qt5/src-cpp/RootDesktopObject.cpp b/src-qt5/src-cpp/RootDesktopObject.cpp index e7873991..d151653b 100644 --- a/src-qt5/src-cpp/RootDesktopObject.cpp +++ b/src-qt5/src-cpp/RootDesktopObject.cpp @@ -9,6 +9,7 @@ #include <QApplication> #include <QScreen> +#include <QDebug> // === PUBLIC === RootDesktopObject::RootDesktopObject(QObject *parent) : QObject(parent){ @@ -39,6 +40,10 @@ void RootDesktopObject::logout(){ emit startLogout(); } +void RootDesktopObject::mousePositionChanged(){ + emit mouseMoved(); +} + // === PUBLIC SLOTS === void RootDesktopObject::updateScreens(){ QList<QScreen*> scrns = QApplication::screens(); @@ -53,6 +58,7 @@ void RootDesktopObject::updateScreens(){ //Delete any leftover objects for(int i=0; i<s_objects.length(); i++){ s_objects[i]->deleteLater(); } s_objects = tmp; + emit screensChanged(); } void RootDesktopObject::ChangeWallpaper(QString screen, QString value){ diff --git a/src-qt5/src-cpp/RootDesktopObject.h b/src-qt5/src-cpp/RootDesktopObject.h index 0c280c2a..4bc568d3 100644 --- a/src-qt5/src-cpp/RootDesktopObject.h +++ b/src-qt5/src-cpp/RootDesktopObject.h @@ -33,7 +33,7 @@ public: //QML Access Functions Q_INVOKABLE void logout(); - + Q_INVOKABLE void mousePositionChanged(); private: QList<ScreenObject*> s_objects; @@ -46,6 +46,7 @@ private slots: signals: void screensChanged(); void startLogout(); + void mouseMoved(); }; #endif diff --git a/src-qt5/src-qml/RootDesktop.qml b/src-qt5/src-qml/RootDesktop.qml index b9d62894..a2576f2e 100644 --- a/src-qt5/src-qml/RootDesktop.qml +++ b/src-qt5/src-qml/RootDesktop.qml @@ -15,8 +15,11 @@ // root->setResizeMode(QQuickView::SizeRootObjectToView); // root->engine()->rootContext()->setContextProperty("RootObject", rootobj); //=========================================== -import QtQuick 2.0 +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 @@ -28,22 +31,33 @@ Rectangle { //Setup the right-click context menu MouseArea { anchors.fill: rootCanvas - acceptedButton: Qt.RightButton - onClicked: { contextMenu.open() } + 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 { - test: qtTr("Logout") - indicator: Image{ + text: "Logout" + iconName: "system-logout" + /*indicator: Image{ asynchronous: true - autoTransform: true + //autoTransform: true source: "image://theme/system-logout" + }*/ + onTriggered: { + RootObject.logout() + //contextMenu.close() } - onTriggered: RootObject.logout() } } @@ -51,14 +65,14 @@ Rectangle { Repeater{ model: RootObject.screens AnimatedImage { - id: ("screen_"+modelData.name) asynchronous: true clip: true source: modelData.background - x: modelData.screen.virtualX - y: modelData.screen.virtualY - width: modelData.screen.width - height: modelData.screen.height + x: modelData.x + y: modelData.y + z: 0+index + width: modelData.width + height: modelData.height } } } |