Browse Source

added ability to read GTA V game language

Syping 4 months ago
parent
commit
39f20aca9d

+ 1
- 5
.ci/windows_docker.sh View File

@@ -15,11 +15,7 @@ docker run --rm \
15 15
 export GTA5VIEW_EXECUTABLE=gta5view-${EXECUTABLE_VERSION}${EXECUTABLE_ARCH}.exe && \
16 16
 
17 17
 # Upload Assets to Dropbox
18
-if [ "${PACKAGE_CODE}" == "Dropbox" ]; then
19
-	${PROJECT_DIR}/.ci/dropbox_uploader.sh mkdir gta5view-builds/${PACKAGE_VERSION}
20
-	${PROJECT_DIR}/.ci/dropbox_uploader.sh upload ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} gta5view-builds/${PACKAGE_VERSION}/${GTA5VIEW_EXECUTABLE} && \
21
-	rm -rf ${GTA5VIEW_EXECUTABLE}
22
-elif [ "${PACKAGE_CODE}" == "gta5-mods" ]; then
18
+if [ "${PACKAGE_CODE}" == "gta5-mods" ]; then
23 19
 	${PROJECT_DIR}/.ci/dropbox_uploader.sh mkdir gta5-mods/${PACKAGE_VERSION}
24 20
 	${PROJECT_DIR}/.ci/dropbox_uploader.sh upload ${PROJECT_DIR}/assets/${GTA5VIEW_EXECUTABLE} gta5-mods/${PACKAGE_VERSION}/${GTA5VIEW_EXECUTABLE} && \
25 21
 	rm -rf ${GTA5VIEW_EXECUTABLE}

+ 0
- 5
.travis.yml View File

@@ -22,11 +22,6 @@ matrix:
22 22
     - BUILD_SCRIPT=windows_docker.sh
23 23
     - QT_SELECT=qt5-x86_64-w64-mingw32
24 24
     - RELEASE_LABEL="Windows 64-Bit Portable"
25
-    - EXECUTABLE_ARCH=_x64
26
-  - env:
27
-    - BUILD_SCRIPT=windows_docker.sh
28
-    - QT_SELECT=qt5-x86_64-w64-mingw32
29
-    - PACKAGE_CODE=Dropbox
30 25
   - env:
31 26
     - BUILD_SCRIPT=windows_docker.sh
32 27
     - QT_SELECT=qt5-x86_64-w64-mingw32

+ 286
- 0
AppEnv.cpp View File

@@ -206,6 +206,292 @@ QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
206 206
     return getPlayerFetchingUrl(crewID, QString::number(pageNumber));
207 207
 }
208 208
 
