Qt: Fix hwaccel settings
Vicki Pfau vi@endrift.com
Wed, 15 May 2019 10:42:39 -0700
2 files changed,
6 insertions(+),
9 deletions(-)
M
src/platform/qt/SettingsView.cpp
→
src/platform/qt/SettingsView.cpp
@@ -466,7 +466,7 @@ m_controller->setQtOption("language", language.bcp47Name());
emit languageChanged(); } - int videoScale = m_controller->getOption("videoScale").toInt(); + int videoScale = m_controller->getOption("videoScale", 1).toInt(); int hwaccelVideo = m_controller->getOption("hwaccelVideo").toInt(); if (videoScale != m_ui.videoScale->value() || hwaccelVideo != m_ui.hwaccelVideo->currentIndex()) { emit videoRendererChanged();@@ -551,7 +551,7 @@ loadSetting("logToStdout", m_ui.logToStdout);
loadSetting("logFile", m_ui.logFile); loadSetting("useDiscordPresence", m_ui.useDiscordPresence); loadSetting("audioHle", m_ui.audioHle); - loadSetting("videoScale", m_ui.videoScale); + loadSetting("videoScale", m_ui.videoScale, 1); m_ui.libraryStyle->setCurrentIndex(loadSetting("libraryStyle").toInt());@@ -616,10 +616,7 @@ m_ui.cgbModel->setCurrentIndex(index >= 0 ? index : 0);
} #endif - int hwaccelVideo = m_controller->getOption("hwaccelVideo", 1).toInt(); - if (hwaccelVideo < 1) { - hwaccelVideo = 1; - } + int hwaccelVideo = m_controller->getOption("hwaccelVideo", 0).toInt(); m_ui.hwaccelVideo->setCurrentIndex(hwaccelVideo); }@@ -677,9 +674,9 @@ QString option = loadSetting(key);
field->setValue(option.isNull() ? defaultVal : option.toInt()); } -void SettingsView::loadSetting(const char* key, QSpinBox* field) { +void SettingsView::loadSetting(const char* key, QSpinBox* field, int defaultVal) { QString option = loadSetting(key); - field->setValue(option.toInt()); + field->setValue(option.isNull() ? defaultVal : option.toInt()); } QString SettingsView::loadSetting(const char* key) {
M
src/platform/qt/SettingsView.h
→
src/platform/qt/SettingsView.h
@@ -77,7 +77,7 @@ void loadSetting(const char* key, QComboBox*);
void loadSetting(const char* key, QDoubleSpinBox*); void loadSetting(const char* key, QLineEdit*); void loadSetting(const char* key, QSlider*, int defaultVal = 0); - void loadSetting(const char* key, QSpinBox*); + void loadSetting(const char* key, QSpinBox*, int defaultVal = 0); QString loadSetting(const char* key); };