Merge pull request #6788 from spycrab/qt_gconf_fixes

Qt/GraphicsWindow: Fix multiple issues
This commit is contained in:
spycrab 2018-05-10 12:16:19 +02:00 committed by GitHub
commit fd1ea63383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 15 deletions

View File

@ -173,8 +173,6 @@ void GeneralWidget::SaveSettings()
const auto current_backend = backend->GetName(); const auto current_backend = backend->GetName();
if (SConfig::GetInstance().m_strVideoBackend != current_backend) if (SConfig::GetInstance().m_strVideoBackend != current_backend)
{ {
SConfig::GetInstance().m_strVideoBackend = current_backend;
if (backend->GetName() == "Software Renderer") if (backend->GetName() == "Software Renderer")
{ {
QMessageBox confirm_sw; QMessageBox confirm_sw;
@ -201,7 +199,11 @@ void GeneralWidget::SaveSettings()
} }
} }
SConfig::GetInstance().m_strVideoBackend = current_backend; SConfig::GetInstance().m_strVideoBackend = current_backend;
backend->InitBackendInfo();
g_Config.Refresh();
g_video_backend = backend.get();
g_video_backend->InitBackendInfo();
emit BackendChanged(QString::fromStdString(current_backend)); emit BackendChanged(QString::fromStdString(current_backend));
break; break;
} }

View File

@ -19,10 +19,13 @@
#include "DolphinQt2/Config/Graphics/SoftwareRendererWidget.h" #include "DolphinQt2/Config/Graphics/SoftwareRendererWidget.h"
#include "DolphinQt2/MainWindow.h" #include "DolphinQt2/MainWindow.h"
#include "DolphinQt2/QtUtils/WrapInScrollArea.h" #include "DolphinQt2/QtUtils/WrapInScrollArea.h"
#include "VideoCommon/VideoConfig.h"
GraphicsWindow::GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindow* parent) GraphicsWindow::GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindow* parent)
: QDialog(parent), m_xrr_config(xrr_config) : QDialog(parent), m_xrr_config(xrr_config)
{ {
g_Config.Refresh();
CreateMainLayout(); CreateMainLayout();
setWindowTitle(tr("Graphics")); setWindowTitle(tr("Graphics"));
@ -67,18 +70,22 @@ void GraphicsWindow::CreateMainLayout()
connect(m_software_renderer, &SoftwareRendererWidget::BackendChanged, this, connect(m_software_renderer, &SoftwareRendererWidget::BackendChanged, this,
&GraphicsWindow::OnBackendChanged); &GraphicsWindow::OnBackendChanged);
m_wrapped_general = GetWrappedWidget(m_general_widget, this, 50, 305);
m_wrapped_enhancements = GetWrappedWidget(m_enhancements_widget, this, 50, 305);
m_wrapped_hacks = GetWrappedWidget(m_hacks_widget, this, 50, 305);
m_wrapped_advanced = GetWrappedWidget(m_advanced_widget, this, 50, 305);
m_wrapped_software = GetWrappedWidget(m_software_renderer, this, 50, 305);
if (SConfig::GetInstance().m_strVideoBackend != "Software Renderer") if (SConfig::GetInstance().m_strVideoBackend != "Software Renderer")
{ {
m_tab_widget->addTab(GetWrappedWidget(m_general_widget, this, 50, 305), tr("General")); m_tab_widget->addTab(m_wrapped_general, tr("General"));
m_tab_widget->addTab(GetWrappedWidget(m_enhancements_widget, this, 50, 305), m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
tr("Enhancements")); m_tab_widget->addTab(m_wrapped_hacks, tr("Hacks"));
m_tab_widget->addTab(GetWrappedWidget(m_hacks_widget, this, 50, 305), tr("Hacks")); m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
m_tab_widget->addTab(GetWrappedWidget(m_advanced_widget, this, 50, 305), tr("Advanced"));
} }
else else
{ {
m_tab_widget->addTab(GetWrappedWidget(m_software_renderer, this, 50, 305), m_tab_widget->addTab(m_wrapped_software, tr("Software Renderer"));
tr("Software Renderer"));
} }
setLayout(main_layout); setLayout(main_layout);
@ -90,16 +97,16 @@ void GraphicsWindow::OnBackendChanged(const QString& backend)
if (backend == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1) if (backend == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1)
{ {
m_tab_widget->clear(); m_tab_widget->clear();
m_tab_widget->addTab(m_software_renderer, tr("Software Renderer")); m_tab_widget->addTab(m_wrapped_software, tr("Software Renderer"));
} }
if (backend != QStringLiteral("Software Renderer") && m_tab_widget->count() == 1) if (backend != QStringLiteral("Software Renderer") && m_tab_widget->count() == 1)
{ {
m_tab_widget->clear(); m_tab_widget->clear();
m_tab_widget->addTab(m_general_widget, tr("General")); m_tab_widget->addTab(m_wrapped_general, tr("General"));
m_tab_widget->addTab(m_enhancements_widget, tr("Enhancements")); m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
m_tab_widget->addTab(m_hacks_widget, tr("Hacks")); m_tab_widget->addTab(m_wrapped_hacks, tr("Hacks"));
m_tab_widget->addTab(m_advanced_widget, tr("Advanced")); m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
} }
emit BackendChanged(backend); emit BackendChanged(backend);

View File

@ -49,6 +49,12 @@ private:
GeneralWidget* m_general_widget; GeneralWidget* m_general_widget;
SoftwareRendererWidget* m_software_renderer; SoftwareRendererWidget* m_software_renderer;
QWidget* m_wrapped_advanced;
QWidget* m_wrapped_enhancements;
QWidget* m_wrapped_hacks;
QWidget* m_wrapped_general;
QWidget* m_wrapped_software;
X11Utils::XRRConfiguration* m_xrr_config; X11Utils::XRRConfiguration* m_xrr_config;
QHash<QObject*, const char*> m_widget_descriptions; QHash<QObject*, const char*> m_widget_descriptions;