style: unify identifier naming per updated conventions

Automated with clang-tidy readability-identifier-naming (config added to
.clang-tidy) plus scripted passes, per the updated rules now documented
in CONTRIBUTING.md:

- types (class/struct/enum/alias/template params): PascalCase
- functions, variables, members: snake_case (incl. rational -> Rational)
- private/protected members: trailing underscore; static member
  variables likewise (instance_, available_themes_)
- constants and enum values: snake_case (kLinear -> k_linear,
  F32P -> f32p); ALL_CAPS reserved for macros
- macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG ->
  OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE,
  include guards -> OAK_*)
- file names: all lowercase (Current/Plugin/OliveHost/OliveClip/
  OlivePluginInstance -> current/plugin/olivehost/oliveclip/
  oliveplugininstance)
- getters share the member name sans underscore, setters set_foo()
- Qt and third-party (OpenFX) virtual overrides and framework callbacks
  keep their original names (exempt in .clang-tidy)

Manual follow-ups required where automation could not reach:
- string-based QMetaObject/SIGNAL/SLOT references updated to renamed
  methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...)
- macro bodies referencing renamed methods (OLIVE_CONFIG,
  NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*)
- self-shadowing locals renamed where signals/methods became same-named
  (size_changed, worker_count, selected_items, import param, filters)
- third_party OFX member/namespace usages restored (OFX::Host::*,
  _created, _clipPrefsDirty, createInstance, clearPersistentMessage)
