add donation system

1.10.x
Syping 2 years ago
parent 04603af8ff
commit 817f356b33
  1. 2
      .ci/debian_build.sh
  2. 1
      .ci/donate.txt
  3. 2
      .ci/osx_build.sh
  4. 2
      .ci/windows_build.sh
  5. 2
      .ci/wininstall_build.sh
  6. 2
      .flatpak/de.syping.gta5view.yaml
  7. 16
      CMakeLists.txt
  8. 147
      OptionsDialog.cpp
  9. 197
      UserInterface.cpp
  10. 5
      UserInterface.h
  11. BIN
      res/btc.svgz
  12. 9
      res/donate.qrc
  13. BIN
      res/eth.svgz
  14. 212
      res/gta5sync.ts
  15. BIN
      res/gta5sync_de.qm
  16. 212
      res/gta5sync_de.ts
  17. 212
      res/gta5sync_en_US.ts
  18. BIN
      res/gta5sync_fr.qm
  19. 216
      res/gta5sync_fr.ts
  20. BIN
      res/gta5sync_ko.qm
  21. 216
      res/gta5sync_ko.ts
  22. BIN
      res/gta5sync_ru.qm
  23. 216
      res/gta5sync_ru.ts
  24. BIN
      res/gta5sync_uk.qm
  25. 216
      res/gta5sync_uk.ts
  26. BIN
      res/gta5sync_zh_TW.qm
  27. 216
      res/gta5sync_zh_TW.ts
  28. BIN
      res/ltc.svgz
  29. BIN
      res/qt6/qtbase_de.qm
  30. BIN
      res/qt6/qtbase_zh_TW.qm
  31. BIN
      res/xmr.svgz
  32. BIN
      res/zec.svgz

@ -28,7 +28,9 @@ cmake \
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
"-DWITH_DONATE=ON" \
"-DWITH_TELEMETRY=ON" \
"-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
"-DQCONF_BUILD=ON" \
../../ && \

@ -0,0 +1 @@
btc:187NSQSPzdMpQDGhxZAuw4AhZ7LgoAPV7D,eth:0x19d71DfCa86104d37a13D3c5d419936421CDC569,ltc:LKr6yvBoMMGmcxViS8Kc1A2sDjVSWTXn4m,xmr:43TB3ZMP5nk1pu5EQXRGPzdTKvmFEBGgccX3tNhRknLLiUYQ7z7dNedVHEA6WrWdByZv1isvFmjSGhCF7ddx3eRxFdm5Fzz,zec:t1SpfDKj6qGZFwyRdzJBw9w2PTj8rUixZGh

@ -14,7 +14,9 @@ cd build && \
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
"-DWITH_DONATE=ON" \
"-DWITH_TELEMETRY=ON" \
"-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
../ && \
make -j 4 && \

@ -17,7 +17,9 @@ mingw64-qt-cmake \
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
"-DWITH_DONATE=ON" \
"-DWITH_TELEMETRY=ON" \
"-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
.. && \
make -j 4 && \

@ -13,7 +13,9 @@ mingw64-qt-cmake \
"-DGTA5VIEW_BUILDCODE=${PACKAGE_CODE}" \
"-DGTA5VIEW_APPVER=${APPLICATION_VERSION}" \
"-DGTA5VIEW_COMMIT=${APPLICATION_COMMIT}" \
"-DWITH_DONATE=ON" \
"-DWITH_TELEMETRY=ON" \
"-DDONATE_ADDRESSES=$(cat ${PROJECT_DIR}/.ci/donate.txt)" \
"-DTELEMETRY_WEBURL=https://dev.syping.de/gta5view-userstats/" \
"-DQCONF_BUILD=ON" \
"-DGTA5VIEW_INLANG=RUNDIR:SEPARATOR:lang" \

@ -15,6 +15,8 @@ modules:
config-opts:
- -DFLATPAK_BUILD=ON
- -DQCONF_BUILD=ON
- -DGTA5VIEW_BUILDCODE=Flatpak
- -DGTA5VIEW_BUILDTYPE=Release
sources:
- type: dir
path: ../

@ -217,6 +217,22 @@ if(FLATPAK_BUILD)
)
endif()
option(WITH_DONATE "Donate menu option and donation dialog" OFF)
if(WITH_DONATE)
set(DONATE_ADDRESSES "" CACHE STRING "Donation addresses")
list(APPEND GTA5VIEW_DEFINES
-DGTA5SYNC_DONATE
)
list(APPEND GTA5VIEW_RESOURCES
res/donate.qrc
)
if(DONATE_ADDRESSES)
list(APPEND GTA5VIEW_DEFINES
"-DGTA5SYNC_DONATE_ADDRESSES=\"${DONATE_ADDRESSES}\""
)
endif()
endif()
option(WITH_MOTD "Developer message system directed to users" OFF)
if(WITH_MOTD)
set(MOTD_WEBURL "" CACHE STRING "Messages WebURL")

