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-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 +++ 9 files changed, 141 insertions(+), 1 deletion(-) 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/src-desktop') 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