From 0072003a14a0dc192df611c53a88e7aadb0343e4 Mon Sep 17 00:00:00 2001
From: FearlessTobi <thm.frey@gmail.com>
Date: Sun, 26 Jan 2020 00:37:48 +0100
Subject: configure_ui: Address some review comments from the previous PR

---
 src/yuzu/configuration/configure_ui.cpp | 36 ++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 16 deletions(-)

(limited to 'src/yuzu/configuration/configure_ui.cpp')

diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp
index 3058f25099..24b6c5b722 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);
-- 
cgit v1.2.3-70-g09d2