mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-18 17:43:22 +02:00
Merge pull request #4398 from zhaowenlan1779/config-fix
citra_qt/configuration: fix language configuration issues
This commit is contained in:
commit
d3b1b5f22c
@ -20,12 +20,12 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void setConfiguration();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateAudioDevices(int sink_index);
|
void updateAudioDevices(int sink_index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
|
||||||
void setOutputSinkFromSinkID();
|
void setOutputSinkFromSinkID();
|
||||||
void setAudioDeviceFromDeviceID();
|
void setAudioDeviceFromDeviceID();
|
||||||
void setVolumeIndicatorText(int percentage);
|
void setVolumeIndicatorText(int percentage);
|
||||||
|
@ -20,8 +20,6 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -14,7 +14,6 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, const HotkeyRegistry& registry
|
|||||||
: QDialog(parent), ui(new Ui::ConfigureDialog) {
|
: QDialog(parent), ui(new Ui::ConfigureDialog) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->generalTab->PopulateHotkeyList(registry);
|
ui->generalTab->PopulateHotkeyList(registry);
|
||||||
this->setConfiguration();
|
|
||||||
this->PopulateSelectionList();
|
this->PopulateSelectionList();
|
||||||
connect(ui->uiTab, &ConfigureUi::languageChanged, this, &ConfigureDialog::onLanguageChanged);
|
connect(ui->uiTab, &ConfigureUi::languageChanged, this, &ConfigureDialog::onLanguageChanged);
|
||||||
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
|
||||||
@ -27,7 +26,17 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, const HotkeyRegistry& registry
|
|||||||
|
|
||||||
ConfigureDialog::~ConfigureDialog() = default;
|
ConfigureDialog::~ConfigureDialog() = default;
|
||||||
|
|
||||||
void ConfigureDialog::setConfiguration() {}
|
void ConfigureDialog::setConfiguration() {
|
||||||
|
ui->generalTab->setConfiguration();
|
||||||
|
ui->systemTab->setConfiguration();
|
||||||
|
ui->inputTab->loadConfiguration();
|
||||||
|
ui->graphicsTab->setConfiguration();
|
||||||
|
ui->audioTab->setConfiguration();
|
||||||
|
ui->cameraTab->setConfiguration();
|
||||||
|
ui->debugTab->setConfiguration();
|
||||||
|
ui->webTab->setConfiguration();
|
||||||
|
ui->uiTab->setConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigureDialog::applyConfiguration() {
|
void ConfigureDialog::applyConfiguration() {
|
||||||
ui->generalTab->applyConfiguration();
|
ui->generalTab->applyConfiguration();
|
||||||
@ -44,12 +53,14 @@ void ConfigureDialog::applyConfiguration() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDialog::PopulateSelectionList() {
|
void ConfigureDialog::PopulateSelectionList() {
|
||||||
|
ui->selectorList->clear();
|
||||||
|
|
||||||
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("UI")}},
|
{{tr("General"),
|
||||||
{tr("System"), {tr("System"), tr("Audio"), tr("Camera")}},
|
{QT_TR_NOOP("General"), QT_TR_NOOP("Web"), QT_TR_NOOP("Debug"), QT_TR_NOOP("UI")}},
|
||||||
{tr("Graphics"), {tr("Graphics")}},
|
{tr("System"), {QT_TR_NOOP("System"), QT_TR_NOOP("Audio"), QT_TR_NOOP("Camera")}},
|
||||||
{tr("Controls"), {tr("Input")}}}};
|
{tr("Graphics"), {QT_TR_NOOP("Graphics")}},
|
||||||
|
{tr("Controls"), {QT_TR_NOOP("Input")}}}};
|
||||||
|
|
||||||
for (const auto& entry : items) {
|
for (const auto& entry : items) {
|
||||||
auto* item = new QListWidgetItem(entry.first);
|
auto* item = new QListWidgetItem(entry.first);
|
||||||
@ -61,7 +72,21 @@ void ConfigureDialog::PopulateSelectionList() {
|
|||||||
|
|
||||||
void ConfigureDialog::onLanguageChanged(const QString& locale) {
|
void ConfigureDialog::onLanguageChanged(const QString& locale) {
|
||||||
emit languageChanged(locale);
|
emit languageChanged(locale);
|
||||||
|
// first apply the configuration, and then restore the display
|
||||||
|
applyConfiguration();
|
||||||
|
retranslateUi();
|
||||||
|
setConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureDialog::retranslateUi() {
|
||||||
|
int old_row = ui->selectorList->currentRow();
|
||||||
|
int old_index = ui->tabWidget->currentIndex();
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
|
PopulateSelectionList();
|
||||||
|
// restore selection after repopulating
|
||||||
|
ui->selectorList->setCurrentRow(old_row);
|
||||||
|
ui->tabWidget->setCurrentIndex(old_index);
|
||||||
|
|
||||||
ui->generalTab->retranslateUi();
|
ui->generalTab->retranslateUi();
|
||||||
ui->systemTab->retranslateUi();
|
ui->systemTab->retranslateUi();
|
||||||
ui->inputTab->retranslateUi();
|
ui->inputTab->retranslateUi();
|
||||||
@ -78,20 +103,15 @@ void ConfigureDialog::UpdateVisibleTabs() {
|
|||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QHash<QString, QWidget*> widgets = {{tr("General"), ui->generalTab},
|
const QHash<QString, QWidget*> widgets = {
|
||||||
{tr("System"), ui->systemTab},
|
{"General", ui->generalTab}, {"System", ui->systemTab}, {"Input", ui->inputTab},
|
||||||
{tr("Input"), ui->inputTab},
|
{"Graphics", ui->graphicsTab}, {"Audio", ui->audioTab}, {"Camera", ui->cameraTab},
|
||||||
{tr("Graphics"), ui->graphicsTab},
|
{"Debug", ui->debugTab}, {"Web", ui->webTab}, {"UI", ui->uiTab}};
|
||||||
{tr("Audio"), ui->audioTab},
|
|
||||||
{tr("Camera"), ui->cameraTab},
|
|
||||||
{tr("Debug"), ui->debugTab},
|
|
||||||
{tr("Web"), ui->webTab},
|
|
||||||
{tr("UI"), ui->uiTab}};
|
|
||||||
|
|
||||||
ui->tabWidget->clear();
|
ui->tabWidget->clear();
|
||||||
|
|
||||||
QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
|
QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
|
||||||
|
|
||||||
for (const auto& tab : tabs)
|
for (const auto& tab : tabs)
|
||||||
ui->tabWidget->addTab(widgets[tab], tab);
|
ui->tabWidget->addTab(widgets[tab], tr(qPrintable(tab)));
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureDialog> ui;
|
std::unique_ptr<Ui::ConfigureDialog> ui;
|
||||||
|
@ -24,9 +24,8 @@ public:
|
|||||||
void ResetDefaults();
|
void ResetDefaults();
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
std::unique_ptr<Ui::ConfigureGeneral> ui;
|
||||||
};
|
};
|
||||||
|
@ -20,8 +20,6 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
private:
|
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -343,5 +343,4 @@ void ConfigureInput::keyPressEvent(QKeyEvent* event) {
|
|||||||
|
|
||||||
void ConfigureInput::retranslateUi() {
|
void ConfigureInput::retranslateUi() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
updateButtonLabels();
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,9 @@ public:
|
|||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
|
/// Load configuration settings.
|
||||||
|
void loadConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureInput> ui;
|
std::unique_ptr<Ui::ConfigureInput> ui;
|
||||||
|
|
||||||
@ -69,8 +72,6 @@ private:
|
|||||||
/// keyboard events are ignored.
|
/// keyboard events are ignored.
|
||||||
bool want_keyboard_keys = false;
|
bool want_keyboard_keys = false;
|
||||||
|
|
||||||
/// Load configuration settings.
|
|
||||||
void loadConfiguration();
|
|
||||||
/// Restore all buttons to their default values.
|
/// Restore all buttons to their default values.
|
||||||
void restoreDefaults();
|
void restoreDefaults();
|
||||||
/// Clear all input configuration
|
/// Clear all input configuration
|
||||||
|
@ -422,5 +422,4 @@ void ConfigureSystem::RefreshConsoleID() {
|
|||||||
|
|
||||||
void ConfigureSystem::retranslateUi() {
|
void ConfigureSystem::retranslateUi() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
ReadSystemSettings();
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void setConfiguration();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLanguageChanged(int index);
|
void onLanguageChanged(int index);
|
||||||
@ -28,7 +29,5 @@ signals:
|
|||||||
void languageChanged(const QString& locale);
|
void languageChanged(const QString& locale);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureUi> ui;
|
std::unique_ptr<Ui::ConfigureUi> ui;
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,16 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_change_language_info">
|
||||||
|
<property name="text">
|
||||||
|
<string>Note: Changing language will apply your configuration.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
@ -21,6 +21,7 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
void setConfiguration();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void RefreshTelemetryID();
|
void RefreshTelemetryID();
|
||||||
@ -29,8 +30,6 @@ public slots:
|
|||||||
void OnLoginVerified();
|
void OnLoginVerified();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
|
||||||
|
|
||||||
bool user_verified = true;
|
bool user_verified = true;
|
||||||
QFutureWatcher<bool> verify_watcher;
|
QFutureWatcher<bool> verify_watcher;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user