distinguish more GTA V RDR 2 code, remove SidebarGenerator
This commit is contained in:
		
							parent
							
								
									51f9cffddf
								
							
						
					
					
						commit
						23663d389b
					
				
					 13 changed files with 18 additions and 235 deletions
				
			
		| 
						 | 
				
			
			@ -78,7 +78,6 @@ set(GTA5VIEW_SOURCES
 | 
			
		|||
    src/SavegameData.cpp
 | 
			
		||||
    src/SavegameDialog.cpp
 | 
			
		||||
    src/SavegameWidget.cpp
 | 
			
		||||
    src/SidebarGenerator.cpp
 | 
			
		||||
    src/SnapmaticEditor.cpp
 | 
			
		||||
    src/SnapmaticJson.cpp
 | 
			
		||||
    src/SnapmaticPicture.cpp
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +119,6 @@ set(GTA5VIEW_HEADERS
 | 
			
		|||
    src/SavegameData.h
 | 
			
		||||
    src/SavegameDialog.h
 | 
			
		||||
    src/SavegameWidget.h
 | 
			
		||||
    src/SidebarGenerator.h
 | 
			
		||||
    src/SnapmaticEditor.h
 | 
			
		||||
    src/SnapmaticJson.h
 | 
			
		||||
    src/SnapmaticPicture.h
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ QString AppEnv::getBuildCode()
 | 
			
		|||
 | 
			
		||||
// Folder Stuff
 | 
			
		||||
 | 
			
		||||
QString AppEnv::getGameFolder(bool *ok)
 | 
			
		||||
QString AppEnv::getGTAVFolder(bool *ok)
 | 
			
		||||
{
 | 
			
		||||
    QDir dir;
 | 
			
		||||
    QString GTAV_FOLDER = QString::fromUtf8(qgetenv("GTAV_FOLDER"));
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +108,7 @@ QString AppEnv::getGameFolder(bool *ok)
 | 
			
		|||
    return QString();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool AppEnv::setGameFolder(QString gameFolder)
 | 
			
		||||
bool AppEnv::setGTAVFolder(QString gameFolder)
 | 
			
		||||
{
 | 
			
		||||
    QDir dir;
 | 
			
		||||
    dir.setPath(gameFolder);
 | 
			
		||||
| 
						 | 
				
			
			@ -166,33 +166,7 @@ QString AppEnv::getShareFolder()
 | 
			
		|||
 | 
			
		||||
QByteArray AppEnv::getUserAgent()
 | 
			
		||||
{
 | 
			
		||||
#if QT_VERSION >= 0x050400
 | 
			
		||||
#ifdef Q_OS_WIN
 | 
			
		||||
    QString kernelVersion = QSysInfo::kernelVersion();
 | 
			
		||||
    const QStringList &kernelVersionList = kernelVersion.split(".");
 | 
			
		||||
    if (kernelVersionList.length() > 2) {
 | 
			
		||||
        kernelVersion = kernelVersionList.at(0) % "." % kernelVersionList.at(1);
 | 
			
		||||
    }
 | 
			
		||||
    QString runArch = QSysInfo::buildCpuArchitecture();
 | 
			
		||||
    if (runArch == "x86_64") {
 | 
			
		||||
        runArch = "Win64; x64";
 | 
			
		||||
    }
 | 
			
		||||
    else if (runArch == "i686") {
 | 
			
		||||
        const QString &curArch = QSysInfo::currentCpuArchitecture();
 | 
			
		||||
        if (curArch == "x86_64") {
 | 
			
		||||
            runArch = "WOW64";
 | 
			
		||||
        }
 | 
			
		||||
        else if (curArch == "i686") {
 | 
			
		||||
            runArch = "Win32; x86";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return QString("Mozilla/5.0 (Windows NT %1; %2) %3/%4").arg(kernelVersion, runArch, GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
 | 
			
		||||
#else
 | 
			
		||||
    return QString("Mozilla/5.0 (%1; %2) %3/%4").arg(QSysInfo::kernelType(), QSysInfo::kernelVersion(), GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
    return QString("Mozilla/5.0 %1/%2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER).toUtf8();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QUrl AppEnv::getCrewFetchingUrl(QString crewID)
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +186,7 @@ QUrl AppEnv::getPlayerFetchingUrl(QString crewID, int pageNumber)
 | 
			
		|||
 | 
			
		||||
// Game Stuff
 | 
			
		||||
 | 
			
		||||
GameVersion AppEnv::getGameVersion()
 | 
			
		||||
GameVersion AppEnv::getGTAVVersion()
 | 
			
		||||
{
 | 
			
		||||
#ifdef Q_OS_WIN
 | 
			
		||||
    QString argumentValue;
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +235,7 @@ GameVersion AppEnv::getGameVersion()
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GameLanguage AppEnv::getGameLanguage(GameVersion gameVersion)
 | 
			
		||||
GameLanguage AppEnv::getGTAVLanguage(GameVersion gameVersion)
 | 
			
		||||
{
 | 
			
		||||
    if (gameVersion == GameVersion::SocialClubVersion) {
 | 
			
		||||
#ifdef Q_OS_WIN
 | 
			
		||||
| 
						 | 
				
			
			@ -368,68 +342,6 @@ QString AppEnv::gameLanguageToString(GameLanguage gameLanguage)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 Q_OS_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;
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        Q_UNUSED(gameLanguage)
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    if (steamVersion) {
 | 
			
		||||
#ifdef Q_OS_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;
 | 
			
		||||
        }
 | 
			
		||||
#else
 | 
			
		||||
        Q_UNUSED(gameLanguage)
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Screen Stuff
 | 
			
		||||
 | 
			
		||||
qreal AppEnv::screenRatio()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										11
									
								
								src/AppEnv.h
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/AppEnv.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2016-2021 Syping
 | 
			
		||||
* Copyright (C) 2016-2023 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
| 
						 | 
				
			
			@ -35,8 +35,8 @@ public:
 | 
			
		|||
    static QString getBuildCode();
 | 
			
		||||
 | 
			
		||||
    // Folder Stuff
 | 
			
		||||
    static QString getGameFolder(bool *ok = 0);
 | 
			
		||||
    static bool setGameFolder(QString gameFolder);
 | 
			
		||||
    static QString getGTAVFolder(bool *ok = 0);
 | 
			
		||||
    static bool setGTAVFolder(QString gameFolder);
 | 
			
		||||
    static QString getExLangFolder();
 | 
			
		||||
    static QString getInLangFolder();
 | 
			
		||||
    static QString getImagesFolder();
 | 
			
		||||
| 
						 | 
				
			
			@ -50,11 +50,10 @@ public:
 | 
			
		|||
    static QUrl getPlayerFetchingUrl(QString crewID, int pageNumber);
 | 
			
		||||
 | 
			
		||||
    // Game Stuff
 | 
			
		||||
    static GameVersion getGameVersion();
 | 
			
		||||
    static GameLanguage getGameLanguage(GameVersion gameVersion);
 | 
			
		||||
    static GameVersion getGTAVVersion();
 | 
			
		||||
    static GameLanguage getGTAVLanguage(GameVersion gameVersion);
 | 
			
		||||
    static GameLanguage gameLanguageFromString(QString gameLanguage);
 | 
			
		||||
    static QString gameLanguageToString(GameLanguage gameLanguage);
 | 
			
		||||
    static bool setGameLanguage(GameVersion gameVersion, GameLanguage gameLanguage);
 | 
			
		||||
 | 
			
		||||
    // Screen Stuff
 | 
			
		||||
    static qreal screenRatio();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@
 | 
			
		|||
 | 
			
		||||
#include "ui_ImportDialog.h"
 | 
			
		||||
#include "SnapmaticPicture.h"
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "ImportDialog.h"
 | 
			
		||||
#include "imagecropper.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -533,10 +532,6 @@ fileDialogPreOpen: //Work?
 | 
			
		|||
    filters << QApplication::translate("ProfileInterface", "All image files (%1)").arg(imageFormatsStr.trimmed());
 | 
			
		||||
    filters << QApplication::translate("ProfileInterface", "All files (**)");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value(profileName % "+Directory", StandardPaths::documentsLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value(profileName % "+Geometry", "").toByteArray());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -843,10 +838,6 @@ fileDialogPreOpen:
 | 
			
		|||
    filters << QApplication::translate("ProfileInterface", "All image files (%1)").arg(imageFormatsStr.trimmed());
 | 
			
		||||
    filters << QApplication::translate("ProfileInterface", "All files (**)");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value("Geometry", "").toByteArray());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ void OptionsDialog::setupLanguageBox()
 | 
			
		|||
                                                                                                                                                                  "System in context of System default"));
 | 
			
		||||
#ifdef Q_OS_WIN
 | 
			
		||||
    QString cbAutoStr;
 | 
			
		||||
    if (AppEnv::getGameLanguage(AppEnv::getGameVersion()) != GameLanguage::Undefined) {
 | 
			
		||||
    if (AppEnv::getGTAVLanguage(AppEnv::getGTAVVersion()) != GameLanguage::Undefined) {
 | 
			
		||||
        cbAutoStr = tr("%1 (Game language)", "Next closest language compared to the Game settings").arg(tr("Auto", "Automatic language choice."));
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
| 
						 | 
				
			
			@ -661,7 +661,7 @@ void OptionsDialog::on_cbIgnoreAspectRatio_toggled(bool checked)
 | 
			
		|||
void OptionsDialog::setupCustomGTAFolder()
 | 
			
		||||
{
 | 
			
		||||
    bool ok;
 | 
			
		||||
    QString defaultGameFolder = AppEnv::getGameFolder(&ok);
 | 
			
		||||
    QString defaultGameFolder = AppEnv::getGTAVFolder(&ok);
 | 
			
		||||
    settings->beginGroup("dir");
 | 
			
		||||
    currentCFolder = settings->value("dir", "").toString();
 | 
			
		||||
    currentFFolder = settings->value("force", false).toBool();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2016-2020 Syping
 | 
			
		||||
* Copyright (C) 2016-2023 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +21,6 @@
 | 
			
		|||
#include "PictureExport.h"
 | 
			
		||||
#include "PictureDialog.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include <QStringBuilder>
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
| 
						 | 
				
			
			@ -96,10 +95,6 @@ fileDialogPreSave: //Work?
 | 
			
		|||
    filters << PictureDialog::tr("JPEG Graphics (*.jpg *.jpeg)");
 | 
			
		||||
    filters << PictureDialog::tr("Portable Network Graphics (*.png)");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -241,10 +236,6 @@ fileDialogPreSave: //Work?
 | 
			
		|||
#endif
 | 
			
		||||
    filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
 | 
			
		||||
    fileDialog.selectFile(QString(picture->getExportPictureFileName() % ".g5e"));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@
 | 
			
		|||
#include "ProfileInterface.h"
 | 
			
		||||
#include "ui_ProfileInterface.h"
 | 
			
		||||
#include "PlayerListDialog.h"
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "SnapmaticWidget.h"
 | 
			
		||||
#include "DatabaseThread.h"
 | 
			
		||||
#include "SavegameWidget.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -563,10 +562,6 @@ fileDialogPreOpen: //Work?
 | 
			
		|||
    filters << tr("All image files (%1)").arg(imageFormatsStr.trimmed());
 | 
			
		||||
    filters << tr("All files (%1)").arg("**");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value(profileName % "+Directory", StandardPaths::documentsLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value(profileName % "+Geometry", "").toByteArray());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@
 | 
			
		|||
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "SavegameWidget.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "SavegameCopy.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -60,9 +59,6 @@ fileDialogPreSave: //Work?
 | 
			
		|||
    filters << SavegameWidget::tr("All files (%1)").arg("**");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value("Directory", StandardPaths::picturesLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
 | 
			
		||||
    fileDialog.selectFile(sgdFileInfo.fileName());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2016-2021 Syping
 | 
			
		||||
* Copyright (C) 2016-2023 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,6 @@
 | 
			
		|||
 | 
			
		||||
#include "SavegameWidget.h"
 | 
			
		||||
#include "ui_SavegameWidget.h"
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "SavegameDialog.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "SavegameData.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,61 +0,0 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2016-2017 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
* the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
* (at your option) any later version.
 | 
			
		||||
*
 | 
			
		||||
* This program is distributed in the hope that it will be useful,
 | 
			
		||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
* GNU General Public License for more details.
 | 
			
		||||
*
 | 
			
		||||
* You should have received a copy of the GNU General Public License
 | 
			
		||||
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "AppEnv.h"
 | 
			
		||||
#include <QList>
 | 
			
		||||
#include <QUrl>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
 | 
			
		||||
SidebarGenerator::SidebarGenerator()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QList<QUrl> SidebarGenerator::generateSidebarUrls(QList<QUrl> sidebarUrls)
 | 
			
		||||
{
 | 
			
		||||
    QDir dir;
 | 
			
		||||
 | 
			
		||||
    dir.setPath(StandardPaths::picturesLocation());
 | 
			
		||||
    if (dir.exists())
 | 
			
		||||
    {
 | 
			
		||||
        sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dir.setPath(StandardPaths::documentsLocation());
 | 
			
		||||
    if (dir.exists())
 | 
			
		||||
    {
 | 
			
		||||
        sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool gameFolderExists;
 | 
			
		||||
    QString gameFolder = AppEnv::getGameFolder(&gameFolderExists);
 | 
			
		||||
    if (gameFolderExists)
 | 
			
		||||
    {
 | 
			
		||||
        sidebarUrls += QUrl::fromLocalFile(gameFolder);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dir.setPath(StandardPaths::desktopLocation());
 | 
			
		||||
    if (dir.exists())
 | 
			
		||||
    {
 | 
			
		||||
        sidebarUrls += QUrl::fromLocalFile(dir.absolutePath());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return sidebarUrls;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2016-2017 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
* the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
* (at your option) any later version.
 | 
			
		||||
*
 | 
			
		||||
* This program is distributed in the hope that it will be useful,
 | 
			
		||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
* GNU General Public License for more details.
 | 
			
		||||
*
 | 
			
		||||
* You should have received a copy of the GNU General Public License
 | 
			
		||||
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef SIDEBARGENERATOR_H
 | 
			
		||||
#define SIDEBARGENERATOR_H
 | 
			
		||||
 | 
			
		||||
#include <QList>
 | 
			
		||||
#include <QUrl>
 | 
			
		||||
 | 
			
		||||
class SidebarGenerator
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    SidebarGenerator();
 | 
			
		||||
    static QList<QUrl> generateSidebarUrls(QList<QUrl> sidebarUrls);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // SIDEBARGENERATOR_H
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*****************************************************************************
 | 
			
		||||
* gta5view Grand Theft Auto V Profile Viewer
 | 
			
		||||
* Copyright (C) 2017-2021 Syping
 | 
			
		||||
* Copyright (C) 2017-2023 Syping
 | 
			
		||||
*
 | 
			
		||||
* This program is free software: you can redistribute it and/or modify
 | 
			
		||||
* it under the terms of the GNU General Public License as published by
 | 
			
		||||
| 
						 | 
				
			
			@ -484,7 +484,7 @@ QString TranslationClass::getCurrentAreaLanguage()
 | 
			
		|||
{
 | 
			
		||||
    const QStringList areaTranslations = listAreaTranslations();
 | 
			
		||||
    if (userAreaLanguage == "Auto" || userAreaLanguage.trimmed().isEmpty()) {
 | 
			
		||||
        const GameLanguage gameLanguage = AppEnv::getGameLanguage(AppEnv::getGameVersion());
 | 
			
		||||
        const GameLanguage gameLanguage = AppEnv::getGTAVLanguage(AppEnv::getGTAVVersion());
 | 
			
		||||
        if (gameLanguage == GameLanguage::Undefined) {
 | 
			
		||||
#ifdef GTA5SYNC_DEBUG
 | 
			
		||||
            qDebug() << "autoAreaLanguageModeInterface";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,6 @@
 | 
			
		|||
#include "ui_UserInterface.h"
 | 
			
		||||
#include "ProfileInterface.h"
 | 
			
		||||
#include "SnapmaticPicture.h"
 | 
			
		||||
#include "SidebarGenerator.h"
 | 
			
		||||
#include "SavegameDialog.h"
 | 
			
		||||
#include "StandardPaths.h"
 | 
			
		||||
#include "OptionsDialog.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -316,13 +315,13 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
 | 
			
		|||
    QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
 | 
			
		||||
 | 
			
		||||
    bool folderExists;
 | 
			
		||||
    GTAV_Folder = AppEnv::getGameFolder(&folderExists);
 | 
			
		||||
    GTAV_Folder = AppEnv::getGTAVFolder(&folderExists);
 | 
			
		||||
    if (!folderExists && showFolderDialog) {
 | 
			
		||||
        const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
 | 
			
		||||
        if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
 | 
			
		||||
            GTAV_Folder = GTAV_Folder_Temp;
 | 
			
		||||
            folderExists = true;
 | 
			
		||||
            AppEnv::setGameFolder(GTAV_Folder);
 | 
			
		||||
            AppEnv::setGTAVFolder(GTAV_Folder);
 | 
			
		||||
 | 
			
		||||
            // First time folder selection save
 | 
			
		||||
            settings.beginGroup("dir");
 | 
			
		||||
| 
						 | 
				
			
			@ -571,10 +570,6 @@ fileDialogPreOpen:
 | 
			
		|||
    filters << ProfileInterface::tr("RDR 2 Photo files (%1)").arg("PRDR3*");
 | 
			
		||||
    filters << ProfileInterface::tr("All files (%1)").arg("**");
 | 
			
		||||
    fileDialog.setNameFilters(filters);
 | 
			
		||||
 | 
			
		||||
    QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
 | 
			
		||||
 | 
			
		||||
    fileDialog.setSidebarUrls(sidebarUrls);
 | 
			
		||||
    fileDialog.setDirectory(settings.value("OpenDialogDirectory", StandardPaths::documentsLocation()).toString());
 | 
			
		||||
    fileDialog.restoreGeometry(settings.value("OpenDialogGeometry","").toByteArray());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -815,7 +810,7 @@ void UserInterface::on_actionSelect_GTA_Folder_triggered()
 | 
			
		|||
            closeProfile_p();
 | 
			
		||||
        }
 | 
			
		||||
        GTAV_Folder = GTAV_Folder_Temp;
 | 
			
		||||
        AppEnv::setGameFolder(GTAV_Folder);
 | 
			
		||||
        AppEnv::setGTAVFolder(GTAV_Folder);
 | 
			
		||||
        on_cmdReload_clicked();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue