added ability to read GTA V game language

This commit is contained in:
Syping 2018-07-28 04:55:55 +02:00
parent c29cc44717
commit 39f20aca9d
30 changed files with 3131 additions and 1856 deletions

View File

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

View File

@ -22,11 +22,6 @@ matrix:
- BUILD_SCRIPT=windows_docker.sh - BUILD_SCRIPT=windows_docker.sh
- QT_SELECT=qt5-x86_64-w64-mingw32 - QT_SELECT=qt5-x86_64-w64-mingw32
- RELEASE_LABEL="Windows 64-Bit Portable" - RELEASE_LABEL="Windows 64-Bit Portable"
- EXECUTABLE_ARCH=_x64
- env:
- BUILD_SCRIPT=windows_docker.sh
- QT_SELECT=qt5-x86_64-w64-mingw32
- PACKAGE_CODE=Dropbox
- env: - env:
- BUILD_SCRIPT=windows_docker.sh - BUILD_SCRIPT=windows_docker.sh
- QT_SELECT=qt5-x86_64-w64-mingw32 - QT_SELECT=qt5-x86_64-w64-mingw32

View File

@ -206,6 +206,292 @@ QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
return getPlayerFetchingUrl(crewID, QString::number(pageNumber)); return getPlayerFetchingUrl(crewID, QString::number(pageNumber));
} }
// Game Stuff
GameVersion AppEnv::getGameVersion()
{
#ifdef GTA5SYNC_WIN
QString argumentValue;
#ifdef _WIN64
argumentValue = "\\WOW6432Node";
#endif
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
QString installFolderSc = registrySettingsSc.value("InstallFolder", "").toString();
QDir installFolderScDir(installFolderSc);
bool scVersionInstalled = false;
if (!installFolderSc.isEmpty() && installFolderScDir.exists())
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "gameVersionFoundSocialClubVersion";
#endif
scVersionInstalled = true;
}
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\GTAV").arg(argumentValue), QSettings::NativeFormat);
QString installFolderSteam = registrySettingsSteam.value("installfoldersteam", "").toString();
if (installFolderSteam.right(5) == "\\GTAV")
{
installFolderSteam = installFolderSteam.remove(installFolderSteam.length() - 5, 5);
}
QDir installFolderSteamDir(installFolderSteam);
bool steamVersionInstalled = false;
if (!installFolderSteam.isEmpty() && installFolderSteamDir.exists())
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "gameVersionFoundSteamVersion";
#endif
steamVersionInstalled = true;
}
if (scVersionInstalled && steamVersionInstalled)
{
return GameVersion::BothVersions;
}
else if (scVersionInstalled)
{
return GameVersion::SocialClubVersion;
}
else if (steamVersionInstalled)
{
return GameVersion::SteamVersion;
}
else
{
return GameVersion::NoVersion;
}
#else
return GameVersion::NoVersion;
#endif
}
GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
{
if (gameVersion == GameVersion::SocialClubVersion)
{
#ifdef GTA5SYNC_WIN
QString argumentValue;
#ifdef _WIN64
argumentValue = "\\WOW6432Node";
#endif
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
QString languageSc = registrySettingsSc.value("Language", "").toString();
return gameLanguageFromString(languageSc);
#else
return GameLanguage::Undefined;
#endif
}
else if (gameVersion == GameVersion::SteamVersion)
{
#ifdef GTA5SYNC_WIN
QString argumentValue;
#ifdef _WIN64
argumentValue = "\\WOW6432Node";
#endif
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
QString languageSteam = registrySettingsSteam.value("Language", "").toString();
return gameLanguageFromString(languageSteam);
#else
return GameLanguage::Undefined;
#endif
}
else
{
return GameLanguage::Undefined;
}
}
GameLanguage AppEnv::gameLanguageFromString(QString gameLanguage)
{
if (gameLanguage == "en-US")
{
return GameLanguage::English;
}
else if (gameLanguage == "fr-FR")
{
return GameLanguage::French;
}
else if (gameLanguage == "it-IT")
{
return GameLanguage::Italian;
}
else if (gameLanguage == "de-DE")
{
return GameLanguage::German;
}
else if (gameLanguage == "es-ES")
{
return GameLanguage::Spanish;
}
else if (gameLanguage == "es-MX")
{
return GameLanguage::Mexican;
}
else if (gameLanguage == "pt-BR")
{
return GameLanguage::Brasilian;
}
else if (gameLanguage == "ru-RU")
{
return GameLanguage::Russian;
}
else if (gameLanguage == "pl-PL")
{
return GameLanguage::Polish;
}
else if (gameLanguage == "ja-JP")
{
return GameLanguage::Japanese;
}
else if (gameLanguage == "zh-CHS")
{
return GameLanguage::SChinese;
}
else if (gameLanguage == "zh-CHT")
{
return GameLanguage::TChinese;
}
else if (gameLanguage == "ko-KR")
{
return GameLanguage::Koreana;
}
else
{
return GameLanguage::Undefined;
}
}
QString AppEnv::gameLanguageToString(GameLanguage gameLanguage)
{
if (gameLanguage == GameLanguage::English)
{
return "en-US";
}
else if (gameLanguage == GameLanguage::French)
{
return "fr-FR";
}
else if (gameLanguage == GameLanguage::Italian)
{
return "it-IT";
}
else if (gameLanguage == GameLanguage::German)
{
return "de-DE";
}
else if (gameLanguage == GameLanguage::Spanish)
{
return "es-ES";
}
else if (gameLanguage == GameLanguage::Mexican)
{
return "es-MX";
}
else if (gameLanguage == GameLanguage::Brasilian)
{
return "pt-BR";
}
else if (gameLanguage == GameLanguage::Russian)
{
return "ru-RU";
}
else if (gameLanguage == GameLanguage::Polish)
{
return "pl-PL";
}
else if (gameLanguage == GameLanguage::Japanese)
{
return "ja-JP";
}
else if (gameLanguage == GameLanguage::SChinese)
{
return "zh-CHS";
}
else if (gameLanguage == GameLanguage::TChinese)
{
return "zh-CHT";
}
else if (gameLanguage == GameLanguage::Koreana)
{
return "ko-KR";
}
else
{
return "Undefinied";
}
}
bool AppEnv::setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage)
{
bool socialClubVersion = false;
bool steamVersion = false;
if (gameVersion == GameVersion::SocialClubVersion)
{
socialClubVersion = true;
}
else if (gameVersion == GameVersion::SteamVersion)
{
steamVersion = true;
}
else if (gameVersion == GameVersion::BothVersions)
{
socialClubVersion = true;
steamVersion = true;
}
else
{
return false;
}
if (socialClubVersion)
{
#ifdef GTA5SYNC_WIN
QString argumentValue;
#ifdef _WIN64
argumentValue = "\\WOW6432Node";
#endif
QSettings registrySettingsSc(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V").arg(argumentValue), QSettings::NativeFormat);
if (gameLanguage != GameLanguage::Undefined)
{
registrySettingsSc.setValue("Language", gameLanguageToString(gameLanguage));
}
else
{
registrySettingsSc.remove("Language");
}
registrySettingsSc.sync();
if (registrySettingsSc.status() != QSettings::NoError)
{
return false;
}
#endif
}
if (steamVersion)
{
#ifdef GTA5SYNC_WIN
QString argumentValue;
#ifdef _WIN64
argumentValue = "\\WOW6432Node";
#endif
QSettings registrySettingsSteam(QString("HKEY_LOCAL_MACHINE\\SOFTWARE%1\\Rockstar Games\\Grand Theft Auto V Steam").arg(argumentValue), QSettings::NativeFormat);
if (gameLanguage != GameLanguage::Undefined)
{
registrySettingsSteam.setValue("Language", gameLanguageToString(gameLanguage));
}
else
{
registrySettingsSteam.remove("Language");
}
registrySettingsSteam.sync();
if (registrySettingsSteam.status() != QSettings::NoError)
{
return false;
}
#endif
}
return true;
}
// Screen Stuff
qreal AppEnv::screenRatio() qreal AppEnv::screenRatio()
{ {
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000

View File

@ -22,6 +22,9 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
enum class GameVersion : int { NoVersion = 0, SocialClubVersion = 1, SteamVersion = 2, BothVersions = 3 };
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 };
class AppEnv class AppEnv
{ {
public: public:
@ -44,6 +47,13 @@ public:
static QUrl getPlayerFetchingUrl(QString crewID, QString pageNumber); static QUrl getPlayerFetchingUrl(QString crewID, QString pageNumber);
static QUrl getPlayerFetchingUrl(QString crewID, int pageNumber); static QUrl getPlayerFetchingUrl(QString crewID, int pageNumber);
// Game Stuff
static GameVersion getGameVersion();
static GameLanguage getGameLanguage(GameVersion gameVersion);
static GameLanguage gameLanguageFromString(QString gameLanguage);
static QString gameLanguageToString(GameLanguage gameLanguage);
static bool setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage);
// Screen Stuff // Screen Stuff
static qreal screenRatio(); static qreal screenRatio();
}; };

View File

@ -63,13 +63,6 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
avatarAreaImage = QImage(":/img/avatarareaimport.png"); avatarAreaImage = QImage(":/img/avatarareaimport.png");
selectedColour = QColor::fromRgb(0, 0, 0, 255); selectedColour = QColor::fromRgb(0, 0, 0, 255);
// Set Import Settings
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Import");
QString currentProfile = settings.value("Profile", "Default").toString();
settings.endGroup();
processSettings(currentProfile);
// Set Icon for OK Button // Set Icon for OK Button
if (QIcon::hasThemeIcon("dialog-ok")) if (QIcon::hasThemeIcon("dialog-ok"))
{ {
@ -95,6 +88,13 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
ui->labBackgroundImage->setText(tr("Background Image:")); ui->labBackgroundImage->setText(tr("Background Image:"));
ui->cmdBackgroundWipe->setVisible(false); ui->cmdBackgroundWipe->setVisible(false);
// Set Import Settings
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Import");
QString currentProfile = settings.value("Profile", "Default").toString();
settings.endGroup();
processSettings(currentProfile);
// DPI calculation // DPI calculation
qreal screenRatio = AppEnv::screenRatio(); qreal screenRatio = AppEnv::screenRatio();
snapmaticResolutionLW = 516 * screenRatio; // 430 snapmaticResolutionLW = 516 * screenRatio; // 430

View File

@ -20,8 +20,10 @@
#include "ui_JsonEditorDialog.h" #include "ui_JsonEditorDialog.h"
#include "SnapmaticEditor.h" #include "SnapmaticEditor.h"
#include "AppEnv.h" #include "AppEnv.h"
#include "config.h"
#include <QStringBuilder> #include <QStringBuilder>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject>
#include <QMessageBox> #include <QMessageBox>
#if QT_VERSION >= 0x050200 #if QT_VERSION >= 0x050200
@ -29,6 +31,10 @@
#include <QDebug> #include <QDebug>
#endif #endif
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#endif
JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) : JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
QDialog(parent), smpic(picture), QDialog(parent), smpic(picture),
ui(new Ui::JsonEditorDialog) ui(new Ui::JsonEditorDialog)
@ -185,6 +191,22 @@ bool JsonEditorDialog::saveJsonContent()
jsonCode = newCode; jsonCode = newCode;
smpic->updateStrings(); smpic->updateStrings();
smpic->emitUpdate(); smpic->emitUpdate();
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "JSONEdited";
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
return true; return true;
} }
return true; return true;
@ -198,13 +220,13 @@ bool JsonEditorDialog::saveJsonContent()
void JsonEditorDialog::on_cmdClose_clicked() void JsonEditorDialog::on_cmdClose_clicked()
{ {
this->close(); close();
} }
void JsonEditorDialog::on_cmdSave_clicked() void JsonEditorDialog::on_cmdSave_clicked()
{ {
if (saveJsonContent()) if (saveJsonContent())
{ {
this->close(); close();
} }
} }

View File

@ -103,6 +103,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
setupInterfaceSettings(); setupInterfaceSettings();
setupStatisticsSettings(); setupStatisticsSettings();
setupSnapmaticPictureViewer(); setupSnapmaticPictureViewer();
setupWindowsGameSettings();
#ifndef Q_QS_ANDROID #ifndef Q_QS_ANDROID
// DPI calculation // DPI calculation
@ -110,7 +111,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
resize(435 * screenRatio, 405 * screenRatio); resize(435 * screenRatio, 405 * screenRatio);
#endif #endif
this->setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR)); setWindowTitle(windowTitle().arg(GTA5SYNC_APPSTR));
} }
OptionsDialog::~OptionsDialog() OptionsDialog::~OptionsDialog()
@ -150,9 +151,21 @@ void OptionsDialog::setupLanguageBox()
currentAreaLanguage = settings->value("AreaLanguage", "Auto").toString(); currentAreaLanguage = settings->value("AreaLanguage", "Auto").toString();
settings->endGroup(); settings->endGroup();
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", QString cbSysStr = tr("%1 (Language priority)", "First language a person can talk with a different person/application. \"Native\" or \"Not Native\".").arg(tr("System",
"System in context of System default")); "System in context of System default"));
#ifdef GTA5SYNC_WIN
QString cbAutoStr;
if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined)
{
cbAutoStr = tr("%1 (Game language)", "Next closest language compared to the Game settings").arg(tr("Auto", "Automatic language choice."));
}
else
{
cbAutoStr = tr("%1 (Closest to Interface)", "Next closest language compared to the Interface").arg(tr("Auto", "Automatic language choice."));
}
#else
QString cbAutoStr = tr("%1 (Closest to Interface)", "Next closest language compared to the Interface").arg(tr("Auto", "Automatic language choice.")); QString cbAutoStr = tr("%1 (Closest to Interface)", "Next closest language compared to the Interface").arg(tr("Auto", "Automatic language choice."));
#endif
ui->cbLanguage->addItem(cbSysStr, "System"); ui->cbLanguage->addItem(cbSysStr, "System");
ui->cbAreaLanguage->addItem(cbAutoStr, "Auto"); ui->cbAreaLanguage->addItem(cbAutoStr, "Auto");
@ -412,6 +425,15 @@ void OptionsDialog::applySettings()
settings->endGroup(); settings->endGroup();
Telemetry->refresh(); Telemetry->refresh();
Telemetry->work(); Telemetry->work();
if (ui->cbUsageData->isChecked() && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "SettingsUpdated";
jsonObject["UpdateTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif #endif
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@ -432,6 +454,7 @@ void OptionsDialog::applySettings()
Translator->initUserLanguage(); Translator->initUserLanguage();
} }
settings->sync();
emit settingsApplied(newContentMode, languageChanged); emit settingsApplied(newContentMode, languageChanged);
if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder)) if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder))
@ -576,6 +599,77 @@ void OptionsDialog::setupStatisticsSettings()
#endif #endif
} }
void OptionsDialog::setupWindowsGameSettings()
{
#ifdef GTA5SYNC_GAME
GameVersion gameVersion = AppEnv::getGameVersion();
#ifdef GTA5SYNC_WIN
if (gameVersion != GameVersion::NoVersion)
{
if (gameVersion == GameVersion::SocialClubVersion)
{
ui->gbSteam->setDisabled(true);
ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No"))));
if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined)
{
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
}
else
{
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
}
ui->labSteamLanguage->setVisible(false);
}
else if (gameVersion == GameVersion::SteamVersion)
{
ui->gbSocialClub->setDisabled(true);
ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No"))));
ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
ui->labSocialClubLanguage->setVisible(false);
if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined)
{
ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
}
else
{
ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
}
}
else
{
ui->labSocialClubFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
ui->labSteamFound->setText(tr("Found: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes"))));
if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined)
{
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
}
else
{
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
}
if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined)
{
ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
}
else
{
ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
}
}
}
else
{
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
}
#else
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
#endif
#else
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
#endif
}
void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked) void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
{ {
if (checked) if (checked)

View File

@ -79,6 +79,7 @@ private:
void setupInterfaceSettings(); void setupInterfaceSettings();
void setupStatisticsSettings(); void setupStatisticsSettings();
void setupSnapmaticPictureViewer(); void setupSnapmaticPictureViewer();
void setupWindowsGameSettings();
void applySettings(); void applySettings();
}; };

