improvement for RDR 2 support, some code reworks
This commit is contained in:
parent
9c0cc39b4f
commit
51f9cffddf
8 changed files with 65 additions and 78 deletions
|
@ -64,10 +64,10 @@ QString AppEnv::getGameFolder(bool *ok)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#ifdef Q_OS_UNIX
|
||||
// TODO: Try to locate the Steam Proton GTA V folder
|
||||
const QString GTAV_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/GTA V";
|
||||
#else
|
||||
// TODO: Try to locate the Steam Proton GTA V folder
|
||||
const QString GTAV_defaultFolder = StandardPaths::documentsLocation() % "/Rockstar Games/GTA V";
|
||||
#endif
|
||||
QString GTAV_returnFolder = GTAV_defaultFolder;
|
||||
|
|
|
@ -84,11 +84,12 @@ ImportDialog::ImportDialog(QString profileName, QWidget *parent) :
|
|||
ui->cmdBackgroundWipe->setVisible(false);
|
||||
|
||||
// Snapmatic Resolution
|
||||
ui->cbResolution->addItem("GTA V", QSize(960, 536));
|
||||
ui->cbResolution->addItem("FiveM", QSize(1920, 1072));
|
||||
ui->cbResolution->addItem("1280x720", QSize(1280, 720));
|
||||
ui->cbResolution->addItem("1920x1080", QSize(1920, 1080));
|
||||
ui->cbResolution->addItem("2560x1440", QSize(2560, 1440));
|
||||
ui->cbResolution->addItem("GTA V (536p)", QSize(960, 536));
|
||||
ui->cbResolution->addItem("FiveM (1072p)", QSize(1920, 1072));
|
||||
ui->cbResolution->addItem("RDR 2 (1080p)", QSize(1920, 1080));
|
||||
ui->cbResolution->addItem("Preset (720p)", QSize(1280, 720));
|
||||
ui->cbResolution->addItem("Preset (1440p)", QSize(2560, 1440));
|
||||
ui->cbResolution->addItem("Preset (2160p)", QSize(3840, 2160));
|
||||
|
||||
// Set Import Settings
|
||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2022 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* gta5view Grand Theft Auto V Profile Viewer
|
||||
* Copyright (C) 2016-2017 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
|
||||
|
@ -28,7 +28,6 @@
|
|||
|
||||
SavegameCopy::SavegameCopy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SavegameCopy::copySavegame(QWidget *parent, QString sgdPath)
|
||||
|
@ -48,13 +47,17 @@ fileDialogPreSave: //Work?
|
|||
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
|
||||
fileDialog.setOption(QFileDialog::DontConfirmOverwrite, true);
|
||||
fileDialog.setDefaultSuffix("");
|
||||
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
||||
fileDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
fileDialog.setWindowTitle(SavegameWidget::tr(("Export Savegame...")));
|
||||
fileDialog.setLabelText(QFileDialog::Accept, SavegameWidget::tr("Export"));
|
||||
|
||||
QStringList filters;
|
||||
filters << SavegameWidget::tr("Savegame files (SGTA*)");
|
||||
filters << SavegameWidget::tr("All files (**)");
|
||||
const QString fileName = sgdFileInfo.fileName();
|
||||
if (fileName.startsWith("SGTA5"))
|
||||
filters << SavegameWidget::tr("GTA V Savegames files (%1)").arg("SGTA5*");
|
||||
else if (fileName.startsWith("SRDR3"))
|
||||
filters << SavegameWidget::tr("RDR 2 Savegames files (%1)").arg("SRDR3*");
|
||||
filters << SavegameWidget::tr("All files (%1)").arg("**");
|
||||
fileDialog.setNameFilters(filters);
|
||||
|
||||
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
|
||||
|
@ -64,38 +67,30 @@ fileDialogPreSave: //Work?
|
|||
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||
fileDialog.selectFile(sgdFileInfo.fileName());
|
||||
|
||||
if (fileDialog.exec())
|
||||
{
|
||||
if (fileDialog.exec()) {
|
||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||
if (selectedFiles.length() == 1)
|
||||
{
|
||||
if (selectedFiles.length() == 1) {
|
||||
QString selectedFile = selectedFiles.at(0);
|
||||
|
||||
if (QFile::exists(selectedFile))
|
||||
{
|
||||
if (QMessageBox::Yes == QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Overwrite %1 with current Savegame?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
||||
{
|
||||
if (!QFile::remove(selectedFile))
|
||||
{
|
||||
if (QFile::exists(selectedFile)) {
|
||||
if (QMessageBox::Yes == QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Overwrite %1 with current Savegame?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) {
|
||||
if (!QFile::remove(selectedFile)) {
|
||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to overwrite %1 with current Savegame").arg("\""+selectedFile+"\""));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
|
||||
bool isCopied = QFile::copy(sgdPath, selectedFile);
|
||||
if (!isCopied)
|
||||
{
|
||||
if (!isCopied) {
|
||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("Failed to export current Savegame"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
QMessageBox::warning(parent, SavegameWidget::tr("Export Savegame"), SavegameWidget::tr("No valid file is selected"));
|
||||
goto fileDialogPreSave; //Work?
|
||||
}
|
||||
|
|
|
@ -920,13 +920,13 @@ void SnapmaticPicture::initialise(uint32_t photoFormat)
|
|||
t_jsonObject["crewid"] = 0;
|
||||
t_jsonObject["districtname"] = 0;
|
||||
t_jsonObject["drctr"] = false;
|
||||
t_jsonObject["inphotomode"] = true;
|
||||
|
||||
boost::json::object t_locObject;
|
||||
t_locObject["x"] = 0;
|
||||
t_locObject["y"] = 0;
|
||||
t_locObject["z"] = 0;
|
||||
|
||||
t_jsonObject["inphotomode"] = true;
|
||||
t_jsonObject["loc"] = t_locObject;
|
||||
t_jsonObject["meme"] = false;
|
||||
t_jsonObject["mid"] = "";
|
||||
|
|
|
@ -317,15 +317,11 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
|||
|
||||
bool folderExists;
|
||||
GTAV_Folder = AppEnv::getGameFolder(&folderExists);
|
||||
if (folderExists) {
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
}
|
||||
else if (showFolderDialog) {
|
||||
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;
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
AppEnv::setGameFolder(GTAV_Folder);
|
||||
|
||||
// First time folder selection save
|
||||
|
@ -351,17 +347,16 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
|
|||
|
||||
if (folderExists) {
|
||||
QDir GTAV_ProfilesDir;
|
||||
GTAV_ProfilesFolder = GTAV_Folder % "/Profiles";
|
||||
GTAV_ProfilesDir.setPath(GTAV_ProfilesFolder);
|
||||
GTAV_ProfilesDir.setPath(GTAV_Folder % "/Profiles");
|
||||
|
||||
GTAV_Profiles = GTAV_ProfilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort);
|
||||
setupProfileUi();
|
||||
|
||||
if (GTAV_Profiles.length() == 1) {
|
||||
openProfile(GTAV_Profiles.at(0));
|
||||
openProfile(GTAV_Profiles.at(0), RagePhoto::PhotoFormat::GTA5);
|
||||
}
|
||||
else if(GTAV_Profiles.contains(defaultProfile)) {
|
||||
openProfile(defaultProfile);
|
||||
openProfile(defaultProfile, RagePhoto::PhotoFormat::GTA5);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -415,21 +410,24 @@ void UserInterface::on_cmdReload_clicked()
|
|||
void UserInterface::profileButton_clicked()
|
||||
{
|
||||
QPushButton *profileBtn = (QPushButton*)sender();
|
||||
openProfile(profileBtn->objectName());
|
||||
openProfile(profileBtn->objectName(), RagePhoto::PhotoFormat::GTA5);
|
||||
}
|
||||
|
||||
void UserInterface::openProfile(const QString &profileName_)
|
||||
void UserInterface::openProfile(const QString &profileName_, quint32 gameFormat)
|
||||
{
|
||||
profileOpen = true;
|
||||
profileName = profileName_;
|
||||
profileUI = new ProfileInterface(profileDB, crewDB, threadDB);
|
||||
ui->swProfile->addWidget(profileUI);
|
||||
ui->swProfile->setCurrentWidget(profileUI);
|
||||
profileUI->setProfileFolder(GTAV_ProfilesFolder % "/" % profileName, profileName, RagePhoto::PhotoFormat::GTA5); // TODO: do not assume GTA V
|
||||
if (gameFormat == RagePhoto::PhotoFormat::GTA5)
|
||||
profileUI->setProfileFolder(GTAV_Folder % "/Profiles/" % profileName, profileName, gameFormat);
|
||||
else if (gameFormat == RagePhoto::PhotoFormat::RDR2)
|
||||
profileUI->setProfileFolder(RDR2_Folder % "/Profiles/" % profileName, profileName, gameFormat);
|
||||
profileUI->settingsApplied(contentMode, false);
|
||||
profileUI->setupProfileInterface();
|
||||
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
|
||||
QObject::connect(profileUI, SIGNAL(profileLoaded()), this, SLOT(profileLoaded()));
|
||||
QObject::connect(profileUI, &ProfileInterface::profileClosed, this, &UserInterface::closeProfile);
|
||||
QObject::connect(profileUI, &ProfileInterface::profileLoaded, this, &UserInterface::profileLoaded);
|
||||
setWindowTitle(defaultWindowTitle.arg(profileName));
|
||||
}
|
||||
|
||||
|
@ -817,7 +815,6 @@ void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
|||
closeProfile_p();
|
||||
}
|
||||
GTAV_Folder = GTAV_Folder_Temp;
|
||||
QDir::setCurrent(GTAV_Folder);
|
||||
AppEnv::setGameFolder(GTAV_Folder);
|
||||
on_cmdReload_clicked();
|
||||
}
|
||||
|
|
|
@ -105,10 +105,11 @@ private:
|
|||
QString language;
|
||||
QString defaultWindowTitle;
|
||||
QString GTAV_Folder;
|
||||
QString GTAV_ProfilesFolder;
|
||||
QString RDR2_Folder;
|
||||
QStringList GTAV_Profiles;
|
||||
QStringList RDR2_Profiles;
|
||||
void setupProfileUi();
|
||||
void openProfile(const QString &profileName);
|
||||
void openProfile(const QString &profileName, quint32 gameFormat);
|
||||
void closeProfile_p();
|
||||
void openSelectProfile();
|
||||
void retranslateUi();
|
||||
|
|
55
src/main.cpp
55
src/main.cpp
|
@ -54,7 +54,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "windows.h"
|
||||
#include <windows.h>
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
@ -131,21 +131,22 @@ int main(int argc, char *argv[])
|
|||
bool telemetryWindowLaunched = settings.value("PersonalUsageDataWindowLaunched", false).toBool();
|
||||
bool pushUsageData = settings.value("PushUsageData", false).toBool();
|
||||
if (!telemetryWindowLaunched && !pushUsageData) {
|
||||
QDialog *telemetryDialog = new QDialog();
|
||||
telemetryDialog->setObjectName(QStringLiteral("TelemetryDialog"));
|
||||
telemetryDialog->setWindowTitle(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
|
||||
telemetryDialog->setWindowFlags(telemetryDialog->windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
|
||||
telemetryDialog->setWindowIcon(IconLoader::loadingAppIcon());
|
||||
QVBoxLayout *telemetryLayout = new QVBoxLayout(telemetryDialog);
|
||||
QDialog telemetryDialog;
|
||||
telemetryDialog.setObjectName(QStringLiteral("TelemetryDialog"));
|
||||
telemetryDialog.setWindowTitle(QString("%1 %2").arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
|
||||
telemetryDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
telemetryDialog.setWindowFlag(Qt::WindowCloseButtonHint, false);
|
||||
telemetryDialog.setWindowIcon(IconLoader::loadingAppIcon());
|
||||
QVBoxLayout *telemetryLayout = new QVBoxLayout(&telemetryDialog);
|
||||
telemetryLayout->setObjectName(QStringLiteral("TelemetryLayout"));
|
||||
telemetryDialog->setLayout(telemetryLayout);
|
||||
UiModLabel *telemetryLabel = new UiModLabel(telemetryDialog);
|
||||
telemetryDialog.setLayout(telemetryLayout);
|
||||
UiModLabel *telemetryLabel = new UiModLabel(&telemetryDialog);
|
||||
telemetryLabel->setObjectName(QStringLiteral("TelemetryLabel"));
|
||||
telemetryLabel->setText(QString("<h4>%2</h4>%1").arg(
|
||||
QApplication::translate("TelemetryDialog", "You want help %1 to improve in the future by including personal usage data in your submission?").arg(GTA5SYNC_APPSTR),
|
||||
QApplication::translate("TelemetryDialog", "%1 User Statistics").arg(GTA5SYNC_APPSTR)));
|
||||
telemetryLayout->addWidget(telemetryLabel);
|
||||
QCheckBox *telemetryCheckBox = new QCheckBox(telemetryDialog);
|
||||
QCheckBox *telemetryCheckBox = new QCheckBox(&telemetryDialog);
|
||||
telemetryCheckBox->setObjectName(QStringLiteral("TelemetryCheckBox"));
|
||||
telemetryCheckBox->setText(QApplication::translate("TelemetryDialog", "Yes, I want include personal usage data."));
|
||||
telemetryLayout->addWidget(telemetryCheckBox);
|
||||
|
@ -154,14 +155,14 @@ int main(int argc, char *argv[])
|
|||
telemetryLayout->addLayout(telemetryButtonLayout);
|
||||
QSpacerItem *telemetryButtonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
telemetryButtonLayout->addSpacerItem(telemetryButtonSpacer);
|
||||
QPushButton *telemetryButton = new QPushButton(telemetryDialog);
|
||||
QPushButton *telemetryButton = new QPushButton(&telemetryDialog);
|
||||
telemetryButton->setObjectName(QStringLiteral("TelemetryButton"));
|
||||
telemetryButton->setText(QApplication::translate("TelemetryDialog", "&OK"));
|
||||
telemetryButtonLayout->addWidget(telemetryButton);
|
||||
QObject::connect(telemetryButton, SIGNAL(clicked(bool)), telemetryDialog, SLOT(close()));
|
||||
telemetryDialog->setFixedSize(telemetryDialog->sizeHint());
|
||||
telemetryDialog->exec();
|
||||
QObject::disconnect(telemetryButton, SIGNAL(clicked(bool)), telemetryDialog, SLOT(close()));
|
||||
QObject::connect(telemetryButton, &QPushButton::clicked, &telemetryDialog, &QDialog::close);
|
||||
telemetryDialog.setFixedSize(telemetryDialog.sizeHint());
|
||||
telemetryDialog.exec();
|
||||
QObject::disconnect(telemetryButton, &QPushButton::clicked, &telemetryDialog, &QDialog::close);
|
||||
if (telemetryCheckBox->isChecked()) {
|
||||
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||
telemetrySettings.beginGroup("Telemetry");
|
||||
|
@ -173,20 +174,19 @@ int main(int argc, char *argv[])
|
|||
Telemetry->work();
|
||||
}
|
||||
settings.setValue("PersonalUsageDataWindowLaunched", true);
|
||||
delete telemetryDialog;
|
||||
}
|
||||
#endif
|
||||
settings.endGroup();
|
||||
|
||||
for (const QString ¤tArg : applicationArgs) {
|
||||
QString reworkedArg;
|
||||
if (currentArg.left(9) == "-showpic=" && selectedAction == "") {
|
||||
reworkedArg = QString(currentArg).remove(0,9);
|
||||
if (currentArg.startsWith("-showpic=") && selectedAction == "") {
|
||||
reworkedArg = QString(currentArg).remove(0, 9);
|
||||
arg1 = reworkedArg;
|
||||
selectedAction = "showpic";
|
||||
}
|
||||
else if (currentArg.left(9) == "-showsgd=" && selectedAction == "") {
|
||||
reworkedArg = QString(currentArg).remove(0,9);
|
||||
else if (currentArg.startsWith("-showsgd=") && selectedAction == "") {
|
||||
reworkedArg = QString(currentArg).remove(0, 9);
|
||||
arg1 = reworkedArg;
|
||||
selectedAction = "showsgd";
|
||||
}
|
||||
|
@ -194,19 +194,16 @@ int main(int argc, char *argv[])
|
|||
QFile argumentFile(currentArg);
|
||||
QFileInfo argumentFileInfo(argumentFile);
|
||||
if (argumentFile.exists()) {
|
||||
QString argumentFileName = argumentFileInfo.fileName();
|
||||
QString argumentFileType = argumentFileName.left(4);
|
||||
QString argumentFileExt = argumentFileName.right(4);
|
||||
|
||||
if (argumentFileType == "PGTA" || argumentFileExt == ".g5e") {
|
||||
const QString argumentFileName = argumentFileInfo.fileName();
|
||||
if (argumentFileName.startsWith("PGTA5") || argumentFileName.startsWith("PRDR3") || argumentFileName.endsWith(".g5e")) {
|
||||
arg1 = currentArg;
|
||||
selectedAction = "showpic";
|
||||
}
|
||||
else if (argumentFileType == "SGTA") {
|
||||
else if (argumentFileName.startsWith("SGTA5") || argumentFileName.startsWith("SRDR3")) {
|
||||
arg1 = currentArg;
|
||||
selectedAction = "showsgd";
|
||||
}
|
||||
else if (argumentFileType == "MISR") {
|
||||
else if (argumentFileName.startsWith("MISREP")) {
|
||||
arg1 = currentArg;
|
||||
selectedAction = "showsgd";
|
||||
}
|
||||
|
@ -295,11 +292,7 @@ int main(int argc, char *argv[])
|
|||
#else
|
||||
uiWindow.setupDirEnv();
|
||||
#endif
|
||||
#ifdef Q_OS_ANDROID
|
||||
uiWindow.showMaximized();
|
||||
#else
|
||||
uiWindow.show();
|
||||
#endif
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue