swap the list to general > general
This commit is contained in:
parent
0361db0875
commit
4e38ea421e
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<std::string> 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);
|
||||
|
|
|
|||
|
|
@ -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::ConfigureFilesystem> ui;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -239,66 +239,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>External Content</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_external">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_external_desc">
|
||||
<property name="text">
|
||||
<string>Add directories to scan for DLCs and Updates without installing to NAND</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="external_content_list">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_external_buttons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="add_external_dir_button">
|
||||
<property name="text">
|
||||
<string>Add Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remove_external_dir_button">
|
||||
<property name="text">
|
||||
<string>Remove Selected</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_external">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -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 <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QListWidget>
|
||||
#include <QMessageBox>
|
||||
#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<std::string> 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) {
|
||||
|
|
|
|||
|
|
@ -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<void()> reset_callback;
|
||||
|
||||
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,66 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_external">
|
||||
<property name="title">
|
||||
<string>External Content</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_external">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_external_desc">
|
||||
<property name="text">
|
||||
<string>Add directories to scan for DLCs and Updates without installing to NAND</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="external_content_list">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_external_buttons">
|
||||
<item>
|
||||
<widget class="QPushButton" name="add_external_dir_button">
|
||||
<property name="text">
|
||||
<string>Add Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remove_external_dir_button">
|
||||
<property name="text">
|
||||
<string>Remove Selected</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_external">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
|||
Loading…
Reference in New Issue