diff options
| author | Jonathan Bauer | 2011-03-10 16:08:12 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2011-03-10 16:08:12 +0100 |
| commit | 88a8b6e735b111c937d056c3c944b1444d5660f5 (patch) | |
| tree | ad6d1db3cc62bbb99965ab995e946040ce0df56c /src/sysInfo.cpp | |
| parent | callback function when download queue is empty (diff) | |
| download | fbgui-88a8b6e735b111c937d056c3c944b1444d5660f5.tar.gz fbgui-88a8b6e735b111c937d056c3c944b1444d5660f5.tar.xz fbgui-88a8b6e735b111c937d056c3c944b1444d5660f5.zip | |
test function that returns a json, use: fbgui.getNames()
Diffstat (limited to 'src/sysInfo.cpp')
| -rw-r--r-- | src/sysInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index 8da1c46..19117a5 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -2,6 +2,9 @@ #include <QString> #include <QTime> #include <QNetworkInterface> +#include <QVariantMap> +#include <QVariantList> +#include <QByteArray> //static int eth0_index = 0; // ------------------------------------------------------------------------------------------------ @@ -47,3 +50,23 @@ QString sysInfo::getIPAddress(){ // still here? return "ip_error"; } +QByteArray sysInfo::getNames(){ + + QVariantMap foo; + foo.insert("name", "foo"); + foo.insert("type", 123); + + QVariantMap fooo; + fooo.insert("name", "boo"); + fooo.insert("type", 321); + + QVariantList jsonV; + jsonV << foo << fooo; + + QJson::Serializer serializer; + QByteArray json = serializer.serialize(jsonV); + + qDebug() << json; + return json; + +} |