@ -234,15 +234,12 @@ void OptionsDialog::setupLanguageBox()
availableLanguages.removeDuplicates();
availableLanguages.sort();
for (QString lang : availableLanguages)
{
for (QString lang : availableLanguages) {
// correcting Language Location if possible
QString aLang = lang;
if (QFile::exists(":/global/global." % lang % ".loc"))
{
if (QFile::exists(":/global/global." % lang % ".loc")) {
QFile locFile(":/global/global." % lang % ".loc");
if (locFile.open(QFile::ReadOnly))
{
if (locFile.open(QFile::ReadOnly)) {
aLang = QString::fromUtf8(locFile.readLine()).trimmed();
locFile.close();
}
@ -253,8 +250,7 @@ void OptionsDialog::setupLanguageBox()
QString langIconStr = "flag-" % TranslationClass::getCountryCode(langLocale);
ui->cbAreaLanguage->addItem(QIcon::fromTheme(langIconStr), cbLangStr, lang);
if (currentAreaLanguage == lang)
{
if (currentAreaLanguage == lang) {
#if QT_VERSION >= 0x050000
ui->cbAreaLanguage->setCurrentText(cbLangStr);
#else
@ -265,8 +261,7 @@ void OptionsDialog::setupLanguageBox()
}
QString aCurrentAreaLanguage = Translator->getCurrentAreaLanguage();
if (QFile::exists(":/global/global." % aCurrentAreaLanguage % ".loc"))
{
if (QFile::exists(":/global/global." % aCurrentAreaLanguage % ".loc")) {
qDebug() << "locFile found";
QFile locFile(":/global/global." % aCurrentAreaLanguage % ".loc");
if (locFile.open(QFile::ReadOnly))
@ -286,10 +281,8 @@ void OptionsDialog::setupRadioButtons()
contentMode = settings->value("ContentMode", 0).toInt(&contentModeOk);
settings->endGroup();
if (contentModeOk)
{
switch (contentMode)
{
if (contentModeOk) {
switch (contentMode) {
case 0:
case 20:
ui->rbModern->setChecked(true);
@ -329,8 +322,7 @@ void OptionsDialog::setupInterfaceSettings()
currentIndex++;
}
}
else
{
else {
if (availableStyles.contains(currentStyle, Qt::CaseInsensitive)) {
int currentIndex = 0;
for (const QString &currentStyleFF : availableStyles) {
@ -379,16 +371,13 @@ void OptionsDialog::applySettings()
settings->beginGroup("Profile");
int newContentMode = 20;
if (ui->rbModern->isChecked())
{
if (ui->rbModern->isChecked()) {
newContentMode = 20;
}
else if (ui->rbClassic->isChecked())
{
else if (ui->rbClassic->isChecked()) {
newContentMode = 10;
}
if (ui->cbDoubleclick->isChecked())
{
if (ui->cbDoubleclick->isChecked()) {
newContentMode++;
}
settings->setValue("ContentMode", newContentMode);
@ -400,18 +389,15 @@ void OptionsDialog::applySettings()
settings->endGroup();
settings->beginGroup("Pictures");
if (ui->cbPicCustomQuality->isChecked())
{
if (ui->cbPicCustomQuality->isChecked()) {
settings->setValue("CustomQuality", ui->hsPicQuality->value());
}
settings->setValue("CustomQualityEnabled", ui->cbPicCustomQuality->isChecked());
QString sizeMode = "Default";
if (ui->rbPicDesktopRes->isChecked())
{
if (ui->rbPicDesktopRes->isChecked()) {
sizeMode = "Desktop";
}
else if (ui->rbPicCustomRes->isChecked())
{
else if (ui->rbPicCustomRes->isChecked()) {
sizeMode = "Custom";
settings->setValue("CustomSize", QSize(ui->sbPicExportWidth->value(), ui->sbPicExportHeight->value()));
}
@ -456,8 +442,7 @@ void OptionsDialog::applySettings()
settings->endGroup();
Telemetry->refresh();
Telemetry->work();
if (ui->cbUsageData->isChecked() && Telemetry->canPush())
{
if (ui->cbUsageData->isChecked() && Telemetry->canPush()) {
QJsonDocument jsonDocument;
QJsonObject jsonObject;
jsonObject["Type"] = "SettingsUpdated";
@ -478,22 +463,19 @@ void OptionsDialog::applySettings()
bool languageChanged = ui->cbLanguage->itemData(ui->cbLanguage->currentIndex()).toString() != currentLanguage;
bool languageAreaChanged = ui->cbAreaLanguage->itemData(ui->cbLanguage->currentIndex()).toString() != currentAreaLanguage;
#endif
if (languageChanged)
{
if (languageChanged) {
Translator->unloadTranslation(qApp);
Translator->initUserLanguage();
Translator->loadTranslation(qApp);
}
else if (languageAreaChanged)
{
else if (languageAreaChanged) {
Translator->initUserLanguage();
}
settings->sync();
emit settingsApplied(newContentMode, languageChanged);
if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder))
{
if ((forceCustomFolder && ui->txtFolder->text() != currentCFolder) || (forceCustomFolder != currentFFolder && forceCustomFolder)) {
QMessageBox::information(this, tr("%1", "%1").arg(GTA5SYNC_APPSTR), tr("The new Custom Folder will initialise after you restart %1.").arg(GTA5SYNC_APPSTR));
}
}
@ -510,11 +492,9 @@ void OptionsDialog::setupDefaultProfile()
void OptionsDialog::commitProfiles(const QStringList &profiles)
{
for (QString profile : profiles)
{
for (QString profile : profiles) {
ui->cbProfiles->addItem(tr("Profile: %1").arg(profile), profile);
if (defaultProfile == profile)
{
if (defaultProfile == profile) {
#if QT_VERSION >= 0x050000
ui->cbProfiles->setCurrentText(tr("Profile: %1").arg(profile));
#else
@ -552,8 +532,7 @@ void OptionsDialog::setupPictureSettings()
// Quality Settings
customQuality = settings->value("CustomQuality", defaultQuality).toInt();
if (customQuality < 1 || customQuality > 100)
{
if (customQuality < 1 || customQuality > 100) {
customQuality = 100;
}
ui->hsPicQuality->setValue(customQuality);
@ -561,42 +540,34 @@ void OptionsDialog::setupPictureSettings()
// Size Settings
cusExportSize = settings->value("CustomSize", defExportSize).toSize();
if (cusExportSize.width() > 3840)
{
if (cusExportSize.width() > 3840) {
cusExportSize.setWidth(3840);
}
else if (cusExportSize.height() > 2160)
{
else if (cusExportSize.height() > 2160) {
cusExportSize.setHeight(2160);
}
if (cusExportSize.width() < 1)
{
if (cusExportSize.width() < 1) {
cusExportSize.setWidth(1);
}
else if (cusExportSize.height() < 1)
{
else if (cusExportSize.height() < 1) {
cusExportSize.setHeight(1);
}
ui->sbPicExportWidth->setValue(cusExportSize.width());
ui->sbPicExportHeight->setValue(cusExportSize.height());
QString sizeMode = settings->value("ExportSizeMode", "Default").toString();
if (sizeMode == "Desktop")
{
if (sizeMode == "Desktop") {
ui->rbPicDesktopRes->setChecked(true);
}
else if (sizeMode == "Custom")
{
else if (sizeMode == "Custom") {
ui->rbPicCustomRes->setChecked(true);
}
else
{
else {
ui->rbPicDefaultRes->setChecked(true);
}
aspectRatio = (Qt::AspectRatioMode)settings->value("AspectRatio", Qt::KeepAspectRatio).toInt();
if (aspectRatio == Qt::IgnoreAspectRatio)
{
if (aspectRatio == Qt::IgnoreAspectRatio) {
ui->cbIgnoreAspectRatio->setChecked(true);
}
@ -615,17 +586,14 @@ void OptionsDialog::setupStatisticsSettings()
ui->cbUsageData->setChecked(settings->value("PushUsageData", false).toBool());
settings->endGroup();
if (Telemetry->isStateForced())
{
if (Telemetry->isStateForced()) {
ui->cbParticipateStats->setEnabled(false);
}
if (Telemetry->isRegistered())
{
if (Telemetry->isRegistered()) {
ui->labParticipationID->setText(tr("Participation ID: %1").arg(Telemetry->getRegisteredID()));
}
else
{
else {
ui->labParticipationID->setText(tr("Participation ID: %1").arg(tr("Not registered")));
ui->cmdCopyStatsID->setVisible(false);
}
@ -639,62 +607,49 @@ void OptionsDialog::setupWindowsGameSettings()
#ifdef GTA5SYNC_GAME
GameVersion gameVersion = AppEnv::getGameVersion();
#ifdef Q_OS_WIN
if (gameVersion != GameVersion::NoVersion)
{
if (gameVersion == GameVersion::SocialClubVersion)
{
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)
{
if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined) {
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
}
else
{
else {
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
}
ui->labSteamLanguage->setVisible(false);
}
else if (gameVersion == GameVersion::SteamVersion)
{
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)
{
if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined) {
ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
}
else
{
else {
ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
}
}
else
{
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)
{
if (AppEnv::getGameLanguage(GameVersion::SocialClubVersion) != GameLanguage::Undefined) {
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SocialClubVersion))).nativeLanguageName()));
}
else
{
else {
ui->labSocialClubLanguage->setText(tr("Language: %1").arg(tr("OS defined")));
}
if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined)
{
if (AppEnv::getGameLanguage(GameVersion::SteamVersion) != GameLanguage::Undefined) {
ui->labSteamLanguage->setText(tr("Language: %1").arg(QLocale(AppEnv::gameLanguageToString(AppEnv::getGameLanguage(GameVersion::SteamVersion))).nativeLanguageName()));
}
else
{
else {
ui->labSteamLanguage->setText(tr("Language: %1").arg(tr("Steam defined")));
}
}
}
else
{
else {
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabGame));
}
#else
@ -707,12 +662,10 @@ void OptionsDialog::setupWindowsGameSettings()
void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
{
if (checked)
{
if (checked) {
aspectRatio = Qt::IgnoreAspectRatio;
}
else
{
else {
aspectRatio = Qt::KeepAspectRatio;
}
}
@ -724,8 +677,7 @@ void OptionsDialog::setupCustomGTAFolder()
settings->beginGroup("dir");
currentCFolder = settings->value("dir", "").toString();
currentFFolder = settings->value("force", false).toBool();
if (currentCFolder == "" && ok)
{
if (currentCFolder == "" && ok) {
currentCFolder = defaultGameFolder;
}
ui->txtFolder->setText(currentCFolder);
@ -754,8 +706,7 @@ void OptionsDialog::setupSnapmaticPictureViewer()
void OptionsDialog::on_cmdExploreFolder_clicked()
{
QString GTAV_Folder = QFileDialog::getExistingDirectory(this, UserInterface::tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
if (QFileInfo(GTAV_Folder).exists())
{
if (QFileInfo(GTAV_Folder).exists()) {
ui->txtFolder->setText(GTAV_Folder);
}
}

@ -38,6 +38,7 @@
#include <QSpacerItem>
#include <QPushButton>
#include <QMessageBox>
#include <QClipboard>
#include <QSettings>
#include <QFileInfo>
#include <QTimer>
@ -50,11 +51,11 @@
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, MessageThread *threadMessage, QWidget *parent) :
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), threadMessage(threadMessage),
ui(new Ui::UserInterface)
#else
#else
UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
QMainWindow(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
ui(new Ui::UserInterface)
#endif
#endif
{
ui->setupUi(this);
contentMode = 0;
@ -153,6 +154,84 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
ui->actionDelete_selected->setIcon(QIcon::fromTheme("remove"));
}
#ifdef GTA5SYNC_DONATE
#ifdef GTA5SYNC_DONATE_ADDRESSES
donateAction = new QAction(tr("&Donate"), this);
if (QIcon::hasThemeIcon("help-donate")) {
donateAction->setIcon(QIcon::fromTheme("help-donate"));
}
else if (QIcon::hasThemeIcon("taxes-finances")) {
donateAction->setIcon(QIcon::fromTheme("taxes-finances"));
}
ui->menuHelp->insertAction(ui->actionAbout_gta5sync, donateAction);
QObject::connect(donateAction, &QAction::triggered, this, [=](){
QDialog *donateDialog = new QDialog(this);
donateDialog->setWindowTitle(QString("%1 - %2").arg(GTA5SYNC_APPSTR, tr("Donate")));
#if QT_VERSION >= 0x050900
donateDialog->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
donateDialog->setWindowFlags(donateDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
#endif
QVBoxLayout *donateLayout = new QVBoxLayout;
donateDialog->setLayout(donateLayout);
QLabel *methodsLabel = new QLabel(QString("<b>%1</b>").arg(tr("Donation methods")), this);
methodsLabel->setWordWrap(true);
donateLayout->addWidget(methodsLabel);
const QStringList addressList = QString::fromUtf8(GTA5SYNC_DONATE_ADDRESSES).split(',');
for (const QString &address : addressList) {
const QStringList addressList = address.split(':');
if (addressList.length() == 2) {
const QString currency = addressList.at(0);
const QString address = addressList.at(1);
QHBoxLayout *addressLayout = new QHBoxLayout;
const QString iconPath = QString(":/donate/%1.svgz").arg(currency);
if (QFile::exists(iconPath)) {
QLabel *currencyLabel = new QLabel(this);
currencyLabel->setFixedSize(32, 32);
currencyLabel->setScaledContents(true);
currencyLabel->setPixmap(QIcon(iconPath).pixmap(QSize(32, 32)));
addressLayout->addWidget(currencyLabel);
}
else {
QLabel *currencyLabel = new QLabel(QString("<b>%1</b>").arg(currency.toUpper()), this);
addressLayout->addWidget(currencyLabel);
}
QLabel *addressLabel = new QLabel(address, this);
addressLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
addressLabel->setTextFormat(Qt::PlainText);
addressLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
addressLabel->setWordWrap(true);
addressLayout->addWidget(addressLabel);
QPushButton *addressButton = new QPushButton(tr("Copy"), this);
QObject::connect(addressButton, &QPushButton::pressed, this, [=](){
QApplication::clipboard()->setText(address);
});
addressLayout->addWidget(addressButton);
donateLayout->addLayout(addressLayout);
}
}
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
QPushButton *closeButton = new QPushButton(donateDialog);
closeButton->setText(tr("&Close"));
if (QIcon::hasThemeIcon("dialog-close")) {
closeButton->setIcon(QIcon::fromTheme("dialog-close"));
}
else if (QIcon::hasThemeIcon("gtk-close")) {
closeButton->setIcon(QIcon::fromTheme("gtk-close"));
}
buttonLayout->addWidget(closeButton);
donateLayout->addLayout(buttonLayout);
QObject::connect(closeButton, &QPushButton::clicked, donateDialog, &QDialog::accept);
QObject::connect(donateDialog, &QDialog::finished, donateDialog, &QDialog::deleteLater);
QTimer::singleShot(0, closeButton, [=](){
closeButton->setFocus();
});
donateDialog->open();
});
#endif
#endif
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
#ifndef Q_QS_ANDROID
@ -172,22 +251,20 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
if (folderExists) {
QDir::setCurrent(GTAV_Folder);
}
else {
if (showFolderDialog) {
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
if (QFileInfo(GTAV_Folder).exists()) {
folderExists = true;
QDir::setCurrent(GTAV_Folder);
AppEnv::setGameFolder(GTAV_Folder);
// First time folder selection save
settings.beginGroup("dir");
if (settings.value("dir", "").toString().isEmpty())
{
settings.setValue("dir", GTAV_Folder);
}
settings.endGroup();
else if (showFolderDialog) {
GTAV_Folder = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
if (QFileInfo(GTAV_Folder).exists()) {
folderExists = true;
QDir::setCurrent(GTAV_Folder);
AppEnv::setGameFolder(GTAV_Folder);
// First time folder selection save
settings.beginGroup("dir");
if (settings.value("dir", "").toString().isEmpty())
{
settings.setValue("dir", GTAV_Folder);
}
settings.endGroup();
}
}
@ -289,8 +366,7 @@ void UserInterface::openProfile(const QString &profileName_)
void UserInterface::closeProfile()
{
if (profileOpen)
{
if (profileOpen) {
closeProfile_p();
}
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
@ -465,68 +541,61 @@ fileDialogPreOpen:
bool UserInterface::openFile(QString selectedFile, bool warn)
{
QString selectedFileName = QFileInfo(selectedFile).fileName();
if (QFile::exists(selectedFile))
{
if (selectedFileName.left(4) == "PGTA" || selectedFileName.right(4) == ".g5e")
{
if (QFile::exists(selectedFile)) {
if (selectedFileName.left(4) == "PGTA" || selectedFileName.right(4) == ".g5e") {
SnapmaticPicture *picture = new SnapmaticPicture(selectedFile);
if (picture->readingPicture())
{
if (picture->readingPicture()) {
openSnapmaticFile(picture);
delete picture;
return true;
}
else
{
if (warn) QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("Failed to read Snapmatic picture"));
else {
if (warn)
QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("Failed to read Snapmatic picture"));
delete picture;
return false;
}
}
else if (selectedFileName.left(4) == "SGTA")
{
else if (selectedFileName.left(4) == "SGTA") {
SavegameData *savegame = new SavegameData(selectedFile);
if (savegame->readingSavegame())
{
if (savegame->readingSavegame()) {
openSavegameFile(savegame);
delete savegame;
return true;
}
else
{
if (warn) QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("Failed to read Savegame file"));
else {
if (warn)
QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("Failed to read Savegame file"));
delete savegame;
return false;
}
}
else
{
else {
SnapmaticPicture *picture = new SnapmaticPicture(selectedFile);
SavegameData *savegame = new SavegameData(selectedFile);
if (picture->readingPicture())
{
if (picture->readingPicture()) {
delete savegame;
openSnapmaticFile(picture);
delete picture;
return true;
}
else if (savegame->readingSavegame())
{
else if (savegame->readingSavegame()) {
delete picture;
openSavegameFile(savegame);
delete savegame;
return true;
}
else
{
else {
delete savegame;
delete picture;
if (warn) QMessageBox::warning(this, tr("Open File"), tr("Can't open %1 because of not valid file format").arg("\""+selectedFileName+"\""));
if (warn)
QMessageBox::warning(this, tr("Open File"), tr("Can't open %1 because of not valid file format").arg("\""+selectedFileName+"\""));
return false;
}
}
}
if (warn) QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("No valid file is selected"));
if (warn)
QMessageBox::warning(this, tr("Open File"), ProfileInterface::tr("No valid file is selected"));
return false;
}
@ -571,13 +640,11 @@ void UserInterface::openSavegameFile(SavegameData *savegame)
void UserInterface::settingsApplied(int _contentMode, bool languageChanged)
{
if (languageChanged)
{
if (languageChanged) {
retranslateUi();
}
contentMode = _contentMode;
if (profileOpen)
{
if (profileOpen) {
profileUI->settingsApplied(contentMode, languageChanged);
}
}
@ -611,7 +678,11 @@ void UserInterface::showMessages(const QStringList messages)
{
QDialog *messageDialog = new QDialog(this);
messageDialog->setWindowTitle(tr("%1 - Messages").arg(GTA5SYNC_APPSTR));
#if QT_VERSION >= 0x050900
messageDialog->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
messageDialog->setWindowFlags(messageDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
#endif
QVBoxLayout *messageLayout = new QVBoxLayout;
messageDialog->setLayout(messageLayout);
QStackedWidget *stackWidget = new QStackedWidget(messageDialog);
@ -682,7 +753,9 @@ void UserInterface::showMessages(const QStringList messages)
});
QObject::connect(closeButton, &QPushButton::clicked, messageDialog, &QDialog::accept);
QObject::connect(messageDialog, &QDialog::finished, messageDialog, &QDialog::deleteLater);
QTimer::singleShot(0, closeButton, SLOT(setFocus()));
QTimer::singleShot(0, closeButton, [=](){
closeButton->setFocus();
});
messageDialog->show();
}
@ -698,10 +771,8 @@ void UserInterface::updateCacheId(uint cacheId)
void UserInterface::on_actionSelect_GTA_Folder_triggered()
{
QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
if (QFileInfo(GTAV_Folder_Temp).exists())
{
if (profileOpen)
{
if (QFileInfo(GTAV_Folder_Temp).exists()) {
if (profileOpen) {
closeProfile_p();
}
GTAV_Folder = GTAV_Folder_Temp;
@ -714,36 +785,36 @@ void UserInterface::on_actionSelect_GTA_Folder_triggered()
void UserInterface::on_action_Enable_In_game_triggered()
{
if (profileOpen)
{
profileUI->enableSelected();
}
}
void UserInterface::on_action_Disable_In_game_triggered()
{
if (profileOpen)
{
profileUI->disableSelected();
}
}
void UserInterface::retranslateUi()
{
ui->retranslateUi(this);
#ifdef GTA5SYNC_DONATE
#ifdef GTA5SYNC_DONATE_ADDRESSES
donateAction->setText(tr("&Donate"));
#endif
#endif
ui->actionAbout_gta5sync->setText(tr("&About %1").arg(GTA5SYNC_APPSTR));
QString appVersion = GTA5SYNC_APPVER;
#ifndef GTA5SYNC_BUILDTYPE_REL
#ifdef GTA5SYNC_COMMIT
if (!appVersion.contains("-")) { appVersion = appVersion % "-" % GTA5SYNC_COMMIT; }
if (!appVersion.contains("-"))
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
#endif
#endif
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, appVersion));
if (profileOpen)
{
if (profileOpen) {
setWindowTitle(defaultWindowTitle.arg(profileName));
}
else
{
else {
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
}
}

@ -90,6 +90,11 @@ private:
DatabaseThread *threadDB;
#ifdef GTA5SYNC_MOTD
MessageThread *threadMessage;
#endif
#ifdef GTA5SYNC_DONATE
#ifdef GTA5SYNC_DONATE_ADDRESSES
QAction *donateAction;
#endif
#endif
Ui::UserInterface *ui;
ProfileInterface *profileUI;

Binary file not shown.

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/donate">
<file>btc.svgz</file>
<file>eth.svgz</file>
<file>ltc.svgz</file>
<file>xmr.svgz</file>
<file>zec.svgz</file>
</qresource>
</RCC>

Binary file not shown.

@ -192,21 +192,21 @@ Pictures and Savegames</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="857"/>
<location filename="../PictureDialog.cpp" line="883"/>
<location filename="../PictureDialog.cpp" line="852"/>
<location filename="../PictureDialog.cpp" line="878"/>
<location filename="../SnapmaticWidget.cpp" line="370"/>
<location filename="../SnapmaticWidget.cpp" line="396"/>
<source>Snapmatic Image Editor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="857"/>
<location filename="../PictureDialog.cpp" line="852"/>
<location filename="../SnapmaticWidget.cpp" line="370"/>
<source>Patching of Snapmatic Image failed because of I/O Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="883"/>
<location filename="../PictureDialog.cpp" line="878"/>
<location filename="../SnapmaticWidget.cpp" line="396"/>
<source>Patching of Snapmatic Image failed because of Image Error</source>
<translation type="unfinished"></translation>
@ -728,26 +728,26 @@ Y: %2</source>
<message>
<location filename="../OptionsDialog.ui" line="399"/>
<location filename="../OptionsDialog.ui" line="422"/>
<location filename="../OptionsDialog.cpp" line="647"/>
<location filename="../OptionsDialog.cpp" line="648"/>
<location filename="../OptionsDialog.cpp" line="662"/>
<location filename="../OptionsDialog.cpp" line="663"/>
<location filename="../OptionsDialog.cpp" line="676"/>
<location filename="../OptionsDialog.cpp" line="677"/>
<location filename="../OptionsDialog.cpp" line="613"/>
<location filename="../OptionsDialog.cpp" line="614"/>
<location filename="../OptionsDialog.cpp" line="625"/>
<location filename="../OptionsDialog.cpp" line="626"/>
<location filename="../OptionsDialog.cpp" line="636"/>
<location filename="../OptionsDialog.cpp" line="637"/>
<source>Found: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.ui" line="406"/>
<location filename="../OptionsDialog.ui" line="429"/>
<location filename="../OptionsDialog.cpp" line="651"/>
<location filename="../OptionsDialog.cpp" line="655"/>
<location filename="../OptionsDialog.cpp" line="667"/>
<location filename="../OptionsDialog.cpp" line="671"/>
<location filename="../OptionsDialog.cpp" line="680"/>
<location filename="../OptionsDialog.cpp" line="684"/>
<location filename="../OptionsDialog.cpp" line="688"/>
<location filename="../OptionsDialog.cpp" line="692"/>
<location filename="../OptionsDialog.cpp" line="616"/>
<location filename="../OptionsDialog.cpp" line="619"/>
<location filename="../OptionsDialog.cpp" line="629"/>
<location filename="../OptionsDialog.cpp" line="632"/>
<location filename="../OptionsDialog.cpp" line="639"/>
<location filename="../OptionsDialog.cpp" line="642"/>
<location filename="../OptionsDialog.cpp" line="645"/>
<location filename="../OptionsDialog.cpp" line="648"/>
<source>Language: %1</source>
<translation type="unfinished"></translation>
</message>
@ -768,7 +768,7 @@ Y: %2</source>
</message>
<message>
<location filename="../OptionsDialog.ui" line="465"/>
<location filename="../OptionsDialog.cpp" line="609"/>
<location filename="../OptionsDialog.cpp" line="580"/>
<source>Participate in %1 User Statistics</source>
<translation type="unfinished"></translation>
</message>
@ -804,8 +804,8 @@ Y: %2</source>
</message>
<message>
<location filename="../OptionsDialog.ui" line="554"/>
<location filename="../OptionsDialog.cpp" line="625"/>
<location filename="../OptionsDialog.cpp" line="629"/>
<location filename="../OptionsDialog.cpp" line="594"/>
<location filename="../OptionsDialog.cpp" line="597"/>
<source>Participation ID: %1</source>
<translation type="unfinished"></translation>
</message>
@ -828,7 +828,7 @@ Y: %2</source>
<location filename="../OptionsDialog.ui" line="611"/>
<location filename="../OptionsDialog.ui" line="633"/>
<location filename="../OptionsDialog.cpp" line="230"/>
<location filename="../OptionsDialog.cpp" line="279"/>
<location filename="../OptionsDialog.cpp" line="274"/>
<source>Current: %1</source>
<translation type="unfinished"></translation>
</message>
@ -923,62 +923,62 @@ Y: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="497"/>
<location filename="../OptionsDialog.cpp" line="479"/>
<source>%1</source>
<comment>%1</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="497"/>
<location filename="../OptionsDialog.cpp" line="479"/>
<source>The new Custom Folder will initialise after you restart %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="507"/>
<location filename="../OptionsDialog.cpp" line="489"/>
<source>No Profile</source>
<comment>No Profile, as default</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="515"/>
<location filename="../OptionsDialog.cpp" line="519"/>
<location filename="../OptionsDialog.cpp" line="521"/>
<location filename="../OptionsDialog.cpp" line="496"/>
<location filename="../OptionsDialog.cpp" line="499"/>
<location filename="../OptionsDialog.cpp" line="501"/>
<source>Profile: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="610"/>
<location filename="../OptionsDialog.cpp" line="581"/>
<source>View %1 User Statistics Online</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="629"/>
<location filename="../OptionsDialog.cpp" line="597"/>
<source>Not registered</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="647"/>
<location filename="../OptionsDialog.cpp" line="663"/>
<location filename="../OptionsDialog.cpp" line="676"/>
<location filename="../OptionsDialog.cpp" line="677"/>
<location filename="../OptionsDialog.cpp" line="613"/>
<location filename="../OptionsDialog.cpp" line="626"/>
<location filename="../OptionsDialog.cpp" line="636"/>
<location filename="../OptionsDialog.cpp" line="637"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="648"/>
<location filename="../OptionsDialog.cpp" line="662"/>
<location filename="../OptionsDialog.cpp" line="614"/>
<location filename="../OptionsDialog.cpp" line="625"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="655"/>
<location filename="../OptionsDialog.cpp" line="684"/>
<location filename="../OptionsDialog.cpp" line="619"/>
<location filename="../OptionsDialog.cpp" line="642"/>
<source>OS defined</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsDialog.cpp" line="671"/>
<location filename="../OptionsDialog.cpp" line="692"/>
<location filename="../OptionsDialog.cpp" line="632"/>
<location filename="../OptionsDialog.cpp" line="648"/>
<source>Steam defined</source>
<translation type="unfinished"></translation>
</message>
@ -1055,42 +1055,42 @@ Y: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="468"/>
<location filename="../PictureDialog.cpp" line="463"/>
<source>Key 1 - Avatar Preview Mode
Key 2 - Toggle Overlay
Arrow Keys - Navigate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="523"/>
<location filename="../PictureDialog.cpp" line="518"/>
<source>Snapmatic Picture Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="523"/>
<location filename="../PictureDialog.cpp" line="518"/>
<source>Failed at %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="544"/>
<location filename="../PictureDialog.cpp" line="662"/>
<location filename="../SnapmaticEditor.cpp" line="219"/>
<location filename="../PictureDialog.cpp" line="539"/>
<location filename="../PictureDialog.cpp" line="657"/>
<location filename="../SnapmaticEditor.cpp" line="220"/>
<source>No Players</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="544"/>
<location filename="../PictureDialog.cpp" line="641"/>
<location filename="../PictureDialog.cpp" line="539"/>
<location filename="../PictureDialog.cpp" line="636"/>
<source>No Crew</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="544"/>
<location filename="../PictureDialog.cpp" line="539"/>
<source>Unknown Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../PictureDialog.cpp" line="597"/>
<location filename="../PictureDialog.cpp" line="592"/>
<source>Avatar Preview Mode
Press 1 for Default View</source>
<translation type="unfinished"></translation>
@ -1341,7 +1341,7 @@ Press 1 for Default View</source>
<location filename="../ImportDialog.cpp" line="534"/>
<location filename="../ImportDialog.cpp" line="844"/>
<location filename="../ProfileInterface.cpp" line="518"/>
<location filename="../UserInterface.cpp" line="441"/>
<location filename="../UserInterface.cpp" line="517"/>
<source>All files (**)</source>
<translation type="unfinished"></translation>
</message>
@ -1386,26 +1386,26 @@ Press 1 for Default View</source>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="514"/>
<location filename="../UserInterface.cpp" line="438"/>
<location filename="../UserInterface.cpp" line="514"/>
<source>GTA V Export (*.g5e)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="515"/>
<location filename="../UserInterface.cpp" line="439"/>
<location filename="../UserInterface.cpp" line="515"/>
<source>Savegames files (SGTA*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="516"/>
<location filename="../UserInterface.cpp" line="440"/>
<location filename="../UserInterface.cpp" line="516"/>
<source>Snapmatic pictures (PGTA*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="542"/>
<location filename="../ProfileInterface.cpp" line="969"/>
<location filename="../UserInterface.cpp" line="529"/>
<location filename="../UserInterface.cpp" line="598"/>
<source>No valid file is selected</source>
<translation type="unfinished"></translation>
</message>
@ -1424,13 +1424,13 @@ Press 1 for Default View</source>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="643"/>
<location filename="../UserInterface.cpp" line="481"/>
<location filename="../UserInterface.cpp" line="554"/>
<source>Failed to read Snapmatic picture</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="682"/>
<location filename="../UserInterface.cpp" line="497"/>
<location filename="../UserInterface.cpp" line="568"/>
<source>Failed to read Savegame file</source>
<translation type="unfinished"></translation>
</message>
@ -1640,7 +1640,7 @@ Press 1 for Default View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../UserInterface.cpp" line="437"/>
<location filename="../UserInterface.cpp" line="513"/>
<source>All profile files (*.g5e SGTA* PGTA*)</source>
<translation type="unfinished"></translation>
</message>
@ -1854,8 +1854,8 @@ Press 1 for Default View</source>
<location filename="../JsonEditorDialog.cpp" line="176"/>
<location filename="../JsonEditorDialog.cpp" line="181"/>
<location filename="../JsonEditorDialog.cpp" line="212"/>
<location filename="../PictureDialog.cpp" line="778"/>
<location filename="../SnapmaticEditor.cpp" line="301"/>
<location filename="../PictureDialog.cpp" line="773"/>
<location filename="../SnapmaticEditor.cpp" line="302"/>
<location filename="../SnapmaticWidget.cpp" line="428"/>
<source>Snapmatic Properties</source>
<translation type="unfinished"></translation>
@ -1947,8 +1947,8 @@ Press 1 for Default View</source>
</message>
<message>
<location filename="../JsonEditorDialog.cpp" line="181"/>
<location filename="../PictureDialog.cpp" line="778"/>
<location filename="../SnapmaticEditor.cpp" line="301"/>
<location filename="../PictureDialog.cpp" line="773"/>
<location filename="../SnapmaticEditor.cpp" line="302"/>
<location filename="../SnapmaticWidget.cpp" line="428"/>
<source>Patching of Snapmatic Properties failed because of I/O Error</source>
<translation type="unfinished"></translation>
@ -1960,72 +1960,72 @@ Press 1 for Default View</source>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="2343"/>
<location filename="../SnapmaticEditor.cpp" line="402"/>
<location filename="../SnapmaticEditor.cpp" line="403"/>
<source>Snapmatic Crew</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ProfileInterface.cpp" line="2343"/>
<location filename="../SnapmaticEditor.cpp" line="402"/>
<location filename="../SnapmaticEditor.cpp" line="403"/>
<source>New Snapmatic crew:</source>
<translation type="unfinished"></translation>