summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2020-01-26 00:37:48 +0100
committerFearlessTobi <thm.frey@gmail.com>2020-07-18 14:09:13 +0200
commit0072003a14a0dc192df611c53a88e7aadb0343e4 (patch)
treed0f3779e7755a7e91260da689c2f83f0790d1a88 /src
parentyuzu: Port translation support from Citra (diff)
downloadyuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.gz
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.bz2
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.lz
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.xz
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.zst
yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/configure_ui.cpp36
-rw-r--r--src/yuzu/configuration/configure_ui.h1
2 files changed, 21 insertions, 16 deletions
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp
index 3058f2509..24b6c5b72 100644
--- a/src/yuzu/configuration/configure_ui.cpp
+++ b/src/yuzu/configuration/configure_ui.cpp
@@ -29,23 +29,8 @@ constexpr std::array row_text_names{
ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) {
ui->setupUi(this);
- ui->language_combobox->addItem(tr("<System>"), QString{});
- ui->language_combobox->addItem(tr("English"), QStringLiteral("en"));
- QDirIterator it(QStringLiteral(":/languages"), QDirIterator::NoIteratorFlags);
- while (it.hasNext()) {
- QString locale = it.next();
- locale.truncate(locale.lastIndexOf(QLatin1Char{'.'}));
- locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1);
- QString lang = QLocale::languageToString(QLocale(locale).language());
- ui->language_combobox->addItem(lang, locale);
- }
- // Unlike other configuration changes, interface language changes need to be reflected on the
- // interface immediately. This is done by passing a signal to the main window, and then
- // retranslating when passing back.
- connect(ui->language_combobox,
- static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
- &ConfigureUi::OnLanguageChanged);
+ InitializeLanguageComboBox();
for (const auto& theme : UISettings::themes) {
ui->theme_combobox->addItem(QString::fromUtf8(theme.first),
@@ -120,6 +105,25 @@ void ConfigureUi::RetranslateUI() {
}
}
+void ConfigureUi::InitializeLanguageComboBox() {
+ ui->language_combobox->addItem(tr("<System>"), QString{});
+ ui->language_combobox->addItem(tr("English"), QStringLiteral("en"));
+ QDirIterator it(QStringLiteral(":/languages"), QDirIterator::NoIteratorFlags);
+ while (it.hasNext()) {
+ QString locale = it.next();
+ locale.truncate(locale.lastIndexOf(QLatin1Char{'.'}));
+ locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1);
+ const QString lang = QLocale::languageToString(QLocale(locale).language());
+ ui->language_combobox->addItem(lang, locale);
+ }
+
+ // Unlike other configuration changes, interface language changes need to be reflected on the
+ // interface immediately. This is done by passing a signal to the main window, and then
+ // retranslating when passing back.
+ connect(ui->language_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
+ &ConfigureUi::OnLanguageChanged);
+}
+
void ConfigureUi::InitializeIconSizeComboBox() {
for (const auto& size : default_icon_sizes) {
ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first);
diff --git a/src/yuzu/configuration/configure_ui.h b/src/yuzu/configuration/configure_ui.h
index 3ecbd07c4..c30bcf6ff 100644
--- a/src/yuzu/configuration/configure_ui.h
+++ b/src/yuzu/configuration/configure_ui.h
@@ -34,6 +34,7 @@ private:
void changeEvent(QEvent*) override;
void RetranslateUI();
+ void InitializeLanguageComboBox();
void InitializeIconSizeComboBox();
void InitializeRowComboBoxes();