summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNiklas Goby2011-03-08 16:34:00 +0100
committerNiklas Goby2011-03-08 16:34:00 +0100
commit1c6bebb8f86969a2111936e0107fa163e10fec21 (patch)
treeacf89a1ea0b533202c807112abf22c6b32a4718a /src
parentbinPath init fix (diff)
downloadfbgui-1c6bebb8f86969a2111936e0107fa163e10fec21.tar.gz
fbgui-1c6bebb8f86969a2111936e0107fa163e10fec21.tar.xz
fbgui-1c6bebb8f86969a2111936e0107fa163e10fec21.zip
added the getSysInfo Method getIPAddress:
Diffstat (limited to 'src')
-rw-r--r--src/sysInfo.cpp15
-rw-r--r--src/sysInfo.h1
2 files changed, 16 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;
+}
diff --git a/src/sysInfo.h b/src/sysInfo.h
index e4a2354..86443b8 100644
--- a/src/sysInfo.h
+++ b/src/sysInfo.h
@@ -11,6 +11,7 @@ class sysInfo {
private:
QString getMACAddress();
+ QString getIPAddress();
};
#endif // SYSTEMINFO_H