From 4f23db02db40784fe8b627c5b4af9ea2efedb7aa Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 2 May 2020 15:36:35 +1000 Subject: [PATCH] preferences: removed integer quality modes --- .../preferences/tabs/preferencesqualitytab.cpp | 18 ++++++++++++++---- .../preferences/tabs/preferencesqualitytab.h | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/dialog/preferences/tabs/preferencesqualitytab.cpp b/app/dialog/preferences/tabs/preferencesqualitytab.cpp index 39e37ca4c..32884c5f3 100644 --- a/app/dialog/preferences/tabs/preferencesqualitytab.cpp +++ b/app/dialog/preferences/tabs/preferencesqualitytab.cpp @@ -26,7 +26,6 @@ #include "audio/sampleformat.h" #include "render/colormanager.h" -#include "render/pixelformat.h" OLIVE_NAMESPACE_ENTER @@ -49,12 +48,12 @@ PreferencesQualityTab::PreferencesQualityTab() quality_stack_ = new QStackedWidget(); offline_group_ = new PreferencesQualityGroup(tr("Offline Quality")); - offline_group_->bit_depth_combobox()->setCurrentIndex(PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOffline)); + offline_group_->SetBitDepth(PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOffline)); offline_group_->ocio_method()->setCurrentIndex(ColorManager::GetOCIOMethodForMode(RenderMode::kOffline)); quality_stack_->addWidget(offline_group_); online_group_ = new PreferencesQualityGroup(tr("Online Quality")); - online_group_->bit_depth_combobox()->setCurrentIndex(PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOnline)); + online_group_->SetBitDepth(PixelFormat::instance()->GetConfiguredFormatForMode(RenderMode::kOnline)); online_group_->ocio_method()->setCurrentIndex(ColorManager::GetOCIOMethodForMode(RenderMode::kOnline)); quality_stack_->addWidget(online_group_); @@ -92,7 +91,8 @@ PreferencesQualityGroup::PreferencesQualityGroup(const QString &title, QWidget * PixelFormat::Format pix_fmt = static_cast(i); // We always render with an alpha channel internally - if (PixelFormat::FormatHasAlphaChannel(pix_fmt)) { + if (PixelFormat::FormatHasAlphaChannel(pix_fmt) + && PixelFormat::FormatIsFloat(pix_fmt)) { bit_depth_combobox_->addItem(PixelFormat::GetName(pix_fmt), i); } @@ -112,6 +112,16 @@ PreferencesQualityGroup::PreferencesQualityGroup(const QString &title, QWidget * quality_outer_layout->addStretch(); } +void PreferencesQualityGroup::SetBitDepth(PixelFormat::Format f) +{ + for (int i=0;icount();i++) { + if (bit_depth_combobox_->itemData(i) == f) { + bit_depth_combobox_->setCurrentIndex(i); + break; + } + } +} + QComboBox *PreferencesQualityGroup::bit_depth_combobox() { return bit_depth_combobox_; diff --git a/app/dialog/preferences/tabs/preferencesqualitytab.h b/app/dialog/preferences/tabs/preferencesqualitytab.h index 1219c485d..beae8ff62 100644 --- a/app/dialog/preferences/tabs/preferencesqualitytab.h +++ b/app/dialog/preferences/tabs/preferencesqualitytab.h @@ -26,6 +26,7 @@ #include #include +#include "render/pixelformat.h" #include "preferencestab.h" OLIVE_NAMESPACE_ENTER @@ -36,6 +37,8 @@ class PreferencesQualityGroup : public QGroupBox public: PreferencesQualityGroup(const QString& title, QWidget* parent = nullptr); + void SetBitDepth(PixelFormat::Format f); + QComboBox* bit_depth_combobox(); QComboBox* ocio_method();