From 86baaed2cad6a9f03f6d0d4bda2967fc5f37787c Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Thu, 10 Mar 2011 14:08:04 +0100 Subject: now the getAllInfo() method works. We just return a String the parens will be set by javascript on the site. also changed the getIPAddress method. now we get the ip address which is not the localhost address --- src/sysInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index 9456fe5..796d06d 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -42,16 +42,17 @@ QString sysInfo::getIPAddress(){ QList addrlist = qni.allAddresses(); // This is does not return the right IP atm... foreach(QHostAddress addr, addrlist){ - if (addr.protocol() == QAbstractSocket::IPv4Protocol) + if (addr.protocol() == QAbstractSocket::IPv4Protocol && addr != QHostAddress::LocalHost){ qDebug() << "eth0: IPv4 Address: " << addr.toString(); return addr.toString(); + } } // still here? + qDebug() << "ip_error"; return "ip_error"; } // ------------------------------------------------------------------------------------------------ QString sysInfo::getAllInfos(){ - //QString tmp = '{"mac":"' + getMACAddress() + '", "ip":"' + getIPAddress() +'"}'; QString tmp = "\"mac\":\"" + getMACAddress() + "\", \"ip\":\"" + getIPAddress() +"\""; return tmp; -- cgit v1.2.3-55-g7522