diff options
| author | Niklas Goby | 2011-03-10 14:08:04 +0100 |
|---|---|---|
| committer | Niklas Goby | 2011-03-10 14:08:04 +0100 |
| commit | 86baaed2cad6a9f03f6d0d4bda2967fc5f37787c (patch) | |
| tree | 4ff00fee6734ce9b5e311fdc9e156f44aa2b5069 /src | |
| parent | sytax fix and a new tryout for the getAllInfo() (diff) | |
| download | fbgui-86baaed2cad6a9f03f6d0d4bda2967fc5f37787c.tar.gz fbgui-86baaed2cad6a9f03f6d0d4bda2967fc5f37787c.tar.xz fbgui-86baaed2cad6a9f03f6d0d4bda2967fc5f37787c.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysInfo.cpp | 5 |
1 files 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<QHostAddress> 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; |
