Merge pull request #6738 from spycrab/qt_fix_empty_adapter

Qt/GeneralWidget: Fix empty adapter option
This commit is contained in:
Mat M 2018-05-03 13:11:00 -04:00 committed by GitHub
commit 348125eda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -52,7 +52,7 @@ void GeneralWidget::CreateWidgets()
m_aspect_combo = m_aspect_combo =
new GraphicsChoice({tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window")}, new GraphicsChoice({tr("Auto"), tr("Force 16:9"), tr("Force 4:3"), tr("Stretch to Window")},
Config::GFX_ASPECT_RATIO); Config::GFX_ASPECT_RATIO);
m_adapter_combo = new GraphicsChoice({}, Config::GFX_ADAPTER); m_adapter_combo = new QComboBox;
m_enable_vsync = new GraphicsBool(tr("V-Sync"), Config::GFX_VSYNC); m_enable_vsync = new GraphicsBool(tr("V-Sync"), Config::GFX_VSYNC);
m_enable_fullscreen = new QCheckBox(tr("Use Fullscreen")); m_enable_fullscreen = new QCheckBox(tr("Use Fullscreen"));
@ -311,6 +311,7 @@ void GeneralWidget::AddDescriptions()
AddDescription(m_shader_compilation_mode[3], TR_SHADER_COMPILE_ASYNC_SKIP_DESCRIPTION); AddDescription(m_shader_compilation_mode[3], TR_SHADER_COMPILE_ASYNC_SKIP_DESCRIPTION);
AddDescription(m_wait_for_shaders, TR_SHADER_COMPILE_BEFORE_START_DESCRIPTION); AddDescription(m_wait_for_shaders, TR_SHADER_COMPILE_BEFORE_START_DESCRIPTION);
} }
void GeneralWidget::OnBackendChanged(const QString& backend_name) void GeneralWidget::OnBackendChanged(const QString& backend_name)
{ {
for (const auto& backend : g_available_video_backends) for (const auto& backend : g_available_video_backends)
@ -325,9 +326,11 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name)
m_adapter_combo->clear(); m_adapter_combo->clear();
for (const auto& adapter : g_Config.backend_info.Adapters) const auto& adapters = g_Config.backend_info.Adapters;
for (const auto& adapter : adapters)
m_adapter_combo->addItem(QString::fromStdString(adapter)); m_adapter_combo->addItem(QString::fromStdString(adapter));
m_adapter_combo->setCurrentIndex(g_Config.iAdapter); m_adapter_combo->setCurrentIndex(g_Config.iAdapter);
m_adapter_combo->setEnabled(g_Config.backend_info.Adapters.size()); m_adapter_combo->setEnabled(!adapters.empty());
} }