DolphinQt: Remove software renderer settings widget

Thus, the software renderer uses the same settings as everything else, fixing https://bugs.dolphin-emu.org/issues/13051.
This commit is contained in:
Pokechu22 2022-09-26 15:39:52 -07:00
parent b90d23158f
commit 3d0cd8b076
5 changed files with 4 additions and 180 deletions

View File

@ -92,8 +92,6 @@ add_executable(dolphin-emu
Config/Graphics/HacksWidget.h
Config/Graphics/PostProcessingConfigWindow.cpp
Config/Graphics/PostProcessingConfigWindow.h
Config/Graphics/SoftwareRendererWidget.cpp
Config/Graphics/SoftwareRendererWidget.h
Config/GraphicsModListWidget.cpp
Config/GraphicsModListWidget.h
Config/GraphicsModWarningWidget.cpp

View File

@ -18,7 +18,6 @@
#include "DolphinQt/Config/Graphics/EnhancementsWidget.h"
#include "DolphinQt/Config/Graphics/GeneralWidget.h"
#include "DolphinQt/Config/Graphics/HacksWidget.h"
#include "DolphinQt/Config/Graphics/SoftwareRendererWidget.h"
#include "DolphinQt/MainWindow.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
@ -51,30 +50,19 @@ void GraphicsWindow::CreateMainLayout()
m_enhancements_widget = new EnhancementsWidget(this);
m_hacks_widget = new HacksWidget(this);
m_advanced_widget = new AdvancedWidget(this);
m_software_renderer = new SoftwareRendererWidget(this);
connect(m_general_widget, &GeneralWidget::BackendChanged, this,
&GraphicsWindow::OnBackendChanged);
connect(m_software_renderer, &SoftwareRendererWidget::BackendChanged, this,
&GraphicsWindow::OnBackendChanged);
m_wrapped_general = GetWrappedWidget(m_general_widget, this, 50, 100);
m_wrapped_enhancements = GetWrappedWidget(m_enhancements_widget, this, 50, 100);
m_wrapped_hacks = GetWrappedWidget(m_hacks_widget, this, 50, 100);
m_wrapped_advanced = GetWrappedWidget(m_advanced_widget, this, 50, 100);
m_wrapped_software = GetWrappedWidget(m_software_renderer, this, 50, 100);
if (Config::Get(Config::MAIN_GFX_BACKEND) != "Software Renderer")
{
m_tab_widget->addTab(m_wrapped_general, tr("General"));
m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
m_tab_widget->addTab(m_wrapped_hacks, tr("Hacks"));
m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
}
else
{
m_tab_widget->addTab(m_wrapped_software, tr("Software Renderer"));
}
m_tab_widget->addTab(m_wrapped_general, tr("General"));
m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
m_tab_widget->addTab(m_wrapped_hacks, tr("Hacks"));
m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
setLayout(main_layout);
}
@ -86,20 +74,6 @@ void GraphicsWindow::OnBackendChanged(const QString& backend_name)
setWindowTitle(
tr("%1 Graphics Configuration").arg(tr(g_video_backend->GetDisplayName().c_str())));
if (backend_name == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1)
{
m_tab_widget->clear();
m_tab_widget->addTab(m_wrapped_software, tr("Software Renderer"));
}
if (backend_name != QStringLiteral("Software Renderer") && m_tab_widget->count() == 1)
{
m_tab_widget->clear();
m_tab_widget->addTab(m_wrapped_general, tr("General"));
m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
m_tab_widget->addTab(m_wrapped_hacks, tr("Hacks"));
m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
}
emit BackendChanged(backend_name);
}

View File

