From 5a28603ff0af7bb5b2fdf2c0f8e8ef4fd1168f8a Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 7 Mar 2011 22:38:56 +0100 Subject: SysInfo class .. (bad name I know...) --- src/SysInfo.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/SysInfo.cpp (limited to 'src/SysInfo.cpp') 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 +#include +#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 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; +} + -- cgit v1.2.3-55-g7522