diff options
author | Ken Moore <ken@ixsystems.com> | 2018-01-30 13:21:58 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-01-30 13:21:58 -0500 |
commit | 8b1cdec37e58d606a16ecb7539f72b092a3e2e16 (patch) | |
tree | d896ee61d74eccf1dd311da778c7c2cd3201403f /src-qt5/src-cpp | |
parent | Get the OSInterface framework up and running (template OS only at the moment) (diff) | |
download | lumina-8b1cdec37e58d606a16ecb7539f72b092a3e2e16.tar.gz lumina-8b1cdec37e58d606a16ecb7539f72b092a3e2e16.tar.bz2 lumina-8b1cdec37e58d606a16ecb7539f72b092a3e2e16.zip |
Start putting the new statusTray plugin together.
The networking status button is working now, need to finish the others.
Diffstat (limited to 'src-qt5/src-cpp')
-rw-r--r-- | src-qt5/src-cpp/framework-OSInterface.h | 7 | ||||
-rw-r--r-- | src-qt5/src-cpp/framework-OSInterface.pri | 4 | ||||
-rw-r--r-- | src-qt5/src-cpp/framework-OSInterface_private.cpp | 11 | ||||
-rw-r--r-- | src-qt5/src-cpp/tests/main.cpp | 3 |
4 files changed, 20 insertions, 5 deletions
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; } |