diff options
-rw-r--r-- | src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp | 21 | ||||
-rw-r--r-- | src-qt5/src-cpp/framework-OSInterface-template.cpp | 17 | ||||
-rw-r--r-- | src-qt5/src-cpp/framework-OSInterface.h | 3 |
3 files changed, 24 insertions, 17 deletions
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp index 69ea5faa..1870eefb 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp @@ -78,19 +78,20 @@ void LBattery::updateBattery(bool force){ break; } } - if(icon<iconOld && icon==0){ - //Play some audio warning chime when - bool playaudio = sessionsettings->value("PlayBatteryLowAudio",true).toBool(); - if( playaudio ){ QString sfile = LSession::handle()->sessionSettings()->value("audiofiles/batterylow", LOS::LuminaShare()+"low-battery.ogg").toString(); + if(icon<iconOld && icon==0){ + //Play some audio warning chime when + bool playaudio = sessionsettings->value("PlayBatteryLowAudio",true).toBool(); + if( playaudio ){ + QString sfile = LSession::handle()->sessionSettings()->value("audiofiles/batterylow", LOS::LuminaShare()+"low-battery.ogg").toString(); LSession::handle()->playAudioFile(sfile); - } + } + } - if(icon==0){ label->setStyleSheet("QLabel{ background: red;}"); } - else if(icon==14 && charge>98){ label->setStyleSheet("QLabel{ background: green;}"); } - else{ label->setStyleSheet("QLabel{ background: transparent;}"); } - iconOld = icon; + if(icon==0){ label->setStyleSheet("QLabel{ background: red;}"); } + else if(icon==14 && charge>98){ label->setStyleSheet("QLabel{ background: green;}"); } + else{ label->setStyleSheet("QLabel{ background: transparent;}"); } + iconOld = icon; - } //Now update the display QString tt; //Make sure the tooltip can be properly translated as necessary (Ken Moore 5/9/14) diff --git a/src-qt5/src-cpp/framework-OSInterface-template.cpp b/src-qt5/src-cpp/framework-OSInterface-template.cpp index 972e02e0..a1553857 100644 --- a/src-qt5/src-cpp/framework-OSInterface-template.cpp +++ b/src-qt5/src-cpp/framework-OSInterface-template.cpp @@ -45,6 +45,11 @@ QString OSInterface::networkType(){ return ""; } +QString OSInterface::networkTypeFromDeviceName(QString name){ + //Return options: wifi, wired, cell, cell-2G, cell-3G, cell-4G + return ""; +} + float OSInterface::networkStrength(){ return -1; } //percentage. ("wired" type should always be 100%) QString OSInterface::networkHostname(){ @@ -126,21 +131,21 @@ void OSInterface::netAccessChanged(QNetworkAccessManager::NetworkAccessibility s case QNetworkConfiguration::Bearer2G: type="cell-2G"; break; case QNetworkConfiguration::Bearer3G: type="cell-3G"; break; case QNetworkConfiguration::Bearer4G: type="cell-4G"; break; - default: type=""; + default: type=networkTypeFromDeviceName(active.name()); //could not be auto-determined - run the OS-specific routine } INFO.insert("netaccess/type", type); - qDebug() << "Detected Device Status:" << active.identifier() << type << stat; + //qDebug() << "Detected Device Status:" << active.identifier() << type << stat; QNetworkInterface iface = QNetworkInterface::interfaceFromName(active.name()); - qDebug() << " - Configuration: Name:" << active.name() << active.bearerTypeName() << active.identifier(); - qDebug() << " - Interface: MAC Address:" << iface.hardwareAddress() << "Name:" << iface.name() << iface.humanReadableName() << iface.isValid(); + //qDebug() << " - Configuration: Name:" << active.name() << active.bearerTypeName() << active.identifier(); + //qDebug() << " - Interface: MAC Address:" << iface.hardwareAddress() << "Name:" << iface.name() << iface.humanReadableName() << iface.isValid(); QList<QNetworkAddressEntry> addressList = iface.addressEntries(); QStringList address; //NOTE: There are often 2 addresses, IPv4 and IPv6 for(int i=0; i<addressList.length(); i++){ address << addressList[i].ip().toString(); } - qDebug() << " - IP Address:" << address; - qDebug() << " - Hostname:" << networkHostname(); + //qDebug() << " - IP Address:" << address; + //qDebug() << " - Hostname:" << networkHostname(); INFO.insert("netaccess/address", address.join(", ")); emit networkStatusChanged(); } diff --git a/src-qt5/src-cpp/framework-OSInterface.h b/src-qt5/src-cpp/framework-OSInterface.h index a173ad5a..f367039e 100644 --- a/src-qt5/src-cpp/framework-OSInterface.h +++ b/src-qt5/src-cpp/framework-OSInterface.h @@ -76,11 +76,12 @@ public: // = Network Information = Q_INVOKABLE bool networkAvailable(); Q_INVOKABLE QString networkType(); //"wifi", "wired", "cell", "cell-2G", "cell-3G", "cell-4G" + Q_INVOKABLE QString networkTypeFromDeviceName(QString name); //wifi, wired, cell, cell-2G, cell-3G, cell-4G Q_INVOKABLE float networkStrength(); //percentage. ("wired" type should always be 100%) Q_INVOKABLE QString networkHostname(); Q_INVOKABLE QHostAddress networkAddress(); // = Network Modification = - + // = Media Shortcuts = Q_INVOKABLE QStringList mediaDirectories(); //directory where XDG shortcuts are placed for interacting with media (local/remote) Q_INVOKABLE QStringList mediaShortcuts(); //List of currently-available XDG shortcut file paths |