main.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "dialog.h"
  2. #include "Log/Log.h"
  3. #include <QApplication>
  4. #include <QDebug>
  5. #include <QFile>
  6. #include <QFileInfo>
  7. #include <QDir>
  8. #include <QTextStream>
  9. #include <iostream>
  10. #include <QStorageInfo>
  11. #define VER_FILE "1.0.0.0"
  12. #define GIT_HASH ""
  13. QString getSystemInfo()
  14. {
  15. QString s = "\n";
  16. s.append(QString("Build:%1 Version:%2\n").arg(GIT_HASH).arg(VER_FILE));
  17. s.append("System Info: \n");
  18. QTextStream out(&s);
  19. QSysInfo systemInfo;
  20. #ifdef Q_OS_WIN
  21. out << " Windows Version: " << systemInfo.windowsVersion() << endl;
  22. #endif
  23. out << " Build Cpu Architecture: " << systemInfo.buildCpuArchitecture() << endl;
  24. out << " Current Cpu Architecture: " << systemInfo.currentCpuArchitecture() << endl;
  25. out << " Kernel Type: " << systemInfo.kernelType() << endl;
  26. out << " Kernel Version: " << systemInfo.kernelVersion() << endl;
  27. out << " Machine Host Name: " << systemInfo.machineHostName() << endl;
  28. out << " Product Type: " << systemInfo.productType() << endl;
  29. out << " Product Version: " << systemInfo.productVersion() << endl;
  30. out << " Byte Order: " << systemInfo.buildAbi() << endl;
  31. out << " Pretty ProductName: " << systemInfo.prettyProductName() << endl;
  32. // root
  33. QStorageInfo storage = QStorageInfo::root();
  34. out << storage.rootPath() << endl;
  35. out << "isReadOnly:" << storage.isReadOnly() << endl;
  36. out << "name:" << storage.name() << endl;
  37. out << "fileSystemType:" << storage.fileSystemType() << endl;
  38. out << "size:" << storage.bytesTotal()/1000/1000 << "MB" << endl;
  39. out << "availableSize:" << storage.bytesAvailable()/1000/1000 << "MB" << endl;
  40. // current volumn
  41. QStorageInfo storageCurrent(qApp->applicationDirPath());
  42. out << qApp->applicationDirPath() << endl;
  43. out << storageCurrent.rootPath() << endl;
  44. out << "isReadOnly:" << storageCurrent.isReadOnly() << endl;
  45. out << "name:" << storageCurrent.name() << endl;
  46. out << "fileSystemType:" << storageCurrent.fileSystemType() << endl;
  47. out << "size:" << storageCurrent.bytesTotal()/1000/1000 << "MB" << endl;
  48. out << "availableSize:" << storageCurrent.bytesAvailable()/1000/1000 << "MB" << endl;
  49. return s;
  50. }
  51. int main(int argc, char *argv[])
  52. {
  53. QApplication a(argc, argv);
  54. LogError(getSystemInfo());
  55. LogError("start HmiRunTimeData!");
  56. Dialog w;
  57. w.show();
  58. return a.exec();
  59. }