View File

@ -382,6 +382,72 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabGame">
<attribute name="title">
<string>Game</string>
</attribute>
<layout class="QVBoxLayout" name="vlGame">
<item>
<widget class="QGroupBox" name="gbSocialClub">
<property name="title">
<string>Social Club Version</string>
</property>
<layout class="QVBoxLayout" name="vlGameSocialClub">
<item>
<widget class="QLabel" name="labSocialClubFound">
<property name="text">
<string>Found: %1</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labSocialClubLanguage">
<property name="text">
<string>Language: %1</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbSteam">
<property name="title">
<string>Steam Version</string>
</property>
<layout class="QVBoxLayout" name="vlGameSteam">
<item>
<widget class="QLabel" name="labSteamFound">
<property name="text">
<string>Found: %1</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labSteamLanguage">
<property name="text">
<string>Language: %1</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="vsGame">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabStats"> <widget class="QWidget" name="tabStats">
<attribute name="title"> <attribute name="title">
<string>Feedback</string> <string>Feedback</string>
@ -473,7 +539,7 @@
<property name="title"> <property name="title">
<string>Other</string> <string>Other</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="vlFeedbackOther">
<item> <item>
<layout class="QHBoxLayout" name="hlParticipation"> <layout class="QHBoxLayout" name="hlParticipation">
<item> <item>

View File

@ -32,6 +32,7 @@
#include "GlobalString.h" #include "GlobalString.h"
#include "UiModLabel.h" #include "UiModLabel.h"
#include "AppEnv.h" #include "AppEnv.h"
#include "config.h"
#ifdef GTA5SYNC_WIN #ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050200 #if QT_VERSION >= 0x050200
@ -45,6 +46,7 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QApplication> #include <QApplication>
#include <QFontMetrics> #include <QFontMetrics>
#include <QJsonObject>
#include <QSizePolicy> #include <QSizePolicy>
#include <QStaticText> #include <QStaticText>
#include <QFileDialog> #include <QFileDialog>
@ -67,6 +69,10 @@
#include <QUrl> #include <QUrl>
#include <QDir> #include <QDir>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#endif
// Macros for better Overview + RAM // Macros for better Overview + RAM
#define locX QString::number(picture->getSnapmaticProperties().location.x) #define locX QString::number(picture->getSnapmaticProperties().location.x)
#define locY QString::number(picture->getSnapmaticProperties().location.y) #define locY QString::number(picture->getSnapmaticProperties().location.y)
@ -910,6 +916,23 @@ void PictureDialog::openPreviewMap()
else else
{ {
updated(); updated();
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "LocationEdited";
jsonObject["ExtraFlags"] = "Viewer";
jsonObject["EditedSize"] = QString::number(picture->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
} }
} }
delete mapLocDialog; delete mapLocDialog;
@ -976,6 +999,23 @@ void PictureDialog::editSnapmaticImage()
return; return;
} }
smpic->emitCustomSignal("PictureUpdated"); smpic->emitCustomSignal("PictureUpdated");
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImageEdited";
jsonObject["ExtraFlags"] = "Viewer";
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
} }
else else
{ {

View File

@ -66,6 +66,12 @@
#include <random> #include <random>
#include <ctime> #include <ctime>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#include <QJsonDocument>
#include <QJsonObject>
#endif
#define importTimeFormat "HHmmss" #define importTimeFormat "HHmmss"
#define findRetryLimit 500 #define findRetryLimit 500
@ -597,6 +603,26 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
{ {
bool success = importSnapmaticPicture(picture, notMultiple); bool success = importSnapmaticPicture(picture, notMultiple);
if (!success) delete picture; if (!success) delete picture;
#ifdef GTA5SYNC_TELEMETRY
if (success)
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImportSuccess";
jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonObject["ImportType"] = "Snapmatic";
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
return success; return success;
} }
else else
@ -613,6 +639,25 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
{ {
bool success = importSavegameData(savegame, selectedFile, notMultiple); bool success = importSavegameData(savegame, selectedFile, notMultiple);
if (!success) delete savegame; if (!success) delete savegame;
#ifdef GTA5SYNC_TELEMETRY
if (success)
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImportSuccess";
jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonObject["ImportType"] = "Savegame";
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
return success; return success;
} }
else else
@ -767,6 +812,27 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
picture->setPictureTitle(importDialog->getImageTitle()); picture->setPictureTitle(importDialog->getImageTitle());
picture->updateStrings(); picture->updateStrings();
success = importSnapmaticPicture(picture, notMultiple); success = importSnapmaticPicture(picture, notMultiple);
#ifdef GTA5SYNC_TELEMETRY
if (success)
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImportSuccess";
jsonObject["ExtraFlag"] = "Dialog";
jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonObject["ImportType"] = "Image";
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
} }
} }
else else
@ -794,6 +860,26 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
bool success = importSnapmaticPicture(picture, notMultiple); bool success = importSnapmaticPicture(picture, notMultiple);
delete savegame; delete savegame;
if (!success) delete picture; if (!success) delete picture;
#ifdef GTA5SYNC_TELEMETRY
if (success)
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImportSuccess";
jsonObject["ImportSize"] = QString::number(picture->getContentMaxLength());
jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonObject["ImportType"] = "Snapmatic";
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
return success; return success;
} }
else if (savegame->readingSavegame()) else if (savegame->readingSavegame())
@ -801,6 +887,25 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
bool success = importSavegameData(savegame, selectedFile, notMultiple); bool success = importSavegameData(savegame, selectedFile, notMultiple);
delete picture; delete picture;
if (!success) delete savegame; if (!success) delete savegame;
#ifdef GTA5SYNC_TELEMETRY
if (success)
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImportSuccess";
jsonObject["ImportTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonObject["ImportType"] = "Savegame";
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
return success; return success;
} }
else else
@ -1326,7 +1431,7 @@ void ProfileInterface::deleteSelected()
if (widget->getWidgetType() == "SnapmaticWidget") if (widget->getWidgetType() == "SnapmaticWidget")
{ {
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget); SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(widget);
if (picWidget->getPicture()->deletePicFile()) if (picWidget->getPicture()->deletePictureFile())
{ {
pictureDeleted(picWidget); pictureDeleted(picWidget);
} }

View File

@ -22,6 +22,7 @@
#include "PlayerListDialog.h" #include "PlayerListDialog.h"
#include "StringParser.h" #include "StringParser.h"
#include "AppEnv.h" #include "AppEnv.h"
#include "config.h"
#include <QStringListIterator> #include <QStringListIterator>
#include <QStringBuilder> #include <QStringBuilder>
#include <QTextDocument> #include <QTextDocument>
@ -30,6 +31,12 @@
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#include <QJsonDocument>
#include <QJsonObject>
#endif
SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileDB, QWidget *parent) : SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileDB, QWidget *parent) :
QDialog(parent), crewDB(crewDB), profileDB(profileDB), QDialog(parent), crewDB(crewDB), profileDB(profileDB),
ui(new Ui::SnapmaticEditor) ui(new Ui::SnapmaticEditor)
@ -261,11 +268,11 @@ void SnapmaticEditor::setSnapmaticTitle(const QString &title)
ui->labTitle->setText(titleStr); ui->labTitle->setText(titleStr);
if (SnapmaticPicture::verifyTitle(snapmaticTitle)) if (SnapmaticPicture::verifyTitle(snapmaticTitle))
{ {
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</a>").arg(tr("Yes", "Yes, should work fine")))); ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: green\">%1</span>").arg(tr("Yes", "Yes, should work fine"))));
} }
else else
{ {
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</a>").arg(tr("No", "No, could lead to issues")))); ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</span>").arg(tr("No", "No, could lead to issues"))));
} }
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width())); ui->gbValues->resize(ui->gbValues->width(), ui->gbValues->heightForWidth(ui->gbValues->width()));
@ -332,6 +339,22 @@ void SnapmaticEditor::on_cmdApply_clicked()
{ {
smpic->updateStrings(); smpic->updateStrings();
smpic->emitUpdate(); smpic->emitUpdate();
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "PropertyEdited";
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
} }
} }
close(); close();

