From e1554c04a128477b082cc633a5e2e1d5aa5c2fa3 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Sun, 16 Jul 2017 14:11:11 -0700 Subject: [PATCH] Qt: implement remainder of 'Options' menu --- Source/Core/DolphinQt2/Config/SettingsWindow.cpp | 7 ++++++- Source/Core/DolphinQt2/Config/SettingsWindow.h | 3 +++ Source/Core/DolphinQt2/MainWindow.cpp | 10 ++++++++++ Source/Core/DolphinQt2/MainWindow.h | 1 + Source/Core/DolphinQt2/MenuBar.cpp | 7 ++++++- Source/Core/DolphinQt2/MenuBar.h | 4 ++++ 6 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp index a3dff1084a..4099af0cd4 100644 --- a/Source/Core/DolphinQt2/Config/SettingsWindow.cpp +++ b/Source/Core/DolphinQt2/Config/SettingsWindow.cpp @@ -41,7 +41,7 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent) AddTab(m_tabs, tr("General"), new GeneralPane(), "config"); AddTab(m_tabs, tr("Interface"), new InterfacePane(), "browse"); auto* audio_pane = new AudioPane; - AddTab(m_tabs, tr("Audio"), audio_pane, "play"); + m_audio_pane_index = AddTab(m_tabs, tr("Audio"), audio_pane, "play"); AddTab(m_tabs, tr("Paths"), new PathPane(), "browse"); connect(this, &SettingsWindow::EmulationStarted, @@ -56,3 +56,8 @@ SettingsWindow::SettingsWindow(QWidget* parent) : QDialog(parent) setLayout(layout); } + +void SettingsWindow::SelectAudioPane() +{ + m_tabs->setCurrentIndex(m_audio_pane_index); +} diff --git a/Source/Core/DolphinQt2/Config/SettingsWindow.h b/Source/Core/DolphinQt2/Config/SettingsWindow.h index 45124d98ac..5733cb03da 100644 --- a/Source/Core/DolphinQt2/Config/SettingsWindow.h +++ b/Source/Core/DolphinQt2/Config/SettingsWindow.h @@ -13,10 +13,13 @@ class SettingsWindow final : public QDialog Q_OBJECT public: explicit SettingsWindow(QWidget* parent = nullptr); + void SelectAudioPane(); + signals: void EmulationStarted(); void EmulationStopped(); private: ListTabWidget* m_tabs; + int m_audio_pane_index = -1; }; diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 767e214e34..14eb4e8ddc 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -184,6 +184,10 @@ void MainWindow::ConnectMenuBar() connect(m_menu_bar, &MenuBar::SetStateSlot, this, &MainWindow::SetStateSlot); // Options + connect(m_menu_bar, &MenuBar::Configure, this, &MainWindow::ShowSettingsWindow); + connect(m_menu_bar, &MenuBar::ConfigureGraphics, this, &MainWindow::ShowGraphicsWindow); + connect(m_menu_bar, &MenuBar::ConfigureAudio, this, &MainWindow::ShowAudioWindow); + connect(m_menu_bar, &MenuBar::ConfigureControllers, this, &MainWindow::ShowControllersWindow); connect(m_menu_bar, &MenuBar::ConfigureHotkeys, this, &MainWindow::ShowHotkeyDialog); // Tools @@ -505,6 +509,12 @@ void MainWindow::ShowSettingsWindow() m_settings_window->activateWindow(); } +void MainWindow::ShowAudioWindow() +{ + m_settings_window->SelectAudioPane(); + ShowSettingsWindow(); +} + void MainWindow::ShowAboutDialog() { AboutDialog* about = new AboutDialog(this); diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index d44d0a4db4..83ef56368a 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -83,6 +83,7 @@ private: void HideRenderWidget(); void ShowSettingsWindow(); + void ShowAudioWindow(); void ShowControllersWindow(); void ShowGraphicsWindow(); void ShowAboutDialog(); diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index 6dbbb89f4b..9d2b4107d9 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -197,7 +197,12 @@ void MenuBar::AddViewMenu() void MenuBar::AddOptionsMenu() { QMenu* options_menu = addMenu(tr("Options")); - options_menu->addAction(tr("Hotkey Settings"), this, &MenuBar::ConfigureHotkeys); + options_menu->addAction(tr("Co&nfiguration..."), this, &MenuBar::Configure); + options_menu->addSeparator(); + options_menu->addAction(tr("&Graphics Settings..."), this, &MenuBar::ConfigureGraphics); + options_menu->addAction(tr("&Audio Settings..."), this, &MenuBar::ConfigureAudio); + options_menu->addAction(tr("&Controller Settings..."), this, &MenuBar::ConfigureControllers); + options_menu->addAction(tr("&Hotkey Settings..."), this, &MenuBar::ConfigureHotkeys); } void MenuBar::AddHelpMenu() diff --git a/Source/Core/DolphinQt2/MenuBar.h b/Source/Core/DolphinQt2/MenuBar.h index 848fad1e67..b4cf5309e6 100644 --- a/Source/Core/DolphinQt2/MenuBar.h +++ b/Source/Core/DolphinQt2/MenuBar.h @@ -44,6 +44,10 @@ signals: void PerformOnlineUpdate(const std::string& region); // Options + void Configure(); + void ConfigureGraphics(); + void ConfigureAudio(); + void ConfigureControllers(); void ConfigureHotkeys(); // View