summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Goby2011-03-10 17:01:58 +0100
committerNiklas Goby2011-03-10 17:01:58 +0100
commita69b9be86e5209b4f168ac64b3357c7a2b9899b5 (patch)
tree0d201386e5e7c5b34ed4cae2cafce44e1d6a1972
parentmisc (diff)
downloadfbgui-a69b9be86e5209b4f168ac64b3357c7a2b9899b5.tar.gz
fbgui-a69b9be86e5209b4f168ac64b3357c7a2b9899b5.tar.xz
fbgui-a69b9be86e5209b4f168ac64b3357c7a2b9899b5.zip
now using the qjson parser in the getAllInfo method
and added some if (debug) commands
-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;
}