View File

@ -38,6 +38,12 @@
#include <QMenu> #include <QMenu>
#include <QFile> #include <QFile>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#include <QJsonDocument>
#include <QJsonObject>
#endif
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent) : SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent) :
ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), profileName(profileName), ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), profileName(profileName),
ui(new Ui::SnapmaticWidget) ui(new Ui::SnapmaticWidget)
@ -158,8 +164,24 @@ bool SnapmaticWidget::deletePicture()
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); 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);
if (uchoice == QMessageBox::Yes) if (uchoice == QMessageBox::Yes)
{ {
if (smpic->deletePicFile()) if (smpic->deletePictureFile())
{ {
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "DeleteSuccess";
jsonObject["DeletedSize"] = QString::number(smpic->getContentMaxLength());
jsonObject["DeletedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
return true; return true;
} }
else else
@ -347,6 +369,23 @@ void SnapmaticWidget::editSnapmaticImage()
return; return;
} }
smpic->emitCustomSignal("PictureUpdated"); smpic->emitCustomSignal("PictureUpdated");
#ifdef GTA5SYNC_TELEMETRY
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "ImageEdited";
jsonObject["ExtraFlags"] = "Interface";
jsonObject["EditedSize"] = QString::number(smpic->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
#endif
} }
else else
{ {
@ -387,6 +426,26 @@ void SnapmaticWidget::openMapViewer()
QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error")); QMessageBox::warning(this, SnapmaticEditor::tr("Snapmatic Properties"), SnapmaticEditor::tr("Patching of Snapmatic Properties failed because of I/O Error"));
picture->setSnapmaticProperties(fallbackProperties); picture->setSnapmaticProperties(fallbackProperties);
} }
#ifdef GTA5SYNC_TELEMETRY
else
{
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry");
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
telemetrySettings.endGroup();
if (pushUsageData && Telemetry->canPush())
{
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "LocationEdited";
jsonObject["ExtraFlags"] = "Interface";
jsonObject["EditedSize"] = QString::number(picture->getContentMaxLength());
jsonObject["EditedTime"] = QString::number(QDateTime::currentDateTimeUtc().toTime_t());
jsonDocument.setObject(jsonObject);
Telemetry->push(TelemetryCategory::PersonalData, jsonDocument);
}
}
#endif
} }
delete mapLocDialog; delete mapLocDialog;
} }

