summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sysInfo.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp
index ddd400a..f5cd18d 100644
--- a/src/sysInfo.cpp
+++ b/src/sysInfo.cpp
@@ -48,12 +48,12 @@ QString sysInfo::getIPAddress(){
// This is does not return the right IP atm...
foreach(QHostAddress addr, addrlist){
if (addr.protocol() == QAbstractSocket::IPv4Protocol && addr != QHostAddress::LocalHost){
- qDebug() << "eth0: IPv4 Address: " << addr.toString();
+ if (debug) qDebug() << "eth0: IPv4 Address: " << addr.toString();
return addr.toString();
}
}
// still here?
- qDebug() << "ip_error";
+ if (debug) qDebug() << "ip_error";
return "ip_error";
}
QByteArray sysInfo::getNames(){
@@ -72,13 +72,19 @@ QByteArray sysInfo::getNames(){
QJson::Serializer serializer;
QByteArray json = serializer.serialize(jsonV);
- qDebug() << json;
+ if (debug) qDebug() << json;
return json;
}
// ------------------------------------------------------------------------------------------------
QString sysInfo::getAllInfos(){
- QString tmp = "\"mac\":\"" + getMACAddress() + "\", \"ip\":\"" + getIPAddress() +"\"";
+ QVariantMap infos;
+ infos.insert("mac", getMACAddress());
+ infos.insert("ip", getIPAddress());
- return tmp;
+ QJson::Serializer serializer;
+ QByteArray json = serializer.serialize(infos);
+
+ if (debug) qDebug() << json;
+ return json;
}