Skip to content
Snippets Groups Projects
Unverified Commit ac54f1a9 authored by Zach Hilman's avatar Zach Hilman Committed by GitHub
Browse files

Merge pull request #2553 from lioncash/language

yuzu/configuration: Make all widgets and dialogs aware of language changes
parents 357ea15a c09ff382
No related branches found
No related tags found
No related merge requests found
Showing
with 229 additions and 41 deletions
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <memory> #include <memory>
#include <QSignalBlocker>
#include "audio_core/sink.h" #include "audio_core/sink.h"
#include "audio_core/sink_details.h" #include "audio_core/sink_details.h"
#include "core/core.h" #include "core/core.h"
...@@ -15,19 +17,15 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) ...@@ -15,19 +17,15 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
: QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) { : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) {
ui->setupUi(this); ui->setupUi(this);
ui->output_sink_combo_box->clear(); InitializeAudioOutputSinkComboBox();
ui->output_sink_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name));
for (const char* id : AudioCore::GetSinkIDs()) {
ui->output_sink_combo_box->addItem(QString::fromUtf8(id));
}
connect(ui->volume_slider, &QSlider::valueChanged, this, connect(ui->volume_slider, &QSlider::valueChanged, this,
&ConfigureAudio::SetVolumeIndicatorText); &ConfigureAudio::SetVolumeIndicatorText);
SetConfiguration();
connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(ui->output_sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
&ConfigureAudio::UpdateAudioDevices); &ConfigureAudio::UpdateAudioDevices);
SetConfiguration();
const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); const bool is_powered_on = Core::System::GetInstance().IsPoweredOn();
ui->output_sink_combo_box->setEnabled(!is_powered_on); ui->output_sink_combo_box->setEnabled(!is_powered_on);
ui->audio_device_combo_box->setEnabled(!is_powered_on); ui->audio_device_combo_box->setEnabled(!is_powered_on);
...@@ -49,8 +47,9 @@ void ConfigureAudio::SetConfiguration() { ...@@ -49,8 +47,9 @@ void ConfigureAudio::SetConfiguration() {
} }
void ConfigureAudio::SetOutputSinkFromSinkID() { void ConfigureAudio::SetOutputSinkFromSinkID() {
int new_sink_index = 0; [[maybe_unused]] const QSignalBlocker blocker(ui->output_sink_combo_box);
int new_sink_index = 0;
const QString sink_id = QString::fromStdString(Settings::values.sink_id); const QString sink_id = QString::fromStdString(Settings::values.sink_id);
for (int index = 0; index < ui->output_sink_combo_box->count(); index++) { for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
if (ui->output_sink_combo_box->itemText(index) == sink_id) { if (ui->output_sink_combo_box->itemText(index) == sink_id) {
...@@ -92,6 +91,14 @@ void ConfigureAudio::ApplyConfiguration() { ...@@ -92,6 +91,14 @@ void ConfigureAudio::ApplyConfiguration() {
static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum(); static_cast<float>(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum();
} }
void ConfigureAudio::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureAudio::UpdateAudioDevices(int sink_index) { void ConfigureAudio::UpdateAudioDevices(int sink_index) {
ui->audio_device_combo_box->clear(); ui->audio_device_combo_box->clear();
ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name)); ui->audio_device_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name));
...@@ -102,6 +109,16 @@ void ConfigureAudio::UpdateAudioDevices(int sink_index) { ...@@ -102,6 +109,16 @@ void ConfigureAudio::UpdateAudioDevices(int sink_index) {
} }
} }
void ConfigureAudio::InitializeAudioOutputSinkComboBox() {
ui->output_sink_combo_box->clear();
ui->output_sink_combo_box->addItem(QString::fromUtf8(AudioCore::auto_device_name));
for (const char* id : AudioCore::GetSinkIDs()) {
ui->output_sink_combo_box->addItem(QString::fromUtf8(id));
}
}
void ConfigureAudio::RetranslateUI() { void ConfigureAudio::RetranslateUI() {
ui->retranslateUi(this); ui->retranslateUi(this);
SetVolumeIndicatorText(ui->volume_slider->sliderPosition());
} }
...@@ -19,9 +19,14 @@ public: ...@@ -19,9 +19,14 @@ public:
~ConfigureAudio() override; ~ConfigureAudio() override;
void ApplyConfiguration(); void ApplyConfiguration();
void RetranslateUI();
private: private:
void changeEvent(QEvent* event) override;
void InitializeAudioOutputSinkComboBox();
void RetranslateUI();
void UpdateAudioDevices(int sink_index); void UpdateAudioDevices(int sink_index);
void SetConfiguration(); void SetConfiguration();
......
...@@ -51,3 +51,15 @@ void ConfigureDebug::ApplyConfiguration() { ...@@ -51,3 +51,15 @@ void ConfigureDebug::ApplyConfiguration() {
filter.ParseFilterString(Settings::values.log_filter); filter.ParseFilterString(Settings::values.log_filter);
Log::SetGlobalFilter(filter); Log::SetGlobalFilter(filter);
} }
void ConfigureDebug::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureDebug::RetranslateUI() {
ui->retranslateUi(this);
}
...@@ -21,6 +21,9 @@ public: ...@@ -21,6 +21,9 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureDebug> ui; std::unique_ptr<Ui::ConfigureDebug> ui;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <QHash> #include <QHash>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QSignalBlocker>
#include "core/settings.h" #include "core/settings.h"
#include "ui_configure.h" #include "ui_configure.h"
#include "yuzu/configuration/config.h" #include "yuzu/configuration/config.h"
...@@ -46,13 +47,38 @@ void ConfigureDialog::ApplyConfiguration() { ...@@ -46,13 +47,38 @@ void ConfigureDialog::ApplyConfiguration() {
Settings::LogSettings(); Settings::LogSettings();
} }
void ConfigureDialog::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QDialog::changeEvent(event);
}
void ConfigureDialog::RetranslateUI() {
const int old_row = ui->selectorList->currentRow();
const int old_index = ui->tabWidget->currentIndex();
ui->retranslateUi(this);
PopulateSelectionList();
ui->selectorList->setCurrentRow(old_row);
UpdateVisibleTabs();
ui->tabWidget->setCurrentIndex(old_index);
}
void ConfigureDialog::PopulateSelectionList() { void ConfigureDialog::PopulateSelectionList() {
const std::array<std::pair<QString, QStringList>, 4> items{ const std::array<std::pair<QString, QStringList>, 4> items{
{{tr("General"), {tr("General"), tr("Web"), tr("Debug"), tr("Game List")}}, {{tr("General"), {tr("General"), tr("Web"), tr("Debug"), tr("Game List")}},
{tr("System"), {tr("System"), tr("Profiles"), tr("Audio")}}, {tr("System"), {tr("System"), tr("Profiles"), tr("Audio")}},
{tr("Graphics"), {tr("Graphics")}}, {tr("Graphics"), {tr("Graphics")}},
{tr("Controls"), {tr("Input"), tr("Hotkeys")}}}}; {tr("Controls"), {tr("Input"), tr("Hotkeys")}}},
};
[[maybe_unused]] const QSignalBlocker blocker(ui->selectorList);
ui->selectorList->clear();
for (const auto& entry : items) { for (const auto& entry : items) {
auto* const item = new QListWidgetItem(entry.first); auto* const item = new QListWidgetItem(entry.first);
item->setData(Qt::UserRole, entry.second); item->setData(Qt::UserRole, entry.second);
...@@ -63,24 +89,28 @@ void ConfigureDialog::PopulateSelectionList() { ...@@ -63,24 +89,28 @@ void ConfigureDialog::PopulateSelectionList() {
void ConfigureDialog::UpdateVisibleTabs() { void ConfigureDialog::UpdateVisibleTabs() {
const auto items = ui->selectorList->selectedItems(); const auto items = ui->selectorList->selectedItems();
if (items.isEmpty()) if (items.isEmpty()) {
return; return;
}
const std::map<QString, QWidget*> widgets = {{tr("General"), ui->generalTab}, const std::map<QString, QWidget*> widgets = {
{tr("System"), ui->systemTab}, {tr("General"), ui->generalTab},
{tr("Profiles"), ui->profileManagerTab}, {tr("System"), ui->systemTab},
{tr("Input"), ui->inputTab}, {tr("Profiles"), ui->profileManagerTab},
{tr("Hotkeys"), ui->hotkeysTab}, {tr("Input"), ui->inputTab},
{tr("Graphics"), ui->graphicsTab}, {tr("Hotkeys"), ui->hotkeysTab},
{tr("Audio"), ui->audioTab}, {tr("Graphics"), ui->graphicsTab},
{tr("Debug"), ui->debugTab}, {tr("Audio"), ui->audioTab},
{tr("Web"), ui->webTab}, {tr("Debug"), ui->debugTab},
{tr("Game List"), ui->gameListTab}}; {tr("Web"), ui->webTab},
{tr("Game List"), ui->gameListTab},
};
[[maybe_unused]] const QSignalBlocker blocker(ui->tabWidget);
ui->tabWidget->clear(); ui->tabWidget->clear();
const QStringList tabs = items[0]->data(Qt::UserRole).toStringList(); const QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
for (const auto& tab : tabs) {
for (const auto& tab : tabs)
ui->tabWidget->addTab(widgets.find(tab)->second, tab); ui->tabWidget->addTab(widgets.find(tab)->second, tab);
}
} }
...@@ -23,6 +23,10 @@ public: ...@@ -23,6 +23,10 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
void UpdateVisibleTabs(); void UpdateVisibleTabs();
void PopulateSelectionList(); void PopulateSelectionList();
......
...@@ -77,7 +77,6 @@ void ConfigureGameList::SetConfiguration() { ...@@ -77,7 +77,6 @@ void ConfigureGameList::SetConfiguration() {
void ConfigureGameList::changeEvent(QEvent* event) { void ConfigureGameList::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) { if (event->type() == QEvent::LanguageChange) {
RetranslateUI(); RetranslateUI();
return;
} }
QWidget::changeEvent(event); QWidget::changeEvent(event);
......
...@@ -45,3 +45,15 @@ void ConfigureGeneral::ApplyConfiguration() { ...@@ -45,3 +45,15 @@ void ConfigureGeneral::ApplyConfiguration() {
Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked();
} }
void ConfigureGeneral::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureGeneral::RetranslateUI() {
ui->retranslateUi(this);
}
...@@ -23,6 +23,9 @@ public: ...@@ -23,6 +23,9 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
std::unique_ptr<Ui::ConfigureGeneral> ui; std::unique_ptr<Ui::ConfigureGeneral> ui;
......
...@@ -101,6 +101,18 @@ void ConfigureGraphics::ApplyConfiguration() { ...@@ -101,6 +101,18 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_blue = static_cast<float>(bg_color.blueF()); Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
} }
void ConfigureGraphics::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureGraphics::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) { void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
bg_color = color; bg_color = color;
......
...@@ -21,6 +21,9 @@ public: ...@@ -21,6 +21,9 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void SetConfiguration(); void SetConfiguration();
void UpdateBackgroundColorButton(QColor color); void UpdateBackgroundColorButton(QColor color);
......
...@@ -17,7 +17,6 @@ ConfigureHotkeys::ConfigureHotkeys(QWidget* parent) ...@@ -17,7 +17,6 @@ ConfigureHotkeys::ConfigureHotkeys(QWidget* parent)
model = new QStandardItemModel(this); model = new QStandardItemModel(this);
model->setColumnCount(3); model->setColumnCount(3);
model->setHorizontalHeaderLabels({tr("Action"), tr("Hotkey"), tr("Context")});
connect(ui->hotkey_list, &QTreeView::doubleClicked, this, &ConfigureHotkeys::Configure); connect(ui->hotkey_list, &QTreeView::doubleClicked, this, &ConfigureHotkeys::Configure);
ui->hotkey_list->setModel(model); ui->hotkey_list->setModel(model);
...@@ -27,6 +26,8 @@ ConfigureHotkeys::ConfigureHotkeys(QWidget* parent) ...@@ -27,6 +26,8 @@ ConfigureHotkeys::ConfigureHotkeys(QWidget* parent)
ui->hotkey_list->setColumnWidth(0, 200); ui->hotkey_list->setColumnWidth(0, 200);
ui->hotkey_list->resizeColumnToContents(1); ui->hotkey_list->resizeColumnToContents(1);
RetranslateUI();
} }
ConfigureHotkeys::~ConfigureHotkeys() = default; ConfigureHotkeys::~ConfigureHotkeys() = default;
...@@ -49,6 +50,20 @@ void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) { ...@@ -49,6 +50,20 @@ void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) {
ui->hotkey_list->expandAll(); ui->hotkey_list->expandAll();
} }
void ConfigureHotkeys::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureHotkeys::RetranslateUI() {
ui->retranslateUi(this);
model->setHorizontalHeaderLabels({tr("Action"), tr("Hotkey"), tr("Context")});
}
void ConfigureHotkeys::Configure(QModelIndex index) { void ConfigureHotkeys::Configure(QModelIndex index) {
if (!index.parent().isValid()) { if (!index.parent().isValid()) {
return; return;
...@@ -112,7 +127,3 @@ void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) { ...@@ -112,7 +127,3 @@ void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
registry.SaveHotkeys(); registry.SaveHotkeys();
} }
void ConfigureHotkeys::RetranslateUI() {
ui->retranslateUi(this);
}
...@@ -22,7 +22,6 @@ public: ...@@ -22,7 +22,6 @@ public:
~ConfigureHotkeys() override; ~ConfigureHotkeys() override;
void ApplyConfiguration(HotkeyRegistry& registry); void ApplyConfiguration(HotkeyRegistry& registry);
void RetranslateUI();
/** /**
* Populates the hotkey list widget using data from the provided registry. * Populates the hotkey list widget using data from the provided registry.
...@@ -32,6 +31,9 @@ public: ...@@ -32,6 +31,9 @@ public:
void Populate(const HotkeyRegistry& registry); void Populate(const HotkeyRegistry& registry);
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void Configure(QModelIndex index); void Configure(QModelIndex index);
bool IsUsedKey(QKeySequence key_sequence) const; bool IsUsedKey(QKeySequence key_sequence) const;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <QSignalBlocker>
#include <QTimer> #include <QTimer>
#include "configuration/configure_touchscreen_advanced.h" #include "configuration/configure_touchscreen_advanced.h"
...@@ -74,11 +75,7 @@ ConfigureInput::ConfigureInput(QWidget* parent) ...@@ -74,11 +75,7 @@ ConfigureInput::ConfigureInput(QWidget* parent)
ui->player5_configure, ui->player6_configure, ui->player7_configure, ui->player8_configure, ui->player5_configure, ui->player6_configure, ui->player7_configure, ui->player8_configure,
}; };
for (auto* controller_box : players_controller) { RetranslateUI();
controller_box->addItems({tr("None"), tr("Pro Controller"), tr("Dual Joycons"),
tr("Single Right Joycon"), tr("Single Left Joycon")});
}
LoadConfiguration(); LoadConfiguration();
UpdateUIEnabled(); UpdateUIEnabled();
...@@ -144,6 +141,31 @@ void ConfigureInput::ApplyConfiguration() { ...@@ -144,6 +141,31 @@ void ConfigureInput::ApplyConfiguration() {
Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked();
} }
void ConfigureInput::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QDialog::changeEvent(event);
}
void ConfigureInput::RetranslateUI() {
ui->retranslateUi(this);
RetranslateControllerComboBoxes();
}
void ConfigureInput::RetranslateControllerComboBoxes() {
for (auto* controller_box : players_controller) {
[[maybe_unused]] const QSignalBlocker blocker(controller_box);
controller_box->clear();
controller_box->addItems({tr("None"), tr("Pro Controller"), tr("Dual Joycons"),
tr("Single Right Joycon"), tr("Single Left Joycon")});
}
LoadPlayerControllerIndices();
}
void ConfigureInput::UpdateUIEnabled() { void ConfigureInput::UpdateUIEnabled() {
bool hit_disabled = false; bool hit_disabled = false;
for (auto* player : players_controller) { for (auto* player : players_controller) {
...@@ -175,11 +197,7 @@ void ConfigureInput::LoadConfiguration() { ...@@ -175,11 +197,7 @@ void ConfigureInput::LoadConfiguration() {
Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD), Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD),
[](const auto& player) { return player.connected; }); [](const auto& player) { return player.connected; });
for (std::size_t i = 0; i < players_controller.size(); ++i) { LoadPlayerControllerIndices();
const auto connected = Settings::values.players[i].connected;
players_controller[i]->setCurrentIndex(
connected ? static_cast<u8>(Settings::values.players[i].type) + 1 : 0);
}
ui->use_docked_mode->setChecked(Settings::values.use_docked_mode); ui->use_docked_mode->setChecked(Settings::values.use_docked_mode);
ui->handheld_connected->setChecked( ui->handheld_connected->setChecked(
...@@ -194,6 +212,14 @@ void ConfigureInput::LoadConfiguration() { ...@@ -194,6 +212,14 @@ void ConfigureInput::LoadConfiguration() {
UpdateUIEnabled(); UpdateUIEnabled();
} }
void ConfigureInput::LoadPlayerControllerIndices() {
for (std::size_t i = 0; i < players_controller.size(); ++i) {
const auto connected = Settings::values.players[i].connected;
players_controller[i]->setCurrentIndex(
connected ? static_cast<u8>(Settings::values.players[i].type) + 1 : 0);
}
}
void ConfigureInput::RestoreDefaults() { void ConfigureInput::RestoreDefaults() {
players_controller[0]->setCurrentIndex(2); players_controller[0]->setCurrentIndex(2);
......
...@@ -33,10 +33,16 @@ public: ...@@ -33,10 +33,16 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void RetranslateControllerComboBoxes();
void UpdateUIEnabled(); void UpdateUIEnabled();
/// Load configuration settings. /// Load configuration settings.
void LoadConfiguration(); void LoadConfiguration();
void LoadPlayerControllerIndices();
/// Restore all buttons to their default values. /// Restore all buttons to their default values.
void RestoreDefaults(); void RestoreDefaults();
......
...@@ -373,6 +373,19 @@ void ConfigureInputPlayer::ApplyConfiguration() { ...@@ -373,6 +373,19 @@ void ConfigureInputPlayer::ApplyConfiguration() {
Settings::values.players[player_index].button_color_right = colors[3]; Settings::values.players[player_index].button_color_right = colors[3];
} }
void ConfigureInputPlayer::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QDialog::changeEvent(event);
}
void ConfigureInputPlayer::RetranslateUI() {
ui->retranslateUi(this);
UpdateButtonLabels();
}
void ConfigureInputPlayer::OnControllerButtonClick(int i) { void ConfigureInputPlayer::OnControllerButtonClick(int i) {
const QColor new_bg_color = QColorDialog::getColor(controller_colors[i]); const QColor new_bg_color = QColorDialog::getColor(controller_colors[i]);
if (!new_bg_color.isValid()) if (!new_bg_color.isValid())
......
...@@ -41,6 +41,9 @@ public: ...@@ -41,6 +41,9 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void OnControllerButtonClick(int i); void OnControllerButtonClick(int i);
/// Load configuration settings. /// Load configuration settings.
......
...@@ -119,6 +119,18 @@ void ConfigureInputSimple::ApplyConfiguration() { ...@@ -119,6 +119,18 @@ void ConfigureInputSimple::ApplyConfiguration() {
UISettings::values.profile_index = index; UISettings::values.profile_index = index;
} }
void ConfigureInputSimple::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureInputSimple::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureInputSimple::LoadConfiguration() { void ConfigureInputSimple::LoadConfiguration() {
const auto index = UISettings::values.profile_index; const auto index = UISettings::values.profile_index;
if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0) { if (index >= static_cast<int>(INPUT_PROFILES.size()) || index < 0) {
......
...@@ -30,6 +30,9 @@ public: ...@@ -30,6 +30,9 @@ public:
void ApplyConfiguration(); void ApplyConfiguration();
private: private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
/// Load configuration settings. /// Load configuration settings.
void LoadConfiguration(); void LoadConfiguration();
......
...@@ -140,6 +140,18 @@ void ConfigureMouseAdvanced::LoadConfiguration() { ...@@ -140,6 +140,18 @@ void ConfigureMouseAdvanced::LoadConfiguration() {
UpdateButtonLabels(); UpdateButtonLabels();
} }
void ConfigureMouseAdvanced::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QDialog::changeEvent(event);
}
void ConfigureMouseAdvanced::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureMouseAdvanced::RestoreDefaults() { void ConfigureMouseAdvanced::RestoreDefaults() {
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) { for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) {
buttons_param[button_id] = Common::ParamPackage{ buttons_param[button_id] = Common::ParamPackage{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment