From 88a8b6e735b111c937d056c3c944b1444d5660f5 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 10 Mar 2011 16:08:12 +0100 Subject: test function that returns a json, use: fbgui.getNames() --- src/sysInfo.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/sysInfo.cpp') 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 #include #include +#include +#include +#include //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; + +} -- cgit v1.2.3-55-g7522