Open Source Snapmatic picture and Savegame viewer/editor for GTA V https://gta5view.syping.de/

TelemetryClass.h 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*****************************************************************************
  2. * gta5view Grand Theft Auto V Profile Viewer
  3. * Copyright (C) 2018 Syping
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *****************************************************************************/
  18. #ifndef TELEMETRYCLASS_H
  19. #define TELEMETRYCLASS_H
  20. #include <QNetworkReply>
  21. #include <QApplication>
  22. #include <QObject>
  23. #include <QString>
  24. #include <QUrl>
  25. enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConf = 3, UserFeedback = 4, ApplicationSpec = 5, PersonalData = 6, CustomEmitted = 99 };
  26. class TelemetryClass : public QObject
  27. {
  28. Q_OBJECT
  29. public:
  30. static TelemetryClass* getInstance() { return &telemetryClassInstance; }
  31. static QString categoryToString(TelemetryCategory category);
  32. static QUrl getWebURL();
  33. bool canPush();
  34. bool canRegister();
  35. bool isEnabled();
  36. bool isStateForced();
  37. bool isRegistered();
  38. void init();
  39. void work();
  40. void refresh();
  41. void setEnabled(bool enabled);
  42. void setDisabled(bool disabled);
  43. void push(TelemetryCategory category);
  44. void push(TelemetryCategory category, const QJsonDocument json);
  45. void registerClient();
  46. QString getRegisteredID();
  47. private:
  48. static TelemetryClass telemetryClassInstance;
  49. QString telemetryClientID;
  50. bool telemetryEnabled;
  51. bool telemetryStateForced;
  52. bool telemetryPushAppConf;
  53. void work_p(bool doWork);
  54. QJsonDocument getOperatingSystem();
  55. QJsonDocument getSystemHardware();
  56. QJsonDocument getApplicationSpec();
  57. QJsonDocument getApplicationConf();
  58. QJsonDocument getSystemLocaleList();
  59. private slots:
  60. void pushFinished(QNetworkReply *reply);
  61. void registerFinished(QNetworkReply *reply);
  62. void work_pd(bool doWork);
  63. signals:
  64. void pushed(bool isSucessful);
  65. void registered(bool isSucessful);
  66. };
  67. extern TelemetryClass telemetryClass;
  68. #define Telemetry TelemetryClass::getInstance()
  69. #endif // TELEMETRYCLASS_H