diff options
| author | 2020-01-26 00:37:48 +0100 | |
|---|---|---|
| committer | 2020-07-18 14:09:13 +0200 | |
| commit | 0072003a14a0dc192df611c53a88e7aadb0343e4 (patch) | |
| tree | d0f3779e7755a7e91260da689c2f83f0790d1a88 /src | |
| parent | yuzu: Port translation support from Citra (diff) | |
| download | yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.gz yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.tar.xz yuzu-0072003a14a0dc192df611c53a88e7aadb0343e4.zip | |
configure_ui: Address some review comments from the previous PR
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_ui.cpp | 36 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.h | 1 |
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{ | |||
| 29 | 29 | ||
| 30 | ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { | 30 | ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { |
| 31 | ui->setupUi(this); | 31 | ui->setupUi(this); |
| 32 | ui->language_combobox->addItem(tr("<System>"), QString{}); | ||
| 33 | ui->language_combobox->addItem(tr("English"), QStringLiteral("en")); | ||
| 34 | QDirIterator it(QStringLiteral(":/languages"), QDirIterator::NoIteratorFlags); | ||
| 35 | while (it.hasNext()) { | ||
| 36 | QString locale = it.next(); | ||
| 37 | locale.truncate(locale.lastIndexOf(QLatin1Char{'.'})); | ||
| 38 | locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1); | ||
| 39 | QString lang = QLocale::languageToString(QLocale(locale).language()); | ||
| 40 | ui->language_combobox->addItem(lang, locale); | ||
| 41 | } | ||
| 42 | 32 | ||
| 43 | // Unlike other configuration changes, interface language changes need to be reflected on the | 33 | InitializeLanguageComboBox(); |
| 44 | // interface immediately. This is done by passing a signal to the main window, and then | ||
| 45 | // retranslating when passing back. | ||
| 46 | connect(ui->language_combobox, | ||
| 47 | static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, | ||
| 48 | &ConfigureUi::OnLanguageChanged); | ||
| 49 | 34 | ||
| 50 | for (const auto& theme : UISettings::themes) { | 35 | for (const auto& theme : UISettings::themes) { |
| 51 | ui->theme_combobox->addItem(QString::fromUtf8(theme.first), | 36 | ui->theme_combobox->addItem(QString::fromUtf8(theme.first), |
| @@ -120,6 +105,25 @@ void ConfigureUi::RetranslateUI() { | |||
| 120 | } | 105 | } |
| 121 | } | 106 | } |
| 122 | 107 | ||
| 108 | void ConfigureUi::InitializeLanguageComboBox() { | ||
| 109 | ui->language_combobox->addItem(tr("<System>"), QString{}); | ||
| 110 | ui->language_combobox->addItem(tr("English"), QStringLiteral("en")); | ||
| 111 | QDirIterator it(QStringLiteral(":/languages"), QDirIterator::NoIteratorFlags); | ||
| 112 | while (it.hasNext()) { | ||
| 113 | QString locale = it.next(); | ||
| 114 | locale.truncate(locale.lastIndexOf(QLatin1Char{'.'})); | ||
| 115 | locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1); | ||
| 116 | const QString lang = QLocale::languageToString(QLocale(locale).language()); | ||
| 117 | ui->language_combobox->addItem(lang, locale); | ||
| 118 | } | ||
| 119 | |||
| 120 | // Unlike other configuration changes, interface language changes need to be reflected on the | ||
| 121 | // interface immediately. This is done by passing a signal to the main window, and then | ||
| 122 | // retranslating when passing back. | ||
| 123 | connect(ui->language_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | ||
| 124 | &ConfigureUi::OnLanguageChanged); | ||
| 125 | } | ||
| 126 | |||
| 123 | void ConfigureUi::InitializeIconSizeComboBox() { | 127 | void ConfigureUi::InitializeIconSizeComboBox() { |
| 124 | for (const auto& size : default_icon_sizes) { | 128 | for (const auto& size : default_icon_sizes) { |
| 125 | ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first); | 129 | 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: | |||
| 34 | void changeEvent(QEvent*) override; | 34 | void changeEvent(QEvent*) override; |
| 35 | void RetranslateUI(); | 35 | void RetranslateUI(); |
| 36 | 36 | ||
| 37 | void InitializeLanguageComboBox(); | ||
| 37 | void InitializeIconSizeComboBox(); | 38 | void InitializeIconSizeComboBox(); |
| 38 | void InitializeRowComboBoxes(); | 39 | void InitializeRowComboBoxes(); |
| 39 | 40 | ||