From 101e1bfd73d528de1475215cab61677f460084e9 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 1 May 2020 00:59:31 +1000 Subject: [PATCH] Qt: Add advanced settings --- src/duckstation-qt/CMakeLists.txt | 3 + src/duckstation-qt/advancedsettingswidget.cpp | 23 +++ src/duckstation-qt/advancedsettingswidget.h | 22 +++ src/duckstation-qt/advancedsettingswidget.ui | 179 ++++++++++++++++++ src/duckstation-qt/duckstation-qt.vcxproj | 14 +- .../duckstation-qt.vcxproj.filters | 5 + src/duckstation-qt/mainwindow.cpp | 2 + src/duckstation-qt/mainwindow.ui | 10 + src/duckstation-qt/settingsdialog.cpp | 7 +- src/duckstation-qt/settingsdialog.h | 4 + src/duckstation-qt/settingsdialog.ui | 9 + 11 files changed, 272 insertions(+), 6 deletions(-) create mode 100644 src/duckstation-qt/advancedsettingswidget.cpp create mode 100644 src/duckstation-qt/advancedsettingswidget.h create mode 100644 src/duckstation-qt/advancedsettingswidget.ui diff --git a/src/duckstation-qt/CMakeLists.txt b/src/duckstation-qt/CMakeLists.txt index 45a9703c4..973316ee1 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 + advancedsettingswidget.cpp + advancedsettingswidget.h + advancedsettingswidget.ui audiosettingswidget.cpp audiosettingswidget.h audiosettingswidget.ui diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp new file mode 100644 index 000000000..f7cf057d8 --- /dev/null +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -0,0 +1,23 @@ +#include "advancedsettingswidget.h" +#include "settingwidgetbinder.h" + +AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog) + : QWidget(parent), m_host_interface(host_interface) +{ + m_ui.setupUi(this); + + for (u32 i = 0; i < static_cast(LOGLEVEL_COUNT); i++) + m_ui.logLevel->addItem(tr(Settings::GetLogLevelDisplayName(static_cast(i)))); + + SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.logLevel, QStringLiteral("Logging/LogLevel"), + &Settings::ParseLogLevelName, &Settings::GetLogLevelName); + SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, m_ui.logFilter, QStringLiteral("Logging/LogFilter")); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToConsole, + QStringLiteral("Logging/LogToConsole")); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToDebug, QStringLiteral("Logging/LogToDebug")); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToWindow, + QStringLiteral("Logging/LogToWindow")); + SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.logToFile, QStringLiteral("Logging/LogToFile")); +} + +AdvancedSettingsWidget::~AdvancedSettingsWidget() = default; diff --git a/src/duckstation-qt/advancedsettingswidget.h b/src/duckstation-qt/advancedsettingswidget.h new file mode 100644 index 000000000..c4c0ee61b --- /dev/null +++ b/src/duckstation-qt/advancedsettingswidget.h @@ -0,0 +1,22 @@ +#pragma once + +#include + +#include "ui_advancedsettingswidget.h" + +class QtHostInterface; +class SettingsDialog; + +class AdvancedSettingsWidget : public QWidget +{ + Q_OBJECT + +public: + explicit AdvancedSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog); + ~AdvancedSettingsWidget(); + +private: + Ui::AdvancedSettingsWidget m_ui; + + QtHostInterface* m_host_interface; +}; diff --git a/src/duckstation-qt/advancedsettingswidget.ui b/src/duckstation-qt/advancedsettingswidget.ui new file mode 100644 index 000000000..7c2a49532 --- /dev/null +++ b/src/duckstation-qt/advancedsettingswidget.ui @@ -0,0 +1,179 @@ + + + AdvancedSettingsWidget + + + + 0 + 0 + 502 + 501 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Logging + + + + + + + + Log Level: + + + + + + + + + + Log Filters: + + + + + + + + + + + + + + Log To System Console + + + + + + + Log To Window + + + + + + + Log To Debug Console + + + + + + + Log To File + + + + + + + + + + + + Tweaks/Hacks + + + + + + These options are tweakable to improve performance/game compatibility. Use at your own risk, modified values will not be supported. + + + true + + + + + + + DMA Max Slice Size: + + + + + + + + + + DMA Halt Ticks: + + + + + + + + + + + + + GPU FIFO Size: + + + + + + + GPU Max Run-Ahead: + + + + + + + + + + Reset To Default + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/src/duckstation-qt/duckstation-qt.vcxproj b/src/duckstation-qt/duckstation-qt.vcxproj index 887d5f1e1..cac016915 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj +++ b/src/duckstation-qt/duckstation-qt.vcxproj @@ -35,6 +35,7 @@ + @@ -64,6 +65,7 @@ + @@ -120,6 +122,12 @@ Document + + Document + + + Document + @@ -128,6 +136,7 @@ + @@ -146,11 +155,6 @@ - - - Document - - {28F14272-0EC4-41BB-849F-182ADB81AF70} Win32Proj diff --git a/src/duckstation-qt/duckstation-qt.vcxproj.filters b/src/duckstation-qt/duckstation-qt.vcxproj.filters index 63687f736..673685338 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj.filters +++ b/src/duckstation-qt/duckstation-qt.vcxproj.filters @@ -36,6 +36,7 @@ + @@ -44,6 +45,7 @@ + @@ -81,4 +83,7 @@ + + + \ No newline at end of file diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 849f1f4c1..90ec57bf9 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -527,6 +527,8 @@ void MainWindow::connectSignals() connect(m_ui.actionGPUSettings, &QAction::triggered, [this]() { doSettings(SettingsDialog::Category::GPUSettings); }); connect(m_ui.actionAudioSettings, &QAction::triggered, [this]() { doSettings(SettingsDialog::Category::AudioSettings); }); + connect(m_ui.actionAdvancedSettings, &QAction::triggered, + [this]() { doSettings(SettingsDialog::Category::AdvancedSettings); }); connect(m_ui.actionGitHubRepository, &QAction::triggered, this, &MainWindow::onGitHubRepositoryActionTriggered); connect(m_ui.actionIssueTracker, &QAction::triggered, this, &MainWindow::onIssueTrackerActionTriggered); connect(m_ui.actionDiscordServer, &QAction::triggered, this, &MainWindow::onDiscordServerActionTriggered); diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index a8ff8c716..928182c17 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -92,6 +92,7 @@ + @@ -361,6 +362,15 @@ General Settings... + + + + :/icons/applications-development.png:/icons/applications-development.png + + + Advanced Settings... + + diff --git a/src/duckstation-qt/settingsdialog.cpp b/src/duckstation-qt/settingsdialog.cpp index 27cb52cea..7b7fed434 100644 --- a/src/duckstation-qt/settingsdialog.cpp +++ b/src/duckstation-qt/settingsdialog.cpp @@ -1,4 +1,5 @@ #include "settingsdialog.h" +#include "advancedsettingswidget.h" #include "audiosettingswidget.h" #include "consolesettingswidget.h" #include "gamelistsettingswidget.h" @@ -30,7 +31,9 @@ static constexpr std::array(SettingsDialog::Catego "GPU Settings
These options control the simulation of the GPU in the console. Various " "enhancements are available, mouse over each for additional information.", "Audio Settings
These options control the audio output of the console. Mouse over an option for " - "additional information."}}; + "additional information.", + "Advanced Settings
These options control logging and internal behavior of the emulator. Mouse " + "over an option for additional information."}}; SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent /* = nullptr */) : QDialog(parent), m_host_interface(host_interface) @@ -46,6 +49,7 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent m_port_settings = new PortSettingsWidget(host_interface, m_ui.settingsContainer); m_gpu_settings = new GPUSettingsWidget(host_interface, m_ui.settingsContainer); m_audio_settings = new AudioSettingsWidget(host_interface, m_ui.settingsContainer); + m_advanced_settings = new AdvancedSettingsWidget(host_interface, m_ui.settingsContainer, this); m_ui.settingsContainer->insertWidget(static_cast(Category::GeneralSettings), m_general_settings); m_ui.settingsContainer->insertWidget(static_cast(Category::ConsoleSettings), m_console_settings); @@ -54,6 +58,7 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent m_ui.settingsContainer->insertWidget(static_cast(Category::PortSettings), m_port_settings); m_ui.settingsContainer->insertWidget(static_cast(Category::GPUSettings), m_gpu_settings); m_ui.settingsContainer->insertWidget(static_cast(Category::AudioSettings), m_audio_settings); + m_ui.settingsContainer->insertWidget(static_cast(Category::AdvancedSettings), m_advanced_settings); m_ui.settingsCategory->setCurrentRow(0); m_ui.settingsContainer->setCurrentIndex(0); diff --git a/src/duckstation-qt/settingsdialog.h b/src/duckstation-qt/settingsdialog.h index 17c231b9f..62ec1f1de 100644 --- a/src/duckstation-qt/settingsdialog.h +++ b/src/duckstation-qt/settingsdialog.h @@ -13,6 +13,7 @@ class ConsoleSettingsWidget; class PortSettingsWidget; class GPUSettingsWidget; class AudioSettingsWidget; +class AdvancedSettingsWidget; class SettingsDialog final : public QDialog { @@ -28,6 +29,7 @@ public: PortSettings, GPUSettings, AudioSettings, + AdvancedSettings, Count }; @@ -41,6 +43,7 @@ public: PortSettingsWidget* getPortSettingsWidget() const { return m_port_settings; } GPUSettingsWidget* getGPUSettingsWidget() const { return m_gpu_settings; } AudioSettingsWidget* getAudioSettingsWidget() const { return m_audio_settings; } + AdvancedSettingsWidget* getAdvancedSettingsWidget() const { return m_advanced_settings; } void registerWidgetHelp(QObject* object, const char* title, const char* recommended_value, const char* text); bool eventFilter(QObject* object, QEvent* event) override; @@ -63,6 +66,7 @@ private: PortSettingsWidget* m_port_settings = nullptr; GPUSettingsWidget* m_gpu_settings = nullptr; AudioSettingsWidget* m_audio_settings = nullptr; + AdvancedSettingsWidget* m_advanced_settings = nullptr; QObject* m_current_help_widget = nullptr; QMap m_widget_help_text_map; diff --git a/src/duckstation-qt/settingsdialog.ui b/src/duckstation-qt/settingsdialog.ui index f2acf4378..f7bff4f2d 100644 --- a/src/duckstation-qt/settingsdialog.ui +++ b/src/duckstation-qt/settingsdialog.ui @@ -103,6 +103,15 @@ :/icons/audio-card.png:/icons/audio-card.png
+ + + Advanced Settings + + + + :/icons/applications-development.png:/icons/applications-development.png + +