diff options
| author | Joe | 2011-03-07 22:38:56 +0100 |
|---|---|---|
| committer | Joe | 2011-03-07 22:38:56 +0100 |
| commit | 5a28603ff0af7bb5b2fdf2c0f8e8ef4fd1168f8a (patch) | |
| tree | 9fa16ad8766f15f4f1d08819e9a29b427cb61c5f /src/SysInfo.cpp | |
| parent | bye bye fbbrowser.ui (diff) | |
| download | fbgui-5a28603ff0af7bb5b2fdf2c0f8e8ef4fd1168f8a.tar.gz fbgui-5a28603ff0af7bb5b2fdf2c0f8e8ef4fd1168f8a.tar.xz fbgui-5a28603ff0af7bb5b2fdf2c0f8e8ef4fd1168f8a.zip | |
SysInfo class .. (bad name I know...)
Diffstat (limited to 'src/SysInfo.cpp')
| -rw-r--r-- | src/SysInfo.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/SysInfo.cpp b/src/SysInfo.cpp new file mode 100644 index 0000000..9ac02eb --- /dev/null +++ b/src/SysInfo.cpp @@ -0,0 +1,31 @@ +#include <QString> +#include <QTime> +#include "SysInfo.h" + +extern bool debug; + +SysInfo::SysInfo(){} +SysInfo::~SysInfo(){} +QString SysInfo::getInfo(QString& infoName){ + if (infoName == QString("time")) + return getTime(); + if (infoName == QString("MAC")) + return getMACAddress(); +} +QString SysInfo::getTime(){ + return QTime::currentTime().toString("hh:mm:ss"); +} +QString SysInfo::getMACAddress(){ + QNetworkInterface *qNetI = new QNetworkInterface(); + QList<QNetworkInterface> list; + list=qNetI->allInterfaces(); + QString str; + QString macAddress; + for (int i = 0; i < list.size(); ++i) { + str = list.at(i).name(); + macAddress = list.at(i).hardwareAddress(); + if (debug) qDebug() << str << " : " << macAddress; + } + return macAddress; +} + |
