MCPcopy Create free account
hub / github.com/IENT/YUView / createVideoHandlerControls

Method createVideoHandlerControls

YUViewLib/src/video/yuv/videoHandlerYUV.cpp:2687–2801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2685#endif
2686
2687QLayout *videoHandlerYUV::createVideoHandlerControls(bool isSizeFixed)
2688{
2689 // Absolutely always only call this function once!
2690 assert(!ui.created());
2691
2692 QVBoxLayout *newVBoxLayout = nullptr;
2693 if (!isSizeFixed)
2694 {
2695 // Our parent (videoHandler) also has controls to add. Create a new vBoxLayout and append the
2696 // parent controls and our controls into that layout, separated by a line. Return that layout
2697 newVBoxLayout = new QVBoxLayout;
2698 newVBoxLayout->addLayout(FrameHandler::createFrameHandlerControls(isSizeFixed));
2699
2700 QFrame *line = new QFrame;
2701 line->setObjectName(QStringLiteral("line"));
2702 line->setFrameShape(QFrame::HLine);
2703 line->setFrameShadow(QFrame::Sunken);
2704 newVBoxLayout->addWidget(line);
2705 }
2706
2707 // Create the UI and setup all the controls
2708 ui.setupUi();
2709
2710 // Add the preset YUV formats. If the current format is in the list, add it and select it.
2711 for (auto format : presetList)
2712 ui.yuvFormatComboBox->addItem(QString::fromStdString(format.getName()));
2713
2714 int idx = presetList.indexOf(srcPixelFormat);
2715 if (idx == -1 && srcPixelFormat.isValid())
2716 {
2717 // The currently set pixel format is not in the presets list. Add and select it.
2718 ui.yuvFormatComboBox->addItem(QString::fromStdString(srcPixelFormat.getName()));
2719 presetList.append(srcPixelFormat);
2720 idx = presetList.indexOf(srcPixelFormat);
2721 }
2722 ui.yuvFormatComboBox->setCurrentIndex(idx);
2723 // Add the custom... entry that allows the user to add custom formats
2724 ui.yuvFormatComboBox->addItem("Custom...");
2725 ui.yuvFormatComboBox->setEnabled(!isSizeFixed);
2726
2727 // Set all the values of the properties widget to the values of this class
2728 const auto hasChroma = (srcPixelFormat.getSubsampling() != Subsampling::YUV_400);
2729 ui.colorComponentsComboBox->addItems(
2730 functions::toQStringList(ComponentDisplayModeMapper.getNames()));
2731 ui.colorComponentsComboBox->setCurrentIndex(
2732 int(ComponentDisplayModeMapper.indexOf(this->conversionSettings.componentDisplayMode)));
2733 ui.colorComponentsComboBox->setEnabled(hasChroma);
2734 ui.chromaInterpolationComboBox->addItems(
2735 functions::toQStringList(ChromaInterpolationMapper.getNames()));
2736 ui.chromaInterpolationComboBox->setCurrentIndex(
2737 int(ChromaInterpolationMapper.indexOf(this->conversionSettings.chromaInterpolation)));
2738 ui.chromaInterpolationComboBox->setEnabled(hasChroma && srcPixelFormat.isChromaSubsampled());
2739 ui.colorConversionComboBox->addItems(functions::toQStringList(ColorConversionMapper.getNames()));
2740 ui.colorConversionComboBox->setCurrentIndex(
2741 int(ColorConversionMapper.indexOf(this->conversionSettings.colorConversion)));
2742 ui.colorConversionComboBox->setEnabled(hasChroma);
2743 ui.lumaScaleSpinBox->setValue(this->conversionSettings.mathParameters[Component::Luma].scale);
2744 ui.lumaOffsetSpinBox->setMaximum(1000);

Callers

nothing calls this directly

Calls 10

toQStringListFunction · 0.85
createdMethod · 0.80
setupUiMethod · 0.80
indexOfMethod · 0.80
appendMethod · 0.80
getNamesMethod · 0.80
isChromaSubsampledMethod · 0.80
getNameMethod · 0.45
isValidMethod · 0.45
getSubsamplingMethod · 0.45

Tested by

no test coverage detected