implemented color management UI functionality in the ExportDialog

Frontend UI work in setting up color management when exporting.
This commit is contained in:
itsmattkc
2019-12-16 16:47:36 +11:00
parent 377e2316be
commit cb5a468b4a
4 changed files with 127 additions and 5 deletions
+27 -2
View File
@@ -4,6 +4,7 @@
#include <QFileDialog>
#include <QHBoxLayout>
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>
#include <QScrollArea>
#include <QSplitter>
@@ -93,6 +94,13 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, QWidget *parent) :
row++;
QProgressBar* progress_bar = new QProgressBar();
progress_bar->setEnabled(false);
progress_bar->setValue(0);
preferences_layout->addWidget(progress_bar, row, 0, 1, 4);
row++;
QDialogButtonBox* buttons = new QDialogButtonBox();
buttons->setCenterButtons(true);
buttons->addButton(tr("Export"), QDialogButtonBox::AcceptRole);
@@ -136,6 +144,15 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, QWidget *parent) :
connect(video_tab_->width_slider(), SIGNAL(ValueChanged(int64_t)), this, SLOT(ResolutionChanged()));
connect(video_tab_->height_slider(), SIGNAL(ValueChanged(int64_t)), this, SLOT(ResolutionChanged()));
connect(video_tab_->maintain_aspect_checkbox(), SIGNAL(toggled(bool)), this, SLOT(ResolutionChanged()));
connect(video_tab_->codec_combobox(), SIGNAL(currentIndexChanged(int)), this, SLOT(VideoCodecChanged()));
connect(video_tab_, SIGNAL(DisplayChanged(const QString&)), preview_viewer_, SLOT(SetOCIODisplay(const QString&)));
connect(video_tab_, SIGNAL(ViewChanged(const QString&)), preview_viewer_, SLOT(SetOCIOView(const QString&)));
connect(video_tab_, SIGNAL(LookChanged(const QString&)), preview_viewer_, SLOT(SetOCIOLook(const QString&)));
// Set viewer to view the node
preview_viewer_->ConnectViewerNode(viewer_node_);
preview_viewer_->SetColorMenuEnabled(false);
preview_viewer_->SetOCIOParameters(video_tab_->CurrentOCIODisplay(), video_tab_->CurrentOCIOView(), video_tab_->CurrentOCIOLook());
}
void ExportDialog::BrowseFilename()
@@ -174,12 +191,13 @@ void ExportDialog::FormatChanged(int index)
// Update video and audio comboboxes
video_tab_->codec_combobox()->clear();
foreach (int vcodec, current_format.video_codecs()) {
video_tab_->codec_combobox()->addItem(codecs_.at(vcodec).name());
video_tab_->codec_combobox()->addItem(codecs_.at(vcodec).name(), vcodec);
}
VideoCodecChanged();
audio_tab_->codec_combobox()->clear();
foreach (int acodec, current_format.audio_codecs()) {
audio_tab_->codec_combobox()->addItem(codecs_.at(acodec).name());
audio_tab_->codec_combobox()->addItem(codecs_.at(acodec).name(), acodec);
}
}
@@ -201,6 +219,13 @@ void ExportDialog::ResolutionChanged()
}
}
void ExportDialog::VideoCodecChanged()
{
const ExportCodec& codec = codecs_.at(video_tab_->codec_combobox()->currentData().toInt());
video_tab_->show_image_sequence_section(codec.flags() & ExportCodec::kStillImage);
}
void ExportDialog::SetUpFormats()
{
// Set up codecs
+2
View File
@@ -74,6 +74,8 @@ private slots:
void ResolutionChanged();
void VideoCodecChanged();
};
#endif // EXPORTDIALOG_H
+76 -3
View File
@@ -6,6 +6,7 @@
#include <QLabel>
#include "core.h"
#include "render/colormanager.h"
ExportVideoTab::ExportVideoTab(QWidget *parent) :
QWidget(parent)
@@ -46,11 +47,37 @@ QComboBox *ExportVideoTab::scaling_method_combobox() const
return scaling_method_combobox_;
}
QCheckBox *ExportVideoTab::image_sequence_checkbox() const
{
return image_sequence_checkbox_;
}
void ExportVideoTab::show_image_sequence_section(bool visible)
{
image_sequence_checkbox_->setVisible(visible);
image_sequence_label_->setVisible(visible);
}
void ExportVideoTab::set_frame_rate(const rational &frame_rate)
{
frame_rate_combobox_->setCurrentIndex(frame_rates_.indexOf(frame_rate));
}
QString ExportVideoTab::CurrentOCIODisplay()
{
return display_combobox_->currentData().toString();
}
QString ExportVideoTab::CurrentOCIOView()
{
return views_combobox_->currentData().toString();
}
QString ExportVideoTab::CurrentOCIOLook()
{
return looks_combobox_->currentData().toString();
}
QWidget* ExportVideoTab::SetupResolutionSection()
{
int row = 0;
@@ -116,20 +143,36 @@ QWidget* ExportVideoTab::SetupColorSection()
QGridLayout* color_layout = new QGridLayout(color_group);
color_layout->addWidget(new QLabel(tr("Display:")), row, 0);
color_layout->addWidget(new QComboBox(), row, 1);
QStringList displays = ColorManager::ListAvailableDisplays();
display_combobox_ = new QComboBox();
foreach (const QString& display, displays) {
display_combobox_->addItem(display, display);
}
connect(display_combobox_, SIGNAL(currentIndexChanged(int)), this, SLOT(ColorDisplayChanged()));
color_layout->addWidget(display_combobox_, row, 1);
row++;
views_combobox_ = new QComboBox();
color_layout->addWidget(new QLabel(tr("View:")), row, 0);
color_layout->addWidget(new QComboBox(), row, 1);
color_layout->addWidget(views_combobox_, row, 1);
row++;
QStringList looks = ColorManager::ListAvailableLooks();
looks_combobox_ = new QComboBox();
looks_combobox_->addItem(tr("(None)"), QString());
foreach (const QString& look, looks) {
looks_combobox_->addItem(look, look);
}
color_layout->addWidget(new QLabel(tr("Look:")), row, 0);
color_layout->addWidget(new QComboBox(), row, 1);
color_layout->addWidget(looks_combobox_, row, 1);
row++;
ColorDisplayChanged();
return color_group;
}
@@ -147,5 +190,35 @@ QWidget *ExportVideoTab::SetupCodecSection()
codec_combobox_ = new QComboBox();
codec_layout->addWidget(codec_combobox_, row, 1);
row++;
image_sequence_label_ = new QLabel(tr("Image Sequence:"));
codec_layout->addWidget(image_sequence_label_, row, 0);
image_sequence_checkbox_ = new QCheckBox();
codec_layout->addWidget(image_sequence_checkbox_, row, 1);
return codec_group;
}
void ExportVideoTab::ColorDisplayChanged()
{
views_combobox_->clear();
QStringList views = ColorManager::ListAvailableViews(display_combobox_->currentData().toString());
foreach (const QString& view, views) {
views_combobox_->addItem(view, view);
}
emit DisplayChanged(display_combobox_->currentData().toString());
}
void ExportVideoTab::ColorViewChanged()
{
emit ViewChanged(views_combobox_->currentData().toString());
}
void ExportVideoTab::ColorLookChanged()
{
emit LookChanged(looks_combobox_->currentData().toString());
}
+22
View File
@@ -20,9 +20,20 @@ public:
IntegerSlider* height_slider() const;
QCheckBox* maintain_aspect_checkbox() const;
QComboBox* scaling_method_combobox() const;
QCheckBox* image_sequence_checkbox() const;
void show_image_sequence_section(bool visible);
void set_frame_rate(const rational& frame_rate);
QString CurrentOCIODisplay();
QString CurrentOCIOView();
QString CurrentOCIOLook();
signals:
void DisplayChanged(const QString& display);
void ViewChanged(const QString& view);
void LookChanged(const QString& look);
private:
QWidget* SetupResolutionSection();
QWidget* SetupColorSection();
@@ -32,12 +43,23 @@ private:
QComboBox* frame_rate_combobox_;
QCheckBox* maintain_aspect_checkbox_;
QComboBox* scaling_method_combobox_;
QCheckBox* image_sequence_checkbox_;
QLabel* image_sequence_label_;
IntegerSlider* width_slider_;
IntegerSlider* height_slider_;
QComboBox* display_combobox_;
QComboBox* views_combobox_;
QComboBox* looks_combobox_;
QList<rational> frame_rates_;
private slots:
void ColorDisplayChanged();
void ColorViewChanged();
void ColorLookChanged();
};
#endif // EXPORTVIDEOTAB_H