#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; }