From 54d81ed13ae83cbe4312bc80b67ecdc974a7204f Mon Sep 17 00:00:00 2001 From: spycrab Date: Sat, 12 May 2018 18:35:53 +0200 Subject: [PATCH 1/4] Qt/SettingsWindow: Wrap tabs in scrollareas --- Source/Core/DolphinQt2/Config/SettingsWindow.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp index a9e3d46fd9..5cdea8b681 100644 --- a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp +++ b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp @@ -9,6 +9,7 @@ #include "DolphinQt2/Config/SettingsWindow.h" #include "DolphinQt2/MainWindow.h" +#include "DolphinQt2/QtUtils/WrapInScrollArea.h" #include "DolphinQt2/Resources.h" #include "DolphinQt2/Settings.h" #include "DolphinQt2/Settings/AdvancedPane.h" @@ -34,14 +35,14 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent) m_tab_widget = new QTabWidget(); layout->addWidget(m_tab_widget); - m_tab_widget->addTab(new GeneralPane(), tr("General")); - m_tab_widget->addTab(new InterfacePane(), tr("Interface")); - m_tab_widget->addTab(new AudioPane(), tr("Audio")); - m_tab_widget->addTab(new PathPane(), tr("Paths")); - m_tab_widget->addTab(new GameCubePane(), tr("GameCube")); + m_tab_widget->addTab(GetWrappedWidget(new GeneralPane, this, 125, 100), tr("General")); + m_tab_widget->addTab(GetWrappedWidget(new InterfacePane, this, 125, 100), tr("Interface")); + m_tab_widget->addTab(GetWrappedWidget(new AudioPane, this, 125, 100), tr("Audio")); + m_tab_widget->addTab(GetWrappedWidget(new PathPane, this, 125, 100), tr("Paths")); + m_tab_widget->addTab(GetWrappedWidget(new GameCubePane, this, 125, 100), tr("GameCube")); auto* wii_pane = new WiiPane; - m_tab_widget->addTab(wii_pane, tr("Wii")); + m_tab_widget->addTab(GetWrappedWidget(wii_pane, this, 125, 100), tr("Wii")); connect(&Settings::Instance(), &Settings::EmulationStateChanged, [wii_pane](Core::State state) { wii_pane->OnEmulationStateChanged(state != Core::State::Uninitialized); From 40e6abad09556933fbee0a0f96db7dfbd534e541 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sat, 12 May 2018 23:29:54 +0200 Subject: [PATCH 2/4] Qt/AudioPane: Improve layout --- Source/Core/DolphinQt2/Settings/AudioPane.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinQt2/Settings/AudioPane.cpp b/Source/Core/DolphinQt2/Settings/AudioPane.cpp index 6174969b51..5df4eec7ff 100644 --- a/Source/Core/DolphinQt2/Settings/AudioPane.cpp +++ b/Source/Core/DolphinQt2/Settings/AudioPane.cpp @@ -112,11 +112,17 @@ void AudioPane::CreateWidgets() m_main_layout = new QGridLayout; - m_main_layout->setColumnStretch(0, 1); + m_main_layout->setRowStretch(0, 0); + m_main_layout->setRowStretch(0, 0); + + m_main_layout->setRowStretch(0, 0); + + dsp_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + m_main_layout->addWidget(dsp_box, 0, 0); - m_main_layout->addWidget(volume_box, 0, 1); - m_main_layout->addWidget(backend_box, 1, 0, 1, -1); - m_main_layout->addWidget(stretching_box, 2, 0, 1, -1); + m_main_layout->addWidget(volume_box, 0, 1, -1, 1); + m_main_layout->addWidget(backend_box, 1, 0); + m_main_layout->addWidget(stretching_box, 2, 0); setLayout(m_main_layout); } From 79533ef789cfef405feaa5c6ecacc1dcd55a2f68 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sat, 12 May 2018 23:36:07 +0200 Subject: [PATCH 3/4] Qt/PathPane: Disable "Remove" button when not applicable --- Source/Core/DolphinQt2/Settings/PathPane.cpp | 13 +++++++++---- Source/Core/DolphinQt2/Settings/PathPane.h | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinQt2/Settings/PathPane.cpp b/Source/Core/DolphinQt2/Settings/PathPane.cpp index 10b38f37bf..1097e6c501 100644 --- a/Source/Core/DolphinQt2/Settings/PathPane.cpp +++ b/Source/Core/DolphinQt2/Settings/PathPane.cpp @@ -120,19 +120,24 @@ QGroupBox* PathPane::MakeGameFolderBox() for (auto& item : items) delete item; }); + connect(m_path_list, &QListWidget::itemSelectionChanged, this, + [this] { m_remove_path->setEnabled(m_path_list->selectedItems().count()); }); + vlayout->addWidget(m_path_list); QHBoxLayout* hlayout = new QHBoxLayout; hlayout->addStretch(); - QPushButton* add = new QPushButton(tr("Add")); - QPushButton* remove = new QPushButton(tr("Remove")); + QPushButton* add = new QPushButton(tr("Add...")); + m_remove_path = new QPushButton(tr("Remove")); + + m_remove_path->setEnabled(false); auto* checkbox = new QCheckBox(tr("Search Subfolders")); checkbox->setChecked(SConfig::GetInstance().m_RecursiveISOFolder); hlayout->addWidget(add); - hlayout->addWidget(remove); + hlayout->addWidget(m_remove_path); vlayout->addLayout(hlayout); vlayout->addWidget(checkbox); @@ -143,7 +148,7 @@ QGroupBox* PathPane::MakeGameFolderBox() }); connect(add, &QPushButton::clicked, this, &PathPane::Browse); - connect(remove, &QPushButton::clicked, this, &PathPane::RemovePath); + connect(m_remove_path, &QPushButton::clicked, this, &PathPane::RemovePath); game_box->setLayout(vlayout); return game_box; diff --git a/Source/Core/DolphinQt2/Settings/PathPane.h b/Source/Core/DolphinQt2/Settings/PathPane.h index 47bec7f31e..d53d973410 100644 --- a/Source/Core/DolphinQt2/Settings/PathPane.h +++ b/Source/Core/DolphinQt2/Settings/PathPane.h @@ -10,6 +10,7 @@ class QGridLayout; class QGroupBox; class QLineEdit; class QListWidget; +class QPushButton; class PathPane final : public QWidget { @@ -35,4 +36,6 @@ private: QLineEdit* m_nand_edit; QLineEdit* m_dump_edit; QLineEdit* m_sdcard_edit; + + QPushButton* m_remove_path; }; From 6c09ce3d95796769dfac4969b9cec4273074f676 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sat, 12 May 2018 23:54:35 +0200 Subject: [PATCH 4/4] Qt: Use proper signals --- .../Core/DolphinQt2/Settings/AdvancedPane.cpp | 3 ++- Source/Core/DolphinQt2/Settings/AudioPane.cpp | 3 --- .../DolphinQt2/Settings/InterfacePane.cpp | 22 ++++++++++--------- Source/Core/DolphinQt2/Settings/PathPane.cpp | 12 +++++----- Source/Core/DolphinQt2/Settings/WiiPane.cpp | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Source/Core/DolphinQt2/Settings/AdvancedPane.cpp b/Source/Core/DolphinQt2/Settings/AdvancedPane.cpp index 16250b810d..8c24b9332f 100644 --- a/Source/Core/DolphinQt2/Settings/AdvancedPane.cpp +++ b/Source/Core/DolphinQt2/Settings/AdvancedPane.cpp @@ -21,10 +21,11 @@ AdvancedPane::AdvancedPane(QWidget* parent) : QWidget(parent) { CreateLayout(); + Update(); + ConnectLayout(); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &AdvancedPane::Update); - Update(); } void AdvancedPane::CreateLayout() diff --git a/Source/Core/DolphinQt2/Settings/AudioPane.cpp b/Source/Core/DolphinQt2/Settings/AudioPane.cpp index 5df4eec7ff..b8948ef5c9 100644 --- a/Source/Core/DolphinQt2/Settings/AudioPane.cpp +++ b/Source/Core/DolphinQt2/Settings/AudioPane.cpp @@ -112,9 +112,6 @@ void AudioPane::CreateWidgets() m_main_layout = new QGridLayout; - m_main_layout->setRowStretch(0, 0); - m_main_layout->setRowStretch(0, 0); - m_main_layout->setRowStretch(0, 0); dsp_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); diff --git a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp index 49d4e51f05..808a0eded5 100644 --- a/Source/Core/DolphinQt2/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt2/Settings/InterfacePane.cpp @@ -171,22 +171,24 @@ void InterfacePane::CreateInGame() void InterfacePane::ConnectLayout() { - connect(m_checkbox_top_window, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_use_builtin_title_database, &QCheckBox::clicked, this, + connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_use_builtin_title_database, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_show_debugging_ui, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_combobox_theme, static_cast(&QComboBox::activated), + connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_combobox_theme, + static_cast(&QComboBox::currentIndexChanged), &Settings::Instance(), &Settings::SetThemeName); connect(m_combobox_userstyle, static_cast(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); - connect(m_combobox_language, static_cast(&QComboBox::activated), this, + connect(m_combobox_language, + static_cast(&QComboBox::currentIndexChanged), this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_confirm_on_stop, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_use_panic_handlers, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_enable_osd, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_pause_on_focus_lost, &QCheckBox::clicked, this, &InterfacePane::OnSaveConfig); - connect(m_checkbox_hide_mouse, &QCheckBox::clicked, &Settings::Instance(), + connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_use_panic_handlers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_enable_osd, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_pause_on_focus_lost, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); + connect(m_checkbox_hide_mouse, &QCheckBox::toggled, &Settings::Instance(), &Settings::SetHideCursor); connect(m_checkbox_use_userstyle, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig); } diff --git a/Source/Core/DolphinQt2/Settings/PathPane.cpp b/Source/Core/DolphinQt2/Settings/PathPane.cpp index 1097e6c501..1f5b734368 100644 --- a/Source/Core/DolphinQt2/Settings/PathPane.cpp +++ b/Source/Core/DolphinQt2/Settings/PathPane.cpp @@ -147,8 +147,8 @@ QGroupBox* PathPane::MakeGameFolderBox() Settings::Instance().ReloadPath(path); }); - connect(add, &QPushButton::clicked, this, &PathPane::Browse); - connect(m_remove_path, &QPushButton::clicked, this, &PathPane::RemovePath); + connect(add, &QPushButton::pressed, this, &PathPane::Browse); + connect(m_remove_path, &QPushButton::pressed, this, &PathPane::RemovePath); game_box->setLayout(vlayout); return game_box; @@ -165,7 +165,7 @@ QGridLayout* PathPane::MakePathsLayout() connect(&Settings::Instance(), &Settings::DefaultGameChanged, [this](const QString& path) { m_game_edit->setText(path); }); QPushButton* game_open = new QPushButton(QStringLiteral("...")); - connect(game_open, &QPushButton::clicked, this, &PathPane::BrowseDefaultGame); + connect(game_open, &QPushButton::pressed, this, &PathPane::BrowseDefaultGame); layout->addWidget(new QLabel(tr("Default ISO:")), 0, 0); layout->addWidget(m_game_edit, 0, 1); layout->addWidget(game_open, 0, 2); @@ -173,7 +173,7 @@ QGridLayout* PathPane::MakePathsLayout() m_nand_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_NANDPath)); connect(m_nand_edit, &QLineEdit::editingFinished, this, &PathPane::OnNANDPathChanged); QPushButton* nand_open = new QPushButton(QStringLiteral("...")); - connect(nand_open, &QPushButton::clicked, this, &PathPane::BrowseWiiNAND); + connect(nand_open, &QPushButton::pressed, this, &PathPane::BrowseWiiNAND); layout->addWidget(new QLabel(tr("Wii NAND Root:")), 1, 0); layout->addWidget(m_nand_edit, 1, 1); layout->addWidget(nand_open, 1, 2); @@ -182,7 +182,7 @@ QGridLayout* PathPane::MakePathsLayout() connect(m_dump_edit, &QLineEdit::editingFinished, [=] { SConfig::GetInstance().m_DumpPath = m_dump_edit->text().toStdString(); }); QPushButton* dump_open = new QPushButton(QStringLiteral("...")); - connect(dump_open, &QPushButton::clicked, this, &PathPane::BrowseDump); + connect(dump_open, &QPushButton::pressed, this, &PathPane::BrowseDump); layout->addWidget(new QLabel(tr("Dump Path:")), 2, 0); layout->addWidget(m_dump_edit, 2, 1); layout->addWidget(dump_open, 2, 2); @@ -190,7 +190,7 @@ QGridLayout* PathPane::MakePathsLayout() m_sdcard_edit = new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strWiiSDCardPath)); connect(m_sdcard_edit, &QLineEdit::editingFinished, this, &PathPane::OnSDCardPathChanged); QPushButton* sdcard_open = new QPushButton(QStringLiteral("...")); - connect(sdcard_open, &QPushButton::clicked, this, &PathPane::BrowseSDCard); + connect(sdcard_open, &QPushButton::pressed, this, &PathPane::BrowseSDCard); layout->addWidget(new QLabel(tr("SD Card Path:")), 3, 0); layout->addWidget(m_sdcard_edit, 3, 1); layout->addWidget(sdcard_open, 3, 2); diff --git a/Source/Core/DolphinQt2/Settings/WiiPane.cpp b/Source/Core/DolphinQt2/Settings/WiiPane.cpp index 89b3f6eb76..f21e5dd86f 100644 --- a/Source/Core/DolphinQt2/Settings/WiiPane.cpp +++ b/Source/Core/DolphinQt2/Settings/WiiPane.cpp @@ -72,9 +72,9 @@ void WiiPane::ConnectLayout() // Whitelisted USB Passthrough Devices connect(m_whitelist_usb_list, &QListWidget::itemClicked, this, &WiiPane::ValidateSelectionState); - connect(m_whitelist_usb_add_button, &QPushButton::released, this, + connect(m_whitelist_usb_add_button, &QPushButton::pressed, this, &WiiPane::OnUSBWhitelistAddButton); - connect(m_whitelist_usb_remove_button, &QPushButton::released, this, + connect(m_whitelist_usb_remove_button, &QPushButton::pressed, this, &WiiPane::OnUSBWhitelistRemoveButton); // Wii Remote Settings