Qt: Move post-processing options into its own tab

This commit is contained in:
Connor McLaughlin 2022-11-21 19:01:14 +10:00 committed by refractionpcsx2
parent 2fb8ecbf02
commit 6f354c6c02
3 changed files with 312 additions and 355 deletions

View File

@ -87,12 +87,6 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
m_ui.setupUi(this);
// start hidden, fixup in updateRendererDependentOptions()
m_ui.hardwareRendererGroup->setVisible(false);
m_ui.verticalLayout->removeWidget(m_ui.hardwareRendererGroup);
m_ui.softwareRendererGroup->setVisible(false);
m_ui.verticalLayout->removeWidget(m_ui.softwareRendererGroup);
//////////////////////////////////////////////////////////////////////////
// Global Settings
//////////////////////////////////////////////////////////////////////////
@ -325,7 +319,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
}
connect(m_ui.renderer, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GraphicsSettingsWidget::onRendererChanged);
connect(m_ui.enableHWFixes, &QCheckBox::stateChanged, this, &GraphicsSettingsWidget::onEnableHardwareFixesChanged);
connect(m_ui.enableHWFixes, &QCheckBox::stateChanged, this, &GraphicsSettingsWidget::updateRendererDependentOptions);
connect(m_ui.textureFiltering, &QComboBox::currentIndexChanged, this, &GraphicsSettingsWidget::onTextureFilteringChange);
connect(m_ui.swTextureFiltering, &QComboBox::currentIndexChanged, this, &GraphicsSettingsWidget::onSWTextureFilteringChange);
updateRendererDependentOptions();
@ -623,13 +617,6 @@ void GraphicsSettingsWidget::onGpuPaletteConversionChanged(int state)
m_ui.anisotropicFiltering->setEnabled(!enabled);
}
void GraphicsSettingsWidget::onEnableHardwareFixesChanged()
{
const bool enabled = (m_ui.enableHWFixes->checkState() == Qt::Checked);
m_ui.hardwareRendererGroup->setTabEnabled(2, enabled);
m_ui.hardwareRendererGroup->setTabEnabled(3, enabled);
}
GSRendererType GraphicsSettingsWidget::getEffectiveRenderer() const
{
const GSRendererType type =
@ -651,58 +638,20 @@ void GraphicsSettingsWidget::updateRendererDependentOptions()
const bool is_hardware = (type == GSRendererType::DX11 || type == GSRendererType::DX12 || type == GSRendererType::OGL || type == GSRendererType::VK || type == GSRendererType::Metal);
const bool is_software = (type == GSRendererType::SW);
const int current_tab = m_hardware_renderer_visible ? m_ui.hardwareRendererGroup->currentIndex() : m_ui.softwareRendererGroup->currentIndex();
const bool hw_fixes = (is_hardware && m_ui.enableHWFixes->checkState() == Qt::Checked);
const int prev_tab = m_ui.tabs->currentIndex();
// move advanced tab to the correct parent
static constexpr std::array<const char*, 3> move_tab_names = {{"Display", "OSD", "Advanced"}};
const std::array<QWidget*, 3> move_tab_pointers = {{m_ui.gameDisplayTab, m_ui.osdTab, m_ui.advancedTab}};
for (size_t i = 0; i < move_tab_pointers.size(); i++)
{
QWidget* tab = move_tab_pointers[i];
const QString tab_label(tr(move_tab_names[i]));
if (const int index = m_ui.softwareRendererGroup->indexOf(tab); index >= 0 && is_hardware)
m_ui.softwareRendererGroup->removeTab(index);
if (const int index = m_ui.hardwareRendererGroup->indexOf(tab); index >= 0 && is_software)
m_ui.hardwareRendererGroup->removeTab(index);
if (const int index = m_ui.hardwareRendererGroup->indexOf(tab); index < 0 && is_hardware)
m_ui.hardwareRendererGroup->insertTab((i == 0) ? 0 : m_ui.hardwareRendererGroup->count(), tab, tab_label);
if (const int index = m_ui.softwareRendererGroup->indexOf(tab); index < 0 && is_software)
m_ui.softwareRendererGroup->insertTab((i == 0) ? 0 : m_ui.softwareRendererGroup->count(), tab, tab_label);
}
m_ui.tabs->setTabVisible(1, is_hardware); // hw rendering
m_ui.tabs->setTabVisible(2, is_software); // sw rendering
m_ui.tabs->setTabVisible(3, hw_fixes); // hardware fixes
m_ui.tabs->setTabVisible(4, hw_fixes); // upscaling fixes
m_ui.tabs->setTabVisible(5, is_hardware); // texture replacement
if (m_hardware_renderer_visible != is_hardware)
{
m_ui.hardwareRendererGroup->setVisible(is_hardware);
if (!is_hardware)
{
m_ui.verticalLayout->removeWidget(m_ui.hardwareRendererGroup);
}
else
{
// map first two tabs over, skip hacks
m_ui.verticalLayout->insertWidget(1, m_ui.hardwareRendererGroup);
m_ui.hardwareRendererGroup->setCurrentIndex((current_tab < 2) ? current_tab : (current_tab + 3));
}
m_hardware_renderer_visible = is_hardware;
}
if (m_software_renderer_visible != is_software)
{
m_ui.softwareRendererGroup->setVisible(is_software);
if (is_hardware)
{
m_ui.verticalLayout->removeWidget(m_ui.softwareRendererGroup);
}
else
{
// software has no hacks tabs
m_ui.verticalLayout->insertWidget(1, m_ui.softwareRendererGroup);
m_ui.softwareRendererGroup->setCurrentIndex((current_tab >= 5) ? (current_tab - 3) : (current_tab >= 2 ? 1 : current_tab));
}
m_software_renderer_visible = is_software;
}
// move back to the renderer if we're on one of the now-hidden tabs
if (is_software && (prev_tab == 1 || (prev_tab >= 2 && prev_tab <= 5)))
m_ui.tabs->setCurrentIndex(2);
else if (is_hardware && prev_tab == 2)
m_ui.tabs->setCurrentIndex(1);
m_ui.overrideTextureBarriers->setDisabled(is_sw_dx);
m_ui.overrideGeometryShader->setDisabled(is_sw_dx);
@ -799,8 +748,4 @@ void GraphicsSettingsWidget::updateRendererDependentOptions()
m_ui.fullscreenModes->setCurrentIndex(m_ui.fullscreenModes->count() - 1);
}
}
m_ui.enableHWFixes->setEnabled(is_hardware);
if (is_hardware)
onEnableHardwareFixesChanged();
}

View File

@ -39,7 +39,6 @@ private Q_SLOTS:
void onSWTextureFilteringChange();
void onRendererChanged(int index);
void onAdapterChanged(int index);
void onEnableHardwareFixesChanged();
void onIntegerScalingChanged();
void onTrilinearFilteringChanged();
void onGpuPaletteConversionChanged(int state);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>658</width>
<height>890</height>
<height>476</height>
</rect>
</property>
<property name="windowTitle">
@ -56,7 +56,7 @@
</widget>
</item>
<item>
<widget class="QTabWidget" name="hardwareRendererGroup">
<widget class="QTabWidget" name="tabs">
<property name="currentIndex">
<number>0</number>
</property>
@ -671,6 +671,88 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="softwareRenderingTab">
<attribute name="title">
<string>Rendering</string>
</attribute>
<layout class="QFormLayout" name="formLayout_9">
<item row="0" column="0">
<widget class="QLabel" name="label_37">
<property name="text">
<string>Texture Filtering:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="swTextureFiltering">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<item>
<property name="text">
<string>Nearest</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Forced)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (PS2)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Forced excluding sprite)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Extra Rendering Threads:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="extraSWThreads">
<property name="suffix">
<string> threads</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QCheckBox" name="swMipmap">
<property name="text">
<string>Mipmapping</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="swAutoFlush">
<property name="text">
<string>Auto Flush</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="hardwareFixesTab">
<attribute name="title">
<string>Hardware Fixes</string>
@ -1126,6 +1208,221 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="postProcessingTab">
<attribute name="title">
<string>Post-Processing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Sharpening/Anti-Aliasing</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Contrast Adaptive Sharpening:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="casMode">
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Sharpen Only (Internal Resolution)</string>
</property>
</item>
<item>
<property name="text">
<string>Sharpen and Resize (Display Resolution)</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_43">
<property name="text">
<string>Sharpness:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="casSharpness">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="fxaa">
<property name="text">
<string>FXAA</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
<string>Filters</string>
</property>
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_35">
<property name="text">
<string>TV Shader:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="tvShader">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Scanline Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Diagonal Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Triangular Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Wave Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Lottes CRT</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="shadeBoost">
<property name="text">
<string>Shade Boost</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_31">
<property name="text">
<string>Brightness:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostBrightness">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_32">
<property name="text">
<string>Contrast:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostContrast">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_33">
<property name="text">
<string>Saturation</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostSaturation">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="osdTab">
<attribute name="title">
<string>OSD</string>
@ -1234,192 +1531,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Post-Processing</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>CAS Mode:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="casMode">
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Sharpen Only (Internal Resolution)</string>
</property>
</item>
<item>
<property name="text">
<string>Sharpen and Upscale (Display Resolution)</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_43">
<property name="text">
<string>Sharpness:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="casSharpness">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="shadeBoost">
<property name="text">
<string>Shade Boost</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_31">
<property name="text">
<string>Brightness:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostBrightness">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_32">
<property name="text">
<string>Contrast:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostContrast">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_33">
<property name="text">
<string>Saturation</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="shadeBoostSaturation">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="fxaa">
<property name="text">
<string>FXAA</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_35">
<property name="text">
<string>TV Shader</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="tvShader">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Scanline Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Diagonal Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Triangular Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Wave Filter</string>
</property>
</item>
<item>
<property name="text">
<string>Lottes CRT</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
@ -1614,104 +1725,6 @@
</widget>
</widget>
</item>
<item>
<widget class="QTabWidget" name="softwareRendererGroup">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>203</height>
</size>
</property>
<property name="documentMode">
<bool>true</bool>
</property>
<widget class="QGroupBox" name="softwareRendererSettings">
<attribute name="title">
<string>Rendering</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_37">
<property name="text">
<string>Texture Filtering:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="swTextureFiltering">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<item>
<property name="text">
<string>Nearest</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Forced)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (PS2)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Forced excluding sprite)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Extra Rendering Threads:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="extraSWThreads">
<property name="suffix">
<string> threads</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QCheckBox" name="swMipmap">
<property name="text">
<string>Mipmapping</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="swAutoFlush">
<property name="text">
<string>Auto Flush</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">