diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 10 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.h | 6 |
4 files changed, 21 insertions, 8 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 97fb664bf..ac42cc7fc 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -92,3 +92,13 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index | |||
| 92 | combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); | 92 | combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); |
| 93 | combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); | 93 | combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); |
| 94 | } | 94 | } |
| 95 | |||
| 96 | int ConfigurationShared::GetComboboxIndex(int global_setting_index, const QComboBox* combobox) { | ||
| 97 | if (Settings::IsConfiguringGlobal()) { | ||
| 98 | return combobox->currentIndex(); | ||
| 99 | } | ||
| 100 | if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { | ||
| 101 | return global_setting_index; | ||
| 102 | } | ||
| 103 | return combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET; | ||
| 104 | } | ||
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index e597dcdb5..04c88758c 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -69,4 +69,7 @@ void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); | |||
| 69 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox | 69 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox |
| 70 | void InsertGlobalItem(QComboBox* combobox, int global_index); | 70 | void InsertGlobalItem(QComboBox* combobox, int global_index); |
| 71 | 71 | ||
| 72 | // Returns the correct index of a QComboBox taking into account global configuration | ||
| 73 | int GetComboboxIndex(int global_setting_index, const QComboBox* combobox); | ||
| 74 | |||
| 72 | } // namespace ConfigurationShared | 75 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 94049f2f4..9ea4c02da 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -31,6 +31,9 @@ constexpr std::array<u32, 7> LOCALE_BLOCKLIST{ | |||
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | static bool IsValidLocale(u32 region_index, u32 language_index) { | 33 | static bool IsValidLocale(u32 region_index, u32 language_index) { |
| 34 | if (region_index >= LOCALE_BLOCKLIST.size()) { | ||
| 35 | return false; | ||
| 36 | } | ||
| 34 | return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; | 37 | return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; |
| 35 | } | 38 | } |
| 36 | 39 | ||
| @@ -55,8 +58,11 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) | |||
| 55 | }); | 58 | }); |
| 56 | 59 | ||
| 57 | const auto locale_check = [this](int index) { | 60 | const auto locale_check = [this](int index) { |
| 58 | const bool valid_locale = | 61 | const auto region_index = ConfigurationShared::GetComboboxIndex( |
| 59 | IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex()); | 62 | Settings::values.region_index.GetValue(true), ui->combo_region); |
| 63 | const auto language_index = ConfigurationShared::GetComboboxIndex( | ||
| 64 | Settings::values.language_index.GetValue(true), ui->combo_language); | ||
| 65 | const bool valid_locale = IsValidLocale(region_index, language_index); | ||
| 60 | ui->label_warn_invalid_locale->setVisible(!valid_locale); | 66 | ui->label_warn_invalid_locale->setVisible(!valid_locale); |
| 61 | if (!valid_locale) { | 67 | if (!valid_locale) { |
| 62 | ui->label_warn_invalid_locale->setText( | 68 | ui->label_warn_invalid_locale->setText( |
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 8f02880a7..a7f086258 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h | |||
| @@ -42,13 +42,7 @@ private: | |||
| 42 | std::unique_ptr<Ui::ConfigureSystem> ui; | 42 | std::unique_ptr<Ui::ConfigureSystem> ui; |
| 43 | bool enabled = false; | 43 | bool enabled = false; |
| 44 | 44 | ||
| 45 | int language_index = 0; | ||
| 46 | int region_index = 0; | ||
| 47 | int time_zone_index = 0; | ||
| 48 | int sound_index = 0; | ||
| 49 | |||
| 50 | ConfigurationShared::CheckState use_rng_seed; | 45 | ConfigurationShared::CheckState use_rng_seed; |
| 51 | ConfigurationShared::CheckState use_custom_rtc; | ||
| 52 | 46 | ||
| 53 | Core::System& system; | 47 | Core::System& system; |
| 54 | }; | 48 | }; |