summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid <25727384+ogniK5377@users.noreply.github.com>2019-09-05 03:02:53 +0200
committerGitHub <noreply@github.com>2019-09-05 03:02:53 +0200
commitaa8daaf22a8cf8ac905f0128eb6da1bca27681a0 (patch)
treece861ab99a989518fab56e6167fecd3c59a01e7b
parentMerge pull request #2707 from DarkLordZach/oss-miimodel (diff)
parentconfigure_dialog: reverse tab map to avoid logic based on user-facing/translatable text (diff)
downloadyuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar.gz
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar.bz2
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar.lz
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar.xz
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.tar.zst
yuzu-aa8daaf22a8cf8ac905f0128eb6da1bca27681a0.zip
Diffstat (limited to '')
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index e636964e3..775e3f2ea 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -68,12 +68,14 @@ void ConfigureDialog::RetranslateUI() {
ui->tabWidget->setCurrentIndex(old_index);
}
+Q_DECLARE_METATYPE(QList<QWidget*>);
+
void ConfigureDialog::PopulateSelectionList() {
- const std::array<std::pair<QString, QStringList>, 4> items{
- {{tr("General"), {tr("General"), tr("Web"), tr("Debug"), tr("Game List")}},
- {tr("System"), {tr("System"), tr("Profiles"), tr("Audio")}},
- {tr("Graphics"), {tr("Graphics")}},
- {tr("Controls"), {tr("Input"), tr("Hotkeys")}}},
+ const std::array<std::pair<QString, QList<QWidget*>>, 4> items{
+ {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->gameListTab}},
+ {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->audioTab}},
+ {tr("Graphics"), {ui->graphicsTab}},
+ {tr("Controls"), {ui->inputTab, ui->hotkeysTab}}},
};
[[maybe_unused]] const QSignalBlocker blocker(ui->selectorList);
@@ -81,7 +83,7 @@ void ConfigureDialog::PopulateSelectionList() {
ui->selectorList->clear();
for (const auto& entry : items) {
auto* const item = new QListWidgetItem(entry.first);
- item->setData(Qt::UserRole, entry.second);
+ item->setData(Qt::UserRole, QVariant::fromValue(entry.second));
ui->selectorList->addItem(item);
}
@@ -93,24 +95,26 @@ void ConfigureDialog::UpdateVisibleTabs() {
return;
}
- const std::map<QString, QWidget*> widgets = {
- {tr("General"), ui->generalTab},
- {tr("System"), ui->systemTab},
- {tr("Profiles"), ui->profileManagerTab},
- {tr("Input"), ui->inputTab},
- {tr("Hotkeys"), ui->hotkeysTab},
- {tr("Graphics"), ui->graphicsTab},
- {tr("Audio"), ui->audioTab},
- {tr("Debug"), ui->debugTab},
- {tr("Web"), ui->webTab},
- {tr("Game List"), ui->gameListTab},
+ const std::map<QWidget*, QString> widgets = {
+ {ui->generalTab, tr("General")},
+ {ui->systemTab, tr("System")},
+ {ui->profileManagerTab, tr("Profiles")},
+ {ui->inputTab, tr("Input")},
+ {ui->hotkeysTab, tr("Hotkeys")},
+ {ui->graphicsTab, tr("Graphics")},
+ {ui->audioTab, tr("Audio")},
+ {ui->debugTab, tr("Debug")},
+ {ui->webTab, tr("Web")},
+ {ui->gameListTab, tr("Game List")},
};
[[maybe_unused]] const QSignalBlocker blocker(ui->tabWidget);
ui->tabWidget->clear();
- const QStringList tabs = items[0]->data(Qt::UserRole).toStringList();
- for (const auto& tab : tabs) {
- ui->tabWidget->addTab(widgets.find(tab)->second, tab);
+
+ const QList<QWidget*> tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole));
+
+ for (const auto tab : tabs) {
+ ui->tabWidget->addTab(tab, widgets.at(tab));
}
}