diff options
| author | Niklas Goby | 2011-03-10 17:01:58 +0100 |
|---|---|---|
| committer | Niklas Goby | 2011-03-10 17:01:58 +0100 |
| commit | a69b9be86e5209b4f168ac64b3357c7a2b9899b5 (patch) | |
| tree | 0d201386e5e7c5b34ed4cae2cafce44e1d6a1972 | |
| parent | misc (diff) | |
| download | fbgui-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.cpp | 16 |
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; } |
