aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp10
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/Panel.qml17
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/StatusTray.qml49
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/plugins.pri9
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/BatteryButton.qml12
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/NetworkButton.qml23
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/TrayIcon.qml13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/plugins/status_tray/VolumeButton.qml13
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.pri1
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/src-qml/src-qml.qrc5
-rw-r--r--src-qt5/src-cpp/framework-OSInterface.h7
-rw-r--r--src-qt5/src-cpp/framework-OSInterface.pri4
-rw-r--r--src-qt5/src-cpp/framework-OSInterface_private.cpp11
-rw-r--r--src-qt5/src-cpp/tests/main.cpp3
15 files changed, 163 insertions, 16 deletions
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 @@
<file>Screen.qml</file>
<file>Panel.qml</file>
<file>NativeWindow.qml</file>
+ <file>plugins/StatusTray.qml</file>
+ <file>plugins/status_tray/TrayIcon.qml</file>
+ <file>plugins/status_tray/VolumeButton.qml</file>
+ <file>plugins/status_tray/NetworkButton.qml</file>
+ <file>plugins/status_tray/BatteryButton.qml</file>
</qresource>
</RCC>
diff --git a/src-qt5/src-cpp/framework-OSInterface.h b/src-qt5/src-cpp/framework-OSInterface.h
index 95b1b441..c12561de 100644
--- a/src-qt5/src-cpp/framework-OSInterface.h
+++ b/src-qt5/src-cpp/framework-OSInterface.h
@@ -50,7 +50,9 @@ class OSInterface : public QObject{
Q_PROPERTY( QString networkType READ networkType NOTIFY networkStatusChanged)
Q_PROPERTY( float networkStrength READ networkStrength NOTIFY networkStatusChanged)
Q_PROPERTY( QString networkHostname READ networkHostname NOTIFY networkStatusChanged)
- Q_PROPERTY( QHostAddress networkAddress READ networkAddress NOTIFY networkStatusChanged)
+ Q_PROPERTY( QStringList networkAddress READ networkAddress NOTIFY networkStatusChanged)
+ Q_PROPERTY( QString networkIcon READ networkIcon NOTIFY networkStatusChanged);
+ Q_PROPERTY( QString networkStatus READ networkStatus NOTIFY networkStatusChanged);
//Media
Q_PROPERTY( QStringList mediaShortcuts READ mediaShortcuts NOTIFY mediaShortcutsChanged)
//Updates
@@ -91,7 +93,8 @@ public:
Q_INVOKABLE float networkStrength(); //percentage. ("wired" type should always be 100%)
Q_INVOKABLE QString networkIcon();
Q_INVOKABLE QString networkHostname();
- Q_INVOKABLE QHostAddress networkAddress();
+ Q_INVOKABLE QStringList networkAddress();
+ Q_INVOKABLE QString networkStatus(); //combines a bunch of the above info into a single string
// = Network Modification =
Q_INVOKABLE bool hasNetworkManager();
diff --git a/src-qt5/src-cpp/framework-OSInterface.pri b/src-qt5/src-cpp/framework-OSInterface.pri
index be705e44..fa6e966c 100644
--- a/src-qt5/src-cpp/framework-OSInterface.pri
+++ b/src-qt5/src-cpp/framework-OSInterface.pri
@@ -1,5 +1,7 @@
-QT *= core network
+QT *= core network quick
+include(../core/libLumina/LUtils.pri)
+include(../core/libLumina/LuminaXDG.pri)
HEADERS *= $${PWD}/framework-OSInterface.h
SOURCES *= $${PWD}/framework-OSInterface_private.cpp
diff --git a/src-qt5/src-cpp/framework-OSInterface_private.cpp b/src-qt5/src-cpp/framework-OSInterface_private.cpp
index 3e623de5..27bf910a 100644
--- a/src-qt5/src-cpp/framework-OSInterface_private.cpp
+++ b/src-qt5/src-cpp/framework-OSInterface_private.cpp
@@ -195,18 +195,24 @@ QString OSInterface::networkHostname(){
return QHostInfo::localHostName();
}
-QHostAddress OSInterface::networkAddress(){
+QStringList OSInterface::networkAddress(){
QString addr;
if(INFO.contains("netaccess/address")){ addr = INFO.value("netaccess/address").toString(); }
- return QHostAddress(addr);
+ return addr.split(", ");
}
bool OSInterface::hasNetworkManager(){
return verifyAppOrBin(networkManagerUtility());
}
+QString OSInterface::networkStatus(){
+ QString stat = "<b>%1</b><br>%2<br>%3";
+ return stat.arg(networkHostname(), networkType(), networkAddress().join("<br>"));
+}
+
//NetworkAccessManager slots
void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility stat){
+ qDebug() << "[DEBUG] Got Net Access Changed";
INFO.insert("netaccess/available", stat== QNetworkAccessManager::Accessible);
//Update all the other network status info at the same time
QNetworkConfiguration active = netman->activeConfiguration();
@@ -265,6 +271,7 @@ void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility s
icon = "network-workgroup"; //failover to a generic "network" icon
}
INFO.insert("netaccess/icon",icon);
+ qDebug() << "[DEBUG] Emit NetworkStatusChanged";
emit networkStatusChanged();
}
diff --git a/src-qt5/src-cpp/tests/main.cpp b/src-qt5/src-cpp/tests/main.cpp
index 682c318a..215d1620 100644
--- a/src-qt5/src-cpp/tests/main.cpp
+++ b/src-qt5/src-cpp/tests/main.cpp
@@ -34,5 +34,8 @@ int main(int argc, char** argv){
timer->start();
int ret = A.exec();
qDebug() << " - Finished";
+ qDebug() << "Ending Status:";
+ qDebug() << "OS.networkAvailable:" << OS.networkAvailable();
+ qDebug() << " - " << OS.networkType() << OS.networkStrength() << OS.networkIcon() << OS.networkHostname() << OS.networkAddress();
return ret;
}
bgstack15