mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 10:51:50 -05:00
settings: warn on invalid regon/language combinations
This commit is contained in:
parent
c5de54d509
commit
2ccf175324
2 changed files with 41 additions and 1 deletions
|
@ -14,6 +14,20 @@
|
||||||
#include "yuzu/configuration/configuration_shared.h"
|
#include "yuzu/configuration/configuration_shared.h"
|
||||||
#include "yuzu/configuration/configure_system.h"
|
#include "yuzu/configuration/configure_system.h"
|
||||||
|
|
||||||
|
constexpr std::array<u32, 7> LOCALE_BLOCKLIST{
|
||||||
|
0b100011100001100000, // Japan
|
||||||
|
0b000001101001100100, // Americas
|
||||||
|
0b100110100001000010, // Europe
|
||||||
|
0b100110100001000010, // Australia
|
||||||
|
0b000000000000000000, // China
|
||||||
|
0b100111100001000000, // Korea
|
||||||
|
0b100111100001000000, // Taiwan
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool IsValidLocale(u32 region_index, u32 language_index) {
|
||||||
|
return ((LOCALE_BLOCKLIST[region_index] >> language_index) & 1) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
|
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
|
||||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -34,6 +48,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->label_console_id->setVisible(Settings::IsConfiguringGlobal());
|
||||||
ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal());
|
ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal());
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>English</string>
|
<string>American English</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -545,6 +545,16 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QLabel" name="label_disable_info">
|
<widget class="QLabel" name="label_disable_info">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
Loading…
Reference in a new issue