From f09c0e5a288d957e3207d774f40af000e09ccf37 Mon Sep 17 00:00:00 2001 From: UltraDaCat <113462733+UltraDaCat@users.noreply.github.com> Date: Mon, 1 Sep 2025 20:08:53 +0200 Subject: [PATCH] Add an option to change DLC path from the settings (#3501) * Update settings_dialog.ui * Update settings_dialog.cpp * rename PLACEHOLDER settings_dialog.cpp * Move DLC above save data settings_dialog.ui --- src/qt_gui/settings_dialog.cpp | 29 +++ src/qt_gui/settings_dialog.ui | 345 ++++++++++++++++++--------------- 2 files changed, 215 insertions(+), 159 deletions(-) diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index e5b605f9c..fbd04174f 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -340,6 +340,21 @@ SettingsDialog::SettingsDialog(std::shared_ptr gui_settings, } }); + connect(ui->folderButton, &QPushButton::clicked, this, [this]() { + const auto dlc_folder_path = Config::getAddonInstallDir(); + QString initial_path; + Common::FS::PathToQString(initial_path, dlc_folder_path); + + QString dlc_folder_path_string = + QFileDialog::getExistingDirectory(this, tr("Select the DLC folder"), initial_path); + + auto file_path = Common::FS::PathFromQString(dlc_folder_path_string); + if (!file_path.empty()) { + Config::setAddonInstallDir(file_path); + ui->currentDLCFolder->setText(dlc_folder_path_string); + } + }); + connect(ui->PortableUserButton, &QPushButton::clicked, this, []() { QString userDir; Common::FS::PathToQString(userDir, std::filesystem::current_path() / "user"); @@ -412,7 +427,9 @@ SettingsDialog::SettingsDialog(std::shared_ptr gui_settings, ui->saveDataGroupBox->installEventFilter(this); ui->currentSaveDataPath->installEventFilter(this); + ui->currentDLCFolder->installEventFilter(this); ui->browseButton->installEventFilter(this); + ui->folderButton->installEventFilter(this); ui->PortableUserFolderGroupBox->installEventFilter(this); // Debug @@ -471,6 +488,11 @@ void SettingsDialog::LoadValuesFromConfig() { Common::FS::PathToQString(save_data_path_string, save_data_path); ui->currentSaveDataPath->setText(save_data_path_string); + const auto dlc_folder_path = Config::getAddonInstallDir(); + QString dlc_folder_path_string; + Common::FS::PathToQString(dlc_folder_path_string, dlc_folder_path); + ui->currentDLCFolder->setText(dlc_folder_path_string); + ui->consoleLanguageComboBox->setCurrentIndex( std::distance(languageIndexes.begin(), std::find(languageIndexes.begin(), languageIndexes.end(), @@ -745,6 +767,13 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) { text = tr("Portable user folder:\\nStores shadPS4 settings and data that will be applied only to the shadPS4 build located in the current folder. Restart the app after creating the portable user folder to begin using it."); } + // DLC Folder + if (elementName == "dlcFolderGroupBox" || elementName == "currentDLCFolder") { + text = tr("DLC Path:\\nThe folder where game DLC loaded from."); + } else if (elementName == "folderButton") { + text = tr("Browse:\\nBrowse for a folder to set as the DLC path."); + } + // Save Data if (elementName == "saveDataGroupBox" || elementName == "currentSaveDataPath") { text = tr("Save Data Path:\\nThe folder where game save data will be saved."); diff --git a/src/qt_gui/settings_dialog.ui b/src/qt_gui/settings_dialog.ui index 703c21815..8b52ce55d 100644 --- a/src/qt_gui/settings_dialog.ui +++ b/src/qt_gui/settings_dialog.ui @@ -59,7 +59,7 @@ - 6 + 5 @@ -73,8 +73,8 @@ 0 0 - 679 - 420 + 944 + 537 @@ -86,8 +86,91 @@ 6 - - + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Emulator + + + false + + + false + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + 10 + + + + + Show Splash + + + + + + + Enable Discord Rich Presence + + + + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Orientation::Vertical @@ -99,8 +182,66 @@ - - + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + System + + + + 70 + + + + + Console Language + + + + + + + + + + + + Emulator Language + + + + + + + + + + + + + + + Qt::Orientation::Vertical @@ -286,64 +427,6 @@ - - - - 6 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - System - - - - 70 - - - - - Console Language - - - - - - - - - - - - Emulator Language - - - - - - - - - - - - - @@ -369,7 +452,7 @@ 0 0 - 149 + 414 69 @@ -425,89 +508,6 @@ - - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Emulator - - - false - - - false - - - - 6 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - 10 - - - - - Show Splash - - - - - - - Enable Discord Rich Presence - - - - - - - Qt::Orientation::Vertical - - - - 20 - 40 - - - - - - - - - - - @@ -538,8 +538,8 @@ 0 0 - 626 - 370 + 944 + 537 @@ -987,8 +987,8 @@ 0 0 - 553 - 244 + 944 + 537 @@ -1282,8 +1282,8 @@ 0 0 - 485 - 348 + 944 + 537 @@ -1524,8 +1524,8 @@ 0 0 - 515 - 228 + 944 + 537 @@ -1796,8 +1796,8 @@ 0 0 - 421 - 319 + 944 + 537 @@ -1844,6 +1844,33 @@ + + + + DLC Folder + + + + + + + + true + + + + + + + Browse + + + + + + + +