209
+// Game Stuff
210
+
211
+GameVersion AppEnv::getGameVersion()
212
+{
213
+#ifdef GTA5SYNC_WIN
214
+    QString argumentValue;
215
+#ifdef _WIN64
216
+    argumentValue = "\\WOW6432Node";
217
+#endif
218
+    QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
219
+    QString installFolderSc = registrySettingsSc.value("InstallFolder", "").toString();
220
+    QDir installFolderScDir(installFolderSc);
221
+    bool scVersionInstalled = false;
222
+    if (!installFolderSc.isEmpty() && installFolderScDir.exists())
223
+    {
224
+#ifdef GTA5SYNC_DEBUG
225
+        qDebug() << "gameVersionFoundSocialClubVersion";
226
+#endif
227
+        scVersionInstalled = true;
228
+    }
229
+
230
+    QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\GTAV").arg(argumentValue), QSettings::NativeFormat);
231
+    QString installFolderSteam = registrySettingsSteam.value("installfoldersteam", "").toString();
232
+    if (installFolderSteam.right(5) == "\\GTAV")
233
+    {
234
+        installFolderSteam = installFolderSteam.remove(installFolderSteam.length() - 5, 5);
235
+    }
236
+    QDir installFolderSteamDir(installFolderSteam);
237
+    bool steamVersionInstalled = false;
238
+    if (!installFolderSteam.isEmpty() && installFolderSteamDir.exists())
239
+    {
240
+#ifdef GTA5SYNC_DEBUG
241
+        qDebug() << "gameVersionFoundSteamVersion";
242
+#endif
243
+        steamVersionInstalled = true;
244
+    }
245
+
246
+    if (scVersionInstalled && steamVersionInstalled)
247
+    {
248
+        return GameVersion::BothVersions;
249
+    }
250
+    else if (scVersionInstalled)
251
+    {
252
+        return GameVersion::SocialClubVersion;
253
+    }
254
+    else if (steamVersionInstalled)
255
+    {
256
+        return GameVersion::SteamVersion;
257
+    }
258
+    else
259
+    {
260
+        return GameVersion::NoVersion;
261
+    }
262
+#else
263
+    return GameVersion::NoVersion;
264
+#endif
265
+}
266
+
267
+GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
268
+{
269
+    if (gameVersion == GameVersion::SocialClubVersion)
270
+    {
271
+#ifdef GTA5SYNC_WIN
272
+        QString argumentValue;
273
+#ifdef _WIN64
274
+        argumentValue = "\\WOW6432Node";
275
+#endif
276
+        QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
277
+        QString languageSc = registrySettingsSc.value("Language", "").toString();
278
+        return gameLanguageFromString(languageSc);
279
+#else
280
+        return GameLanguage::Undefined;
281
+#endif
282
+    }
283
+    else if (gameVersion == GameVersion::SteamVersion)
284
+    {
285
+#ifdef GTA5SYNC_WIN
286
+        QString argumentValue;
287
+#ifdef _WIN64
288
+        argumentValue = "\\WOW6432Node";
289
+#endif
290
+        QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
291
+        QString languageSteam = registrySettingsSteam.value("Language", "").toString();
292
+        return gameLanguageFromString(languageSteam);
293
+#else
294
+        return GameLanguage::Undefined;
295
+#endif
296
+    }
297
+    else
298
+    {
299
+        return GameLanguage::Undefined;
300
+    }
301
+}
302
+
303
+GameLanguage AppEnv::gameLanguageFromString(QString gameLanguage)
304
+{
305
+    if (gameLanguage == "en-US")
306
+    {
307
+        return GameLanguage::English;
308
+    }
309
+    else if (gameLanguage == "fr-FR")
310
+    {
311
+        return GameLanguage::French;
312
+    }
313
+    else if (gameLanguage == "it-IT")
314
+    {
315
+        return GameLanguage::Italian;
316
+    }
317
+    else if (gameLanguage == "de-DE")
318
+    {
319
+        return GameLanguage::German;
320
+    }
321
+    else if (gameLanguage == "es-ES")
322
+    {
323
+        return GameLanguage::Spanish;
324
+    }
325
+    else if (gameLanguage == "es-MX")
326
+    {
327
+        return GameLanguage::Mexican;
328
+    }
329
+    else if (gameLanguage == "pt-BR")
330
+    {
331
+        return GameLanguage::Brasilian;
332
+    }
333
+    else if (gameLanguage == "ru-RU")
334
+    {
335
+        return GameLanguage::Russian;
336
+    }
337
+    else if (gameLanguage == "pl-PL")
338
+    {
339
+        return GameLanguage::Polish;
340
+    }
341
+    else if (gameLanguage == "ja-JP")
342
+    {
343
+        return GameLanguage::Japanese;
344
+    }
345
+    else if (gameLanguage == "zh-CHS")
346
+    {
347
+        return GameLanguage::SChinese;
348
+    }
349
+    else if (gameLanguage == "zh-CHT")
350
+    {
351
+        return GameLanguage::TChinese;
352
+    }
353
+    else if (gameLanguage == "ko-KR")
354
+    {
355
+        return GameLanguage::Koreana;
356
+    }
357
+    else
358
+    {
359
+        return GameLanguage::Undefined;
360
+    }
361
+}
362
+
363
+QString AppEnv::gameLanguageToString(GameLanguage gameLanguage)
364
+{
365
+    if (gameLanguage == GameLanguage::English)
366
+    {
367
+        return "en-US";
368
+    }
369
+    else if (gameLanguage == GameLanguage::French)
370
+    {
371
+        return "fr-FR";
372
+    }
373
+    else if (gameLanguage == GameLanguage::Italian)
374
+    {
375
+        return "it-IT";
376
+    }
377
+    else if (gameLanguage == GameLanguage::German)
378
+    {
379
+        return "de-DE";
380
+    }
381
+    else if (gameLanguage == GameLanguage::Spanish)
382
+    {
383
+        return "es-ES";
384
+    }
385
+    else if (gameLanguage == GameLanguage::Mexican)
386
+    {
387
+        return "es-MX";
388
+    }
389
+    else if (gameLanguage == GameLanguage::Brasilian)
390
+    {
391
+        return "pt-BR";
392
+    }
393
+    else if (gameLanguage == GameLanguage::Russian)
394
+    {
395
+        return "ru-RU";
396
+    }
397
+    else if (gameLanguage == GameLanguage::Polish)
398
+    {
399
+        return "pl-PL";
400
+    }
401
+    else if (gameLanguage == GameLanguage::Japanese)
402
+    {
403
+        return "ja-JP";
404
+    }
405
+    else if (gameLanguage == GameLanguage::SChinese)
406
+    {
407
+        return "zh-CHS";
408
+    }
409
+    else if (gameLanguage == GameLanguage::TChinese)
410
+    {
411
+        return "zh-CHT";
412
+    }
413
+    else if (gameLanguage == GameLanguage::Koreana)
414
+    {
415
+        return "ko-KR";
416
+    }
417
+    else
418
+    {
419
+        return "Undefinied";
420
+    }
421
+}
422
+
423
+bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
424
+{
425
+    bool socialClubVersion = false;
426
+    bool steamVersion = false;
427
+    if (gameVersion == GameVersion::SocialClubVersion)
428
+    {
429
+        socialClubVersion = true;
430
+    }
431
+    else if (gameVersion == GameVersion::SteamVersion)
432
+    {
433
+        steamVersion = true;
434
+    }
435
+    else if (gameVersion == GameVersion::BothVersions)
436
+    {
437
+        socialClubVersion = true;
438
+        steamVersion = true;
439
+    }
440
+    else
441
+    {
442
+        return false;
443
+    }
444
+    if (socialClubVersion)
445
+    {
446
+#ifdef GTA5SYNC_WIN
447
+        QString argumentValue;
448
+#ifdef _WIN64
449
+        argumentValue = "\\WOW6432Node";
450
+#endif
451
+        QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
452
+        if (gameLanguage != GameLanguage::Undefined)
453
+        {
454
+            registrySettingsSc.setValue("Language", gameLanguageToString(gameLanguage));
455
+        }
456
+        else
457
+        {
458
+            registrySettingsSc.remove("Language");
459
+        }
460
+        registrySettingsSc.sync();
461
+        if (registrySettingsSc.status() != QSettings::NoError)
462
+        {
463
+            return false;
464
+        }
465
+#endif
466
+    }
467
+    if (steamVersion)
468
+    {
469
+#ifdef GTA5SYNC_WIN
470
+        QString argumentValue;
471
+#ifdef _WIN64
472
+        argumentValue = "\\WOW6432Node";
473
+#endif
474
+        QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
475
+        if (gameLanguage != GameLanguage::Undefined)
476
+        {
477
+            registrySettingsSteam.setValue("Language", gameLanguageToString(gameLanguage));
478
+        }
479
+        else
480
+        {
481
+            registrySettingsSteam.remove("Language");
482
+        }
483
+        registrySettingsSteam.sync();
484
+        if (registrySettingsSteam.status() != QSettings::NoError)
485
+        {
486
+            return false;
487
+        }
488
+#endif
489
+    }
490
+    return true;
491
+}
492
+
493
+// Screen Stuff
494
+
209 495
 qreal AppEnv::screenRatio()
210 496
 {
211 497
 #if QT_VERSION >= 0x050000

+ 10
- 0
AppEnv.h View File

@@ -22,6 +22,9 @@
22 22
 #include <QString>
23 23
 #include <QUrl>
24 24
 
25
+enum class GameVersion : int { NoVersion = 0, SocialClubVersion = 1, SteamVersion = 2, BothVersions = 3 };
26
+enum class GameLanguage : int { Undefined = 0, English = 1, French = 2, Italian = 3, German = 4, Spanish = 5, Mexican = 6, Brasilian = 7, Russian = 8, Polish = 9, Japanese = 10, SChinese = 11, TChinese = 12, Koreana = 13 };
27
+
25 28
 class AppEnv
26 29
 {
27 30
 public:
@@ -44,6 +47,13 @@ public:
44 47
     static QUrl getPlayerFetchingUrl(QString crewID, QString pageNumber);
45 48
     static QUrl getPlayerFetchingUrl(QString crewID, int pageNumber);
46 49
 
50
+    // Game Stuff
51
+    static GameVersion getGameVersion();
52
+    static GameLanguage getGameLanguage(GameVersion gameVersion);
53
+    static GameLanguage gameLanguageFromString(QString gameLanguage);
54
+    static QString gameLanguageToString(GameLanguage gameLanguage);
55
+    static bool setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage);
56
+
47 57
     // Screen Stuff
48 58
     static qreal screenRatio();
49 59
 };

+ 7
- 7
ImportDialog.cpp View File

@@ -63,13 +63,6 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
63 63
     avatarAreaImage = QImage(":/img/avatarareaimport.png");
64 64
     selectedColour = QColor::fromRgb(0, 0, 0, 255);
65 65
 
66
-    // Set Import Settings
67
-    QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
68
-    settings.beginGroup("Import");
69
-    QString currentProfile = settings.value("Profile", "Default").toString();
70
-    settings.endGroup();
71
-    processSettings(currentProfile);
72
-
73 66
     // Set Icon for OK Button
74 67
     if (QIcon::hasThemeIcon("dialog-ok"))
75 68
     {
@@ -95,6 +88,13 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
95 88
     ui->labBackgroundImage->setText(tr("Background Image:"));
96 89
     ui->cmdBackgroundWipe->setVisible(false);
97 90
 
91
+    // Set Import Settings
92
+    QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
93
+    settings.beginGroup("Import");
94
+    QString currentProfile = settings.value("Profile", "Default").toString();
95
+    settings.endGroup();
96
+    processSettings(currentProfile);
97
+
98 98
     // DPI calculation
99 99
     qreal screenRatio = AppEnv::screenRatio();
100 100
     snapmaticResolutionLW = 516 * screenRatio; // 430

+ 24
- 2
JsonEditorDialog.cpp View File

@@ -20,8 +20,10 @@
20 20
 #include "ui_JsonEditorDialog.h"
21 21
 #include "SnapmaticEditor.h"
22 22
 #include "AppEnv.h"
23
+#include "config.h"
23 24
 #include <QStringBuilder>
24 25
 #include <QJsonDocument>
26
+#include <QJsonObject>
25 27
 #include <QMessageBox>
26 28
 
27 29
 #if QT_VERSION >= 0x050200
@@ -29,6 +31,10 @@
29 31
 #include <QDebug>
30 32
 #endif
31 33
 
34
+#ifdef GTA5SYNC_TELEMETRY
35
+#include "TelemetryClass.h"
36
+#endif
37
+
32 38
 JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
33 39
     QDialog(parent), smpic(picture),
34 40
     ui(new Ui::JsonEditorDialog)
@@ -185,6 +191,22 @@ bool JsonEditorDialog::saveJsonContent()
185 191
             jsonCode = newCode;
186 192
             smpic->updateStrings();
187 193
             smpic->emitUpdate();
194
+#ifdef GTA5SYNC_TELEMETRY
195
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
196
+            telemetrySettings.beginGroup("Telemetry");
197
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
198
+            telemetrySettings.endGroup();
199
+            if (pushUsageData && Telemetry->canPush())
200
+            {
201
+                QJsonDocument jsonDocument;
202
+                QJsonObject jsonObject;
203
+                jsonObject["Type"] = "JSONEdited";
204
+                jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
205
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
206
+                jsonDocument.setObject(jsonObject);
207
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
208
+            }
209
+#endif
188 210
             return true;
189 211
         }
190 212
         return true;
@@ -198,13 +220,13 @@ bool JsonEditorDialog::saveJsonContent()
198 220
 
199 221
 void JsonEditorDialog::on_cmdClose_clicked()
200 222
 {
201
-    this->close();
223
+    close();
202 224
 }
203 225
 
204 226
 void JsonEditorDialog::on_cmdSave_clicked()
205 227
 {
206 228
     if (saveJsonContent())
207 229
     {
208
-        this->close();
230
+        close();
209 231
     }
210 232
 }

+ 97
- 3
OptionsDialog.cpp View File

@@ -103,6 +103,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
103 103
     setupInterfaceSettings();
104 104
     setupStatisticsSettings();
105 105
     setupSnapmaticPictureViewer();
106
+    setupWindowsGameSettings();
106 107
 
107 108
 #ifndef Q_QS_ANDROID
108 109
     // DPI calculation
@@ -110,7 +111,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
110 111
     resize(435 * screenRatio, 405 * screenRatio);
111 112
 #endif
112 113
 
113
-    this->setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR));
114
+    setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR));
114 115
 }
115 116
 
116 117
 OptionsDialog::~OptionsDialog()
@@ -150,9 +151,21 @@ void OptionsDialog::setupLanguageBox()
150 151
     currentAreaLanguage = settings->value("AreaLanguage", "Auto").toString();
151 152
     settings->endGroup();
152 153
 
153
-    QString cbSysStr = tr("%1 (Next Closest Language)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
154
-                                                                                                                                                                      "System in context of System default"));
154
+    QString cbSysStr = tr("%1 (Language priority)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
155
+                                                                                                                                                                  "System in context of System default"));
156
+#ifdef GTA5SYNC_WIN
157
+    QString cbAutoStr;
158
+    if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined)
159
+    {
160
+        cbAutoStr = tr("%1 (Game language)", "Next closest language compared to the Game settings").arg(tr("Auto", "Automatic language choice."));
161
+    }
162
+    else
163
+    {
164
+        cbAutoStr = tr("%1 (Closest to Interface)", "Next closest language compared to the Interface").arg(tr("Auto", "Automatic language choice."));
165
+    }
166
+#else
155 167
     QString cbAutoStr = tr("%1 (Closest to Interface)", "Next closest language compared to the Interface").arg(tr("Auto", "Automatic language choice."));
168
+#endif
156 169
     ui->cbLanguage->addItem(cbSysStr, "System");
157 170
     ui->cbAreaLanguage->addItem(cbAutoStr, "Auto");
158 171
 
@@ -412,6 +425,15 @@ void OptionsDialog::applySettings()
412 425
     settings->endGroup();
413 426
     Telemetry->refresh();
414 427
     Telemetry->work();
428
+    if (ui->cbUsageData->isChecked() && Telemetry->canPush())
429
+    {
430
+        QJsonDocument jsonDocument;
431
+        QJsonObject jsonObject;
432
+        jsonObject["Type"] = "SettingsUpdated";
433
+        jsonObject["UpdateTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
434
+        jsonDocument.setObject(jsonObject);
435
+        Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
436
+    }
415 437
 #endif
416 438
 
417 439
 #if QT_VERSION >= 0x050000
@@ -432,6 +454,7 @@ void OptionsDialog::applySettings()
432 454
         Translator->initUserLanguage();
433 455
     }
434 456
 
457
+    settings->sync();
435 458
     emit settingsApplied(newContentMode, languageChanged);
436 459
 
437 460
     if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder))
@@ -576,6 +599,77 @@ void OptionsDialog::setupStatisticsSettings()
576 599
 #endif
577 600
 }
578 601
 
602
+void OptionsDialog::setupWindowsGameSettings()
603
+{
604
+#ifdef GTA5SYNC_GAME
605
+    GameVersion gameVersion = AppEnv::getGameVersion();
606
+#ifdef GTA5SYNC_WIN
607
+    if (gameVersion != GameVersion::NoVersion)
608
+    {
609
+        if (gameVersion == GameVersion::SocialClubVersion)
610
+        {
611
+            ui->gbSteam->setDisabled(true);
612
+            ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
613
+            ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No"))));
614
+            if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined)
615
+            {
616
+                ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
617
+            }
618
+            else
619
+            {
620
+                ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
621
+            }
622
+            ui->labSteamLanguage->setVisible(false);
623
+        }
624
+        else if (gameVersion == GameVersion::SteamVersion)
625
+        {
626
+            ui->gbSocialClub->setDisabled(true);
627
+            ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No"))));
628
+            ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
629
+            ui->labSocialClubLanguage->setVisible(false);
630
+            if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined)
631
+            {
632
+                ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
633
+            }
634
+            else
635
+            {
636
+                ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
637
+            }
638
+        }
639
+        else
640
+        {
641
+            ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
642
+            ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
643
+            if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined)
644
+            {
645
+                ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
646
+            }
647
+            else
648
+            {
649
+                ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
650
+            }
651
+            if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined)
652
+            {
653
+                ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
654
+            }
655
+            else
656
+            {
657
+                ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
658
+            }
659
+        }
660
+    }
661
+    else
662
+    {
663
+        ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
664
+    }
665
+#else
666
+    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
667
+#endif
668
+#else
669
+    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
670
+#endif
671
+}
672
+
579 673
 void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
580 674
 {
581 675
     if (checked)

+ 1
- 0
OptionsDialog.h View File

@@ -79,6 +79,7 @@ private:
79 79
     void setupInterfaceSettings();
80 80
     void setupStatisticsSettings();
81 81
     void setupSnapmaticPictureViewer();
82
+    void setupWindowsGameSettings();
82 83
     void applySettings();
83 84
 };
84 85
 

+ 67
- 1
OptionsDialog.ui View File

@@ -382,6 +382,72 @@
382 382
        </item>
383 383
       </layout>
384 384
      </widget>
385
+     <widget class="QWidget" name="tabGame">
386
+      <attribute name="title">
387
+       <string>Game</string>
388
+      </attribute>
389
+      <layout class="QVBoxLayout" name="vlGame">
390
+       <item>
391
+        <widget class="QGroupBox" name="gbSocialClub">
392
+         <property name="title">
393
+          <string>Social Club Version</string>
394
+         </property>
395
+         <layout class="QVBoxLayout" name="vlGameSocialClub">
396
+          <item>
397
+           <widget class="QLabel" name="labSocialClubFound">
398
+            <property name="text">
399
+             <string>Found: %1</string>
400
+            </property>
401
+           </widget>
402
+          </item>
403
+          <item>
404
+           <widget class="QLabel" name="labSocialClubLanguage">
405
+            <property name="text">
406
+             <string>Language: %1</string>
407
+            </property>
408
+           </widget>
409
+          </item>
410
+         </layout>
411
+        </widget>
412
+       </item>
413
+       <item>
414
+        <widget class="QGroupBox" name="gbSteam">
415
+         <property name="title">
416
+          <string>Steam Version</string>
417
+         </property>
418
+         <layout class="QVBoxLayout" name="vlGameSteam">
419
+          <item>
420
+           <widget class="QLabel" name="labSteamFound">
421
+            <property name="text">
422
+             <string>Found: %1</string>
423
+            </property>
424
+           </widget>
425
+          </item>
426
+          <item>
427
+           <widget class="QLabel" name="labSteamLanguage">
428
+            <property name="text">
429
+             <string>Language: %1</string>
430
+            </property>
431
+           </widget>
432
+          </item>
433
+         </layout>
434
+        </widget>
435
+       </item>
436
+       <item>
437
+        <spacer name="vsGame">
438
+         <property name="orientation">
439
+          <enum>Qt::Vertical</enum>
440
+         </property>
441
+         <property name="sizeHint" stdset="0">
442
+          <size>
443
+           <width>0</width>
444
+           <height>0</height>
445
+          </size>
446
+         </property>
447
+        </spacer>
448
+       </item>
449
+      </layout>
450
+     </widget>
385 451
      <widget class="QWidget" name="tabStats">
386 452
       <attribute name="title">
387 453
        <string>Feedback</string>
@@ -473,7 +539,7 @@
473 539
          <property name="title">
474 540
           <string>Other</string>
475 541
          </property>
476
-         <layout class="QVBoxLayout" name="verticalLayout">
542
+         <layout class="QVBoxLayout" name="vlFeedbackOther">
477 543
           <item>
478 544
            <layout class="QHBoxLayout" name="hlParticipation">
479 545
             <item>

+ 40
- 0
PictureDialog.cpp View File

@@ -32,6 +32,7 @@
32 32
 #include "GlobalString.h"
33 33
 #include "UiModLabel.h"
34 34
 #include "AppEnv.h"
35
+#include "config.h"
35 36
 
36 37
 #ifdef GTA5SYNC_WIN
37 38
 #if QT_VERSION >= 0x050200
@@ -45,6 +46,7 @@
45 46
 #include <QJsonDocument>
46 47
 #include <QApplication>
47 48
 #include <QFontMetrics>
49
+#include <QJsonObject>
48 50
 #include <QSizePolicy>
49 51
 #include <QStaticText>
50 52
 #include <QFileDialog>
@@ -67,6 +69,10 @@
67 69
 #include <QUrl>
68 70
 #include <QDir>
69 71
 
72
+#ifdef GTA5SYNC_TELEMETRY
73
+#include "TelemetryClass.h"
74
+#endif
75
+
70 76
 // Macros for better Overview + RAM
71 77
 #define locX QString::number(picture->getSnapmaticProperties().location.x)
72 78
 #define locY QString::number(picture->getSnapmaticProperties().location.y)
@@ -910,6 +916,23 @@ void PictureDialog::openPreviewMap()
910 916
         else
911 917
         {
912 918
             updated();
919
+#ifdef GTA5SYNC_TELEMETRY
920
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
921
+            telemetrySettings.beginGroup("Telemetry");
922
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
923
+            telemetrySettings.endGroup();
924
+            if (pushUsageData && Telemetry->canPush())
925
+            {
926
+                QJsonDocument jsonDocument;
927
+                QJsonObject jsonObject;
928
+                jsonObject["Type"] = "LocationEdited";
929
+                jsonObject["ExtraFlags"] = "Viewer";
930
+                jsonObject["EditedSize"] = QString::number(picture->getContentMaxLength());
931
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
932
+                jsonDocument.setObject(jsonObject);
933
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
934
+            }
935
+#endif
913 936
         }
914 937
     }
915 938
     delete mapLocDialog;
@@ -976,6 +999,23 @@ void PictureDialog::editSnapmaticImage()
976 999
                 return;
977 1000
             }
978 1001
             smpic->emitCustomSignal("PictureUpdated");
1002
+#ifdef GTA5SYNC_TELEMETRY
1003
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
1004
+            telemetrySettings.beginGroup("Telemetry");
1005
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
1006
+            telemetrySettings.endGroup();
1007
+            if (pushUsageData && Telemetry->canPush())
1008
+            {
1009
+                QJsonDocument jsonDocument;
1010
+                QJsonObject jsonObject;
1011
+                jsonObject["Type"] = "ImageEdited";
1012
+                jsonObject["ExtraFlags"] = "Viewer";
1013
+                jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
1014
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
1015
+                jsonDocument.setObject(jsonObject);
1016
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
1017
+            }
1018
+#endif
979 1019
         }
980 1020
         else
981 1021
         {

+ 106
- 1
ProfileInterface.cpp View File

@@ -66,6 +66,12 @@
66 66
 #include <random>
67 67
 #include <ctime>
68 68
 
69
+#ifdef GTA5SYNC_TELEMETRY
70
+#include "TelemetryClass.h"
71
+#include <QJsonDocument>
72
+#include <QJsonObject>
73
+#endif
74
+
69 75
 #define importTimeFormat "HHmmss"
70 76
 #define findRetryLimit 500
71 77
 
@@ -597,6 +603,26 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
597 603
             {
598 604
                 bool success = importSnapmaticPicture(picture, notMultiple);
599 605
                 if (!success) delete picture;
606
+#ifdef GTA5SYNC_TELEMETRY
607
+                if (success)
608
+                {
609
+                    QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
610
+                    telemetrySettings.beginGroup("Telemetry");
611
+                    bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
612
+                    telemetrySettings.endGroup();
613
+                    if (pushUsageData && Telemetry->canPush())
614
+                    {
615
+                        QJsonDocument jsonDocument;
616
+                        QJsonObject jsonObject;
617
+                        jsonObject["Type"] = "ImportSuccess";
618
+                        jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
619
+                        jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
620
+                        jsonObject["ImportType"] = "Snapmatic";
621
+                        jsonDocument.setObject(jsonObject);
622
+                        Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
623
+                    }
624
+                }
625
+#endif
600 626
                 return success;
601 627
             }
602 628
             else
@@ -613,6 +639,25 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
613 639
             {
614 640
                 bool success = importSavegameData(savegame, selectedFile, notMultiple);
615 641
                 if (!success) delete savegame;
642
+#ifdef GTA5SYNC_TELEMETRY
643
+                if (success)
644
+                {
645
+                    QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
646
+                    telemetrySettings.beginGroup("Telemetry");
647
+                    bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
648
+                    telemetrySettings.endGroup();
649
+                    if (pushUsageData && Telemetry->canPush())
650
+                    {
651
+                        QJsonDocument jsonDocument;
652
+                        QJsonObject jsonObject;
653
+                        jsonObject["Type"] = "ImportSuccess";
654
+                        jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
655
+                        jsonObject["ImportType"] = "Savegame";
656
+                        jsonDocument.setObject(jsonObject);
657
+                        Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
658
+                    }
659
+                }
660
+#endif
616 661
                 return success;
617 662
             }
618 663
             else
@@ -767,6 +812,27 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
767 812
                             picture->setPictureTitle(importDialog->getImageTitle());
768 813
                             picture->updateStrings();
769 814
                             success = importSnapmaticPicture(picture, notMultiple);
815
+#ifdef GTA5SYNC_TELEMETRY
816
+                            if (success)
817
+                            {
818
+                                QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
819
+                                telemetrySettings.beginGroup("Telemetry");
820
+                                bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
821
+                                telemetrySettings.endGroup();
822
+                                if (pushUsageData && Telemetry->canPush())
823
+                                {
824
+                                    QJsonDocument jsonDocument;
825
+                                    QJsonObject jsonObject;
826
+                                    jsonObject["Type"] = "ImportSuccess";
827
+                                    jsonObject["ExtraFlag"] = "Dialog";
828
+                                    jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
829
+                                    jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
830
+                                    jsonObject["ImportType"] = "Image";
831
+                                    jsonDocument.setObject(jsonObject);
832
+                                    Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
833
+                                }
834
+                            }
835
+#endif
770 836
                         }
771 837
                     }
772 838
                     else
@@ -794,6 +860,26 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
794 860
                 bool success = importSnapmaticPicture(picture, notMultiple);
795 861
                 delete savegame;
796 862
                 if (!success) delete picture;
863
+#ifdef GTA5SYNC_TELEMETRY
864
+                if (success)
865
+                {
866
+                    QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
867
+                    telemetrySettings.beginGroup("Telemetry");
868
+                    bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
869
+                    telemetrySettings.endGroup();
870
+                    if (pushUsageData && Telemetry->canPush())
871
+                    {
872
+                        QJsonDocument jsonDocument;
873
+                        QJsonObject jsonObject;
874
+                        jsonObject["Type"] = "ImportSuccess";
875
+                        jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
876
+                        jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
877
+                        jsonObject["ImportType"] = "Snapmatic";
878
+                        jsonDocument.setObject(jsonObject);
879
+                        Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
880
+                    }
881
+                }
882
+#endif
797 883
                 return success;
798 884
             }
799 885
             else if (savegame->readingSavegame())
@@ -801,6 +887,25 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
801 887
                 bool success = importSavegameData(savegame, selectedFile, notMultiple);
802 888
                 delete picture;
803 889
                 if (!success) delete savegame;
890
+#ifdef GTA5SYNC_TELEMETRY
891
+                if (success)
892
+                {
893
+                    QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
894
+                    telemetrySettings.beginGroup("Telemetry");
895
+                    bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
896
+                    telemetrySettings.endGroup();
897
+                    if (pushUsageData && Telemetry->canPush())
898
+                    {
899
+                        QJsonDocument jsonDocument;
900
+                        QJsonObject jsonObject;
901
+                        jsonObject["Type"] = "ImportSuccess";
902
+                        jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
903
+                        jsonObject["ImportType"] = "Savegame";
904
+                        jsonDocument.setObject(jsonObject);
905
+                        Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
906
+                    }
907
+                }
908
+#endif
804 909
                 return success;
805 910
             }
806 911
             else
@@ -1326,7 +1431,7 @@ void ProfileInterface::deleteSelected()
1326 1431
                     if (widget->getWidgetType() == "SnapmaticWidget")
1327 1432
                     {
1328 1433
                         SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
1329
-                        if (picWidget->getPicture()->deletePicFile())
1434
+                        if (picWidget->getPicture()->deletePictureFile())
1330 1435
                         {
1331 1436
                             pictureDeleted(picWidget);
1332 1437
                         }

+ 25
- 2
SnapmaticEditor.cpp View File

@@ -22,6 +22,7 @@
22 22
 #include "PlayerListDialog.h"
23 23
 #include "StringParser.h"
24 24
 #include "AppEnv.h"
25
+#include "config.h"
25 26
 #include <QStringListIterator>
26 27
 #include <QStringBuilder>
27 28
 #include <QTextDocument>
@@ -30,6 +31,12 @@
30 31
 #include <QDebug>
31 32
 #include <QFile>
32 33
 
34
+#ifdef GTA5SYNC_TELEMETRY
35
+#include "TelemetryClass.h"
36
+#include <QJsonDocument>
37
+#include <QJsonObject>
38
+#endif
39
+
33 40
 SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileDB, QWidget *parent) :
34 41
     QDialog(parent), crewDB(crewDB), profileDB(profileDB),
35 42
     ui(new Ui::SnapmaticEditor)
@@ -261,11 +268,11 @@ void SnapmaticEditor::setSnapmaticTitle(const QString &title)
261 268
     ui->labTitle->setText(titleStr);
262 269
     if (SnapmaticPicture::verifyTitle(snapmaticTitle))
263 270
     {
264
-        ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</a>").arg(tr("Yes", "Yes, should work fine"))));
271
+        ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes", "Yes, should work fine"))));
265 272
     }
266 273
     else
267 274
     {
268
-        ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</a>").arg(tr("No", "No, could lead to issues"))));
275
+        ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No", "No, could lead to issues"))));
269 276
     }
270 277
 #ifndef Q_OS_ANDROID
271 278
     ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
@@ -332,6 +339,22 @@ void SnapmaticEditor::on_cmdApply_clicked()
332 339
         {
333 340
             smpic->updateStrings();
334 341
             smpic->emitUpdate();
342
+#ifdef GTA5SYNC_TELEMETRY
343
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
344
+            telemetrySettings.beginGroup("Telemetry");
345
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
346
+            telemetrySettings.endGroup();
347
+            if (pushUsageData && Telemetry->canPush())
348
+            {
349
+                QJsonDocument jsonDocument;
350
+                QJsonObject jsonObject;
351
+                jsonObject["Type"] = "PropertyEdited";
352
+                jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
353
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
354
+                jsonDocument.setObject(jsonObject);
355
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
356
+            }
357
+#endif
335 358
         }
336 359
     }
337 360
     close();

+ 60
- 1
SnapmaticWidget.cpp View File

@@ -38,6 +38,12 @@
38 38
 #include <QMenu>
39 39
 #include <QFile>
40 40
 
41
+#ifdef GTA5SYNC_TELEMETRY
42
+#include "TelemetryClass.h"
43
+#include <QJsonDocument>
44
+#include <QJsonObject>
45
+#endif
46
+
41 47
 SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent) :
42 48
     ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), profileName(profileName),
43 49
     ui(new Ui::SnapmaticWidget)
@@ -158,8 +164,24 @@ bool SnapmaticWidget::deletePicture()
158 164
     int uchoice = QMessageBox::question(this, tr("Delete picture"), tr("Are you sure to delete %1 from your Snapmatic pictures?").arg("\""+smpic->getPictureTitle()+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
159 165
     if (uchoice == QMessageBox::Yes)
160 166
     {
161
-        if (smpic->deletePicFile())
167
+        if (smpic->deletePictureFile())
162 168
         {
169
+#ifdef GTA5SYNC_TELEMETRY
170
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
171
+            telemetrySettings.beginGroup("Telemetry");
172
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
173
+            telemetrySettings.endGroup();
174
+            if (pushUsageData && Telemetry->canPush())
175
+            {
176
+                QJsonDocument jsonDocument;
177
+                QJsonObject jsonObject;
178
+                jsonObject["Type"] = "DeleteSuccess";
179
+                jsonObject["DeletedSize"] = QString::number(smpic->getContentMaxLength());
180
+                jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
181
+                jsonDocument.setObject(jsonObject);
182
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
183
+            }
184
+#endif
163 185
             return true;
164 186
         }
165 187
         else
@@ -347,6 +369,23 @@ void SnapmaticWidget::editSnapmaticImage()
347 369
                 return;
348 370
             }
349 371
             smpic->emitCustomSignal("PictureUpdated");
372
+#ifdef GTA5SYNC_TELEMETRY
373
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
374
+            telemetrySettings.beginGroup("Telemetry");
375
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
376
+            telemetrySettings.endGroup();
377
+            if (pushUsageData && Telemetry->canPush())
378
+            {
379
+                QJsonDocument jsonDocument;
380
+                QJsonObject jsonObject;
381
+                jsonObject["Type"] = "ImageEdited";
382
+                jsonObject["ExtraFlags"] = "Interface";
383
+                jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
384
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
385
+                jsonDocument.setObject(jsonObject);
386
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
387
+            }
388
+#endif
350 389
         }
351 390
         else
352 391
         {
@@ -387,6 +426,26 @@ void SnapmaticWidget::openMapViewer()
387 426
             QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
388 427
             picture->setSnapmaticProperties(fallbackProperties);
389 428
         }
429
+#ifdef GTA5SYNC_TELEMETRY
430
+        else
431
+        {
432
+            QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
433
+            telemetrySettings.beginGroup("Telemetry");
434
+            bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
435
+            telemetrySettings.endGroup();
436
+            if (pushUsageData && Telemetry->canPush())
437
+            {
438
+                QJsonDocument jsonDocument;
439
+                QJsonObject jsonObject;
440
+                jsonObject["Type"] = "LocationEdited";
441
+                jsonObject["ExtraFlags"] = "Interface";
442
+                jsonObject["EditedSize"] = QString::number(picture->getContentMaxLength());
443
+                jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
444
+                jsonDocument.setObject(jsonObject);
445
+                Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
446
+            }
447
+        }
448
+#endif
390 449
     }
391 450
     delete mapLocDialog;
392 451
 }

+ 12
- 2
TelemetryClass.cpp View File

@@ -169,6 +169,8 @@ void TelemetryClass::push(TelemetryCategory category)
169 169
         break;
170 170
     case TelemetryCategory::UserFeedback:
171 171
         break;
172
+    case TelemetryCategory::PersonalData:
173
+        break;
172 174
     case TelemetryCategory::CustomEmitted:
173 175
         break;
174 176
     }
@@ -393,6 +395,7 @@ QJsonDocument TelemetryClass::getApplicationConf()
393 395
     QJsonObject startupObject;
394 396
     startupObject["AppStyle"] = settings.value("AppStyle", "System").toString();
395 397
     startupObject["CustomStyle"] = settings.value("CustomStyle", false).toBool();
398
+    startupObject["StartCount"] = QString::number(settings.value("StartCount", 0).toUInt());
396 399
     jsonObject["Startup"] = startupObject;
397 400
     settings.endGroup();
398 401
 
@@ -434,11 +437,14 @@ QString TelemetryClass::categoryToString(TelemetryCategory category)
434 437
     case TelemetryCategory::ApplicationConf:
435 438
         return QString("ApplicationConf");
436 439
         break;
440
+    case TelemetryCategory::ApplicationSpec:
441
+        return QString("ApplicationSpec");
442
+        break;
437 443
     case TelemetryCategory::UserFeedback:
438 444
         return QString("UserFeedback");
439 445
         break;
440
-    case TelemetryCategory::ApplicationSpec:
441
-        return QString("ApplicationSpec");
446
+    case TelemetryCategory::PersonalData:
447
+        return QString("PersonalData");
442 448
         break;
443 449
     case TelemetryCategory::CustomEmitted:
444 450
         return QString("CustomEmitted");
@@ -489,6 +495,10 @@ void TelemetryClass::work_p(bool doWork)
489 495
         {
490 496
             push(TelemetryCategory::ApplicationConf);
491 497
         }
498
+        else
499
+        {
500
+            push(TelemetryCategory::ApplicationConf, QJsonDocument());
501
+        }
492 502
     }
493 503
 }
494 504
 

+ 1
- 1
TelemetryClass.h View File

@@ -25,7 +25,7 @@
25 25
 #include <QString>
26 26
 #include <QUrl>
27 27
 
28
-enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConf = 3, UserFeedback = 4, ApplicationSpec = 5, CustomEmitted = 99};
28
+enum class TelemetryCategory : int { OperatingSystemSpec = 0, HardwareSpec = 1, UserLocaleData = 2, ApplicationConf = 3, UserFeedback = 4, ApplicationSpec = 5, PersonalData = 6, CustomEmitted = 99 };
29 29
 
30 30
 class TelemetryClass : public QObject
31 31
 {

+ 38
- 11
TranslationClass.cpp View File

@@ -517,25 +517,52 @@ QString TranslationClass::getCurrentAreaLanguage()
517 517
     const QStringList areaTranslations = listAreaTranslations();
518 518
     if (userAreaLanguage == "Auto" || userAreaLanguage.trimmed().isEmpty())
519 519
     {
520
+        GameLanguage gameLanguage = AppEnv::getGameLanguage(AppEnv::getGameVersion());
521
+        if (gameLanguage == GameLanguage::Undefined)
522
+        {
520 523
 #ifdef GTA5SYNC_DEBUG
521
-        qDebug() << "autoAreaLanguageMode";
524
+            qDebug() << "autoAreaLanguageModeInterface";
522 525
 #endif
523
-        QString langCode = QString(currentLanguage).replace("-", "_");
524
-        if (areaTranslations.contains(langCode))
525
-        {
526
+            QString langCode = QString(currentLanguage).replace("-", "_");
527
+            if (areaTranslations.contains(langCode))
528
+            {
526 529
 #ifdef GTA5SYNC_DEBUG
527
-            qDebug() << "autoAreaLanguageSelected" << langCode;
530
+                qDebug() << "autoAreaLanguageSelected" << langCode;
528 531
 #endif
529
-            return langCode;
532
+                return langCode;
533
+            }
534
+            else if (langCode.contains("_"))
535
+            {
536
+                langCode = langCode.split("_").at(0);
537
+                if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
538
+#ifdef GTA5SYNC_DEBUG
539
+                qDebug() << "autoAreaLanguageSelected" << langCode;
540
+#endif
541
+                return langCode;
542
+            }
530 543
         }
531
-        else if (langCode.contains("_"))
544
+        else
532 545
         {
533
-            langCode = langCode.split("_").at(0);
534
-            if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
535 546
 #ifdef GTA5SYNC_DEBUG
536
-            qDebug() << "autoAreaLanguageSelected" << langCode;
547
+            qDebug() << "autoAreaLanguageModeGame";
537 548
 #endif
538
-            return langCode;
549
+            QString langCode = AppEnv::gameLanguageToString(gameLanguage).replace("-", "_");
550
+            if (areaTranslations.contains(langCode))
551
+            {
552
+#ifdef GTA5SYNC_DEBUG
553
+                qDebug() << "autoAreaLanguageSelected" << langCode;
554
+#endif
555
+                return langCode;
556
+            }
557
+            else if (langCode.contains("_"))
558
+            {
559
+                langCode = langCode.split("_").at(0);
560
+                if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
561
+#ifdef GTA5SYNC_DEBUG
562
+                qDebug() << "autoAreaLanguageSelected" << langCode;
563
+#endif
564
+                return langCode;
565
+            }
539 566
         }
540 567
     }
541 568
     else if (areaTranslations.contains(userAreaLanguage))

+ 10
- 1
main.cpp View File

@@ -75,6 +75,14 @@ int main(int argc, char *argv[])
75 75
     QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
76 76
     settings.beginGroup("Startup");
77 77
 
78
+#ifdef GTA5SYNC_TELEMETRY
79
+    // Increase Start count at every startup
80
+    uint startCount = settings.value("StartCount", 0).toUInt();
81
+    startCount++;
82
+    settings.setValue("StartCount", startCount);
83
+    settings.sync();
84
+#endif
85
+
78 86
     bool isFirstStart = settings.value("IsFirstStart", true).toBool();
79 87
     bool customStyle = settings.value("CustomStyle", false).toBool();
80 88
     QString appStyle = settings.value("AppStyle", "Default").toString();
@@ -181,7 +189,9 @@ int main(int argc, char *argv[])
181 189
             QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
182 190
             telemetrySettings.beginGroup("Telemetry");
183 191
             telemetrySettings.setValue("PushUsageData", true);
192
+            telemetrySettings.setValue("PushAppConf", true);
184 193
             telemetrySettings.endGroup();
194
+            telemetrySettings.sync();
185 195
             Telemetry->init();
186 196
             Telemetry->work();
187 197
         }
@@ -189,7 +199,6 @@ int main(int argc, char *argv[])
189 199
         delete telemetryDialog;
190 200
     }
191 201
 #endif
192
-
193 202
     settings.endGroup();
194 203
 
195 204
     for (QString currentArg : applicationArgs)

+ 334
- 258
res/gta5sync.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_de.qm View File


+ 335
- 259
res/gta5sync_de.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_en_US.qm View File


+ 335
- 259
res/gta5sync_en_US.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_fr.qm View File


+ 335
- 259
res/gta5sync_fr.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_ru.qm View File


+ 335
- 259
res/gta5sync_ru.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_uk.qm View File


+ 335
- 259
res/gta5sync_uk.ts
File diff suppressed because it is too large
View File


BIN
res/gta5sync_zh_TW.qm View File


+ 335
- 259
res/gta5sync_zh_TW.ts
File diff suppressed because it is too large
View File