aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/src-cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-01-12 08:20:09 -0800
committerKen Moore <ken@ixsystems.com>2018-01-12 08:20:09 -0800
commit9083f9a57b4414e0ad6f22127b156bc8581ef45c (patch)
tree5faacc4a2505ccdad776cd6c55f446a6d18d7fca /src-qt5/src-cpp
parentFix up the saving of the current window positions in the backend objects. (diff)
downloadlumina-9083f9a57b4414e0ad6f22127b156bc8581ef45c.tar.gz
lumina-9083f9a57b4414e0ad6f22127b156bc8581ef45c.tar.bz2
lumina-9083f9a57b4414e0ad6f22127b156bc8581ef45c.zip
Add an additional OS-specific network device type parser.
Diffstat (limited to 'src-qt5/src-cpp')
-rw-r--r--src-qt5/src-cpp/framework-OSInterface-template.cpp17
-rw-r--r--src-qt5/src-cpp/framework-OSInterface.h3
2 files changed, 13 insertions, 7 deletions
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
bgstack15