diff options
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..2c67cc1 --- /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; +} + |
