From b9f06bd5991d89e8f0a268b1e0f211fbc3ab449d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 1 Feb 2022 21:59:29 -0500 Subject: [PATCH 1/2] configure_filesystem: Normalize member function casing All other dialog types we have use CamelCase naming. --- src/yuzu/configuration/configure_dialog.cpp | 2 +- src/yuzu/configuration/configure_filesystem.cpp | 8 ++++---- src/yuzu/configuration/configure_filesystem.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 464e7a489..19133ccf5 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -109,7 +109,7 @@ void ConfigureDialog::ApplyConfiguration() { ui_tab->ApplyConfiguration(); system_tab->ApplyConfiguration(); profile_tab->ApplyConfiguration(); - filesystem_tab->applyConfiguration(); + filesystem_tab->ApplyConfiguration(); input_tab->ApplyConfiguration(); hotkeys_tab->ApplyConfiguration(registry); cpu_tab->ApplyConfiguration(); diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 9cb317822..55247ebcc 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -14,7 +14,7 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) : QWidget(parent), ui(std::make_unique()) { ui->setupUi(this); - this->setConfiguration(); + SetConfiguration(); connect(ui->nand_directory_button, &QToolButton::pressed, this, [this] { SetDirectory(DirectoryTarget::NAND, ui->nand_directory_edit); }); @@ -38,7 +38,7 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) ConfigureFilesystem::~ConfigureFilesystem() = default; -void ConfigureFilesystem::setConfiguration() { +void ConfigureFilesystem::SetConfiguration() { ui->nand_directory_edit->setText( QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir))); ui->sdmc_directory_edit->setText( @@ -60,7 +60,7 @@ void ConfigureFilesystem::setConfiguration() { UpdateEnabledControls(); } -void ConfigureFilesystem::applyConfiguration() { +void ConfigureFilesystem::ApplyConfiguration() { Common::FS::SetYuzuPath(Common::FS::YuzuPath::NANDDir, ui->nand_directory_edit->text().toStdString()); Common::FS::SetYuzuPath(Common::FS::YuzuPath::SDMCDir, @@ -143,6 +143,6 @@ void ConfigureFilesystem::UpdateEnabledControls() { !ui->gamecard_current_game->isChecked()); } -void ConfigureFilesystem::retranslateUi() { +void ConfigureFilesystem::RetranslateUI() { ui->retranslateUi(this); } diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h index 2147cd405..0c86ee445 100644 --- a/src/yuzu/configuration/configure_filesystem.h +++ b/src/yuzu/configuration/configure_filesystem.h @@ -20,11 +20,11 @@ public: explicit ConfigureFilesystem(QWidget* parent = nullptr); ~ConfigureFilesystem() override; - void applyConfiguration(); - void retranslateUi(); + void ApplyConfiguration(); private: - void setConfiguration(); + void RetranslateUI(); + void SetConfiguration(); enum class DirectoryTarget { NAND, From 40d31b8b8a2ae85e0c406fe87828542ead0c6745 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 1 Feb 2022 22:03:10 -0500 Subject: [PATCH 2/2] configure_filesystem: Add missing changeEvent() override This allows the dialog to be retranslated during runtime if the language is changed. --- src/yuzu/configuration/configure_filesystem.cpp | 8 ++++++++ src/yuzu/configuration/configure_filesystem.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 55247ebcc..d6fb43f8b 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -38,6 +38,14 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) ConfigureFilesystem::~ConfigureFilesystem() = default; +void ConfigureFilesystem::changeEvent(QEvent* event) { + if (event->type() == QEvent::LanguageChange) { + RetranslateUI(); + } + + QWidget::changeEvent(event); +} + void ConfigureFilesystem::SetConfiguration() { ui->nand_directory_edit->setText( QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir))); diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h index 0c86ee445..b4f9355eb 100644 --- a/src/yuzu/configuration/configure_filesystem.h +++ b/src/yuzu/configuration/configure_filesystem.h @@ -23,6 +23,8 @@ public: void ApplyConfiguration(); private: + void changeEvent(QEvent* event) override; + void RetranslateUI(); void SetConfiguration();