mirror of https://github.com/PCSX2/pcsx2.git
Qt: Fix theme names not being translatable
This commit is contained in:
parent
a705a69022
commit
113e264617
|
@ -931,14 +931,18 @@ namespace SettingWidgetBinder
|
|||
|
||||
template <typename WidgetType>
|
||||
static inline void BindWidgetToEnumSetting(SettingsInterface* sif, WidgetType* widget, std::string section, std::string key,
|
||||
const char** enum_names, const char** enum_values, const char* default_value)
|
||||
const char** enum_names, const char** enum_values, const char* default_value, const char* translation_ctx = nullptr)
|
||||
{
|
||||
using Accessor = SettingAccessor<WidgetType>;
|
||||
|
||||
const std::string value = Host::GetBaseStringSettingValue(section.c_str(), key.c_str(), default_value);
|
||||
|
||||
for (int i = 0; enum_names[i] != nullptr; i++)
|
||||
widget->addItem(QString::fromUtf8(enum_names[i]));
|
||||
{
|
||||
widget->addItem(translation_ctx ?
|
||||
qApp->translate(translation_ctx, enum_names[i]) :
|
||||
QString::fromUtf8(enum_names[i]));
|
||||
}
|
||||
|
||||
int enum_index = -1;
|
||||
for (int i = 0; enum_values[i] != nullptr; i++)
|
||||
|
|
|
@ -92,7 +92,7 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsDialog* dialog, QWidget
|
|||
connect(m_ui.renderToSeparateWindow, &QCheckBox::stateChanged, this, &InterfaceSettingsWidget::onRenderToSeparateWindowChanged);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(sif, m_ui.theme, "UI", "Theme", THEME_NAMES, THEME_VALUES,
|
||||
QtHost::GetDefaultThemeName());
|
||||
QtHost::GetDefaultThemeName(), "InterfaceSettingsWidget");
|
||||
connect(m_ui.theme, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() { emit themeChanged(); });
|
||||
|
||||
populateLanguages();
|
||||
|
|
|
@ -194,7 +194,7 @@ void SetupWizardDialog::setupUi()
|
|||
void SetupWizardDialog::setupLanguagePage()
|
||||
{
|
||||
SettingWidgetBinder::BindWidgetToEnumSetting(nullptr, m_ui.theme, "UI", "Theme",
|
||||
InterfaceSettingsWidget::THEME_NAMES, InterfaceSettingsWidget::THEME_VALUES, QtHost::GetDefaultThemeName());
|
||||
InterfaceSettingsWidget::THEME_NAMES, InterfaceSettingsWidget::THEME_VALUES, QtHost::GetDefaultThemeName(), "InterfaceSettingsWidget");
|
||||
connect(m_ui.theme, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SetupWizardDialog::themeChanged);
|
||||
|
||||
for (const std::pair<QString, QString>& it : QtHost::GetAvailableLanguageList())
|
||||
|
|
Loading…
Reference in New Issue