backendlogic.cpp 893 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "backendlogic.h"
  2. #include "Deviceinfo.h"
  3. #include <QProcess>
  4. #include <QDebug>
  5. #include <QJsonDocument>
  6. #include <QJsonArray>
  7. #include <QJsonObject>
  8. #include <windows.h>
  9. void BackendLogic::shutdown()
  10. {
  11. #if 0
  12. QString program = "C:/WINDOWS/system32/shutdown.exe";
  13. QStringList arguments;
  14. arguments << "-s -t 00";
  15. QProcess *myProcess = new QProcess();
  16. myProcess->start(program, arguments);
  17. #else
  18. #ifdef QT_NO_DEBUG
  19. system("shutdown -s -t 00");
  20. #endif
  21. #ifdef QT_DEBUG
  22. //system("shutdown -s -t 00");
  23. exit(0);
  24. #endif
  25. #endif
  26. }
  27. QJsonObject BackendLogic::getDeviceInfo()
  28. {
  29. QJsonObject jsonObj;
  30. DeviceInfo devinfo;
  31. jsonObj.insert("model", devinfo.m_model);
  32. jsonObj.insert("id", devinfo.m_id);
  33. jsonObj.insert("name", devinfo.m_name);
  34. jsonObj.insert("manufacture", devinfo.m_manufacture);
  35. return jsonObj;
  36. }