#include "sysInfo.h" #include #include #include extern bool debug; sysInfo::sysInfo(){} sysInfo::~sysInfo(){} QString sysInfo::getInfo(QString& infoName){ if (debug) qDebug() << "sysInfo : getInfo(" << 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; } // returns only the latest found interface ... to fix return macAddress; }