From ed711e3a2d28fc80e5c62af35491780f07134b5e Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 7 Mar 2011 22:57:12 +0100 Subject: meh --- 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..2c67cc1 --- /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