diff options
| author | Niklas Goby | 2011-03-10 18:18:37 +0100 |
|---|---|---|
| committer | Niklas Goby | 2011-03-10 18:18:37 +0100 |
| commit | 37d8c8030e67629e621a77e9022d59cb69c73f3e (patch) | |
| tree | ca996e8a677091885ecb8a91993c30a0c83ddefa /src | |
| parent | now using the qjson parser in the getAllInfo method (diff) | |
| download | fbgui-37d8c8030e67629e621a77e9022d59cb69c73f3e.tar.gz fbgui-37d8c8030e67629e621a77e9022d59cb69c73f3e.tar.xz fbgui-37d8c8030e67629e621a77e9022d59cb69c73f3e.zip | |
added a method for reading the out put of a script.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysInfo.cpp | 30 | ||||
| -rw-r--r-- | src/sysInfo.h | 1 |
2 files changed, 30 insertions, 1 deletions
diff --git a/src/sysInfo.cpp b/src/sysInfo.cpp index f5cd18d..7cf2124 100644 --- a/src/sysInfo.cpp +++ b/src/sysInfo.cpp @@ -82,9 +82,37 @@ QString sysInfo::getAllInfos(){ infos.insert("mac", getMACAddress()); infos.insert("ip", getIPAddress()); - QJson::Serializer serializer; + //QJson::Serializer serializer; QByteArray json = serializer.serialize(infos); if (debug) qDebug() << json; return json; } +// +QStringList sysInfo::getPrcOutP2() +{ + QString cmd = "echo test"; + QProcess *process = new QProcess(); + qDebug()<<"try to open: "<<cmd; + process->start(cmd, QIODevice::ReadOnly); + + if (!process->waitForStarted() ) + qDebug()<<"process couldn't get opened"; + + QStringList output; + process->waitForFinished(); + + QTextStream *txt_stream = new QTextStream(process); + + while(!txt_stream->atEnd() ) + { + qDebug()<<"read output: "; + QString tmp_str = txt_stream->readLine(); + output.append(tmp_str); + qDebug()<<tmp_str; + } + + qDebug()<<"process finished: "; + return output; +} + diff --git a/src/sysInfo.h b/src/sysInfo.h index 7ed4d71..652a3f6 100644 --- a/src/sysInfo.h +++ b/src/sysInfo.h @@ -19,6 +19,7 @@ class sysInfo { QString getMACAddress(); QString getIPAddress(); QString getAllInfos(); + QStringList getPrcOutP2(); }; #endif // SYSTEMINFO_H |
