Browse Source

fix some submit code

Syping 4 months ago
parent
commit
2606cd8965
2 changed files with 44 additions and 3 deletions
  1. 42
    2
      SavegameWidget.cpp
  2. 2
    1
      SnapmaticWidget.cpp

+ 42
- 2
SavegameWidget.cpp View File

@@ -1,6 +1,6 @@
1 1
 /*****************************************************************************
2 2
 * gta5view Grand Theft Auto V Profile Viewer
3
-* Copyright (C) 2016-2017 Syping
3
+* Copyright (C) 2016-2018 Syping
4 4
 *
5 5
 * This program is free software: you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
24 24
 #include "SavegameData.h"
25 25
 #include "SavegameCopy.h"
26 26
 #include "AppEnv.h"
27
+#include "config.h"
27 28
 #include <QFileDialog>
28 29
 #include <QMessageBox>
29 30
 #include <QSettings>
@@ -37,6 +38,13 @@
37 38
 #include <QMenu>
38 39
 #include <QUrl>
39 40
 
41
+#ifdef GTA5SYNC_TELEMETRY
42
+#include "TelemetryClass.h"
43
+#include <QJsonDocument>
44
+#include <QJsonObject>
45
+#include <QDateTime>
46
+#endif
47
+
40 48
 SavegameWidget::SavegameWidget(QWidget *parent) :
41 49
     ProfileWidget(parent),
42 50
     ui(new Ui::SavegameWidget)
@@ -134,9 +142,41 @@ void SavegameWidget::on_cmdDelete_clicked()
134 142
         if (!QFile::exists(sgdPath))
135 143
         {
136 144
             emit savegameDeleted();
145
+#ifdef GTA5SYNC_TELEMETRY
146
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
147
+            telemetrySettings.beginGroup("Telemetry");
148
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
149
+            telemetrySettings.endGroup();
150
+            if (pushUsageData && Telemetry->canPush())
151
+            {
152
+                QJsonDocument jsonDocument;
153
+                QJsonObject jsonObject;
154
+                jsonObject["Type"] = "DeleteSuccess";
155
+                jsonObject["ExtraFlags"] = "Savegame";
156
+                jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
157
+                jsonDocument.setObject(jsonObject);
158
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
159
+            }
160
+#endif
137 161
         }
138
-        else if(QFile::remove(sgdPath))
162
+        else if (QFile::remove(sgdPath))
139 163
         {
164
+#ifdef GTA5SYNC_TELEMETRY
165
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
166
+            telemetrySettings.beginGroup("Telemetry");
167
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
168
+            telemetrySettings.endGroup();
169
+            if (pushUsageData && Telemetry->canPush())
170
+            {
171
+                QJsonDocument jsonDocument;
172
+                QJsonObject jsonObject;
173
+                jsonObject["Type"] = "DeleteSuccess";
174
+                jsonObject["ExtraFlags"] = "Savegame";
175
+                jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
176
+                jsonDocument.setObject(jsonObject);
177
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
178
+            }
179
+#endif
140 180
             emit savegameDeleted();
141 181
         }
142 182
         else

+ 2
- 1
SnapmaticWidget.cpp View File

@@ -1,6 +1,6 @@
1 1
 /*****************************************************************************
2 2
 * gta5view Grand Theft Auto V Profile Viewer
3
-* Copyright (C) 2016-2017 Syping
3
+* Copyright (C) 2016-2018 Syping
4 4
 *
5 5
 * This program is free software: you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
@@ -176,6 +176,7 @@ bool SnapmaticWidget::deletePicture()
176 176
                 QJsonDocument jsonDocument;
177 177
                 QJsonObject jsonObject;
178 178
                 jsonObject["Type"] = "DeleteSuccess";
179
+                jsonObject["ExtraFlags"] = "Snapmatic";
179 180
                 jsonObject["DeletedSize"] = QString::number(smpic->getContentMaxLength());
180 181
                 jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
181 182
                 jsonDocument.setObject(jsonObject);