Qt: Add advanced settings

This commit is contained in:
Connor McLaughlin 2020-05-01 00:59:31 +10:00
parent a3792a74ed
commit 101e1bfd73
11 changed files with 272 additions and 6 deletions

View File

@ -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

View File

@ -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<u32>(LOGLEVEL_COUNT); i++)
m_ui.logLevel->addItem(tr(Settings::GetLogLevelDisplayName(static_cast<LOGLEVEL>(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;

View File

@ -0,0 +1,22 @@
#pragma once
#include <QtWidgets/QWidget>
#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;
};

View File

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvancedSettingsWidget</class>
<widget class="QWidget" name="AdvancedSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>502</width>
<height>501</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Logging</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Log Level:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="logLevel"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Log Filters:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="logFilter"/>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="logToConsole">
<property name="text">
<string>Log To System Console</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="logToWindow">
<property name="text">
<string>Log To Window</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="logToDebug">
<property name="text">
<string>Log To Debug Console</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="logToFile">
<property name="text">
<string>Log To File</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Tweaks/Hacks</string>
</property>
<layout class="QFormLayout" name="formLayout_6">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>These options are tweakable to improve performance/game compatibility. Use at your own risk, modified values will not be supported.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>DMA Max Slice Size:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="dmaMaxSliceSize"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>DMA Halt Ticks:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="dmaHaltTicks"/>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="gpuFIFOSize"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>GPU FIFO Size:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>GPU Max Run-Ahead:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="gpuMaxRunAhead"/>
</item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Reset To Default</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="resources/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -35,6 +35,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="advancedsettingswidget.cpp" />
<ClCompile Include="audiosettingswidget.cpp" />
<ClCompile Include="consolesettingswidget.cpp" />
<ClCompile Include="d3d11hostdisplay.cpp" />
@ -64,6 +65,7 @@
<QtMoc Include="gpusettingswidget.h" />
<QtMoc Include="hotkeysettingswidget.h" />
<QtMoc Include="inputbindingwidgets.h" />
<QtMoc Include="advancedsettingswidget.h" />
<ClInclude Include="d3d11hostdisplay.h" />
<QtMoc Include="qtprogresscallback.h" />
<ClInclude Include="qthostdisplay.h" />
@ -120,6 +122,12 @@
<QtUi Include="settingsdialog.ui">
<FileType>Document</FileType>
</QtUi>
<QtUi Include="gpusettingswidget.ui">
<FileType>Document</FileType>
</QtUi>
<QtUi Include="advancedsettingswidget.ui">
<FileType>Document</FileType>
</QtUi>
</ItemGroup>
<ItemGroup>
<QtResource Include="resources\icons.qrc">
@ -128,6 +136,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(IntDir)moc_audiosettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_advancedsettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_consolesettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_gamelistsettingswidget.cpp" />
<ClCompile Include="$(IntDir)moc_gamelistwidget.cpp" />
@ -146,11 +155,6 @@
<ItemGroup>
<Natvis Include="qt5.natvis" />
</ItemGroup>
<ItemGroup>
<QtUi Include="gpusettingswidget.ui">
<FileType>Document</FileType>
</QtUi>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{28F14272-0EC4-41BB-849F-182ADB81AF70}</ProjectGuid>
<Keyword>Win32Proj</Keyword>

View File

@ -36,6 +36,7 @@
<ClCompile Include="openglhostdisplay.cpp" />
<ClCompile Include="d3d11hostdisplay.cpp" />
<ClCompile Include="$(IntDir)qrc_resources.cpp" />
<ClCompile Include="advancedsettingswidget.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="qtsettingsinterface.h" />
@ -44,6 +45,7 @@
<ClInclude Include="qthostdisplay.h" />
<ClInclude Include="d3d11hostdisplay.h" />
<ClInclude Include="openglhostdisplay.h" />
<ClInclude Include="advancedsettingswidget.h" />
</ItemGroup>
<ItemGroup>
<Filter Include="resources">
@ -81,4 +83,7 @@
<ItemGroup>
<Natvis Include="qt5.natvis" />
</ItemGroup>
<ItemGroup>
<None Include="advancedsettingswidget.ui" />
</ItemGroup>
</Project>

View File

@ -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);

View File

@ -92,6 +92,7 @@
<addaction name="actionPortSettings"/>
<addaction name="actionGPUSettings"/>
<addaction name="actionAudioSettings"/>
<addaction name="actionAdvancedSettings"/>
<addaction name="separator"/>
<addaction name="actionAddGameDirectory"/>
<addaction name="separator"/>
@ -361,6 +362,15 @@
<string>General Settings...</string>
</property>
</action>
<action name="actionAdvancedSettings">
<property name="icon">
<iconset resource="resources/icons.qrc">
<normaloff>:/icons/applications-development.png</normaloff>:/icons/applications-development.png</iconset>
</property>
<property name="text">
<string>Advanced Settings...</string>
</property>
</action>
<action name="actionAddGameDirectory">
<property name="icon">
<iconset resource="resources/icons.qrc">

View File

@ -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<const char*, static_cast<int>(SettingsDialog::Catego
"<strong>GPU Settings</strong><hr>These options control the simulation of the GPU in the console. Various "
"enhancements are available, mouse over each for additional information.",
"<strong>Audio Settings</strong><hr>These options control the audio output of the console. Mouse over an option for "
"additional information."}};
"additional information.",
"<strong>Advanced Settings</strong><hr>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<int>(Category::GeneralSettings), m_general_settings);
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::ConsoleSettings), m_console_settings);
@ -54,6 +58,7 @@ SettingsDialog::SettingsDialog(QtHostInterface* host_interface, QWidget* parent
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::PortSettings), m_port_settings);
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::GPUSettings), m_gpu_settings);
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AudioSettings), m_audio_settings);
m_ui.settingsContainer->insertWidget(static_cast<int>(Category::AdvancedSettings), m_advanced_settings);
m_ui.settingsCategory->setCurrentRow(0);
m_ui.settingsContainer->setCurrentIndex(0);

View File

@ -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<QObject*, QString> m_widget_help_text_map;

View File

@ -103,6 +103,15 @@
<normaloff>:/icons/audio-card.png</normaloff>:/icons/audio-card.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Advanced Settings</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/applications-development.png</normaloff>:/icons/applications-development.png</iconset>
</property>
</item>
</widget>
</item>
<item row="0" column="1">