From dfab33a572e61ec5384188a0064ff1c3f8295cd5 Mon Sep 17 00:00:00 2001 From: Christian Feldmann Date: Thu, 31 Aug 2023 09:51:31 +0200 Subject: [PATCH] Commit from der3318 --- YUViewLib/src/video/yuv/videoHandlerYUV.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/YUViewLib/src/video/yuv/videoHandlerYUV.cpp b/YUViewLib/src/video/yuv/videoHandlerYUV.cpp index 2f1c8c35d..fee6e2db8 100644 --- a/YUViewLib/src/video/yuv/videoHandlerYUV.cpp +++ b/YUViewLib/src/video/yuv/videoHandlerYUV.cpp @@ -2725,18 +2725,21 @@ QLayout *videoHandlerYUV::createVideoHandlerControls(bool isSizeFixed) ui.yuvFormatComboBox->setEnabled(!isSizeFixed); // Set all the values of the properties widget to the values of this class + const auto hasChroma = (srcPixelFormat.getSubsampling() != Subsampling::YUV_400); ui.colorComponentsComboBox->addItems( functions::toQStringList(ComponentDisplayModeMapper.getNames())); ui.colorComponentsComboBox->setCurrentIndex( int(ComponentDisplayModeMapper.indexOf(this->conversionSettings.componentDisplayMode))); + ui.colorComponentsComboBox->setEnabled(hasChroma); ui.chromaInterpolationComboBox->addItems( functions::toQStringList(ChromaInterpolationMapper.getNames())); ui.chromaInterpolationComboBox->setCurrentIndex( int(ChromaInterpolationMapper.indexOf(this->conversionSettings.chromaInterpolation))); - ui.chromaInterpolationComboBox->setEnabled(srcPixelFormat.isChromaSubsampled()); + ui.chromaInterpolationComboBox->setEnabled(hasChroma && srcPixelFormat.isChromaSubsampled()); ui.colorConversionComboBox->addItems(functions::toQStringList(ColorConversionMapper.getNames())); ui.colorConversionComboBox->setCurrentIndex( int(ColorConversionMapper.indexOf(this->conversionSettings.colorConversion))); + ui.colorConversionComboBox->setEnabled(hasChroma); ui.lumaScaleSpinBox->setValue(this->conversionSettings.mathParameters[Component::Luma].scale); ui.lumaOffsetSpinBox->setMaximum(1000); ui.lumaOffsetSpinBox->setValue(this->conversionSettings.mathParameters[Component::Luma].offset); @@ -2868,10 +2871,15 @@ void videoHandlerYUV::setSrcPixelFormat(PixelFormatYUV format, bool emitSignal) if (ui.created()) { // Every time the pixel format changed, see if the interpolation combo box is enabled/disabled - QSignalBlocker blocker1(ui.chromaInterpolationComboBox); - QSignalBlocker blocker2(ui.lumaOffsetSpinBox); - QSignalBlocker blocker3(ui.chromaOffsetSpinBox); - ui.chromaInterpolationComboBox->setEnabled(format.isChromaSubsampled()); + const auto hasChroma = (srcPixelFormat.getSubsampling() != Subsampling::YUV_400); + QSignalBlocker blocker1(ui.colorComponentsComboBox); + QSignalBlocker blocker2(ui.chromaInterpolationComboBox); + QSignalBlocker blocker3(ui.colorConversionComboBox); + QSignalBlocker blocker4(ui.lumaOffsetSpinBox); + QSignalBlocker blocker5(ui.chromaOffsetSpinBox); + ui.colorComponentsComboBox->setEnabled(hasChroma); + ui.chromaInterpolationComboBox->setEnabled(hasChroma && format.isChromaSubsampled()); + ui.colorConversionComboBox->setEnabled(hasChroma); ui.lumaOffsetSpinBox->setValue(this->conversionSettings.mathParameters[Component::Luma].offset); ui.chromaOffsetSpinBox->setValue( this->conversionSettings.mathParameters[Component::Chroma].offset);