From 65ae85eb7b583c009eaf04b79d6c6106b886ec56 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 24 Jan 2020 14:51:13 +1000 Subject: [PATCH] Qt: Skeleton for audio settings --- src/duckstation-qt/CMakeLists.txt | 3 + src/duckstation-qt/audiosettingswidget.cpp | 14 ++ src/duckstation-qt/audiosettingswidget.h | 21 +++ src/duckstation-qt/audiosettingswidget.ui | 164 +++++++++++++++++++++ src/duckstation-qt/duckstation-qt.vcxproj | 6 + src/duckstation-qt/settingsdialog.cpp | 3 +- src/duckstation-qt/settingsdialog.h | 5 +- 7 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 src/duckstation-qt/audiosettingswidget.cpp create mode 100644 src/duckstation-qt/audiosettingswidget.h create mode 100644 src/duckstation-qt/audiosettingswidget.ui diff --git a/src/duckstation-qt/CMakeLists.txt b/src/duckstation-qt/CMakeLists.txt index 6b98f003d..bf97a4c46 100644 --- a/src/duckstation-qt/CMakeLists.txt +++ b/src/duckstation-qt/CMakeLists.txt @@ -4,6 +4,9 @@ set(CMAKE_AUTOUIC ON) add_executable(duckstation-qt resources/icons.qrc + audiosettingswidget.cpp + audiosettingswidget.h + audiosettingswidget.ui consolesettingswidget.cpp consolesettingswidget.h consolesettingswidget.ui diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp new file mode 100644 index 000000000..be9004e92 --- /dev/null +++ b/src/duckstation-qt/audiosettingswidget.cpp @@ -0,0 +1,14 @@ +#include "audiosettingswidget.h" +#include "settingwidgetbinder.h" + +AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidget* parent /* = nullptr */) + : QWidget(parent), m_host_interface(host_interface) +{ + m_ui.setupUi(this); + + SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.audioBackend, "Audio/Backend", + &Settings::ParseAudioBackend, &Settings::GetAudioBackendName); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.syncToOutput, "Audio/Sync"); +} + +AudioSettingsWidget::~AudioSettingsWidget() = default; diff --git a/src/duckstation-qt/audiosettingswidget.h b/src/duckstation-qt/audiosettingswidget.h new file mode 100644 index 000000000..cb6967989 --- /dev/null +++ b/src/duckstation-qt/audiosettingswidget.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +#include "ui_audiosettingswidget.h" + +class QtHostInterface; + +class AudioSettingsWidget : public QWidget +{ + Q_OBJECT + +public: + explicit AudioSettingsWidget(QtHostInterface* host_interface, QWidget* parent = nullptr); + ~AudioSettingsWidget(); + +private: + Ui::AudioSettingsWidget m_ui; + + QtHostInterface* m_host_interface; +}; diff --git a/src/duckstation-qt/audiosettingswidget.ui b/src/duckstation-qt/audiosettingswidget.ui new file mode 100644 index 000000000..f18ccc79c --- /dev/null +++ b/src/duckstation-qt/audiosettingswidget.ui @@ -0,0 +1,164 @@ + + + AudioSettingsWidget + + + + 0 + 0 + 502 + 308 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Configuration + + + + + + Backend: + + + + + + + + + + Buffer Size: + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 2048 samples + + + Qt::AlignCenter + + + + + + + Sync To Output + + + + + + + + + + Controls + + + + + + Volume: + + + + + + + Qt::Horizontal + + + + + + + Mute + + + + + + + 100% + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/src/duckstation-qt/duckstation-qt.vcxproj b/src/duckstation-qt/duckstation-qt.vcxproj index 5378c64ed..66dc4578f 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj +++ b/src/duckstation-qt/duckstation-qt.vcxproj @@ -35,6 +35,7 @@ + @@ -53,6 +54,7 @@ + @@ -85,6 +87,9 @@ + + Document + Document @@ -104,6 +109,7 @@ + diff --git a/src/duckstation-qt/settingsdialog.cpp b/src/duckstation-qt/settingsdialog.cpp index 012afa9b9..b69011202 100644 --- a/src/duckstation-qt/settingsdialog.cpp +++ b/src/duckstation-qt/settingsdialog.cpp @@ -1,4 +1,5 @@ #include "settingsdialog.h" +#include "audiosettingswidget.h" #include "consolesettingswidget.h" #include "gamelistsettingswidget.h" #include "gpusettingswidget.h" @@ -17,7 +18,7 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent m_hotkey_settings = new HotkeySettingsWidget(host_interface, m_ui.settingsContainer); m_port_settings = new PortSettingsWidget(host_interface, m_ui.settingsContainer); m_gpu_settings = new GPUSettingsWidget(host_interface, m_ui.settingsContainer); - m_audio_settings = new QWidget(m_ui.settingsContainer); + m_audio_settings = new AudioSettingsWidget(host_interface, m_ui.settingsContainer); m_ui.settingsContainer->insertWidget(0, m_console_settings); m_ui.settingsContainer->insertWidget(1, m_game_list_settings); diff --git a/src/duckstation-qt/settingsdialog.h b/src/duckstation-qt/settingsdialog.h index ddb44fee3..c7d1f9bc5 100644 --- a/src/duckstation-qt/settingsdialog.h +++ b/src/duckstation-qt/settingsdialog.h @@ -10,6 +10,7 @@ class HotkeySettingsWidget; class ConsoleSettingsWidget; class PortSettingsWidget; class GPUSettingsWidget; +class AudioSettingsWidget; class SettingsDialog : public QDialog { @@ -35,7 +36,7 @@ public: HotkeySettingsWidget* getHotkeySettingsWidget() const { return m_hotkey_settings; } PortSettingsWidget* getPortSettingsWidget() const { return m_port_settings; } GPUSettingsWidget* getGPUSettingsWidget() const { return m_gpu_settings; } - QWidget* getAudioSettingsWidget() const { return m_audio_settings; } + AudioSettingsWidget* getAudioSettingsWidget() const { return m_audio_settings; } public Q_SLOTS: void setCategory(Category category); @@ -53,5 +54,5 @@ private: HotkeySettingsWidget* m_hotkey_settings = nullptr; PortSettingsWidget* m_port_settings = nullptr; GPUSettingsWidget* m_gpu_settings = nullptr; - QWidget* m_audio_settings = nullptr; + AudioSettingsWidget* m_audio_settings = nullptr; };