diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 29dd6e2122..1107c77e8c 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -99,7 +99,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, } }); connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); - connect(filesystem_tab.get(), &ConfigureFilesystem::ExternalContentDirsChanged, this, + connect(general_tab.get(), &ConfigureGeneral::ExternalContentDirsChanged, this, &ConfigureDialog::ExternalContentDirsChanged); connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, &ConfigureDialog::UpdateVisibleTabs); diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 2842a86729..f0310a30bd 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -42,15 +42,6 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) &ConfigureFilesystem::UpdateEnabledControls); connect(ui->gamecard_current_game, &QCheckBox::stateChanged, this, &ConfigureFilesystem::UpdateEnabledControls); - - connect(ui->add_external_dir_button, &QPushButton::pressed, this, - &ConfigureFilesystem::AddExternalContentDirectory); - connect(ui->remove_external_dir_button, &QPushButton::pressed, this, - &ConfigureFilesystem::RemoveSelectedExternalContentDirectory); - connect(ui->external_content_list, &QListWidget::itemSelectionChanged, this, [this] { - ui->remove_external_dir_button->setEnabled( - !ui->external_content_list->selectedItems().isEmpty()); - }); } ConfigureFilesystem::~ConfigureFilesystem() = default; @@ -84,7 +75,6 @@ void ConfigureFilesystem::SetConfiguration() { ui->cache_game_list->setChecked(UISettings::values.cache_game_list.GetValue()); - UpdateExternalContentList(); UpdateEnabledControls(); } @@ -106,17 +96,6 @@ void ConfigureFilesystem::ApplyConfiguration() { Settings::values.dump_nso = ui->dump_nso->isChecked(); UISettings::values.cache_game_list = ui->cache_game_list->isChecked(); - - std::vector new_dirs; - new_dirs.reserve(ui->external_content_list->count()); - for (int i = 0; i < ui->external_content_list->count(); ++i) { - new_dirs.push_back(ui->external_content_list->item(i)->text().toStdString()); - } - - if (new_dirs != Settings::values.external_content_dirs) { - Settings::values.external_content_dirs = std::move(new_dirs); - emit ExternalContentDirsChanged(); - } } void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit) { @@ -141,9 +120,6 @@ void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit) case DirectoryTarget::Load: caption = tr("Select Mod Load Directory..."); break; - case DirectoryTarget::ExternalContent: - caption = tr("Select External Content Directory..."); - break; } QString str; @@ -302,43 +278,6 @@ void ConfigureFilesystem::UpdateEnabledControls() { !ui->gamecard_current_game->isChecked()); } -void ConfigureFilesystem::UpdateExternalContentList() { - ui->external_content_list->clear(); - for (const auto& dir : Settings::values.external_content_dirs) { - ui->external_content_list->addItem(QString::fromStdString(dir)); - } -} - -void ConfigureFilesystem::AddExternalContentDirectory() { - const QString dir_path = QFileDialog::getExistingDirectory( - this, tr("Select External Content Directory..."), QString()); - - if (dir_path.isEmpty()) { - return; - } - - QString normalized_path = QDir::toNativeSeparators(dir_path); - if (normalized_path.back() != QDir::separator()) { - normalized_path.append(QDir::separator()); - } - - for (int i = 0; i < ui->external_content_list->count(); ++i) { - if (ui->external_content_list->item(i)->text() == normalized_path) { - QMessageBox::information(this, tr("Directory Already Added"), - tr("This directory is already in the list.")); - return; - } - } - - ui->external_content_list->addItem(normalized_path); -} - -void ConfigureFilesystem::RemoveSelectedExternalContentDirectory() { - auto selected = ui->external_content_list->selectedItems(); - if (!selected.isEmpty()) { - qDeleteAll(ui->external_content_list->selectedItems()); - } -} void ConfigureFilesystem::RetranslateUI() { ui->retranslateUi(this); diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h index a433c9c694..995e636544 100644 --- a/src/yuzu/configuration/configure_filesystem.h +++ b/src/yuzu/configuration/configure_filesystem.h @@ -24,9 +24,6 @@ public: void ApplyConfiguration(); -signals: - void ExternalContentDirsChanged(); - private: void changeEvent(QEvent* event) override; @@ -40,7 +37,6 @@ private: Gamecard, Dump, Load, - ExternalContent, }; void SetDirectory(DirectoryTarget target, QLineEdit* edit); @@ -48,9 +44,6 @@ private: void PromptSaveMigration(const QString& from_path, const QString& to_path); void ResetMetadata(); void UpdateEnabledControls(); - void UpdateExternalContentList(); - void AddExternalContentDirectory(); - void RemoveSelectedExternalContentDirectory(); std::unique_ptr ui; }; diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui index 5dca559281..75c61c74a6 100644 --- a/src/yuzu/configuration/configure_filesystem.ui +++ b/src/yuzu/configuration/configure_filesystem.ui @@ -239,66 +239,6 @@ - - - - External Content - - - - - - Add directories to scan for DLCs and Updates without installing to NAND - - - true - - - - - - - QAbstractItemView::SingleSelection - - - - - - - - - Add Directory - - - - - - - Remove Selected - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index b2fe566a17..f628abeab3 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2016 Citra Emulator Project @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include #include "common/settings.h" #include "core/core.h" @@ -29,6 +32,15 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_, connect(ui->button_reset_defaults, &QPushButton::clicked, this, &ConfigureGeneral::ResetDefaults); + connect(ui->add_external_dir_button, &QPushButton::pressed, this, + &ConfigureGeneral::AddExternalContentDirectory); + connect(ui->remove_external_dir_button, &QPushButton::pressed, this, + &ConfigureGeneral::RemoveSelectedExternalContentDirectory); + connect(ui->external_content_list, &QListWidget::itemSelectionChanged, this, [this] { + ui->remove_external_dir_button->setEnabled( + !ui->external_content_list->selectedItems().isEmpty()); + }); + if (!Settings::IsConfiguringGlobal()) { ui->button_reset_defaults->setVisible(false); } @@ -36,7 +48,9 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_, ConfigureGeneral::~ConfigureGeneral() = default; -void ConfigureGeneral::SetConfiguration() {} +void ConfigureGeneral::SetConfiguration() { + UpdateExternalContentList(); +} void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) { QLayout& general_layout = *ui->general_widget->layout(); @@ -101,6 +115,55 @@ void ConfigureGeneral::ApplyConfiguration() { for (const auto& func : apply_funcs) { func(powered_on); } + + std::vector new_dirs; + new_dirs.reserve(ui->external_content_list->count()); + for (int i = 0; i < ui->external_content_list->count(); ++i) { + new_dirs.push_back(ui->external_content_list->item(i)->text().toStdString()); + } + + if (new_dirs != Settings::values.external_content_dirs) { + Settings::values.external_content_dirs = std::move(new_dirs); + emit ExternalContentDirsChanged(); + } +} + +void ConfigureGeneral::UpdateExternalContentList() { + ui->external_content_list->clear(); + for (const auto& dir : Settings::values.external_content_dirs) { + ui->external_content_list->addItem(QString::fromStdString(dir)); + } +} + +void ConfigureGeneral::AddExternalContentDirectory() { + const QString dir_path = QFileDialog::getExistingDirectory( + this, tr("Select External Content Directory..."), QString()); + + if (dir_path.isEmpty()) { + return; + } + + QString normalized_path = QDir::toNativeSeparators(dir_path); + if (normalized_path.back() != QDir::separator()) { + normalized_path.append(QDir::separator()); + } + + for (int i = 0; i < ui->external_content_list->count(); ++i) { + if (ui->external_content_list->item(i)->text() == normalized_path) { + QMessageBox::information(this, tr("Directory Already Added"), + tr("This directory is already in the list.")); + return; + } + } + + ui->external_content_list->addItem(normalized_path); +} + +void ConfigureGeneral::RemoveSelectedExternalContentDirectory() { + auto selected = ui->external_content_list->selectedItems(); + if (!selected.isEmpty()) { + qDeleteAll(ui->external_content_list->selectedItems()); + } } void ConfigureGeneral::changeEvent(QEvent* event) { diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index ada6526a6a..983fd50f10 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2016 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -39,12 +42,19 @@ public: void ApplyConfiguration() override; void SetConfiguration() override; +signals: + void ExternalContentDirsChanged(); + private: void Setup(const ConfigurationShared::Builder& builder); void changeEvent(QEvent* event) override; void RetranslateUI(); + void UpdateExternalContentList(); + void AddExternalContentDirectory(); + void RemoveSelectedExternalContentDirectory(); + std::function reset_callback; std::unique_ptr ui; diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index a10e7d3a50..78b6081d92 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -46,6 +46,66 @@ + + + + External Content + + + + + + Add directories to scan for DLCs and Updates without installing to NAND + + + true + + + + + + + QAbstractItemView::SingleSelection + + + + + + + + + Add Directory + + + + + + + Remove Selected + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + +