completed RDR 2 game folder detection, some code rework
This commit is contained in:
parent
259e785165
commit
61387ee711
6 changed files with 212 additions and 67 deletions
|
@ -185,12 +185,7 @@ void OptionsDialog::setupLanguageBox(QSettings *settings)
|
||||||
ui->cbLanguage->addItem(cbLangStr, lang);
|
ui->cbLanguage->addItem(cbLangStr, lang);
|
||||||
}
|
}
|
||||||
if (currentLanguage == lang) {
|
if (currentLanguage == lang) {
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
ui->cbLanguage->setCurrentText(cbLangStr);
|
ui->cbLanguage->setCurrentText(cbLangStr);
|
||||||
#else
|
|
||||||
int indexOfLang = ui->cbLanguage->findText(cbLangStr);
|
|
||||||
ui->cbLanguage->setCurrentIndex(indexOfLang);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,11 +347,31 @@ void OptionsDialog::applySettings()
|
||||||
newContentMode++;
|
newContentMode++;
|
||||||
}
|
}
|
||||||
settings.setValue("ContentMode", newContentMode);
|
settings.setValue("ContentMode", newContentMode);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x060000
|
||||||
settings.setValue("Default", ui->cbProfiles->currentData());
|
if (ui->cbProfiles->currentData().typeId() == QMetaType::QString)
|
||||||
#else
|
#else
|
||||||
settings->setValue("Default", ui->cbProfiles->itemData(ui->cbProfiles->currentIndex()));
|
if (ui->cbProfiles->currentData().type() == QVariant::String)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
settings.setValue("Default", ui->cbProfiles->currentData());
|
||||||
|
settings.remove("DefaultGame");
|
||||||
|
}
|
||||||
|
#if QT_VERSION >= 0x060000
|
||||||
|
if (ui->cbProfiles->currentData().typeId() == QMetaType::QStringList)
|
||||||
|
#else
|
||||||
|
if (ui->cbProfiles->currentData().type() == QVariant::StringList)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
const QStringList dataList = ui->cbProfiles->currentData().toStringList();
|
||||||
|
if (dataList.length() == 2) {
|
||||||
|
settings.setValue("Default", dataList.at(0));
|
||||||
|
settings.setValue("DefaultGame", dataList.at(1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.setValue("Default", QVariant());
|
||||||
|
settings.remove("DefaultGame");
|
||||||
|
}
|
||||||
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
const bool forceCustomFolder = ui->cbForceCustomFolder->isChecked();
|
const bool forceCustomFolder = ui->cbForceCustomFolder->isChecked();
|
||||||
|
@ -417,13 +432,8 @@ void OptionsDialog::applySettings()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
const bool languageChanged = ui->cbLanguage->currentData().toString() != currentLanguage;
|
||||||
bool languageChanged = ui->cbLanguage->currentData().toString() != currentLanguage;
|
const bool languageAreaChanged = ui->cbAreaLanguage->currentData().toString() != currentAreaLanguage;
|
||||||
bool languageAreaChanged = ui->cbAreaLanguage->currentData().toString() != currentAreaLanguage;
|
|
||||||
#else
|
|
||||||
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->unloadTranslation(qApp);
|
||||||
Translator->initUserLanguage();
|
Translator->initUserLanguage();
|
||||||
|
@ -436,7 +446,7 @@ void OptionsDialog::applySettings()
|
||||||
settings.sync();
|
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) || (forceCustomFolder_RDR2 && ui->txtFolder_RDR2->text() != currentCFolderR) || (forceCustomFolder_RDR2 != currentFFolderR && forceCustomFolder_RDR2)) {
|
||||||
QMessageBox::information(this, tr("%1", "%1").arg(GTA5SYNC_APPSTR), tr("The new Custom Folder will initialise after you restart %1.").arg(GTA5SYNC_APPSTR));
|
QMessageBox::information(this, tr("%1", "%1").arg(GTA5SYNC_APPSTR), tr("The new Custom Folder will initialise after you restart %1.").arg(GTA5SYNC_APPSTR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,23 +455,19 @@ void OptionsDialog::setupDefaultProfile(QSettings *settings)
|
||||||
{
|
{
|
||||||
settings->beginGroup("Profile");
|
settings->beginGroup("Profile");
|
||||||
defaultProfile = settings->value("Default", QString()).toString();
|
defaultProfile = settings->value("Default", QString()).toString();
|
||||||
|
defaultGame = settings->value("DefaultGame", QStringLiteral("GTA V")).toString();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
QString cbNoneStr = tr("No Profile", "No Profile, as default");
|
QString cbNoneStr = tr("No Profile", "No Profile, as default");
|
||||||
ui->cbProfiles->addItem(cbNoneStr, QString());
|
ui->cbProfiles->addItem(cbNoneStr, QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::commitProfiles(const QStringList &profiles)
|
void OptionsDialog::commitProfiles(const QStringList &profiles, const QString &game)
|
||||||
{
|
{
|
||||||
for (const QString &profile : profiles) {
|
for (const QString &profile : profiles) {
|
||||||
ui->cbProfiles->addItem(tr("Profile: %1").arg(profile), profile);
|
ui->cbProfiles->addItem(tr("%2: %1").arg(profile, game), QStringList() << profile << game);
|
||||||
if (defaultProfile == profile) {
|
if (defaultGame == game && defaultProfile == profile) {
|
||||||
#if QT_VERSION >= 0x050000
|
ui->cbProfiles->setCurrentText(tr("%2: %1").arg(profile, game));
|
||||||
ui->cbProfiles->setCurrentText(tr("Profile: %1").arg(profile));
|
|
||||||
#else
|
|
||||||
int indexOfProfile = ui->cbProfiles->findText(tr("Profile: %1").arg(profile));
|
|
||||||
ui->cbProfiles->setCurrentIndex(indexOfProfile);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,6 +613,14 @@ void OptionsDialog::on_cmdExploreFolder_clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::on_cmdExploreFolder_RDR2_clicked()
|
||||||
|
{
|
||||||
|
const QString RDR2_Folder = QFileDialog::getExistingDirectory(this, UserInterface::tr("Select RDR 2 Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
|
if (!RDR2_Folder.isEmpty() && QDir(RDR2_Folder).exists()) {
|
||||||
|
ui->txtFolder_RDR2->setText(RDR2_Folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::on_cbDefaultStyle_toggled(bool checked)
|
void OptionsDialog::on_cbDefaultStyle_toggled(bool checked)
|
||||||
{
|
{
|
||||||
ui->cbStyleList->setDisabled(checked);
|
ui->cbStyleList->setDisabled(checked);
|
||||||
|
|
|
@ -36,12 +36,13 @@ class OptionsDialog : public QDialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
explicit OptionsDialog(ProfileDatabase *profileDB, QWidget *parent = 0);
|
||||||
void commitProfiles(const QStringList &profiles);
|
void commitProfiles(const QStringList &profiles, const QString &game);
|
||||||
~OptionsDialog();
|
~OptionsDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_cmdOK_clicked();
|
void on_cmdOK_clicked();
|
||||||
void on_cmdExploreFolder_clicked();
|
void on_cmdExploreFolder_clicked();
|
||||||
|
void on_cmdExploreFolder_RDR2_clicked();
|
||||||
void on_cbDefaultStyle_toggled(bool checked);
|
void on_cbDefaultStyle_toggled(bool checked);
|
||||||
void on_cbDefaultFont_toggled(bool checked);
|
void on_cbDefaultFont_toggled(bool checked);
|
||||||
void on_cmdCopyStatsID_clicked();
|
void on_cmdCopyStatsID_clicked();
|
||||||
|
@ -61,6 +62,7 @@ private:
|
||||||
QString currentCFolder;
|
QString currentCFolder;
|
||||||
QString currentCFolderR;
|
QString currentCFolderR;
|
||||||
QString defaultProfile;
|
QString defaultProfile;
|
||||||
|
QString defaultGame;
|
||||||
QString percentString;
|
QString percentString;
|
||||||
bool withoutPlayers;
|
bool withoutPlayers;
|
||||||
bool currentFFolder;
|
bool currentFFolder;
|
||||||
|
|
|
@ -32,12 +32,14 @@
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -108,10 +110,10 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
|
|
||||||
// Set Icon for Choose GTA V Folder Menu Item
|
// Set Icon for Choose GTA V Folder Menu Item
|
||||||
if (QIcon::hasThemeIcon("document-open-folder")) {
|
if (QIcon::hasThemeIcon("document-open-folder")) {
|
||||||
ui->actionSelect_GTA_Folder->setIcon(QIcon::fromTheme("document-open-folder"));
|
ui->actionSelect_Game_Folder->setIcon(QIcon::fromTheme("document-open-folder"));
|
||||||
}
|
}
|
||||||
else if (QIcon::hasThemeIcon("gtk-directory")) {
|
else if (QIcon::hasThemeIcon("gtk-directory")) {
|
||||||
ui->actionSelect_GTA_Folder->setIcon(QIcon::fromTheme("gtk-directory"));
|
ui->actionSelect_Game_Folder->setIcon(QIcon::fromTheme("gtk-directory"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Icon for Open File Menu Item
|
// Set Icon for Open File Menu Item
|
||||||
|
@ -302,6 +304,10 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Profile UI defaults
|
||||||
|
ui->labGTAV->setVisible(false);
|
||||||
|
ui->labRDR2->setVisible(false);
|
||||||
|
|
||||||
// DPI calculation
|
// DPI calculation
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
resize(625 * screenRatio, 500 * screenRatio);
|
resize(625 * screenRatio, 500 * screenRatio);
|
||||||
|
@ -309,18 +315,23 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
|
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::setupDirEnv(bool showFolderWindow)
|
void UserInterface::setupDirEnv()
|
||||||
{
|
{
|
||||||
// settings init
|
|
||||||
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
|
|
||||||
bool folderExists_GTAV, folderExists_RDR2;
|
bool folderExists_GTAV, folderExists_RDR2;
|
||||||
GTAV_Folder = AppEnv::getGTAVFolder(&folderExists_GTAV);
|
if (GTAV_Folder.isEmpty())
|
||||||
RDR2_Folder = AppEnv::getRDR2Folder(&folderExists_RDR2);
|
GTAV_Folder = AppEnv::getGTAVFolder(&folderExists_GTAV);
|
||||||
|
else
|
||||||
|
folderExists_GTAV = QDir(GTAV_Folder).exists();
|
||||||
|
if (RDR2_Folder.isEmpty())
|
||||||
|
RDR2_Folder = AppEnv::getRDR2Folder(&folderExists_RDR2);
|
||||||
|
else
|
||||||
|
folderExists_RDR2 = QDir(RDR2_Folder).exists();
|
||||||
|
|
||||||
// profiles init
|
|
||||||
settings.beginGroup("Profile");
|
settings.beginGroup("Profile");
|
||||||
QString defaultProfile = settings.value("Default", QString()).toString();
|
const QString defaultProfile = settings.value("Default", QString()).toString();
|
||||||
|
const QString defaultGame = settings.value("DefaultGame", QStringLiteral("GTA V")).toString();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
contentMode = settings.value("ContentMode", 0).toInt();
|
contentMode = settings.value("ContentMode", 0).toInt();
|
||||||
|
@ -351,19 +362,23 @@ void UserInterface::setupDirEnv(bool showFolderWindow)
|
||||||
|
|
||||||
setupProfileUi();
|
setupProfileUi();
|
||||||
|
|
||||||
if (GTAV_Profiles.contains(defaultProfile)) {
|
if (GTAV_Profiles.length() == 1 && RDR2_Profiles.length() == 0) {
|
||||||
openProfile(defaultProfile, RagePhoto::PhotoFormat::GTA5);
|
|
||||||
}
|
|
||||||
else if (GTAV_Profiles.length() == 1 && RDR2_Profiles.length() == 0) {
|
|
||||||
openProfile(GTAV_Profiles.at(0), RagePhoto::PhotoFormat::GTA5);
|
openProfile(GTAV_Profiles.at(0), RagePhoto::PhotoFormat::GTA5);
|
||||||
}
|
}
|
||||||
else if (GTAV_Profiles.length() == 0 && RDR2_Profiles.length() == 1) {
|
else if (GTAV_Profiles.length() == 0 && RDR2_Profiles.length() == 1) {
|
||||||
openProfile(RDR2_Profiles.at(0), RagePhoto::PhotoFormat::RDR2);
|
openProfile(RDR2_Profiles.at(0), RagePhoto::PhotoFormat::RDR2);
|
||||||
}
|
}
|
||||||
|
else if (defaultGame == QStringLiteral("GTA V") && GTAV_Profiles.contains(defaultProfile)) {
|
||||||
|
openProfile(defaultProfile, RagePhoto::PhotoFormat::GTA5);
|
||||||
|
}
|
||||||
|
else if (defaultGame == QStringLiteral("RDR 2") && RDR2_Profiles.contains(defaultProfile)) {
|
||||||
|
openProfile(defaultProfile, RagePhoto::PhotoFormat::RDR2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::setupProfileUi()
|
void UserInterface::setupProfileUi()
|
||||||
{
|
{
|
||||||
|
bool profileFound = false;
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
qreal screenRatio = AppEnv::screenRatio();
|
||||||
if (!GTAV_Profiles.isEmpty()) {
|
if (!GTAV_Profiles.isEmpty()) {
|
||||||
int row = 1;
|
int row = 1;
|
||||||
|
@ -380,6 +395,7 @@ void UserInterface::setupProfileUi()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ui->labGTAV->setVisible(true);
|
ui->labGTAV->setVisible(true);
|
||||||
|
profileFound = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->labGTAV->setVisible(false);
|
ui->labGTAV->setVisible(false);
|
||||||
|
@ -399,15 +415,23 @@ void UserInterface::setupProfileUi()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ui->labRDR2->setVisible(true);
|
ui->labRDR2->setVisible(true);
|
||||||
|
profileFound = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui->labRDR2->setVisible(false);
|
ui->labRDR2->setVisible(false);
|
||||||
}
|
}
|
||||||
|
if (profileFound) {
|
||||||
|
ui->cmdSelectGameFolder->setVisible(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->cmdSelectGameFolder->setVisible(true);
|
||||||
|
ui->cmdSelectGameFolder->setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::changeFolder_clicked()
|
void UserInterface::changeFolder_clicked()
|
||||||
{
|
{
|
||||||
on_actionSelect_GTA_Folder_triggered();
|
on_actionSelect_Game_Folder_triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::on_cmdReload_clicked()
|
void UserInterface::on_cmdReload_clicked()
|
||||||
|
@ -497,12 +521,11 @@ void UserInterface::openSelectProfile()
|
||||||
|
|
||||||
void UserInterface::on_actionAbout_gta5sync_triggered()
|
void UserInterface::on_actionAbout_gta5sync_triggered()
|
||||||
{
|
{
|
||||||
AboutDialog *aboutDialog = new AboutDialog(this);
|
AboutDialog aboutDialog(this);
|
||||||
aboutDialog->setWindowIcon(windowIcon());
|
aboutDialog.setWindowIcon(windowIcon());
|
||||||
aboutDialog->setModal(true);
|
aboutDialog.setModal(true);
|
||||||
aboutDialog->show();
|
aboutDialog.show();
|
||||||
aboutDialog->exec();
|
aboutDialog.exec();
|
||||||
delete aboutDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::profileLoaded()
|
void UserInterface::profileLoaded()
|
||||||
|
@ -539,7 +562,8 @@ void UserInterface::on_actionOptions_triggered()
|
||||||
{
|
{
|
||||||
OptionsDialog optionsDialog(profileDB, this);
|
OptionsDialog optionsDialog(profileDB, this);
|
||||||
optionsDialog.setWindowIcon(windowIcon());
|
optionsDialog.setWindowIcon(windowIcon());
|
||||||
optionsDialog.commitProfiles(GTAV_Profiles); // TODO: Diff. GTA V and RDR 2 profiles
|
optionsDialog.commitProfiles(GTAV_Profiles, QStringLiteral("GTA V"));
|
||||||
|
optionsDialog.commitProfiles(RDR2_Profiles, QStringLiteral("RDR 2"));
|
||||||
QObject::connect(&optionsDialog, &OptionsDialog::settingsApplied, this, &UserInterface::settingsApplied);
|
QObject::connect(&optionsDialog, &OptionsDialog::settingsApplied, this, &UserInterface::settingsApplied);
|
||||||
optionsDialog.setModal(true);
|
optionsDialog.setModal(true);
|
||||||
optionsDialog.show();
|
optionsDialog.show();
|
||||||
|
@ -807,15 +831,92 @@ void UserInterface::updateCacheId(uint cacheId)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UserInterface::on_actionSelect_GTA_Folder_triggered()
|
void UserInterface::on_actionSelect_Game_Folder_triggered()
|
||||||
{
|
{
|
||||||
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(this, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
QDialog gameFolderDialog;
|
||||||
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists()) {
|
gameFolderDialog.setWindowTitle(tr("Select Game Folder..."));
|
||||||
if (profileOpen) {
|
gameFolderDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||||
closeProfile_p();
|
|
||||||
|
QVBoxLayout *gameFolderLayout = new QVBoxLayout(&gameFolderDialog);
|
||||||
|
|
||||||
|
QHBoxLayout gtaFolderLayout;
|
||||||
|
gameFolderLayout->addLayout(>aFolderLayout);
|
||||||
|
QLabel *gtaLabel = new QLabel(tr("GTA V:"), &gameFolderDialog);
|
||||||
|
gtaFolderLayout.addWidget(gtaLabel);
|
||||||
|
QLineEdit *gtaLocation = new QLineEdit(AppEnv::getGTAVFolder(), &gameFolderDialog);
|
||||||
|
gtaLocation->setMinimumWidth(400);
|
||||||
|
gtaLocation->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||||
|
gtaFolderLayout.addWidget(gtaLocation);
|
||||||
|
QToolButton *gtaSelectButton = new QToolButton(&gameFolderDialog);
|
||||||
|
gtaSelectButton->setText(QStringLiteral("..."));
|
||||||
|
QObject::connect(gtaSelectButton, &QPushButton::clicked, &gameFolderDialog, [&](){
|
||||||
|
const QString GTAV_Folder_Temp = QFileDialog::getExistingDirectory(&gameFolderDialog, tr("Select GTA V Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
|
if (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists())
|
||||||
|
gtaLocation->setText(GTAV_Folder_Temp);
|
||||||
|
});
|
||||||
|
gtaFolderLayout.addWidget(gtaSelectButton);
|
||||||
|
|
||||||
|
QHBoxLayout rdrFolderLayout;
|
||||||
|
gameFolderLayout->addLayout(&rdrFolderLayout);
|
||||||
|
QLabel *rdrLabel = new QLabel(tr("RDR 2:"), &gameFolderDialog);
|
||||||
|
rdrFolderLayout.addWidget(rdrLabel);
|
||||||
|
QLineEdit *rdrLocation = new QLineEdit(AppEnv::getRDR2Folder(), &gameFolderDialog);
|
||||||
|
rdrLocation->setMinimumWidth(400);
|
||||||
|
rdrLocation->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
|
||||||
|
rdrFolderLayout.addWidget(rdrLocation);
|
||||||
|
QToolButton *rdrSelectButton = new QToolButton(&gameFolderDialog);
|
||||||
|
rdrSelectButton->setText(QStringLiteral("..."));
|
||||||
|
QObject::connect(rdrSelectButton, &QPushButton::clicked, &gameFolderDialog, [&](){
|
||||||
|
const QString RDR2_Folder_Temp = QFileDialog::getExistingDirectory(&gameFolderDialog, tr("Select RDR 2 Folder..."), StandardPaths::documentsLocation(), QFileDialog::ShowDirsOnly);
|
||||||
|
if (!RDR2_Folder_Temp.isEmpty() && QDir(RDR2_Folder_Temp).exists())
|
||||||
|
rdrLocation->setText(RDR2_Folder_Temp);
|
||||||
|
});
|
||||||
|
rdrFolderLayout.addWidget(rdrSelectButton);
|
||||||
|
|
||||||
|
QSpacerItem *gameFolderSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
gameFolderLayout->addSpacerItem(gameFolderSpacer);
|
||||||
|
|
||||||
|
QHBoxLayout buttonLayout;
|
||||||
|
gameFolderLayout->addLayout(&buttonLayout);
|
||||||
|
QSpacerItem *buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
buttonLayout.addSpacerItem(buttonSpacer);
|
||||||
|
QPushButton *selectButton = new QPushButton(tr("&Select"), &gameFolderDialog);
|
||||||
|
QObject::connect(selectButton, &QPushButton::clicked, &gameFolderDialog, &QDialog::accept);
|
||||||
|
selectButton->setFocus();
|
||||||
|
buttonLayout.addWidget(selectButton);
|
||||||
|
QPushButton *closeButton = new QPushButton(tr("&Close"), &gameFolderDialog);
|
||||||
|
QObject::connect(closeButton, &QPushButton::clicked, &gameFolderDialog, &QDialog::reject);
|
||||||
|
buttonLayout.addWidget(closeButton);
|
||||||
|
|
||||||
|
gameFolderDialog.setMinimumSize(gameFolderDialog.sizeHint());
|
||||||
|
gameFolderDialog.setMaximumSize(gameFolderDialog.sizeHint());
|
||||||
|
|
||||||
|
if (gameFolderDialog.exec() == QDialog::Accepted) {
|
||||||
|
const QString GTAV_Folder_Temp = gtaLocation->text();
|
||||||
|
const QString RDR2_Folder_Temp = rdrLocation->text();
|
||||||
|
const bool folderExists_GTAV = (!GTAV_Folder_Temp.isEmpty() && QDir(GTAV_Folder_Temp).exists());
|
||||||
|
const bool folderExists_RDR2 = (!RDR2_Folder_Temp.isEmpty() && QDir(RDR2_Folder_Temp).exists());
|
||||||
|
if (folderExists_GTAV && folderExists_RDR2) {
|
||||||
|
GTAV_Folder = GTAV_Folder_Temp;
|
||||||
|
RDR2_Folder = RDR2_Folder_Temp;
|
||||||
|
if (profileOpen)
|
||||||
|
closeProfile_p();
|
||||||
|
on_cmdReload_clicked();
|
||||||
|
}
|
||||||
|
else if (folderExists_GTAV && !folderExists_RDR2) {
|
||||||
|
GTAV_Folder = GTAV_Folder_Temp;
|
||||||
|
RDR2_Folder = QString();
|
||||||
|
if (profileOpen)
|
||||||
|
closeProfile_p();
|
||||||
|
on_cmdReload_clicked();
|
||||||
|
}
|
||||||
|
else if (folderExists_RDR2 && !folderExists_GTAV) {
|
||||||
|
GTAV_Folder = QString();
|
||||||
|
RDR2_Folder = RDR2_Folder_Temp;
|
||||||
|
if (profileOpen)
|
||||||
|
closeProfile_p();
|
||||||
|
on_cmdReload_clicked();
|
||||||
}
|
}
|
||||||
GTAV_Folder = GTAV_Folder_Temp;
|
|
||||||
on_cmdReload_clicked();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
#else
|
#else
|
||||||
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
explicit UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
|
||||||
#endif
|
#endif
|
||||||
void setupDirEnv(bool showFolderWindow = true);
|
void setupDirEnv();
|
||||||
~UserInterface();
|
~UserInterface();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -66,7 +66,7 @@ private slots:
|
||||||
void on_actionOptions_triggered();
|
void on_actionOptions_triggered();
|
||||||
void on_action_Import_triggered();
|
void on_action_Import_triggered();
|
||||||
void on_actionOpen_File_triggered();
|
void on_actionOpen_File_triggered();
|
||||||
void on_actionSelect_GTA_Folder_triggered();
|
void on_actionSelect_Game_Folder_triggered();
|
||||||
void on_action_Enable_In_game_triggered();
|
void on_action_Enable_In_game_triggered();
|
||||||
void on_action_Disable_In_game_triggered();
|
void on_action_Disable_In_game_triggered();
|
||||||
void on_actionQualify_as_Avatar_triggered();
|
void on_actionQualify_as_Avatar_triggered();
|
||||||
|
|
|
@ -92,6 +92,22 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cmdSelectGameFolder">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Select &Game Folder...</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="vsFooter">
|
<spacer name="vsFooter">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -186,7 +202,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionSelect_GTA_Folder"/>
|
<addaction name="actionSelect_Game_Folder"/>
|
||||||
<addaction name="actionOpen_File"/>
|
<addaction name="actionOpen_File"/>
|
||||||
<addaction name="actionSelect_profile"/>
|
<addaction name="actionSelect_profile"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -322,9 +338,9 @@
|
||||||
<string notr="true">Ctrl+O</string>
|
<string notr="true">Ctrl+O</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSelect_GTA_Folder">
|
<action name="actionSelect_Game_Folder">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select &GTA V Folder...</string>
|
<string>Select &Game Folder...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Select GTA V Folder...</string>
|
<string>Select GTA V Folder...</string>
|
||||||
|
@ -400,5 +416,21 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>cmdSelectGameFolder</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>actionSelect_Game_Folder</receiver>
|
||||||
|
<slot>trigger()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>312</x>
|
||||||
|
<y>256</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>312</x>
|
||||||
|
<y>249</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -150,15 +150,15 @@ int main(int argc, char *argv[])
|
||||||
telemetryCheckBox->setObjectName(QStringLiteral("TelemetryCheckBox"));
|
telemetryCheckBox->setObjectName(QStringLiteral("TelemetryCheckBox"));
|
||||||
telemetryCheckBox->setText(QApplication::translate("TelemetryDialog", "Yes, I want include personal usage data."));
|
telemetryCheckBox->setText(QApplication::translate("TelemetryDialog", "Yes, I want include personal usage data."));
|
||||||
telemetryLayout->addWidget(telemetryCheckBox);
|
telemetryLayout->addWidget(telemetryCheckBox);
|
||||||
QHBoxLayout *telemetryButtonLayout = new QHBoxLayout();
|
QHBoxLayout telemetryButtonLayout;
|
||||||
telemetryButtonLayout->setObjectName(QStringLiteral("TelemetryButtonLayout"));
|
telemetryButtonLayout.setObjectName(QStringLiteral("TelemetryButtonLayout"));
|
||||||
telemetryLayout->addLayout(telemetryButtonLayout);
|
telemetryLayout->addLayout(&telemetryButtonLayout);
|
||||||
QSpacerItem *telemetryButtonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
QSpacerItem *telemetryButtonSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
telemetryButtonLayout->addSpacerItem(telemetryButtonSpacer);
|
telemetryButtonLayout.addSpacerItem(telemetryButtonSpacer);
|
||||||
QPushButton *telemetryButton = new QPushButton(&telemetryDialog);
|
QPushButton *telemetryButton = new QPushButton(&telemetryDialog);
|
||||||
telemetryButton->setObjectName(QStringLiteral("TelemetryButton"));
|
telemetryButton->setObjectName(QStringLiteral("TelemetryButton"));
|
||||||
telemetryButton->setText(QApplication::translate("TelemetryDialog", "&OK"));
|
telemetryButton->setText(QApplication::translate("TelemetryDialog", "&OK"));
|
||||||
telemetryButtonLayout->addWidget(telemetryButton);
|
telemetryButtonLayout.addWidget(telemetryButton);
|
||||||
QObject::connect(telemetryButton, &QPushButton::clicked, &telemetryDialog, &QDialog::close);
|
QObject::connect(telemetryButton, &QPushButton::clicked, &telemetryDialog, &QDialog::close);
|
||||||
telemetryDialog.setFixedSize(telemetryDialog.sizeHint());
|
telemetryDialog.setFixedSize(telemetryDialog.sizeHint());
|
||||||
telemetryDialog.exec();
|
telemetryDialog.exec();
|
||||||
|
@ -287,11 +287,7 @@ int main(int argc, char *argv[])
|
||||||
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
UserInterface uiWindow(&profileDB, &crewDB, &threadDB);
|
||||||
#endif
|
#endif
|
||||||
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
uiWindow.setWindowIcon(IconLoader::loadingAppIcon());
|
||||||
#ifdef GTA5SYNC_FLATPAK
|
|
||||||
uiWindow.setupDirEnv(false);
|
|
||||||
#else
|
|
||||||
uiWindow.setupDirEnv();
|
uiWindow.setupDirEnv();
|
||||||
#endif
|
|
||||||
uiWindow.show();
|
uiWindow.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
Loading…
Reference in a new issue