Permalink
Browse files

Merge pull request #6834 from spycrab/qt_settings_fixes

Qt/SettingsWindow: Multiple improvements
  • Loading branch information...
spycrab committed May 15, 2018
2 parents 1d027c6 + 6c09ce3 commit 51ce30e09d662c11a5fcc4f534f0ff5c6b62b7a8
@@ -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);
@@ -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()
@@ -112,11 +112,14 @@ void AudioPane::CreateWidgets()
m_main_layout = new QGridLayout;
m_main_layout->setColumnStretch(0, 1);
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);
}
@@ -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<void (QComboBox::*)(const QString&)>(&QComboBox::activated),
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
&Settings::Instance(), &Settings::SetThemeName);
connect(m_combobox_userstyle,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);
connect(m_combobox_language, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
connect(m_combobox_language,
static_cast<void (QComboBox::*)(int)>(&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);
}
@@ -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);
@@ -142,8 +147,8 @@ QGroupBox* PathPane::MakeGameFolderBox()
Settings::Instance().ReloadPath(path);
});
connect(add, &QPushButton::clicked, this, &PathPane::Browse);
connect(remove, &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;
@@ -160,15 +165,15 @@ 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);
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);
@@ -177,15 +182,15 @@ 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);
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);
@@ -10,6 +10,7 @@ class QGridLayout;
class QGroupBox;
class QLineEdit;
class QListWidget;
class QPushButton;
class PathPane final : public QWidget
{
@@ -35,4 +36,6 @@ class PathPane final : public QWidget
QLineEdit* m_nand_edit;
QLineEdit* m_dump_edit;
QLineEdit* m_sdcard_edit;
QPushButton* m_remove_path;
};
@@ -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

0 comments on commit 51ce30e

Please sign in to comment.