Skip to content

Commit

Permalink
Qt/SoftwareRendererWidget: Fix backend info not getting updated properly
Browse files Browse the repository at this point in the history
  • Loading branch information
spycrab committed May 19, 2018
1 parent c6bd237 commit ef80361
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
6 changes: 0 additions & 6 deletions Source/Core/DolphinQt2/Config/Graphics/GeneralWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,6 @@ void GeneralWidget::SaveSettings()
return;
}
}
SConfig::GetInstance().m_strVideoBackend = current_backend;

g_Config.Refresh();

g_video_backend = backend.get();
g_video_backend->InitBackendInfo();
emit BackendChanged(QString::fromStdString(current_backend));
break;
}
Expand Down
22 changes: 18 additions & 4 deletions Source/Core/DolphinQt2/Config/Graphics/GraphicsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,31 @@ void GraphicsWindow::CreateMainLayout()
setLayout(main_layout);
}

void GraphicsWindow::OnBackendChanged(const QString& backend)
void GraphicsWindow::OnBackendChanged(const QString& backend_name)
{
SConfig::GetInstance().m_strVideoBackend = backend_name.toStdString();

for (const auto& backend : g_available_video_backends)
{
if (backend->GetName() == backend_name.toStdString())
{
g_Config.Refresh();

g_video_backend = backend.get();
g_video_backend->InitBackendInfo();
break;
}
}

setWindowTitle(tr("%1 Graphics Configuration")
.arg(QString::fromStdString(g_video_backend->GetDisplayName())));
if (backend == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1)
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 != QStringLiteral("Software Renderer") && m_tab_widget->count() == 1)
if (backend_name != QStringLiteral("Software Renderer") && m_tab_widget->count() == 1)
{
m_tab_widget->clear();
m_tab_widget->addTab(m_wrapped_general, tr("General"));
Expand All @@ -113,7 +127,7 @@ void GraphicsWindow::OnBackendChanged(const QString& backend)
m_tab_widget->addTab(m_wrapped_advanced, tr("Advanced"));
}

emit BackendChanged(backend);
emit BackendChanged(backend_name);
}

void GraphicsWindow::RegisterWidget(GraphicsWidget* widget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ void SoftwareRendererWidget::SaveSettings()
{
const auto backend_name = backend->GetName();
if (backend_name != SConfig::GetInstance().m_strVideoBackend)
{
SConfig::GetInstance().m_strVideoBackend = backend_name;
emit BackendChanged(QString::fromStdString(backend_name));
}
break;
}
}
Expand Down

0 comments on commit ef80361

Please sign in to comment.