From 8b1cdec37e58d606a16ecb7539f72b092a3e2e16 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 30 Jan 2018 13:21:58 -0500 Subject: Start putting the new statusTray plugin together. The networking status button is working now, need to finish the others. --- src-qt5/core/lumina-desktop-unified/LSession.cpp | 10 +---- src-qt5/core/lumina-desktop-unified/LSession.h | 2 +- .../src-desktop/src-qml/Panel.qml | 17 +++++++- .../src-desktop/src-qml/plugins/StatusTray.qml | 49 ++++++++++++++++++++++ .../src-desktop/src-qml/plugins/plugins.pri | 9 ++++ .../src-qml/plugins/status_tray/BatteryButton.qml | 12 ++++++ .../src-qml/plugins/status_tray/NetworkButton.qml | 23 ++++++++++ .../src-qml/plugins/status_tray/TrayIcon.qml | 13 ++++++ .../src-qml/plugins/status_tray/VolumeButton.qml | 13 ++++++ .../src-desktop/src-qml/src-qml.pri | 1 + .../src-desktop/src-qml/src-qml.qrc | 5 +++ 11 files changed, 143 insertions(+), 11 deletions(-) create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/NetworkButton.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml (limited to 'src-qt5/core/lumina-desktop-unified') diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index dcd1688f..1c103fab 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -31,7 +31,6 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu qRegisterMetaType< NativeWindowSystem::MouseButton >("NativeWindowSystem::MouseButton"); mediaObj = 0; //private object used for playing login/logout chimes - OSThread = 0; if(this->isPrimaryProcess()){ //Setup the global registrations qsrand(QDateTime::currentMSecsSinceEpoch()); @@ -58,9 +57,6 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu Lumina::APPLIST = XDGDesktopList::instance(); Lumina::ROOTWIN = new RootWindow(); Lumina::SHORTCUTS = new LShortcutEvents(); //this can be moved to it's own thread eventually as well - OSThread = new QThread(); - OSInterface::instance()->moveToThread(OSThread); - OSThread->start(); setupGlobalConnections(); } //end check for primary process } @@ -80,10 +76,6 @@ LSession::~LSession(){ if(Lumina::DESKMAN!=0){ Lumina::DESKMAN->deleteLater(); } if(OSInterface::instance()->isRunning()){ OSInterface::instance()->stop(); } OSInterface::instance()->deleteLater(); - if(OSThread!=0){ - if(OSThread->isRunning()){ OSThread->quit(); } - OSThread->deleteLater(); - } } void LSession::setupSession(){ @@ -117,7 +109,7 @@ void LSession::setupSession(){ //checkUserFiles(); //adds these files to the watcher as well Lumina::NWS->setRoot_numberOfWorkspaces(QStringList() << "one" << "two"); Lumina::NWS->setRoot_currentWorkspace(0); - if(!OSInterface::instance()->isRunning()){ OSInterface::instance()->start(); } + OSInterface::instance()->start(); Lumina::DESKMAN->start(); Lumina::ROOTWIN->start(); diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h index 2735502d..fb4bf29f 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.h +++ b/src-qt5/core/lumina-desktop-unified/LSession.h @@ -29,7 +29,7 @@ private: QTranslator *currTranslator; //Extra background threads for individual objects - QThread *OSThread; //OSInterface thread + public slots: void setupSession(); //called during startup only diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml index 556da5ec..44abb425 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml @@ -7,8 +7,10 @@ import QtQuick 2.2 import QtQuick.Window 2.2 import QtQuick.Controls 1 +import QtQuick.Layouts 1.3 import Lumina.Backend.PanelObject 2.0 +import "./plugins" as PLUGINS Rectangle { //C++ backend object @@ -21,4 +23,17 @@ Rectangle { y: object.y width: object.width height: object.height - } + + GridLayout{ + id: layout + anchors.fill: parent; + columns: (object.width>object.height) ? -1 : 1 + rows: (object.width>object.height) ? 1 : -1 + + //hardcode the "status_tray" plugin at the moment + PLUGINS.StatusTray{ + id: "statustray" + } + } + +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml new file mode 100644 index 00000000..4552ea39 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml @@ -0,0 +1,49 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the QML plugin that displays the OS status/system tray +//=========================================== +import QtQuick 2.2 +import QtQuick.Layouts 1.3 + +import "./status_tray" as QML + + +Rectangle { + property int prefsize: (parent.width < parent.height) ? parent.width : parent.height + id: "status_tray" + //color: "transparent" + Layout.fillHeight: true + Layout.fillWidth: true + + GridLayout{ + anchors.fill: parent + flow: GridLayout.LeftToRight + columnSpacing: 2 + rowSpacing: 2 + + //Volume Status + QML.VolumeButton{ + id: "volButton" + Layout.preferredHeight: status_tray.prefsize + Layout.preferredWidth: status_tray.prefsize + } + //Network Status + QML.NetworkButton{ + Layout.preferredHeight: status_tray.prefsize + Layout.preferredWidth: status_tray.prefsize + } + //Battery Status + QML.BatteryButton{ + id: "batButton" + Layout.preferredHeight: status_tray.prefsize + Layout.preferredWidth: status_tray.prefsize + } + //System Tray Menu Popup + + } //end of layout + +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri new file mode 100644 index 00000000..36cc581b --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri @@ -0,0 +1,9 @@ +#Show the QML files to lupdate for translation purposes - not for the actual build +lupdate_only{ + SOURCES *= $${PWD}/StatusTray.qml \ + $${PWD}/status_tray/TrayIcon.qml \ + $${PWD}/status_tray/VolumeButton.qml \ + $${PWD}/status_tray/NetworkButton.qml \ + $${PWD}/status_tray/BatteryButton.qml + +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml new file mode 100644 index 00000000..0963165d --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml @@ -0,0 +1,12 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Controls 2 + +Rectangle{ + color: "red" +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/NetworkButton.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/NetworkButton.qml new file mode 100644 index 00000000..387c130b --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/NetworkButton.qml @@ -0,0 +1,23 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Controls 1 + +import Lumina.Backend.RootDesktopObject 2.0 +import Lumina.Backend.OSInterface 2.0 + +ToolButton{ + id: "netButton" + property OSInterface os: RootObject.os_interface() + iconName: os.networkIcon + tooltip: os.networkStatus + visible: os.networkAvailable + enabled: os.hasNetworkManager() + onClicked: { + RootObject.launchApplication(os.networkManagerUtility()) + } +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml new file mode 100644 index 00000000..4207b156 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml @@ -0,0 +1,13 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Controls 2 +import Lumina.Backend.NativeWindowObject 2.0 + +Rectangle{ + color: "white" +} diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml new file mode 100644 index 00000000..43992fc4 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml @@ -0,0 +1,13 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +import QtQuick 2.2 +import QtQuick.Controls 1 + +ToolButton{ + text: "volume" + tooltip: "volume" +} 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 79941b82..fa29aa96 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 @@ -6,5 +6,6 @@ lupdate_only{ $${PWD}/Panel.qml \ $${PWD}/NativeWindow.qml } +include(plugins/plugins.pri) 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 index a4dc414f..ba143027 100644 --- 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 @@ -5,5 +5,10 @@ Screen.qml Panel.qml NativeWindow.qml + plugins/StatusTray.qml + plugins/status_tray/TrayIcon.qml + plugins/status_tray/VolumeButton.qml + plugins/status_tray/NetworkButton.qml + plugins/status_tray/BatteryButton.qml -- cgit