123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #include "dialog.h"
- #include "Log/Log.h"
- #include <QApplication>
- #include <QDebug>
- #include <QFile>
- #include <QFileInfo>
- #include <QDir>
- #include <QTextStream>
- #include <iostream>
- #include <QStorageInfo>
- #define VER_FILE "1.0.0.0"
- #define GIT_HASH ""
- QString getSystemInfo()
- {
- QString s = "\n";
- s.append(QString("Build:%1 Version:%2\n").arg(GIT_HASH).arg(VER_FILE));
- s.append("System Info: \n");
- QTextStream out(&s);
- QSysInfo systemInfo;
- #ifdef Q_OS_WIN
- out << " Windows Version: " << systemInfo.windowsVersion() << endl;
- #endif
- out << " Build Cpu Architecture: " << systemInfo.buildCpuArchitecture() << endl;
- out << " Current Cpu Architecture: " << systemInfo.currentCpuArchitecture() << endl;
- out << " Kernel Type: " << systemInfo.kernelType() << endl;
- out << " Kernel Version: " << systemInfo.kernelVersion() << endl;
- out << " Machine Host Name: " << systemInfo.machineHostName() << endl;
- out << " Product Type: " << systemInfo.productType() << endl;
- out << " Product Version: " << systemInfo.productVersion() << endl;
- out << " Byte Order: " << systemInfo.buildAbi() << endl;
- out << " Pretty ProductName: " << systemInfo.prettyProductName() << endl;
- // root
- QStorageInfo storage = QStorageInfo::root();
- out << storage.rootPath() << endl;
- out << "isReadOnly:" << storage.isReadOnly() << endl;
- out << "name:" << storage.name() << endl;
- out << "fileSystemType:" << storage.fileSystemType() << endl;
- out << "size:" << storage.bytesTotal()/1000/1000 << "MB" << endl;
- out << "availableSize:" << storage.bytesAvailable()/1000/1000 << "MB" << endl;
- // current volumn
- QStorageInfo storageCurrent(qApp->applicationDirPath());
- out << qApp->applicationDirPath() << endl;
- out << storageCurrent.rootPath() << endl;
- out << "isReadOnly:" << storageCurrent.isReadOnly() << endl;
- out << "name:" << storageCurrent.name() << endl;
- out << "fileSystemType:" << storageCurrent.fileSystemType() << endl;
- out << "size:" << storageCurrent.bytesTotal()/1000/1000 << "MB" << endl;
- out << "availableSize:" << storageCurrent.bytesAvailable()/1000/1000 << "MB" << endl;
- return s;
- }
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- LogError(getSystemInfo());
- LogError("start HmiRunTimeData!");
- Dialog w;
- w.show();
- return a.exec();
- }
|