- STL protocol aliases restored (const_iterator) with .clang-tidy
  ignore rules; qHash overloads restored

Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
2026-07-19 16:10:54 +08:00
parent cb1718a103
commit bb40b4923e
1014 changed files with 44257 additions and 44220 deletions
+13 -13
View File
@@ -33,7 +33,7 @@ namespace olive
{
AV1Section::AV1Section(QWidget *parent)
: AV1Section(AV1CRFSection::kDefaultAV1CRF, parent)
: AV1Section(AV1CRFSection::k_default_a_v1_crf, parent)
{
}
@@ -89,15 +89,15 @@ AV1Section::AV1Section(int default_crf, QWidget *parent)
compression_method_stack_, &QStackedWidget::setCurrentIndex);
}
void AV1Section::AddOpts(EncodingParams *params)
void AV1Section::add_opts(EncodingParams *params)
{
CompressionMethod method = static_cast<CompressionMethod>(
compression_method_stack_->currentIndex());
if (method == kConstantRateFactor) {
if (method == k_constant_rate_factor) {
// Set Quantizer value
params->set_video_option(QStringLiteral("qp"),
QString::number(crf_section_->GetValue()));
QString::number(crf_section_->get_value()));
}
params->set_video_option(QStringLiteral("preset"),
@@ -111,27 +111,27 @@ AV1CRFSection::AV1CRFSection(int default_crf, QWidget *parent)
layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setMinimum(k_minimum_crf);
crf_slider_->setMaximum(k_maximum_crf);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
IntegerSlider *crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(
crf_input->setMaximumWidth(QtUtils::q_font_metrics_width(
crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->set_minimum(k_minimum_crf);
crf_input->set_maximum(k_maximum_crf);
crf_input->set_value(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
connect(crf_slider_, &QSlider::valueChanged, crf_input,
&IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_,
&IntegerSlider::set_value);
connect(crf_input, &IntegerSlider::value_changed, crf_slider_,
&QSlider::setValue);
}
int AV1CRFSection::GetValue() const
int AV1CRFSection::get_value() const
{
return crf_slider_->value();
}
+9 -9
View File
@@ -19,8 +19,8 @@
***/
#ifndef AV1SECTION_H
#define AV1SECTION_H
#ifndef OAK_AV1SECTION_H
#define OAK_AV1SECTION_H
#include <QSlider>
#include <QStackedWidget>
@@ -37,13 +37,13 @@ class AV1CRFSection : public QWidget {
public:
AV1CRFSection(int default_crf, QWidget *parent = nullptr);
int GetValue() const;
int get_value() const;
static const int kDefaultAV1CRF = 30;
static const int k_default_a_v1_crf = 30;
private:
static const int kMinimumCRF = 0;
static const int kMaximumCRF = 63;
static const int k_minimum_crf = 0;
static const int k_maximum_crf = 63;
QSlider *crf_slider_;
};
@@ -52,13 +52,13 @@ class AV1Section : public CodecSection {
Q_OBJECT
public:
enum CompressionMethod {
kConstantRateFactor,
k_constant_rate_factor,
};
AV1Section(QWidget *parent = nullptr);
AV1Section(int default_crf, QWidget *parent);
virtual void AddOpts(EncodingParams *params) override;
virtual void add_opts(EncodingParams *params) override;
private:
QStackedWidget *compression_method_stack_;
@@ -70,4 +70,4 @@ private:
}
#endif // AV1SECTION_H
#endif // OAK_AV1SECTION_H
+2 -2
View File
@@ -79,14 +79,14 @@ CineformSection::CineformSection(QWidget *parent)
layout->addWidget(quality_combobox_, row, 1);
}
void CineformSection::AddOpts(EncodingParams *params)
void CineformSection::add_opts(EncodingParams *params)
{
params->set_video_option(
QStringLiteral("quality"),
QString::number(quality_combobox_->currentIndex()));
}
void CineformSection::SetOpts(const EncodingParams *p)
void CineformSection::set_opts(const EncodingParams *p)
{
quality_combobox_->setCurrentIndex(
p->video_option(QStringLiteral("quality")).toInt());
+5 -5
View File
@@ -19,8 +19,8 @@
***/
#ifndef CINEFORMSECTION_H
#define CINEFORMSECTION_H
#ifndef OAK_CINEFORMSECTION_H
#define OAK_CINEFORMSECTION_H
#include <QComboBox>
@@ -34,9 +34,9 @@ class CineformSection : public CodecSection {
public:
CineformSection(QWidget *parent = nullptr);
virtual void AddOpts(EncodingParams *params) override;
virtual void add_opts(EncodingParams *params) override;
virtual void SetOpts(const EncodingParams *p) override;
virtual void set_opts(const EncodingParams *p) override;
private:
QComboBox *quality_combobox_;
@@ -44,4 +44,4 @@ private:
}
#endif // CINEFORMSECTION_H
#endif // OAK_CINEFORMSECTION_H
+5 -5
View File
@@ -19,8 +19,8 @@
***/
#ifndef CODECSECTION_H
#define CODECSECTION_H
#ifndef OAK_CODECSECTION_H
#define OAK_CODECSECTION_H
#include <QWidget>
@@ -34,12 +34,12 @@ class CodecSection : public QWidget {
public:
CodecSection(QWidget *parent = nullptr);
virtual void AddOpts(EncodingParams *params)
virtual void add_opts(EncodingParams *params)
{
Q_UNUSED(params)
}
virtual void SetOpts(const EncodingParams *p)
virtual void set_opts(const EncodingParams *p)
{
Q_UNUSED(p)
}
@@ -47,4 +47,4 @@ public:
}
#endif // CODECSECTION_H
#endif // OAK_CODECSECTION_H
+3 -3
View File
@@ -29,17 +29,17 @@ namespace olive
CodecStack::CodecStack(QWidget *parent)
: super{ parent }
{
connect(this, &CodecStack::currentChanged, this, &CodecStack::OnChange);
connect(this, &CodecStack::currentChanged, this, &CodecStack::on_change);
}
void CodecStack::addWidget(QWidget *widget)
{
super::addWidget(widget);
OnChange(currentIndex());
on_change(currentIndex());
}
void CodecStack::OnChange(int index)
void CodecStack::on_change(int index)
{
for (int i = 0; i < count(); i++) {
if (i == index) {
+4 -4
View File
@@ -19,8 +19,8 @@
***/
#ifndef CODECSTACK_H
#define CODECSTACK_H
#ifndef OAK_CODECSTACK_H
#define OAK_CODECSTACK_H
#include <QStackedWidget>
@@ -37,9 +37,9 @@ public:
signals:
private slots:
void OnChange(int index);
void on_change(int index);
};
}
#endif // CODECSTACK_H
#endif // OAK_CODECSTACK_H
+45 -45
View File
@@ -33,7 +33,7 @@ namespace olive
{
H264Section::H264Section(QWidget *parent)
: H264Section(H264CRFSection::kDefaultH264CRF, parent)
: H264Section(H264CRFSection::k_default_h264_crf, parent)
{
}
@@ -101,7 +101,7 @@ H264Section::H264Section(int default_crf, QWidget *parent)
compression_method_stack_, &QStackedWidget::setCurrentIndex);
}
void H264Section::AddOpts(EncodingParams *params)
void H264Section::add_opts(EncodingParams *params)
{
// FIXME: Implement two-pass
@@ -113,24 +113,24 @@ void H264Section::AddOpts(EncodingParams *params)
params->set_video_option(QStringLiteral("ove_compressionmethod"),
QString::number(method));
if (method == kConstantRateFactor) {
if (method == k_constant_rate_factor) {
// Simply set CRF value
params->set_video_option(QStringLiteral("crf"),
QString::number(crf_section_->GetValue()));
QString::number(crf_section_->get_value()));
} else {
int64_t target_rate, max_rate, min_rate;
if (method == kTargetBitRate) {
if (method == k_target_bit_rate) {
// Use user-supplied values for the bit rate
target_rate = bitrate_section_->GetTargetBitRate();
target_rate = bitrate_section_->get_target_bit_rate();
min_rate = 0;
max_rate = bitrate_section_->GetMaximumBitRate();
max_rate = bitrate_section_->get_maximum_bit_rate();
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
int64_t target_fs = filesize_section_->GetFileSize();
int64_t target_fs = filesize_section_->get_file_size();
target_rate = qRound64(static_cast<double>(target_fs) /
params->GetExportLength().toDouble());
params->get_export_length().to_double());
min_rate = target_rate;
max_rate = target_rate;
@@ -151,26 +151,26 @@ void H264Section::AddOpts(EncodingParams *params)
QString::number(preset_combobox_->currentIndex()));
}
void H264Section::SetOpts(const EncodingParams *p)
void H264Section::set_opts(const EncodingParams *p)
{
CompressionMethod method = static_cast<CompressionMethod>(
p->video_option(QStringLiteral("ove_compressionmethod")).toInt());
compression_method_stack_->setCurrentIndex(method);
if (method == kConstantRateFactor) {
crf_section_->SetValue(p->video_option(QStringLiteral("crf")).toInt());
if (method == k_constant_rate_factor) {
crf_section_->set_value(p->video_option(QStringLiteral("crf")).toInt());
} else {
int64_t target_rate = p->video_bit_rate();
int64_t max_rate = p->video_max_bit_rate();
if (method == kTargetBitRate) {
if (method == k_target_bit_rate) {
// Use user-supplied values for the bit rate
bitrate_section_->SetTargetBitRate(target_rate);
bitrate_section_->SetMaximumBitRate(max_rate);
bitrate_section_->set_target_bit_rate(target_rate);
bitrate_section_->set_maximum_bit_rate(max_rate);
} else {
// Calculate the bit rate from the file size divided by the sequence length in seconds (bits per second)
filesize_section_->SetFileSize(
filesize_section_->set_file_size(
p->video_option(QStringLiteral("ove_targetfilesize"))
.toLongLong());
}
@@ -184,32 +184,32 @@ H264CRFSection::H264CRFSection(int default_crf, QWidget *parent)
layout->setContentsMargins(0, 0, 0, 0);
crf_slider_ = new QSlider(Qt::Horizontal);
crf_slider_->setMinimum(kMinimumCRF);
crf_slider_->setMaximum(kMaximumCRF);
crf_slider_->setMinimum(k_minimum_crf);
crf_slider_->setMaximum(k_maximum_crf);
crf_slider_->setValue(default_crf);
layout->addWidget(crf_slider_);
IntegerSlider *crf_input = new IntegerSlider();
crf_input->setMaximumWidth(QtUtils::QFontMetricsWidth(
crf_input->setMaximumWidth(QtUtils::q_font_metrics_width(
crf_input->fontMetrics(), QStringLiteral("HHHH")));
crf_input->SetMinimum(kMinimumCRF);
crf_input->SetMaximum(kMaximumCRF);
crf_input->SetValue(default_crf);
crf_input->set_minimum(k_minimum_crf);
crf_input->set_maximum(k_maximum_crf);
crf_input->set_value(default_crf);
crf_input->SetDefaultValue(default_crf);
layout->addWidget(crf_input);
connect(crf_slider_, &QSlider::valueChanged, crf_input,
&IntegerSlider::SetValue);
connect(crf_input, &IntegerSlider::ValueChanged, crf_slider_,
&IntegerSlider::set_value);
connect(crf_input, &IntegerSlider::value_changed, crf_slider_,
&QSlider::setValue);
}
int H264CRFSection::GetValue() const
int H264CRFSection::get_value() const
{
return crf_slider_->value();
}
void H264CRFSection::SetValue(int c)
void H264CRFSection::set_value(int c)
{
crf_slider_->setValue(c);
}
@@ -225,7 +225,7 @@ H264BitRateSection::H264BitRateSection(QWidget *parent)
layout->addWidget(new QLabel(tr("Target Bit Rate (Mbps):")), row, 0);
target_rate_ = new FloatSlider();
target_rate_->SetMinimum(0);
target_rate_->set_minimum(0);
layout->addWidget(target_rate_, row, 1);
row++;
@@ -233,7 +233,7 @@ H264BitRateSection::H264BitRateSection(QWidget *parent)
layout->addWidget(new QLabel(tr("Maximum Bit Rate (Mbps):")), row, 0);
max_rate_ = new FloatSlider();
max_rate_->SetMinimum(0);
max_rate_->set_minimum(0);
layout->addWidget(max_rate_, row, 1);
row++;
@@ -244,28 +244,28 @@ H264BitRateSection::H264BitRateSection(QWidget *parent)
layout->addWidget(two_pass_box, row, 1);
// Bit rate defaults
target_rate_->SetValue(16.0);
max_rate_->SetValue(32.0);
target_rate_->set_value(16.0);
max_rate_->set_value(32.0);
}
int64_t H264BitRateSection::GetTargetBitRate() const
int64_t H264BitRateSection::get_target_bit_rate() const
{
return qRound64(target_rate_->GetValue() * 1000000.0);
return qRound64(target_rate_->get_value() * 1000000.0);
}
void H264BitRateSection::SetTargetBitRate(int64_t b)
void H264BitRateSection::set_target_bit_rate(int64_t b)
{
target_rate_->SetValue(double(b) * 0.000001);
target_rate_->set_value(double(b) * 0.000001);
}
int64_t H264BitRateSection::GetMaximumBitRate() const
int64_t H264BitRateSection::get_maximum_bit_rate() const
{
return qRound64(max_rate_->GetValue() * 1000000.0);
return qRound64(max_rate_->get_value() * 1000000.0);
}
void H264BitRateSection::SetMaximumBitRate(int64_t b)
void H264BitRateSection::set_maximum_bit_rate(int64_t b)
{
max_rate_->SetValue(double(b) * 0.000001);
max_rate_->set_value(double(b) * 0.000001);
}
H264FileSizeSection::H264FileSizeSection(QWidget *parent)
@@ -279,7 +279,7 @@ H264FileSizeSection::H264FileSizeSection(QWidget *parent)
layout->addWidget(new QLabel(tr("Target File Size (MB):")), row, 0);
file_size_ = new FloatSlider();
file_size_->SetMinimum(0);
file_size_->set_minimum(0);
layout->addWidget(file_size_, row, 1);
row++;
@@ -290,23 +290,23 @@ H264FileSizeSection::H264FileSizeSection(QWidget *parent)
layout->addWidget(two_pass_box, row, 1);
// File size defaults
file_size_->SetValue(700.0);
file_size_->set_value(700.0);
}
int64_t H264FileSizeSection::GetFileSize() const
int64_t H264FileSizeSection::get_file_size() const
{
// Convert megabytes to BITS
return qRound64(file_size_->GetValue() * 1024.0 * 1024.0 * 8.0);
return qRound64(file_size_->get_value() * 1024.0 * 1024.0 * 8.0);
}
void H264FileSizeSection::SetFileSize(int64_t f)
void H264FileSizeSection::set_file_size(int64_t f)
{
// Convert bits back to megabytes
file_size_->SetValue(double(f) / 8.0 / 1024.0 / 1024.0);
file_size_->set_value(double(f) / 8.0 / 1024.0 / 1024.0);
}
H265Section::H265Section(QWidget *parent)
: H264Section(H264CRFSection::kDefaultH265CRF, parent)
: H264Section(H264CRFSection::k_default_h265_crf, parent)
{
}
+20 -20
View File
@@ -19,8 +19,8 @@
***/
#ifndef H264SECTION_H
#define H264SECTION_H
#ifndef OAK_H264SECTION_H
#define OAK_H264SECTION_H
#include <QSlider>
#include <QStackedWidget>
@@ -37,15 +37,15 @@ class H264CRFSection : public QWidget {
public:
H264CRFSection(int default_crf, QWidget *parent = nullptr);
int GetValue() const;
void SetValue(int c);
int get_value() const;
void set_value(int c);
static constexpr int kDefaultH264CRF = 18;
static constexpr int kDefaultH265CRF = 23;
static constexpr int k_default_h264_crf = 18;
static constexpr int k_default_h265_crf = 23;
private:
static constexpr int kMinimumCRF = 0;
static constexpr int kMaximumCRF = 51;
static constexpr int k_minimum_crf = 0;
static constexpr int k_maximum_crf = 51;
QSlider *crf_slider_;
};
@@ -58,14 +58,14 @@ public:
/**
* @brief Get user-selected target bit rate (returns in BITS)
*/
int64_t GetTargetBitRate() const;
void SetTargetBitRate(int64_t b);
int64_t get_target_bit_rate() const;
void set_target_bit_rate(int64_t b);
/**
* @brief Get user-selected maximum bit rate (returns in BITS)
*/
int64_t GetMaximumBitRate() const;
void SetMaximumBitRate(int64_t b);
int64_t get_maximum_bit_rate() const;
void set_maximum_bit_rate(int64_t b);
private:
FloatSlider *target_rate_;
@@ -81,8 +81,8 @@ public:
/**
* @brief Returns file size in BITS
*/
int64_t GetFileSize() const;
void SetFileSize(int64_t f);
int64_t get_file_size() const;
void set_file_size(int64_t f);
private:
FloatSlider *file_size_;
@@ -92,17 +92,17 @@ class H264Section : public CodecSection {
Q_OBJECT
public:
enum CompressionMethod {
kConstantRateFactor,
kTargetBitRate,
kTargetFileSize
k_constant_rate_factor,
k_target_bit_rate,
k_target_file_size
};
H264Section(QWidget *parent = nullptr);
H264Section(int default_crf, QWidget *parent);
virtual void AddOpts(EncodingParams *params) override;
virtual void add_opts(EncodingParams *params) override;
virtual void SetOpts(const EncodingParams *p) override;
virtual void set_opts(const EncodingParams *p) override;
private:
QStackedWidget *compression_method_stack_;
@@ -124,4 +124,4 @@ public:
}
#endif // H264SECTION_H
#endif // OAK_H264SECTION_H
+7 -7
View File
@@ -39,7 +39,7 @@ ImageSection::ImageSection(QWidget *parent)
image_sequence_checkbox_ = new QCheckBox();
connect(image_sequence_checkbox_, &QCheckBox::toggled, this,
&ImageSection::ImageSequenceCheckBoxToggled);
&ImageSection::image_sequence_check_box_toggled);
layout->addWidget(image_sequence_checkbox_, row, 1);
row++;
@@ -47,15 +47,15 @@ ImageSection::ImageSection(QWidget *parent)
layout->addWidget(new QLabel(tr("Frame to Export:")), row, 0);
frame_slider_ = new RationalSlider();
frame_slider_->SetMinimum(0);
frame_slider_->SetValue(0);
frame_slider_->SetDisplayType(RationalSlider::kTime);
connect(frame_slider_, &RationalSlider::ValueChanged, this,
&ImageSection::TimeChanged);
frame_slider_->set_minimum(0);
frame_slider_->set_value(0);
frame_slider_->set_display_type(RationalSlider::k_time);
connect(frame_slider_, &RationalSlider::value_changed, this,
&ImageSection::time_changed);
layout->addWidget(frame_slider_, row, 1);
}
void ImageSection::ImageSequenceCheckBoxToggled(bool e)
void ImageSection::image_sequence_check_box_toggled(bool e)
{
frame_slider_->setEnabled(!e);
}
+13 -13
View File
@@ -19,8 +19,8 @@
***/
#ifndef IMAGESECTION_H
#define IMAGESECTION_H
#ifndef OAK_IMAGESECTION_H
#define OAK_IMAGESECTION_H
#include <QCheckBox>
@@ -35,33 +35,33 @@ class ImageSection : public CodecSection {
public:
ImageSection(QWidget *parent = nullptr);
bool IsImageSequenceChecked() const
bool is_image_sequence_checked() const
{
return image_sequence_checkbox_->isChecked();
}
void SetImageSequenceChecked(bool e)
void set_image_sequence_checked(bool e)
{
image_sequence_checkbox_->setChecked(e);
}
void SetTimebase(const rational &r)
void set_timebase(const Rational &r)
{
frame_slider_->SetTimebase(r);
frame_slider_->set_timebase(r);
}
rational GetTime() const
Rational get_time() const
{
return frame_slider_->GetValue();
return frame_slider_->get_value();
}
void SetTime(const rational &t)
void set_time(const Rational &t)
{
frame_slider_->SetValue(t);
frame_slider_->set_value(t);
}
signals:
void TimeChanged(const rational &t);
void time_changed(const Rational &t);
private:
QCheckBox *image_sequence_checkbox_;
@@ -69,9 +69,9 @@ private:
RationalSlider *frame_slider_;
private slots:
void ImageSequenceCheckBoxToggled(bool e);
void image_sequence_check_box_toggled(bool e);
};
}
#endif // IMAGESECTION_H
#endif // OAK_IMAGESECTION_H
+208 -208
View File
@@ -74,10 +74,10 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
QPushButton *file_browse_btn = new QPushButton();
file_browse_btn->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
file_browse_btn->setIcon(icon::Folder);
file_browse_btn->setIcon(icon::folder);
file_browse_btn->setToolTip(tr("Browse for exported file filename"));
connect(file_browse_btn, &QPushButton::clicked, this,
&ExportDialog::BrowseFilename);
&ExportDialog::browse_filename);
preferences_layout->addWidget(file_browse_btn, row, 3);
row++;
@@ -86,11 +86,11 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
preset_lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
preferences_layout->addWidget(preset_lbl, row, 0);
preset_combobox_ = new QComboBox();
LoadPresets();
load_presets();
connect(
preset_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportDialog::PresetComboBoxChanged);
this, &ExportDialog::preset_combo_box_changed);
preferences_layout->addWidget(preset_combobox_, row, 1, 1, 2);
/*QPushButton* preset_load_btn = new QPushButton();
@@ -99,15 +99,15 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
preferences_layout->addWidget(preset_load_btn, row, 2);*/
QPushButton *preset_save_btn = new QPushButton();
preset_save_btn->setIcon(icon::Save);
preset_save_btn->setIcon(icon::save);
preset_save_btn->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
preferences_layout->addWidget(preset_save_btn, row, 3);
connect(preset_save_btn, &QPushButton::clicked, this,
&ExportDialog::SavePreset);
&ExportDialog::save_preset);
row++;
preferences_layout->addWidget(QtUtils::CreateHorizontalLine(), row, 0, 1,
preferences_layout->addWidget(QtUtils::create_horizontal_line(), row, 0, 1,
4);
row++;
@@ -117,13 +117,13 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
range_combobox_ = new QComboBox();
range_combobox_->addItem(tr("Entire Sequence"));
range_combobox_->addItem(tr("In to Out"));
range_combobox_->setEnabled(viewer_node_->GetWorkArea()->enabled());
range_combobox_->setEnabled(viewer_node_->get_work_area()->enabled());
preferences_layout->addWidget(range_combobox_, row, 1, 1, 3);
row++;
preferences_layout->addWidget(QtUtils::CreateHorizontalLine(), row, 0, 1,
preferences_layout->addWidget(QtUtils::create_horizontal_line(), row, 0, 1,
4);
row++;
@@ -153,20 +153,20 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
color_manager_ = viewer_node_->project()->color_manager();
video_tab_ = new ExportVideoTab(color_manager_);
AddPreferencesTab(video_tab_, tr("Video"));
add_preferences_tab(video_tab_, tr("Video"));
// Set video tab time and make connections
connect(viewer_node, &ViewerOutput::PlayheadChanged, video_tab_,
&ExportVideoTab::SetTime);
connect(video_tab_, &ExportVideoTab::TimeChanged, viewer_node,
&ViewerOutput::SetPlayhead);
video_tab_->SetTime(viewer_node->GetPlayhead());
connect(viewer_node, &ViewerOutput::playhead_changed, video_tab_,
&ExportVideoTab::set_time);
connect(video_tab_, &ExportVideoTab::time_changed, viewer_node,
&ViewerOutput::set_playhead);
video_tab_->set_time(viewer_node->get_playhead());
audio_tab_ = new ExportAudioTab();
AddPreferencesTab(audio_tab_, tr("Audio"));
add_preferences_tab(audio_tab_, tr("Audio"));
subtitle_tab_ = new ExportSubtitlesTab();
AddPreferencesTab(subtitle_tab_, tr("Subtitles"));
add_preferences_tab(subtitle_tab_, tr("Subtitles"));
preferences_layout->addWidget(preferences_tabs_, row, 0, 1, 4);
@@ -206,7 +206,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
QPushButton *export_btn = new QPushButton(tr("Export"));
btn_layout->addWidget(export_btn);
connect(export_btn, &QPushButton::clicked, this,
&ExportDialog::StartExport);
&ExportDialog::start_export);
QPushButton *cancel_btn = new QPushButton(tr("Cancel"));
btn_layout->addWidget(cancel_btn);
@@ -220,7 +220,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
QVBoxLayout *preview_layout = new QVBoxLayout(preview_area);
preview_layout->addWidget(new QLabel(tr("Preview")));
preview_viewer_ = new ViewerWidget();
preview_viewer_->ruler()->SetMarkerEditingEnabled(false);
preview_viewer_->ruler()->set_marker_editing_enabled(false);
preview_viewer_->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
preview_layout->addWidget(preview_viewer_);
@@ -230,56 +230,56 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
splitter->setSizes({ 1, 99999 });
// Set default filename
SetDefaultFilename();
set_default_filename();
// Set defaults
previously_selected_format_ = ExportFormat::kFormatMPEG4Video;
connect(format_combobox_, &ExportFormatComboBox::FormatChanged, this,
&ExportDialog::FormatChanged);
previously_selected_format_ = ExportFormat::k_format_mpe_g4_video;
connect(format_combobox_, &ExportFormatComboBox::format_changed, this,
&ExportDialog::format_changed);
VideoParams vp = viewer_node_->GetVideoParams();
VideoParams vp = viewer_node_->get_video_params();
video_aspect_ratio_ =
static_cast<double>(vp.width()) / static_cast<double>(vp.height());
connect(video_tab_->width_slider(), &IntegerSlider::ValueChanged, this,
&ExportDialog::ResolutionChanged);
connect(video_tab_->width_slider(), &IntegerSlider::value_changed, this,
&ExportDialog::resolution_changed);
connect(video_tab_->height_slider(), &IntegerSlider::ValueChanged, this,
&ExportDialog::ResolutionChanged);
connect(video_tab_->height_slider(), &IntegerSlider::value_changed, this,
&ExportDialog::resolution_changed);
connect(
video_tab_->scaling_method_combobox(),
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportDialog::UpdateViewerDimensions);
this, &ExportDialog::update_viewer_dimensions);
connect(video_tab_->maintain_aspect_checkbox(), &QCheckBox::toggled, this,
&ExportDialog::ResolutionChanged);
&ExportDialog::resolution_changed);
connect(video_tab_, &ExportVideoTab::ColorSpaceChanged, preview_viewer_,
connect(video_tab_, &ExportVideoTab::color_space_changed, preview_viewer_,
static_cast<void (ViewerWidget::*)(const ColorTransform &)>(
&ViewerWidget::SetColorTransform));
connect(video_tab_, &ExportVideoTab::ImageSequenceCheckBoxChanged, this,
&ExportDialog::ImageSequenceCheckBoxChanged);
&ViewerWidget::set_color_transform));
connect(video_tab_, &ExportVideoTab::image_sequence_check_box_changed, this,
&ExportDialog::image_sequence_check_box_changed);
// We don't check if the codec supports subtitles because we can always export to a sidecar file
bool has_subtitle_tracks = SequenceHasSubtitles();
bool has_subtitle_tracks = sequence_has_subtitles();
connect(subtitles_enabled_, &QCheckBox::toggled, subtitle_tab_,
&QWidget::setEnabled);
subtitles_enabled_->setEnabled(has_subtitle_tracks);
// If the viewer already has cached params, use them
if (!stills_only_mode_ &&
viewer_node_->GetLastUsedEncodingParams().IsValid()) {
viewer_node_->get_last_used_encoding_params().is_valid()) {
// This will automatically set the param data
QtUtils::SetComboBoxData(preset_combobox_, kPresetLastUsed);
QtUtils::set_combo_box_data(preset_combobox_, k_preset_last_used);
} else {
SetDefaults();
set_defaults();
}
// Set viewer to view the node and set its colorspace
preview_viewer_->ConnectViewerNode(viewer_node_);
preview_viewer_->SetColorMenuEnabled(false);
preview_viewer_->SetColorTransform(video_tab_->CurrentOCIOColorSpace());
preview_viewer_->connect_viewer_node(viewer_node_);
preview_viewer_->set_color_menu_enabled(false);
preview_viewer_->set_color_transform(video_tab_->current_ocio_color_space());
qApp->installEventFilter(this);
@@ -294,21 +294,21 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, bool stills_only_mode,
subtitle_tab_->setEnabled(subtitles_enabled_->isChecked());
}
rational ExportDialog::GetSelectedTimebase() const
Rational ExportDialog::get_selected_timebase() const
{
return video_tab_->GetSelectedFrameRate().flipped();
return video_tab_->get_selected_frame_rate().flipped();
}
void ExportDialog::SetSelectedTimebase(const rational &r)
void ExportDialog::set_selected_timebase(const Rational &r)
{
video_tab_->SetSelectedFrameRate(r.flipped());
video_tab_->set_selected_frame_rate(r.flipped());
}
void ExportDialog::StartExport()
void ExportDialog::start_export()
{
if (!video_enabled_->isChecked() && !audio_enabled_->isChecked() &&
!subtitles_enabled_->isChecked()) {
QtUtils::MsgBox(
QtUtils::msg_box(
this, QMessageBox::Critical, tr("Invalid parameters"),
tr("Video, audio, and subtitles are disabled. There's nothing to export."));
return;
@@ -317,12 +317,12 @@ void ExportDialog::StartExport()
// Validate if the entered filename contains the correct extension (the extension is necessary
// for both FFmpeg and OIIO to determine the output format)
QString necessary_ext = QStringLiteral(".%1").arg(
ExportFormat::GetExtension(format_combobox_->GetFormat()));
ExportFormat::get_extension(format_combobox_->get_format()));
QString proposed_filename = filename_edit_->text().trimmed();
// If it doesn't, see if the user wants to append it automatically. If not, we don't abort the export.
if (!proposed_filename.endsWith(necessary_ext, Qt::CaseInsensitive)) {
if (QtUtils::MsgBox(
if (QtUtils::msg_box(
this, QMessageBox::Warning, tr("Invalid filename"),
tr("The filename must contain the extension \"%1\". Would you like to append it "
"automatically?")
@@ -340,8 +340,8 @@ void ExportDialog::StartExport()
// If the directory does not exist, try to create it
QDir dest_dir(file_info.path());
if (!FileFunctions::DirectoryIsValid(dest_dir)) {
QtUtils::MsgBox(
if (!FileFunctions::directory_is_valid(dest_dir)) {
QtUtils::msg_box(
this, QMessageBox::Critical,
tr("Failed to create output directory"),
tr("The intended output directory doesn't exist and Oak Video Editor couldn't create it. "
@@ -350,22 +350,22 @@ void ExportDialog::StartExport()
}
// Validate if this is an image sequence and if the filename contains enough digits
if (video_tab_->IsImageSequenceSet()) {
if (video_tab_->is_image_sequence_set()) {
// Ensure filename contains digits
if (!Encoder::FilenameContainsDigitPlaceholder(proposed_filename)) {
QtUtils::MsgBox(
if (!Encoder::filename_contains_digit_placeholder(proposed_filename)) {
QtUtils::msg_box(
this, QMessageBox::Critical, tr("Invalid filename"),
tr("Export is set to an image sequence, but the filename does not have a section for digits "
"(formatted as [#####] where the amount of # is the amount of digits)."));
return;
}
int64_t frame_count = GetExportLengthInTimebaseUnits();
int64_t needed_digit_count = GetDigitCount(frame_count);
int64_t frame_count = get_export_length_in_timebase_units();
int64_t needed_digit_count = get_digit_count(frame_count);
int current_digit_count =
Encoder::GetImageSequencePlaceholderDigitCount(proposed_filename);
Encoder::get_image_sequence_placeholder_digit_count(proposed_filename);
if (current_digit_count < needed_digit_count) {
QtUtils::MsgBox(
QtUtils::msg_box(
this, QMessageBox::Critical, tr("Invalid filename"),
tr("Filename doesn't contain enough digits for the amount of frames "
"this export will need (need %1 for %n frame(s)).",
@@ -377,7 +377,7 @@ void ExportDialog::StartExport()
// Validate if the file exists and whether the user wishes to overwrite it
if (file_info.exists()) {
if (QtUtils::MsgBox(
if (QtUtils::msg_box(
this, QMessageBox::Warning, tr("Confirm Overwrite"),
tr("The file \"%1\" already exists. Do you want to overwrite it?")
.arg(proposed_filename),
@@ -388,50 +388,50 @@ void ExportDialog::StartExport()
// Validate video resolution
if (video_enabled_->isChecked() &&
(video_tab_->GetSelectedCodec() == ExportCodec::kCodecH264 ||
video_tab_->GetSelectedCodec() == ExportCodec::kCodecH265) &&
(video_tab_->width_slider()->GetValue() % 2 != 0 ||
video_tab_->height_slider()->GetValue() % 2 != 0)) {
QtUtils::MsgBox(this, QMessageBox::Critical, tr("Invalid Parameters"),
(video_tab_->get_selected_codec() == ExportCodec::k_codec_h264 ||
video_tab_->get_selected_codec() == ExportCodec::k_codec_h265) &&
(video_tab_->width_slider()->get_value() % 2 != 0 ||
video_tab_->height_slider()->get_value() % 2 != 0)) {
QtUtils::msg_box(this, QMessageBox::Critical, tr("Invalid Parameters"),
tr("Width and height must be multiples of 2."));
return;
}
ExportTask *task =
new ExportTask(viewer_node_, color_manager_, GenerateParams());
new ExportTask(viewer_node_, color_manager_, generate_params());
if (export_bkg_box_->isChecked()) {
// Send to TaskManager to export in background
TaskManager::instance()->AddTask(task);
TaskManager::instance()->add_task(task);
this->accept();
} else {
// Use modal dialog box
TaskDialog *td = new TaskDialog(task, tr("Export"), this);
connect(td, &TaskDialog::TaskSucceeded, this,
&ExportDialog::ExportFinished);
connect(td, &TaskDialog::task_succeeded, this,
&ExportDialog::export_finished);
td->open();
}
}
void ExportDialog::ExportFinished()
void ExportDialog::export_finished()
{
TaskDialog *td = static_cast<TaskDialog *>(sender());
if (td->GetTask()->IsCancelled()) {
if (td->get_task()->is_cancelled()) {
// If this task was cancelled, we stay open so the user can potentially queue another export
} else {
// Accept this dialog and close
if (import_file_after_export_->isEnabled() &&
import_file_after_export_->isChecked()) {
QString filename = filename_edit_->text().trimmed();
emit RequestImportFile(filename);
emit request_import_file(filename);
}
this->accept();
}
}
void ExportDialog::ImageSequenceCheckBoxChanged(bool e)
void ExportDialog::image_sequence_check_box_changed(bool e)
{
QFileInfo current_fileinfo(filename_edit_->text());
@@ -439,11 +439,11 @@ void ExportDialog::ImageSequenceCheckBoxChanged(bool e)
QString suffix = current_fileinfo.suffix();
if (e) {
if (!Encoder::FilenameContainsDigitPlaceholder(basename)) {
if (!Encoder::filename_contains_digit_placeholder(basename)) {
basename.append(QStringLiteral("_[#####]"));
}
} else {
basename = Encoder::FilenameRemoveDigitPlaceholder(basename);
basename = Encoder::filename_remove_digit_placeholder(basename);
}
// Set filename
@@ -454,16 +454,16 @@ void ExportDialog::ImageSequenceCheckBoxChanged(bool e)
filename_edit_->setText(current_fileinfo.dir().filePath(basename));
}
void ExportDialog::SavePreset()
void ExportDialog::save_preset()
{
ExportSavePresetDialog d(GenerateParams(), this);
ExportSavePresetDialog d(generate_params(), this);
if (d.exec() == QDialog::Accepted) {
LoadPresets();
preset_combobox_->setCurrentText(d.GetSelectedPresetName());
load_presets();
preset_combobox_->setCurrentText(d.get_selected_preset_name());
}
}
void ExportDialog::PresetComboBoxChanged()
void ExportDialog::preset_combo_box_changed()
{
if (loading_presets_) {
return;
@@ -472,16 +472,16 @@ void ExportDialog::PresetComboBoxChanged()
QComboBox *c = static_cast<QComboBox *>(sender());
int preset_number = c->currentData().toInt();
if (preset_number == kPresetDefault) {
SetDefaults();
} else if (preset_number == kPresetLastUsed) {
SetParams(viewer_node_->GetLastUsedEncodingParams());
if (preset_number == k_preset_default) {
set_defaults();
} else if (preset_number == k_preset_last_used) {
set_params(viewer_node_->get_last_used_encoding_params());
} else {
SetParams(presets_.at(preset_number));
set_params(presets_.at(preset_number));
}
}
void ExportDialog::AddPreferencesTab(QWidget *inner_widget,
void ExportDialog::add_preferences_tab(QWidget *inner_widget,
const QString &title)
{
QScrollArea *scroll_area = new QScrollArea();
@@ -490,14 +490,14 @@ void ExportDialog::AddPreferencesTab(QWidget *inner_widget,
preferences_tabs_->addTab(scroll_area, title);
}
void ExportDialog::BrowseFilename()
void ExportDialog::browse_filename()
{
ExportFormat::Format f = format_combobox_->GetFormat();
ExportFormat::Format f = format_combobox_->get_format();
QString browsed_fn = QFileDialog::getSaveFileName(
this, "", filename_edit_->text().trimmed(),
QStringLiteral("%1 (*.%2)")
.arg(ExportFormat::GetName(f), ExportFormat::GetExtension(f)),
.arg(ExportFormat::get_name(f), ExportFormat::get_extension(f)),
nullptr,
// We don't confirm overwrite here because we do it later
@@ -508,12 +508,12 @@ void ExportDialog::BrowseFilename()
}
}
void ExportDialog::FormatChanged(ExportFormat::Format current_format)
void ExportDialog::format_changed(ExportFormat::Format current_format)
{
QString current_filename = filename_edit_->text().trimmed();
QString previously_selected_ext =
ExportFormat::GetExtension(previously_selected_format_);
QString currently_selected_ext = ExportFormat::GetExtension(current_format);
ExportFormat::get_extension(previously_selected_format_);
QString currently_selected_ext = ExportFormat::get_extension(current_format);
// If the previous extension was added, remove it
if (current_filename.endsWith(previously_selected_ext,
@@ -530,72 +530,72 @@ void ExportDialog::FormatChanged(ExportFormat::Format current_format)
previously_selected_format_ = current_format;
// Update video and audio comboboxes
bool has_video_codecs = video_tab_->SetFormat(current_format);
bool has_video_codecs = video_tab_->set_format(current_format);
video_enabled_->setChecked(has_video_codecs);
video_enabled_->setEnabled(has_video_codecs);
bool has_audio_codecs = audio_tab_->SetFormat(current_format);
bool has_audio_codecs = audio_tab_->set_format(current_format);
audio_enabled_->setChecked(has_audio_codecs);
audio_enabled_->setEnabled(has_audio_codecs);
if (subtitles_enabled_->isEnabled()) {
subtitle_tab_->SetFormat(current_format);
subtitle_tab_->set_format(current_format);
}
}
void ExportDialog::ResolutionChanged()
void ExportDialog::resolution_changed()
{
if (video_tab_->maintain_aspect_checkbox()->isChecked()) {
// Keep aspect ratio maintained
if (sender() == video_tab_->height_slider()) {
// Convert height to float
double new_width = video_tab_->height_slider()->GetValue();
double new_width = video_tab_->height_slider()->get_value();
// Generate width from aspect ratio
new_width *= video_aspect_ratio_;
// Align to even number and set
video_tab_->width_slider()->SetValue(new_width);
video_tab_->width_slider()->set_value(new_width);
} else {
// Convert width to float
double new_height = video_tab_->width_slider()->GetValue();
double new_height = video_tab_->width_slider()->get_value();
// Generate height from aspect ratio
new_height /= video_aspect_ratio_;
// Align to even number and set
video_tab_->height_slider()->SetValue(new_height);
video_tab_->height_slider()->set_value(new_height);
}
}
UpdateViewerDimensions();
update_viewer_dimensions();
}
void ExportDialog::LoadPresets()
void ExportDialog::load_presets()
{
loading_presets_ = true;
preset_combobox_->clear();
presets_.clear();
preset_combobox_->addItem(tr("Default"), kPresetDefault);
preset_combobox_->addItem(tr("Default"), k_preset_default);
if (viewer_node_->GetLastUsedEncodingParams().IsValid()) {
preset_combobox_->addItem(tr("Last Used"), kPresetLastUsed);
if (viewer_node_->get_last_used_encoding_params().is_valid()) {
preset_combobox_->addItem(tr("Last Used"), k_preset_last_used);
}
preset_combobox_->insertSeparator(preset_combobox_->count());
QStringList l = EncodingParams::GetListOfPresets();
QStringList l = EncodingParams::get_list_of_presets();
presets_.reserve(l.size());
for (const QString &preset : l) {
EncodingParams p;
QFile f(EncodingParams::GetPresetPath().filePath(preset));
QFile f(EncodingParams::get_preset_path().filePath(preset));
if (f.open(QFile::ReadOnly)) {
if (p.Load(&f)) {
if (p.load(&f)) {
preset_combobox_->addItem(preset, int(presets_.size()));
presets_.push_back(p);
}
@@ -606,7 +606,7 @@ void ExportDialog::LoadPresets()
loading_presets_ = false;
}
void ExportDialog::SetDefaultFilename()
void ExportDialog::set_default_filename()
{
Project *p = viewer_node_->project();
@@ -619,16 +619,16 @@ void ExportDialog::SetDefaultFilename()
doc_location = QFileInfo(p->filename()).dir();
}
QString file_location = doc_location.filePath(viewer_node_->GetLabel());
QString file_location = doc_location.filePath(viewer_node_->get_label());
filename_edit_->setText(file_location);
}
bool ExportDialog::SequenceHasSubtitles() const
bool ExportDialog::sequence_has_subtitles() const
{
if (Sequence *s = dynamic_cast<Sequence *>(viewer_node_)) {
TrackList *tl = s->track_list(Track::kSubtitle);
for (Track *t : tl->GetTracks()) {
if (!t->IsMuted() && !t->Blocks().empty()) {
TrackList *tl = s->track_list(Track::k_subtitle);
for (Track *t : tl->get_tracks()) {
if (!t->is_muted() && !t->blocks().empty()) {
return true;
}
}
@@ -637,67 +637,67 @@ bool ExportDialog::SequenceHasSubtitles() const
return false;
}
void ExportDialog::SetDefaults()
void ExportDialog::set_defaults()
{
if (!stills_only_mode_) {
format_combobox_->SetFormat(ExportFormat::kFormatMPEG4Video);
format_combobox_->set_format(ExportFormat::k_format_mpe_g4_video);
} else {
format_combobox_->SetFormat(ExportFormat::kFormatPNG);
format_combobox_->set_format(ExportFormat::k_format_png);
}
FormatChanged(format_combobox_->GetFormat());
format_changed(format_combobox_->get_format());
VideoParams vp = viewer_node_->GetVideoParams();
AudioParams ap = viewer_node_->GetAudioParams();
VideoParams vp = viewer_node_->get_video_params();
AudioParams ap = viewer_node_->get_audio_params();
video_tab_->width_slider()->SetValue(vp.width());
video_tab_->width_slider()->set_value(vp.width());
video_tab_->width_slider()->SetDefaultValue(vp.width());
video_tab_->height_slider()->SetValue(vp.height());
video_tab_->height_slider()->set_value(vp.height());
video_tab_->height_slider()->SetDefaultValue(vp.height());
video_tab_->SetSelectedFrameRate(vp.frame_rate());
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(
video_tab_->set_selected_frame_rate(vp.frame_rate());
video_tab_->pixel_aspect_combobox()->set_pixel_aspect_ratio(
vp.pixel_aspect_ratio());
video_tab_->pixel_format_field()->SetPixelFormat(
video_tab_->pixel_format_field()->set_pixel_format(
static_cast<PixelFormat::Format>(
OLIVE_CONFIG("OnlinePixelFormat").toInt()));
video_tab_->interlaced_combobox()->SetInterlaceMode(vp.interlacing());
audio_tab_->sample_rate_combobox()->SetSampleRate(ap.sample_rate());
audio_tab_->sample_format_combobox()->SetAttemptToRestoreFormat(false);
audio_tab_->channel_layout_combobox()->SetChannelLayout(
OAK_CONFIG("OnlinePixelFormat").toInt()));
video_tab_->interlaced_combobox()->set_interlace_mode(vp.interlacing());
audio_tab_->sample_rate_combobox()->set_sample_rate(ap.sample_rate());
audio_tab_->sample_format_combobox()->set_attempt_to_restore_format(false);
audio_tab_->channel_layout_combobox()->set_channel_layout(
ap.channel_layout());
subtitles_enabled_->setChecked(SequenceHasSubtitles());
subtitle_tab_->SetSidecarFormat(ExportFormat::kFormatSRT);
subtitles_enabled_->setChecked(sequence_has_subtitles());
subtitle_tab_->set_sidecar_format(ExportFormat::k_format_srt);
}
EncodingParams ExportDialog::GenerateParams() const
EncodingParams ExportDialog::generate_params() const
{
VideoParams video_render_params(
static_cast<int>(video_tab_->width_slider()->GetValue()),
static_cast<int>(video_tab_->height_slider()->GetValue()),
GetSelectedTimebase(),
video_tab_->pixel_format_field()->GetPixelFormat(),
VideoParams::kInternalChannelCount,
video_tab_->pixel_aspect_combobox()->GetPixelAspectRatio(),
video_tab_->interlaced_combobox()->GetInterlaceMode(), 1);
static_cast<int>(video_tab_->width_slider()->get_value()),
static_cast<int>(video_tab_->height_slider()->get_value()),
get_selected_timebase(),
video_tab_->pixel_format_field()->get_pixel_format(),
VideoParams::k_internal_channel_count,
video_tab_->pixel_aspect_combobox()->get_pixel_aspect_ratio(),
video_tab_->interlaced_combobox()->get_interlace_mode(), 1);
AudioParams audio_render_params(
audio_tab_->sample_rate_combobox()->GetSampleRate(),
audio_tab_->channel_layout_combobox()->GetChannelLayout(),
audio_tab_->sample_format_combobox()->GetSampleFormat());
audio_tab_->sample_rate_combobox()->get_sample_rate(),
audio_tab_->channel_layout_combobox()->get_channel_layout(),
audio_tab_->sample_format_combobox()->get_sample_format());
EncodingParams params;
params.set_format(format_combobox_->GetFormat());
params.SetFilename(filename_edit_->text().trimmed());
params.SetExportLength(viewer_node_->GetLength());
params.set_format(format_combobox_->get_format());
params.set_filename(filename_edit_->text().trimmed());
params.set_export_length(viewer_node_->get_length());
if (ExportCodec::IsCodecAStillImage(video_tab_->GetSelectedCodec()) &&
!video_tab_->IsImageSequenceSet()) {
if (ExportCodec::is_codec_a_still_image(video_tab_->get_selected_codec()) &&
!video_tab_->is_image_sequence_set()) {
// Exporting as image without exporting image sequence, only export one frame
rational export_time = video_tab_->GetStillImageTime();
Rational export_time = video_tab_->get_still_image_time();
params.set_custom_range(
TimeRange(export_time, export_time + GetSelectedTimebase()));
} else if (range_combobox_->currentIndex() == kRangeInToOut) {
TimeRange(export_time, export_time + get_selected_timebase()));
} else if (range_combobox_->currentIndex() == k_range_in_to_out) {
// Assume if this combobox is enabled, workarea is enabled - a check that we make in this dialog's constructor
params.set_custom_range(viewer_node_->GetWorkArea()->range());
params.set_custom_range(viewer_node_->get_work_area()->range());
}
if (video_tab_->scaling_method_combobox()->isEnabled()) {
@@ -707,109 +707,109 @@ EncodingParams ExportDialog::GenerateParams() const
}
if (video_enabled_->isChecked()) {
ExportCodec::Codec video_codec = video_tab_->GetSelectedCodec();
ExportCodec::Codec video_codec = video_tab_->get_selected_codec();
video_render_params.set_color_range(video_tab_->color_range());
params.EnableVideo(video_render_params, video_codec);
params.enable_video(video_render_params, video_codec);
params.set_video_threads(video_tab_->threads());
if (video_tab_->isVisible()) {
video_tab_->GetCodecSection()->AddOpts(&params);
video_tab_->get_codec_section()->add_opts(&params);
}
params.set_color_transform(video_tab_->CurrentOCIOColorSpace());
params.set_color_transform(video_tab_->current_ocio_color_space());
params.set_video_pix_fmt(video_tab_->pix_fmt());
params.set_video_is_image_sequence(video_tab_->IsImageSequenceSet());
params.set_video_is_image_sequence(video_tab_->is_image_sequence_set());
}
if (audio_enabled_->isChecked()) {
ExportCodec::Codec audio_codec = audio_tab_->GetCodec();
params.EnableAudio(audio_render_params, audio_codec);
ExportCodec::Codec audio_codec = audio_tab_->get_codec();
params.enable_audio(audio_render_params, audio_codec);
params.set_audio_bit_rate(audio_tab_->bit_rate_slider()->GetValue() *
params.set_audio_bit_rate(audio_tab_->bit_rate_slider()->get_value() *
1000);
}
if (subtitles_enabled_->isEnabled() && subtitles_enabled_->isChecked()) {
if (!subtitle_tab_->GetSidecarEnabled()) {
if (!subtitle_tab_->get_sidecar_enabled()) {
// Export subtitles embedded in container
params.EnableSubtitles(subtitle_tab_->GetSubtitleCodec());
params.enable_subtitles(subtitle_tab_->get_subtitle_codec());
} else {
// Export subtitles to a sidecar file
params.EnableSidecarSubtitles(subtitle_tab_->GetSidecarFormat(),
subtitle_tab_->GetSubtitleCodec());
params.enable_sidecar_subtitles(subtitle_tab_->get_sidecar_format(),
subtitle_tab_->get_subtitle_codec());
}
}
return params;
}
void ExportDialog::SetParams(const EncodingParams &e)
void ExportDialog::set_params(const EncodingParams &e)
{
format_combobox_->SetFormat(e.format());
FormatChanged(format_combobox_->GetFormat());
format_combobox_->set_format(e.format());
format_changed(format_combobox_->get_format());
if (e.has_custom_range() && viewer_node_->GetWorkArea()->enabled()) {
range_combobox_->setCurrentIndex(kRangeInToOut);
if (e.has_custom_range() && viewer_node_->get_work_area()->enabled()) {
range_combobox_->setCurrentIndex(k_range_in_to_out);
}
QtUtils::SetComboBoxData(video_tab_->scaling_method_combobox(),
QtUtils::set_combo_box_data(video_tab_->scaling_method_combobox(),
e.video_scaling_method());
video_enabled_->setChecked(e.video_enabled());
if (e.video_enabled()) {
video_tab_->width_slider()->SetValue(e.video_params().width());
video_tab_->height_slider()->SetValue(e.video_params().height());
SetSelectedTimebase(e.video_params().time_base());
video_tab_->pixel_format_field()->SetPixelFormat(
video_tab_->width_slider()->set_value(e.video_params().width());
video_tab_->height_slider()->set_value(e.video_params().height());
set_selected_timebase(e.video_params().time_base());
video_tab_->pixel_format_field()->set_pixel_format(
e.video_params().format());
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(
video_tab_->pixel_aspect_combobox()->set_pixel_aspect_ratio(
e.video_params().pixel_aspect_ratio());
video_tab_->interlaced_combobox()->SetInterlaceMode(
video_tab_->interlaced_combobox()->set_interlace_mode(
e.video_params().interlacing());
video_tab_->SetSelectedCodec(e.video_codec());
video_tab_->set_selected_codec(e.video_codec());
video_tab_->SetColorRange(e.video_params().color_range());
video_tab_->set_color_range(e.video_params().color_range());
video_tab_->SetThreads(e.video_threads());
video_tab_->set_threads(e.video_threads());
if (video_tab_->isVisible()) {
video_tab_->GetCodecSection()->SetOpts(&e);
video_tab_->get_codec_section()->set_opts(&e);
}
video_tab_->SetOCIOColorSpace(e.color_transform().output());
video_tab_->set_ocio_color_space(e.color_transform().output());
video_tab_->SetPixFmt(e.video_pix_fmt());
video_tab_->set_pix_fmt(e.video_pix_fmt());
video_tab_->SetImageSequence(e.video_is_image_sequence());
video_tab_->set_image_sequence(e.video_is_image_sequence());
}
audio_enabled_->setChecked(e.audio_enabled());
if (e.audio_enabled()) {
audio_tab_->sample_rate_combobox()->SetSampleRate(
audio_tab_->sample_rate_combobox()->set_sample_rate(
e.audio_params().sample_rate());
audio_tab_->channel_layout_combobox()->SetChannelLayout(
audio_tab_->channel_layout_combobox()->set_channel_layout(
e.audio_params().channel_layout());
audio_tab_->sample_format_combobox()->SetSampleFormat(
audio_tab_->sample_format_combobox()->set_sample_format(
e.audio_params().format());
audio_tab_->SetCodec(e.audio_codec());
audio_tab_->set_codec(e.audio_codec());
audio_tab_->bit_rate_slider()->SetValue(e.audio_bit_rate() / 1000);
audio_tab_->bit_rate_slider()->set_value(e.audio_bit_rate() / 1000);
}
if (subtitles_enabled_->isEnabled()) {
subtitles_enabled_->setChecked(e.subtitles_enabled());
subtitle_tab_->SetSidecarEnabled(e.subtitles_are_sidecar());
subtitle_tab_->set_sidecar_enabled(e.subtitles_are_sidecar());
if (e.subtitles_enabled()) {
subtitle_tab_->SetSubtitleCodec(e.subtitles_codec());
subtitle_tab_->set_subtitle_codec(e.subtitles_codec());
if (e.subtitles_are_sidecar()) {
subtitle_tab_->SetSidecarFormat(e.subtitle_sidecar_fmt());
subtitle_tab_->set_sidecar_format(e.subtitle_sidecar_fmt());
}
}
}
@@ -833,46 +833,46 @@ bool ExportDialog::eventFilter(QObject *o, QEvent *e)
void ExportDialog::done(int r)
{
preview_viewer_->ConnectViewerNode(nullptr);
preview_viewer_->connect_viewer_node(nullptr);
if (!stills_only_mode_) {
viewer_node_->SetLastUsedEncodingParams(GenerateParams());
viewer_node_->set_last_used_encoding_params(generate_params());
}
super::done(r);
}
rational ExportDialog::GetExportLength() const
Rational ExportDialog::get_export_length() const
{
if (range_combobox_->currentIndex() == kRangeInToOut) {
return viewer_node_->GetWorkArea()->range().length();
if (range_combobox_->currentIndex() == k_range_in_to_out) {
return viewer_node_->get_work_area()->range().length();
} else {
return viewer_node_->GetLength();
return viewer_node_->get_length();
}
}
int64_t ExportDialog::GetExportLengthInTimebaseUnits() const
int64_t ExportDialog::get_export_length_in_timebase_units() const
{
return Timecode::time_to_timestamp(GetExportLength(),
GetSelectedTimebase());
return Timecode::time_to_timestamp(get_export_length(),
get_selected_timebase());
}
void ExportDialog::UpdateViewerDimensions()
void ExportDialog::update_viewer_dimensions()
{
preview_viewer_->SetViewerResolution(
static_cast<int>(video_tab_->width_slider()->GetValue()),
static_cast<int>(video_tab_->height_slider()->GetValue()));
preview_viewer_->set_viewer_resolution(
static_cast<int>(video_tab_->width_slider()->get_value()),
static_cast<int>(video_tab_->height_slider()->get_value()));
VideoParams vp = viewer_node_->GetVideoParams();
VideoParams vp = viewer_node_->get_video_params();
QMatrix4x4 transform = EncodingParams::GenerateMatrix(
QMatrix4x4 transform = EncodingParams::generate_matrix(
static_cast<EncodingParams::VideoScalingMethod>(
video_tab_->scaling_method_combobox()->currentData().toInt()),
vp.width(), vp.height(),
static_cast<int>(video_tab_->width_slider()->GetValue()),
static_cast<int>(video_tab_->height_slider()->GetValue()));
static_cast<int>(video_tab_->width_slider()->get_value()),
static_cast<int>(video_tab_->height_slider()->get_value()));
preview_viewer_->SetMatrix(transform);
preview_viewer_->set_matrix(transform);
}
}
+27 -27
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTDIALOG_H
#define EXPORTDIALOG_H
#ifndef OAK_EXPORTDIALOG_H
#define OAK_EXPORTDIALOG_H
#include <QComboBox>
#include <QDialog>
@@ -51,11 +51,11 @@ public:
{
}
rational GetSelectedTimebase() const;
void SetSelectedTimebase(const rational &r);
Rational get_selected_timebase() const;
void set_selected_timebase(const Rational &r);
EncodingParams GenerateParams() const;
void SetParams(const EncodingParams &e);
EncodingParams generate_params() const;
void set_params(const EncodingParams &e);
virtual bool eventFilter(QObject *o, QEvent *e) override;
@@ -63,30 +63,30 @@ public slots:
virtual void done(int r) override;
signals:
void RequestImportFile(const QString &s);
void request_import_file(const QString &s);
private:
void AddPreferencesTab(QWidget *inner_widget, const QString &title);
void add_preferences_tab(QWidget *inner_widget, const QString &title);
void LoadPresets();
void SetDefaultFilename();
void load_presets();
void set_default_filename();
bool SequenceHasSubtitles() const;
bool sequence_has_subtitles() const;
void SetDefaults();
void set_defaults();
ViewerOutput *viewer_node_;
ExportFormat::Format previously_selected_format_;
rational GetExportLength() const;
int64_t GetExportLengthInTimebaseUnits() const;
Rational get_export_length() const;
int64_t get_export_length_in_timebase_units() const;
enum RangeSelection { kRangeEntireSequence, kRangeInToOut };
enum RangeSelection { k_range_entire_sequence, k_range_in_to_out };
enum AutoPreset {
kPresetDefault = -1,
kPresetLastUsed = -2,
k_preset_default = -1,
k_preset_last_used = -2,
};
QTabWidget *preferences_tabs_;
@@ -120,25 +120,25 @@ private:
bool loading_presets_;
private slots:
void BrowseFilename();
void browse_filename();
void FormatChanged(ExportFormat::Format current_format);
void format_changed(ExportFormat::Format current_format);
void ResolutionChanged();
void resolution_changed();
void UpdateViewerDimensions();
void update_viewer_dimensions();
void StartExport();
void start_export();
void ExportFinished();
void export_finished();
void ImageSequenceCheckBoxChanged(bool e);
void image_sequence_check_box_changed(bool e);
void SavePreset();
void save_preset();
void PresetComboBoxChanged();
void preset_combo_box_changed();
};
}
#endif // EXPORTDIALOG_H
#endif // OAK_EXPORTDIALOG_H
@@ -73,9 +73,9 @@ ExportAdvancedVideoDialog::ExportAdvancedVideoDialog(
performance_layout->addWidget(new QLabel(tr("Threads:")), row, 0);
thread_slider_ = new IntegerSlider();
thread_slider_->SetMinimum(0);
thread_slider_->set_minimum(0);
thread_slider_->SetDefaultValue(0);
thread_slider_->InsertLabelSubstitution(0, tr("Auto"));
thread_slider_->insert_label_substitution(0, tr("Auto"));
performance_layout->addWidget(thread_slider_, row, 1);
row++;
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EXPORTADVANCEDVIDEODIALOG_H
#define EXPORTADVANCEDVIDEODIALOG_H
#ifndef OAK_EXPORTADVANCEDVIDEODIALOG_H
#define OAK_EXPORTADVANCEDVIDEODIALOG_H
#include <QComboBox>
#include <QDialog>
@@ -36,12 +36,12 @@ public:
int threads() const
{
return static_cast<int>(thread_slider_->GetValue());
return static_cast<int>(thread_slider_->get_value());
}
void set_threads(int t)
{
thread_slider_->SetValue(t);
thread_slider_->set_value(t);
}
QString pix_fmt() const
@@ -75,4 +75,4 @@ private:
}
#endif // EXPORTADVANCEDVIDEODIALOG_H
#endif // OAK_EXPORTADVANCEDVIDEODIALOG_H
+19 -19
View File
@@ -27,7 +27,7 @@
namespace olive
{
const int ExportAudioTab::kDefaultBitRate = 320;
const int ExportAudioTab::k_default_bit_rate = 320;
ExportAudioTab::ExportAudioTab(QWidget *parent)
: QWidget(parent)
@@ -45,11 +45,11 @@ ExportAudioTab::ExportAudioTab(QWidget *parent)
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportAudioTab::UpdateSampleFormats);
this, &ExportAudioTab::update_sample_formats);
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportAudioTab::UpdateBitRateEnabled);
this, &ExportAudioTab::update_bit_rate_enabled);
layout->addWidget(codec_combobox_, row, 1);
row++;
@@ -78,48 +78,48 @@ ExportAudioTab::ExportAudioTab(QWidget *parent)
layout->addWidget(new QLabel(tr("Bit Rate:")), row, 0);
bit_rate_slider_ = new IntegerSlider();
bit_rate_slider_->SetMinimum(32);
bit_rate_slider_->SetMaximum(320);
bit_rate_slider_->SetValue(kDefaultBitRate);
bit_rate_slider_->SetFormat(tr("%1 kbps"));
bit_rate_slider_->set_minimum(32);
bit_rate_slider_->set_maximum(320);
bit_rate_slider_->set_value(k_default_bit_rate);
bit_rate_slider_->set_format(tr("%1 kbps"));
layout->addWidget(bit_rate_slider_, row, 1);
outer_layout->addStretch();
}
int ExportAudioTab::SetFormat(ExportFormat::Format format)
int ExportAudioTab::set_format(ExportFormat::Format format)
{
QList<ExportCodec::Codec> acodecs = ExportFormat::GetAudioCodecs(format);
QList<ExportCodec::Codec> acodecs = ExportFormat::get_audio_codecs(format);
setEnabled(!acodecs.isEmpty());
codec_combobox_->blockSignals(true);
codec_combobox_->clear();
foreach (ExportCodec::Codec acodec, acodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(acodec), acodec);
codec_combobox_->addItem(ExportCodec::get_codec_name(acodec), acodec);
}
codec_combobox_->blockSignals(false);
fmt_ = format;
UpdateSampleFormats();
UpdateBitRateEnabled();
update_sample_formats();
update_bit_rate_enabled();
return acodecs.size();
}
void ExportAudioTab::UpdateSampleFormats()
void ExportAudioTab::update_sample_formats()
{
auto fmts = ExportFormat::GetSampleFormatsForCodec(fmt_, GetCodec());
sample_format_combobox_->SetAvailableFormats(fmts);
auto fmts = ExportFormat::get_sample_formats_for_codec(fmt_, get_codec());
sample_format_combobox_->set_available_formats(fmts);
}
void ExportAudioTab::UpdateBitRateEnabled()
void ExportAudioTab::update_bit_rate_enabled()
{
bool uses_bitrate = !ExportCodec::IsCodecLossless(GetCodec());
bool uses_bitrate = !ExportCodec::is_codec_lossless(get_codec());
bit_rate_slider_->setEnabled(uses_bitrate);
if (!uses_bitrate) {
bit_rate_slider_->SetTristate();
bit_rate_slider_->set_tristate();
} else {
bit_rate_slider_->SetValue(kDefaultBitRate);
bit_rate_slider_->set_value(k_default_bit_rate);
}
}
+9 -9
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTAUDIOTAB_H
#define EXPORTAUDIOTAB_H
#ifndef OAK_EXPORTAUDIOTAB_H
#define OAK_EXPORTAUDIOTAB_H
#include <QComboBox>
#include <QWidget>
@@ -38,13 +38,13 @@ class ExportAudioTab : public QWidget {
public:
ExportAudioTab(QWidget *parent = nullptr);
ExportCodec::Codec GetCodec() const
ExportCodec::Codec get_codec() const
{
return static_cast<ExportCodec::Codec>(
codec_combobox_->currentData().toInt());
}
void SetCodec(ExportCodec::Codec c)
void set_codec(ExportCodec::Codec c)
{
for (int i = 0; i < codec_combobox_->count(); i++) {
if (codec_combobox_->itemData(i) == c) {
@@ -75,7 +75,7 @@ public:
}
public slots:
int SetFormat(ExportFormat::Format format);
int set_format(ExportFormat::Format format);
private:
ExportFormat::Format fmt_;
@@ -85,14 +85,14 @@ private:
SampleFormatComboBox *sample_format_combobox_;
IntegerSlider *bit_rate_slider_;
static const int kDefaultBitRate;
static const int k_default_bit_rate;
private slots:
void UpdateSampleFormats();
void update_sample_formats();
void UpdateBitRateEnabled();
void update_bit_rate_enabled();
};
}
#endif // EXPORTAUDIOTAB_H
#endif // OAK_EXPORTAUDIOTAB_H
+32 -32
View File
@@ -36,31 +36,31 @@ ExportFormatComboBox::ExportFormatComboBox(Mode mode, QWidget *parent)
// Populate combobox formats
switch (mode) {
case kShowAllFormats:
custom_menu_->addAction(CreateHeader(icon::Video, tr("Video")));
PopulateType(Track::kVideo);
case k_show_all_formats:
custom_menu_->addAction(create_header(icon::video, tr("Video")));
populate_type(Track::k_video);
custom_menu_->addSeparator();
custom_menu_->addAction(CreateHeader(icon::Audio, tr("Audio")));
PopulateType(Track::kAudio);
custom_menu_->addAction(create_header(icon::audio, tr("Audio")));
populate_type(Track::k_audio);
custom_menu_->addSeparator();
custom_menu_->addAction(CreateHeader(icon::Subtitles, tr("Subtitle")));
PopulateType(Track::kSubtitle);
custom_menu_->addAction(create_header(icon::subtitles, tr("Subtitle")));
populate_type(Track::k_subtitle);
break;
case kShowAudioOnly:
PopulateType(Track::kAudio);
case k_show_audio_only:
populate_type(Track::k_audio);
break;
case kShowVideoOnly:
PopulateType(Track::kVideo);
case k_show_video_only:
populate_type(Track::k_video);
break;
case kShowSubtitlesOnly:
PopulateType(Track::kSubtitle);
case k_show_subtitles_only:
populate_type(Track::k_subtitle);
break;
}
connect(custom_menu_, &Menu::triggered, this,
&ExportFormatComboBox::HandleIndexChange);
&ExportFormatComboBox::handle_index_change);
}
void ExportFormatComboBox::showPopup()
@@ -69,43 +69,43 @@ void ExportFormatComboBox::showPopup()
custom_menu_->exec(mapToGlobal(QPoint(0, 0)));
}
void ExportFormatComboBox::SetFormat(ExportFormat::Format fmt)
void ExportFormatComboBox::set_format(ExportFormat::Format fmt)
{
current_ = fmt;
clear();
addItem(ExportFormat::GetName(current_));
addItem(ExportFormat::get_name(current_));
}
void ExportFormatComboBox::HandleIndexChange(QAction *a)
void ExportFormatComboBox::handle_index_change(QAction *a)
{
ExportFormat::Format f =
static_cast<ExportFormat::Format>(a->data().toInt());
SetFormat(f);
emit FormatChanged(f);
set_format(f);
emit format_changed(f);
}
void ExportFormatComboBox::PopulateType(Track::Type type)
void ExportFormatComboBox::populate_type(Track::Type type)
{
for (int i = 0; i < ExportFormat::kFormatCount; i++) {
for (int i = 0; i < ExportFormat::k_format_count; i++) {
ExportFormat::Format f = static_cast<ExportFormat::Format>(i);
if (type == Track::kVideo &&
!ExportFormat::GetVideoCodecs(f).isEmpty()) {
if (type == Track::k_video &&
!ExportFormat::get_video_codecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kAudio &&
ExportFormat::GetVideoCodecs(f).isEmpty() &&
!ExportFormat::GetAudioCodecs(f).isEmpty()) {
} else if (type == Track::k_audio &&
ExportFormat::get_video_codecs(f).isEmpty() &&
!ExportFormat::get_audio_codecs(f).isEmpty()) {
// Do nothing
} else if (type == Track::kSubtitle &&
ExportFormat::GetVideoCodecs(f).isEmpty() &&
ExportFormat::GetAudioCodecs(f).isEmpty() &&
!ExportFormat::GetSubtitleCodecs(f).isEmpty()) {
} else if (type == Track::k_subtitle &&
ExportFormat::get_video_codecs(f).isEmpty() &&
ExportFormat::get_audio_codecs(f).isEmpty() &&
!ExportFormat::get_subtitle_codecs(f).isEmpty()) {
// Do nothing
} else {
continue;
}
QString format_name = ExportFormat::GetName(f);
QString format_name = ExportFormat::get_name(f);
QAction *a = custom_menu_->addAction(format_name);
a->setData(i);
@@ -113,7 +113,7 @@ void ExportFormatComboBox::PopulateType(Track::Type type)
}
}
QWidgetAction *ExportFormatComboBox::CreateHeader(const QIcon &icon,
QWidgetAction *ExportFormatComboBox::create_header(const QIcon &icon,
const QString &title)
{
QWidgetAction *a = new QWidgetAction(this);
+15 -15
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTFORMATCOMBOBOX_H
#define EXPORTFORMATCOMBOBOX_H
#ifndef OAK_EXPORTFORMATCOMBOBOX_H
#define OAK_EXPORTFORMATCOMBOBOX_H
#include <QComboBox>
#include <QWidgetAction>
@@ -36,19 +36,19 @@ class ExportFormatComboBox : public QComboBox {
Q_OBJECT
public:
enum Mode {
kShowAllFormats,
kShowAudioOnly,
kShowVideoOnly,
kShowSubtitlesOnly
k_show_all_formats,
k_show_audio_only,
k_show_video_only,
k_show_subtitles_only
};
ExportFormatComboBox(Mode mode, QWidget *parent = nullptr);
ExportFormatComboBox(QWidget *parent = nullptr)
: ExportFormatComboBox(kShowAllFormats, parent)
: ExportFormatComboBox(k_show_all_formats, parent)
{
}
ExportFormat::Format GetFormat() const
ExportFormat::Format get_format() const
{
return current_;
}
@@ -56,24 +56,24 @@ public:
void showPopup();
signals:
void FormatChanged(ExportFormat::Format fmt);
void format_changed(ExportFormat::Format fmt);
public slots:
void SetFormat(ExportFormat::Format fmt);
void set_format(ExportFormat::Format fmt);
private slots:
void HandleIndexChange(QAction *a);
void handle_index_change(QAction *a);
private:
void PopulateType(Track::Type type);
void populate_type(Track::Type type);
QWidgetAction *CreateHeader(const QIcon &icon, const QString &title);
QWidgetAction *create_header(const QIcon &icon, const QString &title);
Menu *custom_menu_;
ExportFormat::Format current_ = ExportFormat::kFormatCount;
ExportFormat::Format current_ = ExportFormat::k_format_count;
};
}
#endif // EXPORTFORMATCOMBOBOX_H
#endif // OAK_EXPORTFORMATCOMBOBOX_H
+7 -7
View File
@@ -39,15 +39,15 @@ ExportSavePresetDialog::ExportSavePresetDialog(const EncodingParams &p,
name_edit_ = new QLineEdit();
// Populate existing list
QStringList l = EncodingParams::GetListOfPresets();
QStringList l = EncodingParams::get_list_of_presets();
if (!l.empty()) {
auto list_widget_ = new QListWidget();
auto list_widget = new QListWidget();
for (const QString &f : l) {
list_widget_->addItem(f);
list_widget->addItem(f);
}
connect(list_widget_, &QListWidget::currentTextChanged, name_edit_,
connect(list_widget, &QListWidget::currentTextChanged, name_edit_,
&QLineEdit::setText);
layout->addWidget(list_widget_);
layout->addWidget(list_widget);
}
auto name_layout = new QHBoxLayout();
@@ -78,7 +78,7 @@ void ExportSavePresetDialog::accept()
return;
}
QDir d(EncodingParams::GetPresetPath());
QDir d(EncodingParams::get_preset_path());
if (!d.exists()) {
d.mkpath(QStringLiteral("."));
}
@@ -101,7 +101,7 @@ void ExportSavePresetDialog::accept()
return;
}
params_.Save(&f);
params_.save(&f);
f.close();
+4 -4
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTSAVEPRESETDIALOG_H
#define EXPORTSAVEPRESETDIALOG_H
#ifndef OAK_EXPORTSAVEPRESETDIALOG_H
#define OAK_EXPORTSAVEPRESETDIALOG_H
#include <QDialog>
#include <QLineEdit>
@@ -36,7 +36,7 @@ class ExportSavePresetDialog : public QDialog {
public:
ExportSavePresetDialog(const EncodingParams &p, QWidget *parent = nullptr);
QString GetSelectedPresetName() const
QString get_selected_preset_name() const
{
return name_edit_->text();
}
@@ -52,4 +52,4 @@ private:
}
#endif // EXPORTSAVEPRESETDIALOG_H
#endif // OAK_EXPORTSAVEPRESETDIALOG_H
+7 -7
View File
@@ -43,7 +43,7 @@ ExportSubtitlesTab::ExportSubtitlesTab(QWidget *parent)
layout->addWidget(sidecar_format_label_, row, 0);
sidecar_format_combobox_ =
new ExportFormatComboBox(ExportFormatComboBox::kShowSubtitlesOnly);
new ExportFormatComboBox(ExportFormatComboBox::k_show_subtitles_only);
sidecar_format_combobox_->setVisible(true);
layout->addWidget(sidecar_format_combobox_, row, 1);
@@ -62,12 +62,12 @@ ExportSubtitlesTab::ExportSubtitlesTab(QWidget *parent)
&QWidget::setVisible);
}
int ExportSubtitlesTab::SetFormat(ExportFormat::Format format)
int ExportSubtitlesTab::set_format(ExportFormat::Format format)
{
auto vcodecs = ExportFormat::GetVideoCodecs(format);
auto acodecs = ExportFormat::GetAudioCodecs(format);
auto vcodecs = ExportFormat::get_video_codecs(format);
auto acodecs = ExportFormat::get_audio_codecs(format);
auto scodecs = ExportFormat::GetSubtitleCodecs(format);
auto scodecs = ExportFormat::get_subtitle_codecs(format);
if (!scodecs.empty() && vcodecs.empty() && acodecs.empty()) {
// If format supports ONLY scodecs, default this to off and disable it
@@ -80,11 +80,11 @@ int ExportSubtitlesTab::SetFormat(ExportFormat::Format format)
}
scodecs =
ExportFormat::GetSubtitleCodecs(sidecar_format_combobox_->GetFormat());
ExportFormat::get_subtitle_codecs(sidecar_format_combobox_->get_format());
codec_combobox_->clear();
foreach (ExportCodec::Codec scodec, scodecs) {
codec_combobox_->addItem(ExportCodec::GetCodecName(scodec), scodec);
codec_combobox_->addItem(ExportCodec::get_codec_name(scodec), scodec);
}
return scodecs.size();
+13 -13
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTSUBTITLESTAB_H
#define EXPORTSUBTITLESTAB_H
#ifndef OAK_EXPORTSUBTITLESTAB_H
#define OAK_EXPORTSUBTITLESTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -38,35 +38,35 @@ class ExportSubtitlesTab : public QWidget {
public:
ExportSubtitlesTab(QWidget *parent = nullptr);
bool GetSidecarEnabled() const
bool get_sidecar_enabled() const
{
return sidecar_checkbox_->isChecked();
}
void SetSidecarEnabled(bool e)
void set_sidecar_enabled(bool e)
{
sidecar_checkbox_->setChecked(e);
}
ExportFormat::Format GetSidecarFormat() const
ExportFormat::Format get_sidecar_format() const
{
return sidecar_format_combobox_->GetFormat();
return sidecar_format_combobox_->get_format();
}
void SetSidecarFormat(ExportFormat::Format f)
void set_sidecar_format(ExportFormat::Format f)
{
sidecar_format_combobox_->SetFormat(f);
sidecar_format_combobox_->set_format(f);
}
int SetFormat(ExportFormat::Format format);
int set_format(ExportFormat::Format format);
ExportCodec::Codec GetSubtitleCodec()
ExportCodec::Codec get_subtitle_codec()
{
return static_cast<ExportCodec::Codec>(
codec_combobox_->currentData().toInt());
}
void SetSubtitleCodec(ExportCodec::Codec c)
void set_subtitle_codec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox_, c);
QtUtils::set_combo_box_data(codec_combobox_, c);
}
private:
@@ -80,4 +80,4 @@ private:
}
#endif // EXPORTSUBTITLESTAB_H
#endif // OAK_EXPORTSUBTITLESTAB_H
+49 -49
View File
@@ -37,49 +37,49 @@ ExportVideoTab::ExportVideoTab(ColorManager *color_manager, QWidget *parent)
: QWidget(parent)
, color_manager_(color_manager)
, threads_(0)
, color_range_(VideoParams::kColorRangeDefault)
, color_range_(VideoParams::k_color_range_default)
{
QVBoxLayout *outer_layout = new QVBoxLayout(this);
outer_layout->addWidget(SetupResolutionSection());
outer_layout->addWidget(setup_resolution_section());
outer_layout->addWidget(SetupCodecSection());
outer_layout->addWidget(setup_codec_section());
outer_layout->addWidget(SetupColorSection());
outer_layout->addWidget(setup_color_section());
outer_layout->addStretch();
}
int ExportVideoTab::SetFormat(ExportFormat::Format format)
int ExportVideoTab::set_format(ExportFormat::Format format)
{
format_ = format;
QList<ExportCodec::Codec> vcodecs = ExportFormat::GetVideoCodecs(format);
QList<ExportCodec::Codec> vcodecs = ExportFormat::get_video_codecs(format);
setEnabled(!vcodecs.isEmpty());
codec_combobox()->clear();
foreach (ExportCodec::Codec vcodec, vcodecs) {
codec_combobox()->addItem(ExportCodec::GetCodecName(vcodec), vcodec);
codec_combobox()->addItem(ExportCodec::get_codec_name(vcodec), vcodec);
}
return vcodecs.size();
}
bool ExportVideoTab::IsImageSequenceSet() const
bool ExportVideoTab::is_image_sequence_set() const
{
ImageSection *img_section =
dynamic_cast<ImageSection *>(codec_stack_->currentWidget());
return (img_section && img_section->IsImageSequenceChecked());
return (img_section && img_section->is_image_sequence_checked());
}
void ExportVideoTab::SetImageSequence(bool e) const
void ExportVideoTab::set_image_sequence(bool e) const
{
if (ImageSection *img_section =
dynamic_cast<ImageSection *>(codec_stack_->currentWidget())) {
img_section->SetImageSequenceChecked(e);
img_section->set_image_sequence_checked(e);
}
}
QWidget *ExportVideoTab::SetupResolutionSection()
QWidget *ExportVideoTab::setup_resolution_section()
{
int row = 0;
@@ -91,7 +91,7 @@ QWidget *ExportVideoTab::SetupResolutionSection()
layout->addWidget(new QLabel(tr("Width:")), row, 0);
width_slider_ = new IntegerSlider();
width_slider_->SetMinimum(1);
width_slider_->set_minimum(1);
layout->addWidget(width_slider_, row, 1);
row++;
@@ -99,7 +99,7 @@ QWidget *ExportVideoTab::SetupResolutionSection()
layout->addWidget(new QLabel(tr("Height:")), row, 0);
height_slider_ = new IntegerSlider();
height_slider_->SetMinimum(1);
height_slider_->set_minimum(1);
layout->addWidget(height_slider_, row, 1);
row++;
@@ -116,22 +116,22 @@ QWidget *ExportVideoTab::SetupResolutionSection()
scaling_method_combobox_ = new QComboBox();
scaling_method_combobox_->setEnabled(false);
scaling_method_combobox_->addItem(tr("Fit"), EncodingParams::kFit);
scaling_method_combobox_->addItem(tr("Stretch"), EncodingParams::kStretch);
scaling_method_combobox_->addItem(tr("Crop"), EncodingParams::kCrop);
scaling_method_combobox_->addItem(tr("Fit"), EncodingParams::k_fit);
scaling_method_combobox_->addItem(tr("Stretch"), EncodingParams::k_stretch);
scaling_method_combobox_->addItem(tr("Crop"), EncodingParams::k_crop);
layout->addWidget(scaling_method_combobox_, row, 1);
// Automatically enable/disable the scaling method depending on maintain aspect ratio
connect(maintain_aspect_checkbox_, &QCheckBox::toggled, this,
&ExportVideoTab::MaintainAspectRatioChanged);
&ExportVideoTab::maintain_aspect_ratio_changed);
row++;
layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
frame_rate_combobox_ = new FrameRateComboBox();
connect(frame_rate_combobox_, &FrameRateComboBox::FrameRateChanged, this,
&ExportVideoTab::UpdateFrameRate);
connect(frame_rate_combobox_, &FrameRateComboBox::frame_rate_changed, this,
&ExportVideoTab::update_frame_rate);
layout->addWidget(frame_rate_combobox_, row, 1);
row++;
@@ -158,15 +158,15 @@ QWidget *ExportVideoTab::SetupResolutionSection()
return resolution_group;
}
QWidget *ExportVideoTab::SetupColorSection()
QWidget *ExportVideoTab::setup_color_section()
{
color_space_chooser_ = new ColorSpaceChooser(color_manager_, true, false);
connect(color_space_chooser_, &ColorSpaceChooser::InputColorSpaceChanged,
this, &ExportVideoTab::ColorSpaceChanged);
connect(color_space_chooser_, &ColorSpaceChooser::input_color_space_changed,
this, &ExportVideoTab::color_space_changed);
return color_space_chooser_;
}
QWidget *ExportVideoTab::SetupCodecSection()
QWidget *ExportVideoTab::setup_codec_section()
{
int row = 0;
@@ -182,7 +182,7 @@ QWidget *ExportVideoTab::SetupCodecSection()
connect(
codec_combobox_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ExportVideoTab::VideoCodecChanged);
this, &ExportVideoTab::video_codec_changed);
row++;
@@ -190,8 +190,8 @@ QWidget *ExportVideoTab::SetupCodecSection()
codec_layout->addWidget(codec_stack_, row, 0, 1, 2);
image_section_ = new ImageSection();
connect(image_section_, &ImageSection::TimeChanged, this,
&ExportVideoTab::TimeChanged);
connect(image_section_, &ImageSection::time_changed, this,
&ExportVideoTab::time_changed);
codec_stack_->addWidget(image_section_);
h264_section_ = new H264Section();
@@ -210,22 +210,22 @@ QWidget *ExportVideoTab::SetupCodecSection()
QPushButton *advanced_btn = new QPushButton(tr("Advanced"));
connect(advanced_btn, &QPushButton::clicked, this,
&ExportVideoTab::OpenAdvancedDialog);
&ExportVideoTab::open_advanced_dialog);
codec_layout->addWidget(advanced_btn, row, 1);
return codec_group;
}
void ExportVideoTab::MaintainAspectRatioChanged(bool val)
void ExportVideoTab::maintain_aspect_ratio_changed(bool val)
{
scaling_method_combobox_->setEnabled(!val);
}
void ExportVideoTab::OpenAdvancedDialog()
void ExportVideoTab::open_advanced_dialog()
{
// Find export formats compatible with this encoder
QStringList pixel_formats =
ExportFormat::GetPixelFormatsForCodec(format_, GetSelectedCodec());
ExportFormat::get_pixel_formats_for_codec(format_, get_selected_codec());
ExportAdvancedVideoDialog d(pixel_formats, this);
@@ -240,7 +240,7 @@ void ExportVideoTab::OpenAdvancedDialog()
}
}
void ExportVideoTab::UpdateFrameRate(rational r)
void ExportVideoTab::update_frame_rate(Rational r)
{
// Convert frame rate to timebase
r.flip();
@@ -249,37 +249,37 @@ void ExportVideoTab::UpdateFrameRate(rational r)
ImageSection *img =
dynamic_cast<ImageSection *>(codec_stack_->widget(i));
if (img) {
img->SetTimebase(r);
img->set_timebase(r);
}
}
}
void ExportVideoTab::VideoCodecChanged()
void ExportVideoTab::video_codec_changed()
{
ExportCodec::Codec codec = GetSelectedCodec();
ExportCodec::Codec codec = get_selected_codec();
switch (codec) {
case ExportCodec::kCodecH264:
case ExportCodec::kCodecH264rgb:
SetCodecSection(h264_section_);
case ExportCodec::k_codec_h264:
case ExportCodec::k_codec_h264rgb:
set_codec_section(h264_section_);
break;
case ExportCodec::kCodecH265:
SetCodecSection(h265_section_);
case ExportCodec::k_codec_h265:
set_codec_section(h265_section_);
break;
case ExportCodec::kCodecAV1:
SetCodecSection(av1_section_);
case ExportCodec::k_codec_a_v1:
set_codec_section(av1_section_);
break;
case ExportCodec::kCodecCineform:
SetCodecSection(cineform_section_);
case ExportCodec::k_codec_cineform:
set_codec_section(cineform_section_);
break;
default:
SetCodecSection(
ExportCodec::IsCodecAStillImage(codec) ? image_section_ : nullptr);
set_codec_section(
ExportCodec::is_codec_a_still_image(codec) ? image_section_ : nullptr);
}
// Set default pixel format
QStringList pix_fmts =
ExportFormat::GetPixelFormatsForCodec(format_, codec);
ExportFormat::get_pixel_formats_for_codec(format_, codec);
if (!pix_fmts.isEmpty()) {
pix_fmt_ = pix_fmts.first();
} else {
@@ -287,13 +287,13 @@ void ExportVideoTab::VideoCodecChanged()
}
}
void ExportVideoTab::SetTime(const rational &time)
void ExportVideoTab::set_time(const Rational &time)
{
for (int i = 0; i < codec_stack_->count(); i++) {
ImageSection *img =
dynamic_cast<ImageSection *>(codec_stack_->widget(i));
if (img) {
img->SetTime(time);
img->set_time(time);
}
}
}
+34 -34
View File
@@ -19,8 +19,8 @@
***/
#ifndef EXPORTVIDEOTAB_H
#define EXPORTVIDEOTAB_H
#ifndef OAK_EXPORTVIDEOTAB_H
#define OAK_EXPORTVIDEOTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -45,25 +45,25 @@ class ExportVideoTab : public QWidget {
public:
ExportVideoTab(ColorManager *color_manager, QWidget *parent = nullptr);
int SetFormat(ExportFormat::Format format);
int set_format(ExportFormat::Format format);
bool IsImageSequenceSet() const;
void SetImageSequence(bool e) const;
bool is_image_sequence_set() const;
void set_image_sequence(bool e) const;
rational GetStillImageTime() const
Rational get_still_image_time() const
{
return image_section_->GetTime();
return image_section_->get_time();
}
ExportCodec::Codec GetSelectedCodec() const
ExportCodec::Codec get_selected_codec() const
{
return static_cast<ExportCodec::Codec>(
codec_combobox()->currentData().toInt());
}
void SetSelectedCodec(ExportCodec::Codec c)
void set_selected_codec(ExportCodec::Codec c)
{
QtUtils::SetComboBoxData(codec_combobox(), c);
QtUtils::set_combo_box_data(codec_combobox(), c);
}
QComboBox *codec_combobox() const
@@ -91,33 +91,33 @@ public:
return scaling_method_combobox_;
}
rational GetSelectedFrameRate() const
Rational get_selected_frame_rate() const
{
return frame_rate_combobox_->GetFrameRate();
return frame_rate_combobox_->get_frame_rate();
}
void SetSelectedFrameRate(const rational &fr)
void set_selected_frame_rate(const Rational &fr)
{
frame_rate_combobox_->SetFrameRate(fr);
UpdateFrameRate(fr);
frame_rate_combobox_->set_frame_rate(fr);
update_frame_rate(fr);
}
QString CurrentOCIOColorSpace()
QString current_ocio_color_space()
{
return color_space_chooser_->input();
}
void SetOCIOColorSpace(const QString &s)
void set_ocio_color_space(const QString &s)
{
color_space_chooser_->set_input(s);
}
CodecSection *GetCodecSection() const
CodecSection *get_codec_section() const
{
return static_cast<CodecSection *>(codec_stack_->currentWidget());
}
void SetCodecSection(CodecSection *section)
void set_codec_section(CodecSection *section)
{
if (section) {
codec_stack_->setVisible(true);
@@ -147,7 +147,7 @@ public:
return threads_;
}
void SetThreads(int t)
void set_threads(int t)
{
threads_ = t;
}
@@ -156,7 +156,7 @@ public:
{
return pix_fmt_;
}
void SetPixFmt(const QString &s)
void set_pix_fmt(const QString &s)
{
pix_fmt_ = s;
}
@@ -165,27 +165,27 @@ public:
{
return color_range_;
}
void SetColorRange(VideoParams::ColorRange c)
void set_color_range(VideoParams::ColorRange c)
{
color_range_ = c;
}
public slots:
void VideoCodecChanged();
void video_codec_changed();
void SetTime(const rational &time);
void set_time(const Rational &time);
signals:
void ColorSpaceChanged(const QString &colorspace);
void color_space_changed(const QString &colorspace);
void ImageSequenceCheckBoxChanged(bool e);
void image_sequence_check_box_changed(bool e);
void TimeChanged(const rational &time);
void time_changed(const Rational &time);
private:
QWidget *SetupResolutionSection();
QWidget *SetupColorSection();
QWidget *SetupCodecSection();
QWidget *setup_resolution_section();
QWidget *setup_color_section();
QWidget *setup_codec_section();
QComboBox *codec_combobox_;
FrameRateComboBox *frame_rate_combobox_;
@@ -218,13 +218,13 @@ private:
ExportFormat::Format format_;
private slots:
void MaintainAspectRatioChanged(bool val);
void maintain_aspect_ratio_changed(bool val);
void OpenAdvancedDialog();
void open_advanced_dialog();
void UpdateFrameRate(rational r);
void update_frame_rate(Rational r);
};
}
#endif // EXPORTVIDEOTAB_H
#endif // OAK_EXPORTVIDEOTAB_H