summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-01-02 23:24:38 +0100
committerGitHub <noreply@github.com>2019-01-02 23:24:38 +0100
commit6a0e258ddef8338090082744630cdce83ba8854b (patch)
tree8e21028c96ac07e33ffab093645bdb8567f23cf9 /src
parentMerge pull request #1969 from lioncash/cast (diff)
parentQt/Configure: Use sidebar to divide tabs into smaller groups (diff)
downloadyuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar.gz
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar.bz2
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar.lz
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar.xz
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.tar.zst
yuzu-6a0e258ddef8338090082744630cdce83ba8854b.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/configure.ui138
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp43
-rw-r--r--src/yuzu/configuration/configure_dialog.h2
3 files changed, 124 insertions, 59 deletions
diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui
index 8706b80d2..ce833b6c8 100644
--- a/src/yuzu/configuration/configure.ui
+++ b/src/yuzu/configuration/configure.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>461</width>
- <height>659</height>
+ <width>382</width>
+ <height>241</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,51 +15,71 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QTabWidget" name="tabWidget">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="ConfigureGeneral" name="generalTab">
- <attribute name="title">
- <string>General</string>
- </attribute>
- </widget>
- <widget class="ConfigureGameList" name="gameListTab">
- <attribute name="title">
- <string>Game List</string>
- </attribute>
- </widget>
- <widget class="ConfigureSystem" name="systemTab">
- <attribute name="title">
- <string>System</string>
- </attribute>
- </widget>
- <widget class="ConfigureInputSimple" name="inputTab">
- <attribute name="title">
- <string>Input</string>
- </attribute>
- </widget>
- <widget class="ConfigureGraphics" name="graphicsTab">
- <attribute name="title">
- <string>Graphics</string>
- </attribute>
- </widget>
- <widget class="ConfigureAudio" name="audioTab">
- <attribute name="title">
- <string>Audio</string>
- </attribute>
- </widget>
- <widget class="ConfigureDebug" name="debugTab">
- <attribute name="title">
- <string>Debug</string>
- </attribute>
- </widget>
- <widget class="ConfigureWeb" name="webTab">
- <attribute name="title">
- <string>Web</string>
- </attribute>
- </widget>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="selectorList">
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="ConfigureGeneral" name="generalTab">
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureGameList" name="gameListTab">
+ <attribute name="title">
+ <string>Game List</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureSystem" name="systemTab">
+ <attribute name="title">
+ <string>System</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureInputSimple" name="inputTab">
+ <attribute name="title">
+ <string>Input</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureGraphics" name="graphicsTab">
+ <attribute name="title">
+ <string>Graphics</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureAudio" name="audioTab">
+ <attribute name="title">
+ <string>Audio</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureDebug" name="debugTab">
+ <attribute name="title">
+ <string>Debug</string>
+ </attribute>
+ </widget>
+ <widget class="ConfigureWeb" name="webTab">
+ <attribute name="title">
+ <string>Web</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
@@ -78,12 +98,6 @@
<container>1</container>
</customwidget>
<customwidget>
- <class>ConfigureGameList</class>
- <extends>QWidget</extends>
- <header>configuration/configure_gamelist.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
<class>ConfigureSystem</class>
<extends>QWidget</extends>
<header>configuration/configure_system.h</header>
@@ -102,12 +116,6 @@
<container>1</container>
</customwidget>
<customwidget>
- <class>ConfigureInputSimple</class>
- <extends>QWidget</extends>
- <header>configuration/configure_input_simple.h</header>
- <container>1</container>
- </customwidget>
- <customwidget>
<class>ConfigureGraphics</class>
<extends>QWidget</extends>
<header>configuration/configure_graphics.h</header>
@@ -119,6 +127,18 @@
<header>configuration/configure_web.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>ConfigureGameList</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_gamelist.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ConfigureInputSimple</class>
+ <extends>QWidget</extends>
+ <header>configuration/configure_input_simple.h</header>
+ <container>1</container>
+ </customwidget>
</customwidgets>
<resources/>
<connections>
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index 3905423e9..90d7c6372 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <QHash>
+#include <QListWidgetItem>
#include "core/settings.h"
#include "ui_configure.h"
#include "yuzu/configuration/config.h"
@@ -13,6 +15,13 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, const HotkeyRegistry& registry
ui->setupUi(this);
ui->generalTab->PopulateHotkeyList(registry);
this->setConfiguration();
+ this->PopulateSelectionList();
+ connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
+ &ConfigureDialog::UpdateVisibleTabs);
+
+ adjustSize();
+
+ ui->selectorList->setCurrentRow(0);
}
ConfigureDialog::~ConfigureDialog() = default;
@@ -30,3 +39,37 @@ void ConfigureDialog::applyConfiguration() {
ui->webTab->applyConfiguration();
Settings::Apply();
}
+
+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("Audio")}},
+ {tr("Graphics"), {tr("Graphics")}},
+ {tr("Controls"), {tr("Input")}}}};
+
+ for (const auto& entry : items) {
+ auto* const item = new QListWidgetItem(entry.first);
+ item->setData(Qt::UserRole, entry.second);
+
+ ui->selectorList->addItem(item);
+ }
+}
+
+void ConfigureDialog::UpdateVisibleTabs() {
+ const auto items = ui->selectorList->selectedItems();
+ if (items.isEmpty())
+ return;
+
+ const std::map<QString, QWidget*> widgets = {
+ {tr("General"), ui->generalTab}, {tr("System"), ui->systemTab},
+ {tr("Input"), ui->inputTab}, {tr("Graphics"), ui->graphicsTab},
+ {tr("Audio"), ui->audioTab}, {tr("Debug"), ui->debugTab},
+ {tr("Web"), ui->webTab}, {tr("Game List"), ui->gameListTab}};
+
+ 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);
+}
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h
index f6df7b827..243d9fa09 100644
--- a/src/yuzu/configuration/configure_dialog.h
+++ b/src/yuzu/configuration/configure_dialog.h
@@ -24,6 +24,8 @@ public:
private:
void setConfiguration();
+ void UpdateVisibleTabs();
+ void PopulateSelectionList();
std::unique_ptr<Ui::ConfigureDialog> ui;
};