@ -1,113 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/Config/Graphics/SoftwareRendererWidget.h"
#include <QComboBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QSpinBox>
#include <QVBoxLayout>
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinQt/Config/Graphics/GraphicsBool.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Config/ToolTipControls/ToolTipComboBox.h"
#include "DolphinQt/Settings.h"
#include "UICommon/VideoUtils.h"
#include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
SoftwareRendererWidget::SoftwareRendererWidget(GraphicsWindow* parent)
{
CreateWidgets();
LoadSettings();
ConnectWidgets();
AddDescriptions();
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
connect(parent, &GraphicsWindow::BackendChanged, [this] { LoadSettings(); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
OnEmulationStateChanged(state != Core::State::Uninitialized);
});
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
}
void SoftwareRendererWidget::CreateWidgets()
{
auto* main_layout = new QVBoxLayout;
auto* rendering_box = new QGroupBox(tr("Rendering"));
auto* rendering_layout = new QGridLayout();
m_backend_combo = new ToolTipComboBox();
rendering_box->setLayout(rendering_layout);
rendering_layout->addWidget(new QLabel(tr("Backend:")), 1, 1);
rendering_layout->addWidget(m_backend_combo, 1, 2);
for (const auto& backend : VideoBackendBase::GetAvailableBackends())
m_backend_combo->addItem(tr(backend->GetDisplayName().c_str()));
main_layout->addWidget(rendering_box);
main_layout->addStretch();
setLayout(main_layout);
}
void SoftwareRendererWidget::ConnectWidgets()
{
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
}
void SoftwareRendererWidget::LoadSettings()
{
for (const auto& backend : VideoBackendBase::GetAvailableBackends())
{
if (backend->GetName() == Config::Get(Config::MAIN_GFX_BACKEND))
{
m_backend_combo->setCurrentIndex(
m_backend_combo->findText(tr(backend->GetDisplayName().c_str())));
}
}
}
void SoftwareRendererWidget::SaveSettings()
{
for (const auto& backend : VideoBackendBase::GetAvailableBackends())
{
if (tr(backend->GetDisplayName().c_str()) == m_backend_combo->currentText())
{
const auto backend_name = backend->GetName();
if (backend_name != Config::Get(Config::MAIN_GFX_BACKEND))
emit BackendChanged(QString::fromStdString(backend_name));
break;
}
}
}
void SoftwareRendererWidget::AddDescriptions()
{
static const char TR_BACKEND_DESCRIPTION[] = QT_TR_NOOP(
"Selects what graphics API to use internally.<br>The software renderer is extremely "
"slow and only useful for debugging, so you'll want to use either Direct3D or "
"OpenGL. Different games and different GPUs will behave differently on each "
"backend, so for the best emulation experience it's recommended to try both and "
"choose the one that's less problematic.<br><br><dolphin_emphasis>If unsure, select "
"OpenGL.</dolphin_emphasis>");
m_backend_combo->SetTitle(tr("Backend"));
m_backend_combo->SetDescription(tr(TR_BACKEND_DESCRIPTION));
}
void SoftwareRendererWidget::OnEmulationStateChanged(bool running)
{
m_backend_combo->setEnabled(!running);
}

View File

@ -1,33 +0,0 @@
// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "DolphinQt/Config/Graphics/GraphicsWidget.h"
class GraphicsBool;
class GraphicsWindow;
class QSpinBox;
class ToolTipComboBox;
class SoftwareRendererWidget final : public GraphicsWidget
{
Q_OBJECT
public:
explicit SoftwareRendererWidget(GraphicsWindow* parent);
signals:
void BackendChanged(const QString& backend);
private:
void LoadSettings() override;
void SaveSettings() override;
void CreateWidgets();
void ConnectWidgets();
void AddDescriptions();
void OnEmulationStateChanged(bool running);
ToolTipComboBox* m_backend_combo;
};

View File

@ -79,7 +79,6 @@
<ClCompile Include="Config\Graphics\GraphicsWindow.cpp" />
<ClCompile Include="Config\Graphics\HacksWidget.cpp" />
<ClCompile Include="Config\Graphics\PostProcessingConfigWindow.cpp" />
<ClCompile Include="Config\Graphics\SoftwareRendererWidget.cpp" />
<ClCompile Include="Config\GraphicsModListWidget.cpp" />
<ClCompile Include="Config\GraphicsModWarningWidget.cpp" />
<ClCompile Include="Config\InfoWidget.cpp" />
@ -276,7 +275,6 @@
<QtMoc Include="Config\Graphics\GraphicsWindow.h" />
<QtMoc Include="Config\Graphics\HacksWidget.h" />
<QtMoc Include="Config\Graphics\PostProcessingConfigWindow.h" />
<QtMoc Include="Config\Graphics\SoftwareRendererWidget.h" />
<QtMoc Include="Config\GraphicsModListWidget.h" />
<QtMoc Include="Config\GraphicsModWarningWidget.h" />
<QtMoc Include="Config\InfoWidget.h" />