View File

@ -169,6 +169,8 @@ void TelemetryClass::push(TelemetryCategory category)
break; break;
case TelemetryCategory::UserFeedback: case TelemetryCategory::UserFeedback:
break; break;
case TelemetryCategory::PersonalData:
break;
case TelemetryCategory::CustomEmitted: case TelemetryCategory::CustomEmitted:
break; break;
} }
@ -393,6 +395,7 @@ QJsonDocument TelemetryClass::getApplicationConf()
QJsonObject startupObject; QJsonObject startupObject;
startupObject["AppStyle"] = settings.value("AppStyle", "System").toString(); startupObject["AppStyle"] = settings.value("AppStyle", "System").toString();
startupObject["CustomStyle"] = settings.value("CustomStyle", false).toBool(); startupObject["CustomStyle"] = settings.value("CustomStyle", false).toBool();
startupObject["StartCount"] = QString::number(settings.value("StartCount", 0).toUInt());
jsonObject["Startup"] = startupObject; jsonObject["Startup"] = startupObject;
settings.endGroup(); settings.endGroup();
@ -434,11 +437,14 @@ QString TelemetryClass::categoryToString(TelemetryCategory category)
case TelemetryCategory::ApplicationConf: case TelemetryCategory::ApplicationConf:
return QString("ApplicationConf"); return QString("ApplicationConf");
break; break;
case TelemetryCategory::ApplicationSpec:
return QString("ApplicationSpec");
break;
case TelemetryCategory::UserFeedback: case TelemetryCategory::UserFeedback:
return QString("UserFeedback"); return QString("UserFeedback");
break; break;
case TelemetryCategory::ApplicationSpec: case TelemetryCategory::PersonalData:
return QString("ApplicationSpec"); return QString("PersonalData");
break; break;
case TelemetryCategory::CustomEmitted: case TelemetryCategory::CustomEmitted:
return QString("CustomEmitted"); return QString("CustomEmitted");
@ -489,6 +495,10 @@ void TelemetryClass::work_p(bool doWork)
{ {
push(TelemetryCategory::ApplicationConf); push(TelemetryCategory::ApplicationConf);
} }
else
{
push(TelemetryCategory::ApplicationConf, QJsonDocument());
}
} }
} }

View File

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

View File

@ -517,25 +517,52 @@ QString TranslationClass::getCurrentAreaLanguage()
const QStringList areaTranslations = listAreaTranslations(); const QStringList areaTranslations = listAreaTranslations();
if (userAreaLanguage == "Auto" || userAreaLanguage.trimmed().isEmpty()) if (userAreaLanguage == "Auto" || userAreaLanguage.trimmed().isEmpty())
{ {
#ifdef GTA5SYNC_DEBUG GameLanguage gameLanguage = AppEnv::getGameLanguage(AppEnv::getGameVersion());
qDebug() << "autoAreaLanguageMode"; if (gameLanguage == GameLanguage::Undefined)
#endif
QString langCode = QString(currentLanguage).replace("-", "_");
if (areaTranslations.contains(langCode))
{ {
#ifdef GTA5SYNC_DEBUG #ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode; qDebug() << "autoAreaLanguageModeInterface";
#endif #endif
return langCode; QString langCode = QString(currentLanguage).replace("-", "_");
if (areaTranslations.contains(langCode))
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode;
#endif
return langCode;
}
else if (langCode.contains("_"))
{
langCode = langCode.split("_").at(0);
if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
#ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode;
#endif
return langCode;
}
} }
else if (langCode.contains("_")) else
{ {
langCode = langCode.split("_").at(0);
if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
#ifdef GTA5SYNC_DEBUG #ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode; qDebug() << "autoAreaLanguageModeGame";
#endif #endif
return langCode; QString langCode = AppEnv::gameLanguageToString(gameLanguage).replace("-", "_");
if (areaTranslations.contains(langCode))
{
#ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode;
#endif
return langCode;
}
else if (langCode.contains("_"))
{
langCode = langCode.split("_").at(0);
if (!areaTranslations.contains(langCode)) goto outputDefaultLanguage;
#ifdef GTA5SYNC_DEBUG
qDebug() << "autoAreaLanguageSelected" << langCode;
#endif
return langCode;
}
} }
} }
else if (areaTranslations.contains(userAreaLanguage)) else if (areaTranslations.contains(userAreaLanguage))

