summaryrefslogtreecommitdiffstats
path: root/src/sysInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysInfo.cpp')
-rw-r--r--src/sysInfo.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp
index 8775777..8c93c52 100644
--- a/src/sysInfo.cpp
+++ b/src/sysInfo.cpp
@@ -11,6 +11,8 @@ QString sysInfo::getInfo(QString& infoName){
if (debug) qDebug() << "sysInfo : getInfo(" << infoName << ")";
if (infoName == QString("mac"))
return getMACAddress();
+ else if (infoName == QString("ip"))
+ return getIPAddress();
// still here? --> error
return "error";
}
@@ -28,3 +30,16 @@ QString sysInfo::getMACAddress(){
// returns only the latest found interface ... to fix
return macAddress;
}
+
+QString sysInfo::getIPAddress(){
+ QString ipAddress = "";
+ QNetworkInterface *qNetI = new QNetworkInterface();
+ QList<QHostAddress> list;
+ list=qNetI->allAddresses();
+ for (int i = 0; i < list.size(); ++i) {
+ ipAddress = list.at(i).toString();
+ if (debug) qDebug() << "IP Address" << " : " << ipAddress;
+ }
+ // returns only the latest found interface ... to fix
+ return ipAddress;
+}