mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 14:52:45 +01:00
Merge pull request #9514 from ColinKinloch/en_gb
settings: warn on invalid regon/language combinations
This commit is contained in:
commit
0b228fde15
2 changed files with 47 additions and 1 deletions
|
@ -14,6 +14,26 @@
|
|||
#include "yuzu/configuration/configuration_shared.h"
|
||||
#include "yuzu/configuration/configure_system.h"
|
||||
|
||||
constexpr std::array<u32, 7> LOCALE_BLOCKLIST{
|
||||
// pzzefezrpnkzeidfej
|
||||
// thhsrnhutlohsternp
|
||||
// BHH4CG U
|
||||
// Raa1AB S
|
||||
// nn9
|
||||
// ts
|
||||
0b0100011100001100000, // Japan
|
||||
0b0000001101001100100, // Americas
|
||||
0b0100110100001000010, // Europe
|
||||
0b0100110100001000010, // Australia
|
||||
0b0000000000000000000, // China
|
||||
0b0100111100001000000, // Korea
|
||||
0b0100111100001000000, // Taiwan
|
||||
};
|
||||
|
||||
static bool IsValidLocale(u32 region_index, u32 language_index) {
|
||||
return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0;
|
||||
}
|
||||
|
||||
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
@ -34,6 +54,22 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
|
|||
}
|
||||
});
|
||||
|
||||
const auto locale_check = [this](int index) {
|
||||
const bool valid_locale =
|
||||
IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex());
|
||||
ui->label_warn_invalid_locale->setVisible(!valid_locale);
|
||||
if (!valid_locale) {
|
||||
ui->label_warn_invalid_locale->setText(
|
||||
tr("Warning: \"%1\" is not a valid language for region \"%2\"")
|
||||
.arg(ui->combo_language->currentText())
|
||||
.arg(ui->combo_region->currentText()));
|
||||
}
|
||||
};
|
||||
|
||||
connect(ui->combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
locale_check);
|
||||
connect(ui->combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
|
||||
|
||||
ui->label_console_id->setVisible(Settings::IsConfiguringGlobal());
|
||||
ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal());
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@
|
|||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>English</string>
|
||||
<string>American English</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -545,6 +545,16 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_warn_invalid_locale">
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_disable_info">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in a new issue