View File

@ -75,6 +75,14 @@ int main(int argc, char *argv[])
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR); QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("Startup"); settings.beginGroup("Startup");
#ifdef GTA5SYNC_TELEMETRY
// Increase Start count at every startup
uint startCount = settings.value("StartCount", 0).toUInt();
startCount++;
settings.setValue("StartCount", startCount);
settings.sync();
#endif
bool isFirstStart = settings.value("IsFirstStart", true).toBool(); bool isFirstStart = settings.value("IsFirstStart", true).toBool();
bool customStyle = settings.value("CustomStyle", false).toBool(); bool customStyle = settings.value("CustomStyle", false).toBool();
QString appStyle = settings.value("AppStyle", "Default").toString(); QString appStyle = settings.value("AppStyle", "Default").toString();
@ -181,7 +189,9 @@ int main(int argc, char *argv[])
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR); QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
telemetrySettings.beginGroup("Telemetry"); telemetrySettings.beginGroup("Telemetry");
telemetrySettings.setValue("PushUsageData", true); telemetrySettings.setValue("PushUsageData", true);
telemetrySettings.setValue("PushAppConf", true);
telemetrySettings.endGroup(); telemetrySettings.endGroup();
telemetrySettings.sync();
Telemetry->init(); Telemetry->init();
Telemetry->work(); Telemetry->work();
} }
@ -189,7 +199,6 @@ int main(int argc, char *argv[])
delete telemetryDialog; delete telemetryDialog;
} }
#endif #endif
settings.endGroup(); settings.endGroup();
for (QString currentArg : applicationArgs) for (QString currentArg : applicationArgs)

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff