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
+2 -2
View File
@@ -115,7 +115,7 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent)
if (!patrons.isEmpty()) {
ScrollingLabel *scroll = new ScrollingLabel(patrons);
scroll->StartAnimating();
scroll->start_animating();
layout->addWidget(scroll);
}
@@ -150,7 +150,7 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent)
void AboutDialog::accept()
{
if (dont_show_again_checkbox_ && dont_show_again_checkbox_->isChecked()) {
OLIVE_CONFIG("ShowWelcomeDialog") = false;
OAK_CONFIG("ShowWelcomeDialog") = false;
}
QDialog::accept();
+3 -3
View File
@@ -19,8 +19,8 @@
***/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#ifndef OAK_ABOUTDIALOG_H
#define OAK_ABOUTDIALOG_H
#include <QCheckBox>
#include <QDialog>
@@ -59,4 +59,4 @@ private:
}
#endif // ABOUTDIALOG_H
#endif // OAK_ABOUTDIALOG_H
+3 -3
View File
@@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PATREON_H
#define PATREON_H
#ifndef OAK_PATREON_H
#define OAK_PATREON_H
#include <QStringList>
QStringList patrons;
#endif // PATREON_H
#endif // OAK_PATREON_H
+11 -11
View File
@@ -28,23 +28,23 @@
namespace olive
{
const int ScrollingLabel::kMinLineHeight = 10;
const int ScrollingLabel::k_min_line_height = 10;
ScrollingLabel::ScrollingLabel(QWidget *parent)
: QWidget(parent)
, animate_(0)
{
timer_.setInterval(50);
connect(&timer_, &QTimer::timeout, this, &ScrollingLabel::AnimationUpdate);
connect(&timer_, &QTimer::timeout, this, &ScrollingLabel::animation_update);
}
ScrollingLabel::ScrollingLabel(const QStringList &text, QWidget *parent)
: ScrollingLabel(parent)
{
SetText(text);
set_text(text);
}
void ScrollingLabel::SetText(const QStringList &text)
void ScrollingLabel::set_text(const QStringList &text)
{
text_ = text;
@@ -53,10 +53,10 @@ void ScrollingLabel::SetText(const QStringList &text)
int width = 0;
foreach (const QString &s, text_) {
width = qMax(width, QtUtils::QFontMetricsWidth(fm, s));
width = qMax(width, QtUtils::q_font_metrics_width(fm, s));
}
setMinimumSize(width, text_height_ * kMinLineHeight);
setMinimumSize(width, text_height_ * k_min_line_height);
}
void ScrollingLabel::paintEvent(QPaintEvent *e)
@@ -82,15 +82,15 @@ void ScrollingLabel::paintEvent(QPaintEvent *e)
const QString &s = text_.at(i);
int width = QtUtils::QFontMetricsWidth(fm, s);
int width = QtUtils::q_font_metrics_width(fm, s);
p.drawText(half_width / 2 - width / 2, text_y, s);
}
for (int y = 0; y < text_height_; y++) {
double mul = double(y) / double(text_height_);
SetOpacityOfScanLine(map.scanLine(y), map.width(), 4, mul);
SetOpacityOfScanLine(map.scanLine(map.height() - 1 - y),
set_opacity_of_scan_line(map.scanLine(y), map.width(), 4, mul);
set_opacity_of_scan_line(map.scanLine(map.height() - 1 - y),
map.width(), 4, mul);
}
}
@@ -99,7 +99,7 @@ void ScrollingLabel::paintEvent(QPaintEvent *e)
wp.drawImage(0, 0, map);
}
void ScrollingLabel::SetOpacityOfScanLine(uchar *scan_line, int width,
void ScrollingLabel::set_opacity_of_scan_line(uchar *scan_line, int width,
int channels, double mul)
{
for (int x = 0; x < width; x++) {
@@ -111,7 +111,7 @@ void ScrollingLabel::SetOpacityOfScanLine(uchar *scan_line, int width,
}
}
void ScrollingLabel::AnimationUpdate()
void ScrollingLabel::animation_update()
{
animate_++;
+9 -9
View File
@@ -19,8 +19,8 @@
***/
#ifndef SCROLLINGLABEL_H
#define SCROLLINGLABEL_H
#ifndef OAK_SCROLLINGLABEL_H
#define OAK_SCROLLINGLABEL_H
#include <QTimer>
#include <QWidget>
@@ -34,14 +34,14 @@ public:
ScrollingLabel(QWidget *parent = nullptr);
ScrollingLabel(const QStringList &text, QWidget *parent = nullptr);
void SetText(const QStringList &text);
void set_text(const QStringList &text);
void StartAnimating()
void start_animating()
{
timer_.start();
}
void StopAnimating()
void stop_animating()
{
timer_.stop();
}
@@ -50,10 +50,10 @@ protected:
virtual void paintEvent(QPaintEvent *e) override;
private:
static void SetOpacityOfScanLine(uchar *scan_line, int width, int channels,
static void set_opacity_of_scan_line(uchar *scan_line, int width, int channels,
double mul);
static const int kMinLineHeight;
static const int k_min_line_height;
QStringList text_;
@@ -64,9 +64,9 @@ private:
int animate_;
private slots:
void AnimationUpdate();
void animation_update();
};
}
#endif // SCROLLINGLABEL_H
#endif // OAK_SCROLLINGLABEL_H
+25 -25
View File
@@ -66,30 +66,30 @@ ActionSearch::ActionSearch(QWidget *parent)
// moveSelectionUp() and moveSelectionDown() are emitted when the user pressed up or down on the text field.
// We override it here to select the upper or lower item in the list.
connect(entry_field, SIGNAL(moveSelectionUp()), this,
connect(entry_field, SIGNAL(move_selection_up()), this,
SLOT(move_selection_up()));
connect(entry_field, SIGNAL(moveSelectionDown()), this,
connect(entry_field, SIGNAL(move_selection_down()), this,
SLOT(move_selection_down()));
layout->addWidget(entry_field);
// Construct list of actions
list_widget = new ActionSearchList(this);
list_widget_ = new ActionSearchList(this);
// Set list's font to 1.2x its standard font size
QFont list_widget_font = list_widget->font();
QFont list_widget_font = list_widget_->font();
list_widget_font.setPointSize(qRound(list_widget_font.pointSize() * 1.2));
list_widget->setFont(list_widget_font);
list_widget_->setFont(list_widget_font);
layout->addWidget(list_widget);
layout->addWidget(list_widget_);
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
connect(list_widget_, SIGNAL(dbl_click()), this, SLOT(perform_action()));
// Instantly focus on the entry field to allow for fully keyboard operation (if this popup was initiated by keyboard
// shortcut for example).
entry_field->setFocus();
}
void ActionSearch::SetMenuBar(QMenuBar *menu_bar)
void ActionSearch::set_menu_bar(QMenuBar *menu_bar)
{
menu_bar_ = menu_bar;
}
@@ -112,7 +112,7 @@ void ActionSearch::search_update(const QString &s, const QString &p,
// (and their submenus).
// We'll clear all the current items in the list since if we're here, we're just starting.
list_widget->clear();
list_widget_->clear();
QList<QAction *> menus = menu_bar_->actions();
@@ -125,8 +125,8 @@ void ActionSearch::search_update(const QString &s, const QString &p,
// Once we're here, all the recursion/item retrieval is complete. We auto-select the first item for better
// keyboard-exclusive functionality.
if (list_widget->count() > 0) {
list_widget->item(0)->setSelected(true);
if (list_widget_->count() > 0) {
list_widget_->item(0)->setSelected(true);
}
} else {
@@ -162,13 +162,13 @@ void ActionSearch::search_update(const QString &s, const QString &p,
// If so, we add it to the list widget.
QListWidgetItem *item = new QListWidgetItem(
QStringLiteral("%1\n(%2)").arg(comp, menu_text),
list_widget);
list_widget_);
// Add a pointer to the original QAction in the item's data
item->setData(Qt::UserRole + 1,
reinterpret_cast<quintptr>(a));
list_widget->addItem(item);
list_widget_->addItem(item);
}
}
}
@@ -179,8 +179,8 @@ void ActionSearch::search_update(const QString &s, const QString &p,
void ActionSearch::perform_action()
{
// Loop over all the items in the list and if we find one that's selected, we trigger it.
QList<QListWidgetItem *> selected_items = list_widget->selectedItems();
if (list_widget->count() > 0 && selected_items.size() > 0) {
QList<QListWidgetItem *> selected_items = list_widget_->selectedItems();
if (list_widget_->count() > 0 && selected_items.size() > 0) {
QListWidgetItem *item = selected_items.at(0);
// Get QAction pointer from item's data
@@ -200,11 +200,11 @@ void ActionSearch::move_selection_up()
// iterating at 1 (instead of 0) to efficiently ignore the first item (since the selection can't go below the very
// bottom item).
int lim = list_widget->count();
int lim = list_widget_->count();
for (int i = 1; i < lim; i++) {
if (list_widget->item(i)->isSelected()) {
list_widget->item(i - 1)->setSelected(true);
list_widget->scrollToItem(list_widget->item(i - 1));
if (list_widget_->item(i)->isSelected()) {
list_widget_->item(i - 1)->setSelected(true);
list_widget_->scrollToItem(list_widget_->item(i - 1));
break;
}
}
@@ -216,11 +216,11 @@ void ActionSearch::move_selection_down()
// one entry before count() to efficiently ignore the item at the end (since the selection can't go below the very
// bottom item).
int lim = list_widget->count() - 1;
int lim = list_widget_->count() - 1;
for (int i = 0; i < lim; i++) {
if (list_widget->item(i)->isSelected()) {
list_widget->item(i + 1)->setSelected(true);
list_widget->scrollToItem(list_widget->item(i + 1));
if (list_widget_->item(i)->isSelected()) {
list_widget_->item(i + 1)->setSelected(true);
list_widget_->scrollToItem(list_widget_->item(i + 1));
break;
}
}
@@ -247,11 +247,11 @@ bool ActionSearchEntry::event(QEvent *e)
switch (static_cast<QKeyEvent *>(e)->key()) {
case Qt::Key_Up:
e->accept();
emit moveSelectionUp();
emit move_selection_up();
return true;
case Qt::Key_Down:
e->accept();
emit moveSelectionDown();
emit move_selection_down();
return true;
}
break;
+7 -7
View File
@@ -19,8 +19,8 @@
***/
#ifndef ACTIONSEARCH_H
#define ACTIONSEARCH_H
#ifndef OAK_ACTIONSEARCH_H
#define OAK_ACTIONSEARCH_H
#include <QDialog>
#include <QLineEdit>
@@ -58,7 +58,7 @@ public:
/**
* @brief Set the menu bar to use in this action search
*/
void SetMenuBar(QMenuBar *menu_bar);
void set_menu_bar(QMenuBar *menu_bar);
private slots:
/**
* @brief Update the list of actions according to a search query
@@ -115,7 +115,7 @@ private:
/**
* @brief Main widget that shows the list of commands
*/
ActionSearchList *list_widget;
ActionSearchList *list_widget_;
/**
* @brief Attached menu bar object
@@ -180,14 +180,14 @@ signals:
/**
* @brief Emitted when the user presses the up arrow key.
*/
void moveSelectionUp();
void move_selection_up();
/**
* @brief Emitted when the user presses the down arrow key.
*/
void moveSelectionDown();
void move_selection_down();
};
}
#endif // ACTIONSEARCH_H
#endif // OAK_ACTIONSEARCH_H
@@ -40,24 +40,24 @@ AutoRecoveryDialog::AutoRecoveryDialog(const QString &message,
bool autocheck_latest, QWidget *parent)
: QDialog(parent)
{
Init(message);
init(message);
PopulateTree(recoveries, autocheck_latest);
populate_tree(recoveries, autocheck_latest);
}
void AutoRecoveryDialog::accept()
{
foreach (QTreeWidgetItem *checkable, checkable_items_) {
if (checkable->checkState(0) == Qt::Checked) {
QString filename = checkable->data(0, kFilenameRole).toString();
Core::instance()->OpenRecoveryProject(filename);
QString filename = checkable->data(0, k_filename_role).toString();
Core::instance()->open_recovery_project(filename);
}
}
super::accept();
}
void AutoRecoveryDialog::Init(const QString &header_text)
void AutoRecoveryDialog::init(const QString &header_text)
{
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -79,11 +79,11 @@ void AutoRecoveryDialog::Init(const QString &header_text)
layout->addWidget(buttons);
}
void AutoRecoveryDialog::PopulateTree(const QStringList &recoveries,
void AutoRecoveryDialog::populate_tree(const QStringList &recoveries,
bool autocheck_latest)
{
// Each entry in `recoveries` is a directory with 1+ recovery projects in it
QDir autorecovery_root(FileFunctions::GetAutoRecoveryRoot());
QDir autorecovery_root(FileFunctions::get_auto_recovery_root());
foreach (const QString &recovery_folder, recoveries) {
QDir recovery_dir(autorecovery_root.filePath(recovery_folder));
@@ -137,7 +137,7 @@ void AutoRecoveryDialog::PopulateTree(const QStringList &recoveries,
}
entry_item->setText(0, entry_name);
entry_item->setData(0, kFilenameRole,
entry_item->setData(0, k_filename_role,
recovery_dir.filePath(entry));
// Allow to be checked, auto-checking the first entry
+6 -6
View File
@@ -19,8 +19,8 @@
***/
#ifndef AUTORECOVERYDIALOG_H
#define AUTORECOVERYDIALOG_H
#ifndef OAK_AUTORECOVERYDIALOG_H
#define OAK_AUTORECOVERYDIALOG_H
#include <QDialog>
#include <QTreeWidget>
@@ -40,17 +40,17 @@ public slots:
virtual void accept() override;
private:
void Init(const QString &header_text);
void init(const QString &header_text);
void PopulateTree(const QStringList &recoveries, bool autocheck);
void populate_tree(const QStringList &recoveries, bool autocheck);
QTreeWidget *tree_widget_;
QVector<QTreeWidgetItem *> checkable_items_;
enum DataRole { kFilenameRole = Qt::UserRole };
enum DataRole { k_filename_role = Qt::UserRole };
};
}
#endif // AUTORECOVERYDIALOG_H
#endif // OAK_AUTORECOVERYDIALOG_H
+60 -60
View File
@@ -56,7 +56,7 @@ ColorDialog::ColorDialog(ColorManager *color_manager, const ManagedColor &start,
hsv_value_gradient_ = new ColorGradientWidget(Qt::Vertical);
hsv_value_gradient_->setFixedWidth(
QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral("HHH")));
QtUtils::q_font_metrics_width(fontMetrics(), QStringLiteral("HHH")));
wheel_layout->addWidget(hsv_value_gradient_);
QHBoxLayout *swatch_layout = new QHBoxLayout();
@@ -76,7 +76,7 @@ ColorDialog::ColorDialog(ColorManager *color_manager, const ManagedColor &start,
splitter->addWidget(value_area);
color_values_widget_ = new ColorValuesWidget(color_manager_);
color_values_widget_->IgnorePickFrom(this);
color_values_widget_->ignore_pick_from(this);
value_layout->addWidget(color_values_widget_);
chooser_ = new ColorSpaceChooser(color_manager_);
@@ -86,32 +86,32 @@ ColorDialog::ColorDialog(ColorManager *color_manager, const ManagedColor &start,
// Split window 50/50
splitter->setSizes({ INT_MAX, INT_MAX });
connect(color_wheel_, &ColorWheelWidget::SelectedColorChanged,
color_values_widget_, &ColorValuesWidget::SetColor);
connect(color_wheel_, &ColorWheelWidget::SelectedColorChanged,
hsv_value_gradient_, &ColorGradientWidget::SetSelectedColor);
connect(color_wheel_, &ColorWheelWidget::SelectedColorChanged, swatch_,
&ColorSwatchChooser::SetCurrentColor);
connect(hsv_value_gradient_, &ColorGradientWidget::SelectedColorChanged,
color_values_widget_, &ColorValuesWidget::SetColor);
connect(hsv_value_gradient_, &ColorGradientWidget::SelectedColorChanged,
color_wheel_, &ColorWheelWidget::SetSelectedColor);
connect(hsv_value_gradient_, &ColorGradientWidget::SelectedColorChanged,
swatch_, &ColorSwatchChooser::SetCurrentColor);
connect(color_values_widget_, &ColorValuesWidget::ColorChanged,
hsv_value_gradient_, &ColorGradientWidget::SetSelectedColor);
connect(color_values_widget_, &ColorValuesWidget::ColorChanged,
color_wheel_, &ColorWheelWidget::SetSelectedColor);
connect(color_values_widget_, &ColorValuesWidget::ColorChanged, swatch_,
&ColorSwatchChooser::SetCurrentColor);
connect(swatch_, &ColorSwatchChooser::ColorClicked, hsv_value_gradient_,
&ColorGradientWidget::SetSelectedColor);
connect(swatch_, &ColorSwatchChooser::ColorClicked, color_wheel_,
&ColorWheelWidget::SetSelectedColor);
connect(swatch_, &ColorSwatchChooser::ColorClicked, color_values_widget_,
&ColorValuesWidget::SetColor);
connect(color_wheel_, &ColorWheelWidget::selected_color_changed,
color_values_widget_, &ColorValuesWidget::set_color);
connect(color_wheel_, &ColorWheelWidget::selected_color_changed,
hsv_value_gradient_, &ColorGradientWidget::set_selected_color);
connect(color_wheel_, &ColorWheelWidget::selected_color_changed, swatch_,
&ColorSwatchChooser::set_current_color);
connect(hsv_value_gradient_, &ColorGradientWidget::selected_color_changed,
color_values_widget_, &ColorValuesWidget::set_color);
connect(hsv_value_gradient_, &ColorGradientWidget::selected_color_changed,
color_wheel_, &ColorWheelWidget::set_selected_color);
connect(hsv_value_gradient_, &ColorGradientWidget::selected_color_changed,
swatch_, &ColorSwatchChooser::set_current_color);
connect(color_values_widget_, &ColorValuesWidget::color_changed,
hsv_value_gradient_, &ColorGradientWidget::set_selected_color);
connect(color_values_widget_, &ColorValuesWidget::color_changed,
color_wheel_, &ColorWheelWidget::set_selected_color);
connect(color_values_widget_, &ColorValuesWidget::color_changed, swatch_,
&ColorSwatchChooser::set_current_color);
connect(swatch_, &ColorSwatchChooser::color_clicked, hsv_value_gradient_,
&ColorGradientWidget::set_selected_color);
connect(swatch_, &ColorSwatchChooser::color_clicked, color_wheel_,
&ColorWheelWidget::set_selected_color);
connect(swatch_, &ColorSwatchChooser::color_clicked, color_values_widget_,
&ColorValuesWidget::set_color);
connect(color_wheel_, &ColorWheelWidget::DiameterChanged,
connect(color_wheel_, &ColorWheelWidget::diameter_changed,
hsv_value_gradient_, &ColorGradientWidget::setFixedHeight);
QDialogButtonBox *buttons =
@@ -120,17 +120,17 @@ ColorDialog::ColorDialog(ColorManager *color_manager, const ManagedColor &start,
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout->addWidget(buttons);
SetColor(start);
set_color(start);
connect(chooser_, &ColorSpaceChooser::ColorSpaceChanged, this,
&ColorDialog::ColorSpaceChanged);
ColorSpaceChanged(chooser_->input(), chooser_->output());
connect(chooser_, &ColorSpaceChooser::color_space_changed, this,
&ColorDialog::color_space_changed);
color_space_changed(chooser_->input(), chooser_->output());
// Set default size ratio to 2:1
resize(sizeHint().height() * 2, sizeHint().height());
}
void ColorDialog::SetColor(const ManagedColor &start)
void ColorDialog::set_color(const ManagedColor &start)
{
chooser_->set_input(start.color_input());
chooser_->set_output(start.color_output());
@@ -142,70 +142,70 @@ void ColorDialog::SetColor(const ManagedColor &start)
} else {
// Convert reference color to the input space
ColorProcessorPtr linear_to_input = ColorProcessor::Create(
color_manager_, color_manager_->GetReferenceColorSpace(),
ColorProcessorPtr linear_to_input = ColorProcessor::create(
color_manager_, color_manager_->get_reference_color_space(),
start.color_input());
managed_start = linear_to_input->ConvertColor(start);
managed_start = linear_to_input->convert_color(start);
}
color_wheel_->SetSelectedColor(managed_start);
hsv_value_gradient_->SetSelectedColor(managed_start);
color_values_widget_->SetColor(managed_start);
swatch_->SetCurrentColor(managed_start);
color_wheel_->set_selected_color(managed_start);
hsv_value_gradient_->set_selected_color(managed_start);
color_values_widget_->set_color(managed_start);
swatch_->set_current_color(managed_start);
}
ManagedColor ColorDialog::GetSelectedColor() const
ManagedColor ColorDialog::get_selected_color() const
{
ManagedColor selected = color_wheel_->GetSelectedColor();
ManagedColor selected = color_wheel_->get_selected_color();
// Convert to linear and return a linear color
if (input_to_ref_processor_) {
selected = input_to_ref_processor_->ConvertColor(selected);
selected = input_to_ref_processor_->convert_color(selected);
}
selected.set_color_input(GetColorSpaceInput());
selected.set_color_output(GetColorSpaceOutput());
selected.set_color_input(get_color_space_input());
selected.set_color_output(get_color_space_output());
return selected;
}
QString ColorDialog::GetColorSpaceInput() const
QString ColorDialog::get_color_space_input() const
{
return chooser_->input();
}
ColorTransform ColorDialog::GetColorSpaceOutput() const
ColorTransform ColorDialog::get_color_space_output() const
{
return chooser_->output();
}
void ColorDialog::ColorSpaceChanged(const QString &input,
void ColorDialog::color_space_changed(const QString &input,
const ColorTransform &output)
{
input_to_ref_processor_ = ColorProcessor::Create(
color_manager_, input, color_manager_->GetReferenceColorSpace());
input_to_ref_processor_ = ColorProcessor::create(
color_manager_, input, color_manager_->get_reference_color_space());
ColorProcessorPtr ref_to_display = ColorProcessor::Create(
color_manager_, color_manager_->GetReferenceColorSpace(), output);
ColorProcessorPtr ref_to_display = ColorProcessor::create(
color_manager_, color_manager_->get_reference_color_space(), output);
ColorProcessorPtr ref_to_input = ColorProcessor::Create(
color_manager_, color_manager_->GetReferenceColorSpace(), input);
ColorProcessorPtr ref_to_input = ColorProcessor::create(
color_manager_, color_manager_->get_reference_color_space(), input);
// Display -> reference is the inverse of the display transform. Older OCIO
// versions crashed on TRANSFORM_DIR_INVERSE; guard by requiring a valid
// processor and fall back to disabling the display tab if creation fails.
ColorProcessorPtr display_to_ref = ColorProcessor::Create(
color_manager_, color_manager_->GetReferenceColorSpace(), output,
ColorProcessor::kInverse);
if (display_to_ref && !display_to_ref->GetProcessor()) {
ColorProcessorPtr display_to_ref = ColorProcessor::create(
color_manager_, color_manager_->get_reference_color_space(), output,
ColorProcessor::k_inverse);
if (display_to_ref && !display_to_ref->get_processor()) {
display_to_ref = nullptr;
}
color_wheel_->SetColorProcessor(input_to_ref_processor_, ref_to_display);
hsv_value_gradient_->SetColorProcessor(input_to_ref_processor_,
color_wheel_->set_color_processor(input_to_ref_processor_, ref_to_display);
hsv_value_gradient_->set_color_processor(input_to_ref_processor_,
ref_to_display);
color_values_widget_->SetColorProcessor(
color_values_widget_->set_color_processor(
input_to_ref_processor_, ref_to_display, display_to_ref, ref_to_input);
}
+8 -8
View File
@@ -19,8 +19,8 @@
***/
#ifndef COLORDIALOG_H
#define COLORDIALOG_H
#ifndef OAK_COLORDIALOG_H
#define OAK_COLORDIALOG_H
#include <QDialog>
@@ -66,14 +66,14 @@ public:
*
* The color is always returned in the ColorManager's reference space (usually scene linear).
*/
ManagedColor GetSelectedColor() const;
ManagedColor get_selected_color() const;
QString GetColorSpaceInput() const;
QString get_color_space_input() const;
ColorTransform GetColorSpaceOutput() const;
ColorTransform get_color_space_output() const;
public slots:
void SetColor(const ManagedColor &c);
void set_color(const ManagedColor &c);
private:
ColorManager *color_manager_;
@@ -91,9 +91,9 @@ private:
ColorSwatchChooser *swatch_;
private slots:
void ColorSpaceChanged(const QString &input, const ColorTransform &output);
void color_space_changed(const QString &input, const ColorTransform &output);
};
}
#endif // COLORDIALOG_H
#endif // OAK_COLORDIALOG_H
+4 -4
View File
@@ -65,7 +65,7 @@ ConfigDialogBase::ConfigDialogBase(QWidget *parent)
void ConfigDialogBase::accept()
{
foreach (ConfigDialogBaseTab *tab, tabs_) {
if (!tab->Validate()) {
if (!tab->validate()) {
return;
}
}
@@ -73,7 +73,7 @@ void ConfigDialogBase::accept()
MultiUndoCommand *command = new MultiUndoCommand();
foreach (ConfigDialogBaseTab *tab, tabs_) {
tab->Accept(command);
tab->accept(command);
}
Core::instance()->undo_stack()->push(command, tr("Set Configuration"));
@@ -83,7 +83,7 @@ void ConfigDialogBase::accept()
QDialog::accept();
}
void ConfigDialogBase::AddTab(ConfigDialogBaseTab *tab, const QString &title)
void ConfigDialogBase::add_tab(ConfigDialogBaseTab *tab, const QString &title)
{
list_widget_->addItem(title);
preference_pane_stack_->addWidget(tab);
@@ -91,7 +91,7 @@ void ConfigDialogBase::AddTab(ConfigDialogBaseTab *tab, const QString &title)
tabs_.append(tab);
}
void ConfigDialogBase::SetCurrentTab(int index)
void ConfigDialogBase::set_current_tab(int index)
{
if (index >= 0 && index < list_widget_->count()) {
list_widget_->setCurrentRow(index);
+5 -5
View File
@@ -19,8 +19,8 @@
***/
#ifndef CONFIGBASE_H
#define CONFIGBASE_H
#ifndef OAK_CONFIGBASE_H
#define OAK_CONFIGBASE_H
#include <QDialog>
#include <QListWidget>
@@ -36,7 +36,7 @@ class ConfigDialogBase : public QDialog {
public:
ConfigDialogBase(QWidget *parent = nullptr);
void SetCurrentTab(int index);
void set_current_tab(int index);
private slots:
/**
@@ -45,7 +45,7 @@ private slots:
virtual void accept() override;
protected:
void AddTab(ConfigDialogBaseTab *tab, const QString &title);
void add_tab(ConfigDialogBaseTab *tab, const QString &title);
virtual void AcceptEvent()
{
@@ -61,4 +61,4 @@ private:
}
#endif // CONFIGBASE_H
#endif // OAK_CONFIGBASE_H
@@ -24,7 +24,7 @@
namespace olive
{
bool ConfigDialogBaseTab::Validate()
bool ConfigDialogBaseTab::validate()
{
return true;
}
+5 -5
View File
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESTAB_H
#define PREFERENCESTAB_H
#ifndef OAK_PREFERENCESTAB_H
#define OAK_PREFERENCESTAB_H
#include <QWidget>
@@ -34,11 +34,11 @@ class ConfigDialogBaseTab : public QWidget {
public:
ConfigDialogBaseTab() = default;
virtual bool Validate();
virtual bool validate();
virtual void Accept(MultiUndoCommand *parent) = 0;
virtual void accept(MultiUndoCommand *parent) = 0;
};
}
#endif // PREFERENCESTAB_H
#endif // OAK_PREFERENCESTAB_H
+16 -16
View File
@@ -37,7 +37,7 @@ DiskCacheDialog::DiskCacheDialog(DiskCacheFolder *folder, QWidget *parent)
int row = 0;
layout->addWidget(new QLabel(tr("Disk Cache: %1").arg(folder->GetPath())),
layout->addWidget(new QLabel(tr("Disk Cache: %1").arg(folder->get_path())),
row, 0, 1, 2);
setWindowTitle(tr("Disk Cache Settings"));
@@ -46,10 +46,10 @@ DiskCacheDialog::DiskCacheDialog(DiskCacheFolder *folder, QWidget *parent)
layout->addWidget(new QLabel(tr("Maximum Disk Cache:")), row, 0);
maximum_cache_slider_ = new FloatSlider();
maximum_cache_slider_->SetFormat(tr("%1 GB"));
maximum_cache_slider_->SetMinimum(1.0);
maximum_cache_slider_->SetValue(static_cast<double>(folder->GetLimit()) /
static_cast<double>(kBytesInGigabyte));
maximum_cache_slider_->set_format(tr("%1 GB"));
maximum_cache_slider_->set_minimum(1.0);
maximum_cache_slider_->set_value(static_cast<double>(folder->get_limit()) /
static_cast<double>(k_bytes_in_gigabyte));
layout->addWidget(maximum_cache_slider_, row, 1);
row++;
@@ -57,14 +57,14 @@ DiskCacheDialog::DiskCacheDialog(DiskCacheFolder *folder, QWidget *parent)
clear_cache_btn_ = new QPushButton(tr("Clear Disk Cache"));
connect(clear_cache_btn_, &QPushButton::clicked, this,
static_cast<void (DiskCacheDialog::*)()>(
&DiskCacheDialog::ClearDiskCache));
&DiskCacheDialog::clear_disk_cache));
layout->addWidget(clear_cache_btn_, row, 1);
row++;
clear_disk_cache_ =
new QCheckBox(tr("Automatically clear disk cache on close"));
clear_disk_cache_->setChecked(folder->GetClearOnClose());
clear_disk_cache_->setChecked(folder->get_clear_on_close());
layout->addWidget(clear_disk_cache_, row, 1);
row++;
@@ -81,24 +81,24 @@ DiskCacheDialog::DiskCacheDialog(DiskCacheFolder *folder, QWidget *parent)
void DiskCacheDialog::accept()
{
qint64 new_disk_cache_limit =
qRound64(maximum_cache_slider_->GetValue() * kBytesInGigabyte);
if (new_disk_cache_limit != folder_->GetLimit()) {
folder_->SetLimit(new_disk_cache_limit);
qRound64(maximum_cache_slider_->get_value() * k_bytes_in_gigabyte);
if (new_disk_cache_limit != folder_->get_limit()) {
folder_->set_limit(new_disk_cache_limit);
}
if (folder_->GetClearOnClose() != clear_disk_cache_->isChecked()) {
folder_->SetClearOnClose(clear_disk_cache_->isChecked());
if (folder_->get_clear_on_close() != clear_disk_cache_->isChecked()) {
folder_->set_clear_on_close(clear_disk_cache_->isChecked());
}
QDialog::accept();
}
void DiskCacheDialog::ClearDiskCache()
void DiskCacheDialog::clear_disk_cache()
{
ClearDiskCache(folder_->GetPath(), this, clear_cache_btn_);
clear_disk_cache(folder_->get_path(), this, clear_cache_btn_);
}
void DiskCacheDialog::ClearDiskCache(const QString &path, QWidget *parent,
void DiskCacheDialog::clear_disk_cache(const QString &path, QWidget *parent,
QPushButton *clear_btn)
{
if (QMessageBox::question(
@@ -109,7 +109,7 @@ void DiskCacheDialog::ClearDiskCache(const QString &path, QWidget *parent,
if (clear_btn)
clear_btn->setEnabled(false);
if (DiskManager::instance()->ClearDiskCache(path)) {
if (DiskManager::instance()->clear_disk_cache(path)) {
if (clear_btn)
clear_btn->setText(tr("Disk Cache Cleared"));
} else {
+5 -5
View File
@@ -19,8 +19,8 @@
***/
#ifndef DISKCACHEDIALOG_H
#define DISKCACHEDIALOG_H
#ifndef OAK_DISKCACHEDIALOG_H
#define OAK_DISKCACHEDIALOG_H
#include <QCheckBox>
#include <QDialog>
@@ -37,7 +37,7 @@ class DiskCacheDialog : public QDialog {
public:
DiskCacheDialog(DiskCacheFolder *folder, QWidget *parent = nullptr);
static void ClearDiskCache(const QString &path, QWidget *parent,
static void clear_disk_cache(const QString &path, QWidget *parent,
QPushButton *clear_btn = nullptr);
public slots:
@@ -53,9 +53,9 @@ private:
QPushButton *clear_cache_btn_;
private slots:
void ClearDiskCache();
void clear_disk_cache();
};
}
#endif // DISKCACHEDIALOG_H
#endif // OAK_DISKCACHEDIALOG_H
+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
@@ -48,14 +48,14 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
{
QGridLayout *layout = new QGridLayout(this);
setWindowTitle(tr("\"%1\" Properties").arg(footage_->GetLabelOrName()));
setWindowTitle(tr("\"%1\" Properties").arg(footage_->get_label_or_name()));
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
int row = 0;
layout->addWidget(new QLabel(tr("Name:")), row, 0);
footage_name_field_ = new QLineEdit(footage_->GetLabel());
footage_name_field_ = new QLineEdit(footage_->get_label());
layout->addWidget(footage_name_field_, row, 1);
row++;
@@ -67,7 +67,7 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
QHBoxLayout *start_time_layout = new QHBoxLayout();
source_start_time_enable_ = new QCheckBox(tr("Set"));
source_start_time_enable_->setChecked(footage_->HasSourceStartTime());
source_start_time_enable_->setChecked(footage_->has_source_start_time());
start_time_layout->addWidget(source_start_time_enable_);
source_start_time_spin_ = new QDoubleSpinBox();
@@ -75,15 +75,15 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
source_start_time_spin_->setDecimals(3);
source_start_time_spin_->setSuffix(QStringLiteral(" s"));
source_start_time_spin_->setValue(
footage_->HasSourceStartTime() ?
footage_->source_start_time().toDouble() :
footage_->has_source_start_time() ?
footage_->source_start_time().to_double() :
0.0);
source_start_time_spin_->setEnabled(
source_start_time_enable_->isChecked());
start_time_layout->addWidget(source_start_time_spin_, 1);
QString detection_note;
if (footage_->HasSourceStartTime()) {
if (footage_->has_source_start_time()) {
const QString &source = footage_->source_start_time_source();
detection_note =
(source == QStringLiteral("manual")) ?
@@ -104,8 +104,8 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
layout->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2);
row++;
track_list = new QListWidget();
layout->addWidget(track_list, row, 0, 1, 2);
track_list_ = new QListWidget();
layout->addWidget(track_list_, row, 0, 1, 2);
row++;
@@ -114,33 +114,33 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
int first_usable_stream = -1;
for (int i = 0; i < footage_->GetTotalStreamCount(); i++) {
Track::Reference reference = footage_->GetReferenceFromRealIndex(i);
for (int i = 0; i < footage_->get_total_stream_count(); i++) {
Track::Reference reference = footage_->get_reference_from_real_index(i);
QString description;
bool is_enabled = false;
switch (reference.type()) {
case Track::kVideo: {
case Track::k_video: {
stacked_widget_->addWidget(
new VideoStreamProperties(footage_, reference.index()));
VideoParams vp = footage_->GetVideoParams(reference.index());
VideoParams vp = footage_->get_video_params(reference.index());
is_enabled = vp.enabled();
description = Footage::DescribeVideoStream(vp);
description = Footage::describe_video_stream(vp);
break;
}
case Track::kAudio: {
case Track::k_audio: {
stacked_widget_->addWidget(
new AudioStreamProperties(footage_, reference.index()));
AudioParams ap = footage_->GetAudioParams(reference.index());
AudioParams ap = footage_->get_audio_params(reference.index());
is_enabled = ap.enabled();
description = Footage::DescribeAudioStream(ap);
description = Footage::describe_audio_stream(ap);
break;
}
case Track::kSubtitle: {
SubtitleParams sp = footage_->GetSubtitleParams(reference.index());
case Track::k_subtitle: {
SubtitleParams sp = footage_->get_subtitle_params(reference.index());
is_enabled = sp.enabled();
// FIXME: Language?
@@ -153,15 +153,15 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
break;
}
QListWidgetItem *item = new QListWidgetItem(description, track_list);
QListWidgetItem *item = new QListWidgetItem(description, track_list_);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(is_enabled ? Qt::Checked : Qt::Unchecked);
track_list->addItem(item);
track_list_->addItem(item);
if (first_usable_stream == -1 &&
(reference.type() == Track::kVideo ||
reference.type() == Track::kAudio ||
reference.type() == Track::kSubtitle)) {
(reference.type() == Track::k_video ||
reference.type() == Track::k_audio ||
reference.type() == Track::k_subtitle)) {
first_usable_stream = i;
}
}
@@ -176,14 +176,14 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent,
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(track_list, &QListWidget::currentRowChanged, stacked_widget_,
connect(track_list_, &QListWidget::currentRowChanged, stacked_widget_,
&QStackedWidget::setCurrentIndex);
// Auto-select first item that actually has properties
if (first_usable_stream >= 0) {
track_list->setCurrentRow(first_usable_stream);
track_list_->setCurrentRow(first_usable_stream);
}
track_list->setFocus();
track_list_->setFocus();
}
void FootagePropertiesDialog::accept()
@@ -191,7 +191,7 @@ void FootagePropertiesDialog::accept()
// Perform sanity check on all pages
for (int i = 0; i < stacked_widget_->count(); i++) {
if (!static_cast<StreamProperties *>(stacked_widget_->widget(i))
->SanityCheck()) {
->sanity_check()) {
// Switch to the failed panel in question
stacked_widget_->setCurrentIndex(i);
@@ -202,45 +202,45 @@ void FootagePropertiesDialog::accept()
MultiUndoCommand *command = new MultiUndoCommand();
if (footage_->GetLabel() != footage_name_field_->text()) {
if (footage_->get_label() != footage_name_field_->text()) {
NodeRenameCommand *nrc = new NodeRenameCommand();
nrc->AddNode(footage_, footage_name_field_->text());
nrc->add_node(footage_, footage_name_field_->text());
command->add_child(nrc);
}
// Apply source start time changes
{
const bool new_enabled = source_start_time_enable_->isChecked();
const rational new_time =
rational::fromDouble(source_start_time_spin_->value());
if (new_enabled != footage_->HasSourceStartTime() ||
const Rational new_time =
Rational::from_double(source_start_time_spin_->value());
if (new_enabled != footage_->has_source_start_time() ||
(new_enabled && new_time != footage_->source_start_time())) {
command->add_child(new FootageSetSourceStartTimeCommand(
footage_, new_enabled, new_time, QStringLiteral("manual")));
}
}
for (int i = 0; i < footage_->GetTotalStreamCount(); i++) {
Track::Reference reference = footage_->GetReferenceFromRealIndex(i);
for (int i = 0; i < footage_->get_total_stream_count(); i++) {
Track::Reference reference = footage_->get_reference_from_real_index(i);
bool new_stream_enabled =
(track_list->item(i)->checkState() == Qt::Checked);
(track_list_->item(i)->checkState() == Qt::Checked);
bool old_stream_enabled = new_stream_enabled;
switch (reference.type()) {
case Track::kVideo:
case Track::k_video:
old_stream_enabled =
footage_->GetVideoParams(reference.index()).enabled();
footage_->get_video_params(reference.index()).enabled();
break;
case Track::kAudio:
case Track::k_audio:
old_stream_enabled =
footage_->GetAudioParams(reference.index()).enabled();
footage_->get_audio_params(reference.index()).enabled();
break;
case Track::kSubtitle:
case Track::k_subtitle:
old_stream_enabled =
footage_->GetSubtitleParams(reference.index()).enabled();
footage_->get_subtitle_params(reference.index()).enabled();
break;
case Track::kNone:
case Track::kCount:
case Track::k_none:
case Track::k_count:
break;
}
@@ -253,11 +253,11 @@ void FootagePropertiesDialog::accept()
for (int i = 0; i < stacked_widget_->count(); i++) {
static_cast<StreamProperties *>(stacked_widget_->widget(i))
->Accept(command);
->accept(command);
}
Core::instance()->undo_stack()->push(
command, tr("Set Footage \"%1\" Properties").arg(footage_->GetLabel()));
command, tr("Set Footage \"%1\" Properties").arg(footage_->get_label()));
QDialog::accept();
}
@@ -272,7 +272,7 @@ FootagePropertiesDialog::StreamEnableChangeCommand::StreamEnableChangeCommand(
}
Project *
FootagePropertiesDialog::StreamEnableChangeCommand::GetRelevantProject() const
FootagePropertiesDialog::StreamEnableChangeCommand::get_relevant_project() const
{
return footage_->project();
}
@@ -280,29 +280,29 @@ FootagePropertiesDialog::StreamEnableChangeCommand::GetRelevantProject() const
void FootagePropertiesDialog::StreamEnableChangeCommand::redo()
{
switch (type_) {
case Track::kVideo: {
VideoParams vp = footage_->GetVideoParams(index_);
case Track::k_video: {
VideoParams vp = footage_->get_video_params(index_);
old_enabled_ = vp.enabled();
vp.set_enabled(new_enabled_);
footage_->SetVideoParams(vp, index_);
footage_->set_video_params(vp, index_);
break;
}
case Track::kAudio: {
AudioParams ap = footage_->GetAudioParams(index_);
case Track::k_audio: {
AudioParams ap = footage_->get_audio_params(index_);
old_enabled_ = ap.enabled();
ap.set_enabled(new_enabled_);
footage_->SetAudioParams(ap, index_);
footage_->set_audio_params(ap, index_);
break;
}
case Track::kSubtitle: {
SubtitleParams sp = footage_->GetSubtitleParams(index_);
case Track::k_subtitle: {
SubtitleParams sp = footage_->get_subtitle_params(index_);
old_enabled_ = sp.enabled();
sp.set_enabled(new_enabled_);
footage_->SetSubtitleParams(sp, index_);
footage_->set_subtitle_params(sp, index_);
break;
}
case Track::kNone:
case Track::kCount:
case Track::k_none:
case Track::k_count:
break;
}
}
@@ -310,33 +310,33 @@ void FootagePropertiesDialog::StreamEnableChangeCommand::redo()
void FootagePropertiesDialog::StreamEnableChangeCommand::undo()
{
switch (type_) {
case Track::kVideo: {
VideoParams vp = footage_->GetVideoParams(index_);
case Track::k_video: {
VideoParams vp = footage_->get_video_params(index_);
vp.set_enabled(old_enabled_);
footage_->SetVideoParams(vp, index_);
footage_->set_video_params(vp, index_);
break;
}
case Track::kAudio: {
AudioParams ap = footage_->GetAudioParams(index_);
case Track::k_audio: {
AudioParams ap = footage_->get_audio_params(index_);
ap.set_enabled(old_enabled_);
footage_->SetAudioParams(ap, index_);
footage_->set_audio_params(ap, index_);
break;
}
case Track::kSubtitle: {
SubtitleParams sp = footage_->GetSubtitleParams(index_);
case Track::k_subtitle: {
SubtitleParams sp = footage_->get_subtitle_params(index_);
sp.set_enabled(old_enabled_);
footage_->SetSubtitleParams(sp, index_);
footage_->set_subtitle_params(sp, index_);
break;
}
case Track::kNone:
case Track::kCount:
case Track::k_none:
case Track::k_count:
break;
}
}
FootagePropertiesDialog::FootageSetSourceStartTimeCommand::
FootageSetSourceStartTimeCommand(Footage *footage, bool enabled,
const rational &time,
const Rational &time,
const QString &source)
: footage_(footage)
, new_enabled_(enabled)
@@ -346,7 +346,7 @@ FootagePropertiesDialog::FootageSetSourceStartTimeCommand::
}
Project *
FootagePropertiesDialog::FootageSetSourceStartTimeCommand::GetRelevantProject()
FootagePropertiesDialog::FootageSetSourceStartTimeCommand::get_relevant_project()
const
{
return footage_->project();
@@ -354,23 +354,23 @@ FootagePropertiesDialog::FootageSetSourceStartTimeCommand::GetRelevantProject()
void FootagePropertiesDialog::FootageSetSourceStartTimeCommand::redo()
{
old_enabled_ = footage_->HasSourceStartTime();
old_enabled_ = footage_->has_source_start_time();
old_time_ = footage_->source_start_time();
old_source_ = footage_->source_start_time_source();
if (new_enabled_) {
footage_->SetSourceStartTime(new_time_, new_source_);
footage_->set_source_start_time(new_time_, new_source_);
} else {
footage_->ClearSourceStartTime();
footage_->clear_source_start_time();
}
}
void FootagePropertiesDialog::FootageSetSourceStartTimeCommand::undo()
{
if (old_enabled_) {
footage_->SetSourceStartTime(old_time_, old_source_);
footage_->set_source_start_time(old_time_, old_source_);
} else {
footage_->ClearSourceStartTime();
footage_->clear_source_start_time();
}
}
@@ -19,8 +19,8 @@
***/
#ifndef MEDIAPROPERTIESDIALOG_H
#define MEDIAPROPERTIESDIALOG_H
#ifndef OAK_MEDIAPROPERTIESDIALOG_H
#define OAK_MEDIAPROPERTIESDIALOG_H
#include <QCheckBox>
#include <QComboBox>
@@ -64,7 +64,7 @@ private:
StreamEnableChangeCommand(Footage *footage, Track::Type type,
int index_in_type, bool enabled);
virtual Project *GetRelevantProject() const override;
virtual Project *get_relevant_project() const override;
protected:
virtual void redo() override;
@@ -82,10 +82,10 @@ private:
class FootageSetSourceStartTimeCommand : public UndoCommand {
public:
FootageSetSourceStartTimeCommand(Footage *footage, bool enabled,
const rational &time,
const Rational &time,
const QString &source);
virtual Project *GetRelevantProject() const override;
virtual Project *get_relevant_project() const override;
protected:
virtual void redo() override;
@@ -95,11 +95,11 @@ private:
Footage *footage_;
bool new_enabled_;
rational new_time_;
Rational new_time_;
QString new_source_;
bool old_enabled_;
rational old_time_;
Rational old_time_;
QString old_source_;
};
@@ -131,12 +131,12 @@ private:
/**
* @brief A list widget for listing the tracks in Media
*/
QListWidget *track_list;
QListWidget *track_list_;
/**
* @brief Frame rate to conform to
*/
QDoubleSpinBox *conform_fr;
QDoubleSpinBox *conform_fr_;
private slots:
/**
@@ -147,4 +147,4 @@ private slots:
}
#endif // MEDIAPROPERTIESDIALOG_H
#endif // OAK_MEDIAPROPERTIESDIALOG_H
@@ -30,7 +30,7 @@ AudioStreamProperties::AudioStreamProperties(Footage *footage, int audio_index)
{
}
void AudioStreamProperties::Accept(MultiUndoCommand *)
void AudioStreamProperties::accept(MultiUndoCommand *)
{
Q_UNUSED(footage_)
Q_UNUSED(audio_index_)
@@ -19,8 +19,8 @@
***/
#ifndef AUDIOSTREAMPROPERTIES_H
#define AUDIOSTREAMPROPERTIES_H
#ifndef OAK_AUDIOSTREAMPROPERTIES_H
#define OAK_AUDIOSTREAMPROPERTIES_H
#include "node/project/footage/footage.h"
#include "streamproperties.h"
@@ -32,7 +32,7 @@ class AudioStreamProperties : public StreamProperties {
public:
AudioStreamProperties(Footage *footage, int audio_index);
virtual void Accept(MultiUndoCommand *parent) override;
virtual void accept(MultiUndoCommand *parent) override;
private:
Footage *footage_;
@@ -42,4 +42,4 @@ private:
}
#endif // AUDIOSTREAMPROPERTIES_H
#endif // OAK_AUDIOSTREAMPROPERTIES_H
@@ -19,8 +19,8 @@
***/
#ifndef STREAMPROPERTIES_H
#define STREAMPROPERTIES_H
#ifndef OAK_STREAMPROPERTIES_H
#define OAK_STREAMPROPERTIES_H
#include <QWidget>
@@ -34,11 +34,11 @@ class StreamProperties : public QWidget {
public:
StreamProperties(QWidget *parent = nullptr);
virtual void Accept(MultiUndoCommand *)
virtual void accept(MultiUndoCommand *)
{
}
virtual bool SanityCheck()
virtual bool sanity_check()
{
return true;
}
@@ -46,4 +46,4 @@ public:
}
#endif // STREAMPROPERTIES_H
#endif // OAK_STREAMPROPERTIES_H
@@ -44,10 +44,10 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
video_layout->addWidget(new QLabel(tr("Pixel Aspect:")), row, 0);
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
pixel_aspect_combo_ = new PixelAspectRatioComboBox();
pixel_aspect_combo_->SetPixelAspectRatio(vp.pixel_aspect_ratio());
pixel_aspect_combo_->set_pixel_aspect_ratio(vp.pixel_aspect_ratio());
video_layout->addWidget(pixel_aspect_combo_, row, 1);
row++;
@@ -55,7 +55,7 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
video_layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
video_interlace_combo_ = new InterlacedComboBox();
video_interlace_combo_->SetInterlaceMode(vp.interlacing());
video_interlace_combo_->set_interlace_mode(vp.interlacing());
video_layout->addWidget(video_interlace_combo_, row, 1);
@@ -64,14 +64,14 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
video_layout->addWidget(new QLabel(tr("Color Space:")), row, 0);
video_color_space_ = new QComboBox();
OCIO::ConstConfigRcPtr config =
footage_->project()->color_manager()->GetConfig();
ocio::ConstConfigRcPtr config =
footage_->project()->color_manager()->get_config();
int number_of_colorspaces = config->getNumColorSpaces();
video_color_space_->addItem(tr("Default (%1)")
.arg(footage_->project()
->color_manager()
->GetDefaultInputColorSpace()));
->get_default_input_color_space()));
for (int i = 0; i < number_of_colorspaces; i++) {
QString colorspace = config->getColorSpaceNameByIndex(i);
@@ -89,14 +89,14 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
color_range_combo_ = new QComboBox();
color_range_combo_->addItem(tr("Limited (16-235)"),
VideoParams::kColorRangeLimited);
VideoParams::k_color_range_limited);
color_range_combo_->addItem(tr("Full (0-255)"),
VideoParams::kColorRangeFull);
VideoParams::k_color_range_full);
color_range_combo_->setCurrentIndex(vp.color_range());
video_layout->addWidget(color_range_combo_, row, 1);
if (vp.channel_count() == VideoParams::kRGBAChannelCount) {
if (vp.channel_count() == VideoParams::k_rgba_channel_count) {
row++;
video_premultiply_alpha_ = new QCheckBox(tr("Premultiplied Alpha"));
@@ -106,7 +106,7 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
row++;
if (vp.video_type() == VideoParams::kVideoTypeImageSequence) {
if (vp.video_type() == VideoParams::k_video_type_image_sequence) {
QGroupBox *imgseq_group = new QGroupBox(tr("Image Sequence"));
QGridLayout *imgseq_layout = new QGridLayout(imgseq_group);
@@ -115,8 +115,8 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
imgseq_layout->addWidget(new QLabel(tr("Start Index:")), imgseq_row, 0);
imgseq_start_time_ = new IntegerSlider();
imgseq_start_time_->SetMinimum(0);
imgseq_start_time_->SetValue(vp.start_time());
imgseq_start_time_->set_minimum(0);
imgseq_start_time_->set_value(vp.start_time());
imgseq_layout->addWidget(imgseq_start_time_, imgseq_row, 1);
imgseq_row++;
@@ -124,8 +124,8 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
imgseq_layout->addWidget(new QLabel(tr("End Index:")), imgseq_row, 0);
imgseq_end_time_ = new IntegerSlider();
imgseq_end_time_->SetMinimum(0);
imgseq_end_time_->SetValue(vp.start_time() + vp.duration() - 1);
imgseq_end_time_->set_minimum(0);
imgseq_end_time_->set_value(vp.start_time() + vp.duration() - 1);
imgseq_layout->addWidget(imgseq_end_time_, imgseq_row, 1);
imgseq_row++;
@@ -133,14 +133,14 @@ VideoStreamProperties::VideoStreamProperties(Footage *footage, int video_index)
imgseq_layout->addWidget(new QLabel(tr("Frame Rate:")), imgseq_row, 0);
imgseq_frame_rate_ = new FrameRateComboBox();
imgseq_frame_rate_->SetFrameRate(vp.frame_rate());
imgseq_frame_rate_->set_frame_rate(vp.frame_rate());
imgseq_layout->addWidget(imgseq_frame_rate_, imgseq_row, 1);
video_layout->addWidget(imgseq_group, row, 0, 1, 2);
}
}
void VideoStreamProperties::Accept(MultiUndoCommand *parent)
void VideoStreamProperties::accept(MultiUndoCommand *parent)
{
QString set_colorspace;
@@ -148,14 +148,14 @@ void VideoStreamProperties::Accept(MultiUndoCommand *parent)
set_colorspace = video_color_space_->currentText();
}
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
if ((video_premultiply_alpha_ &&
video_premultiply_alpha_->isChecked() != vp.premultiplied_alpha()) ||
set_colorspace != vp.colorspace() ||
static_cast<VideoParams::Interlacing>(
video_interlace_combo_->currentIndex()) != vp.interlacing() ||
pixel_aspect_combo_->GetPixelAspectRatio() != vp.pixel_aspect_ratio() ||
pixel_aspect_combo_->get_pixel_aspect_ratio() != vp.pixel_aspect_ratio() ||
color_range_combo_->currentData().toInt() != vp.color_range()) {
parent->add_child(new VideoStreamChangeCommand(
footage_, video_index_,
@@ -164,30 +164,30 @@ void VideoStreamProperties::Accept(MultiUndoCommand *parent)
set_colorspace,
static_cast<VideoParams::Interlacing>(
video_interlace_combo_->currentIndex()),
pixel_aspect_combo_->GetPixelAspectRatio(),
pixel_aspect_combo_->get_pixel_aspect_ratio(),
static_cast<VideoParams::ColorRange>(
color_range_combo_->currentData().toInt())));
}
if (vp.video_type() == VideoParams::kVideoTypeImageSequence) {
if (vp.video_type() == VideoParams::k_video_type_image_sequence) {
int64_t new_dur =
imgseq_end_time_->GetValue() - imgseq_start_time_->GetValue() + 1;
imgseq_end_time_->get_value() - imgseq_start_time_->get_value() + 1;
if (vp.start_time() != imgseq_start_time_->GetValue() ||
if (vp.start_time() != imgseq_start_time_->get_value() ||
vp.duration() != new_dur ||
vp.frame_rate() != imgseq_frame_rate_->GetFrameRate()) {
vp.frame_rate() != imgseq_frame_rate_->get_frame_rate()) {
parent->add_child(new ImageSequenceChangeCommand(
footage_, video_index_, imgseq_start_time_->GetValue(), new_dur,
imgseq_frame_rate_->GetFrameRate()));
footage_, video_index_, imgseq_start_time_->get_value(), new_dur,
imgseq_frame_rate_->get_frame_rate()));
}
}
}
bool VideoStreamProperties::SanityCheck()
bool VideoStreamProperties::sanity_check()
{
if (footage_->GetVideoParams(video_index_).video_type() ==
VideoParams::kVideoTypeImageSequence) {
if (imgseq_start_time_->GetValue() >= imgseq_end_time_->GetValue()) {
if (footage_->get_video_params(video_index_).video_type() ==
VideoParams::k_video_type_image_sequence) {
if (imgseq_start_time_->get_value() >= imgseq_end_time_->get_value()) {
QMessageBox::critical(
this, tr("Invalid Configuration"),
tr("Image sequence end index must be a value higher than the start index."),
@@ -201,7 +201,7 @@ bool VideoStreamProperties::SanityCheck()
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(
Footage *footage, int video_index, bool premultiplied, QString colorspace,
VideoParams::Interlacing interlacing, const rational &pixel_ar,
VideoParams::Interlacing interlacing, const Rational &pixel_ar,
VideoParams::ColorRange range)
: footage_(footage)
, video_index_(video_index)
@@ -214,14 +214,14 @@ VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(
}
Project *
VideoStreamProperties::VideoStreamChangeCommand::GetRelevantProject() const
VideoStreamProperties::VideoStreamChangeCommand::get_relevant_project() const
{
return footage_->project();
}
void VideoStreamProperties::VideoStreamChangeCommand::redo()
{
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
old_premultiplied_ = vp.premultiplied_alpha();
old_colorspace_ = vp.colorspace();
@@ -235,12 +235,12 @@ void VideoStreamProperties::VideoStreamChangeCommand::redo()
vp.set_pixel_aspect_ratio(new_pixel_ar_);
vp.set_color_range(new_range_);
footage_->SetVideoParams(vp, video_index_);
footage_->set_video_params(vp, video_index_);
}
void VideoStreamProperties::VideoStreamChangeCommand::undo()
{
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
vp.set_premultiplied_alpha(old_premultiplied_);
vp.set_colorspace(old_colorspace_);
@@ -248,12 +248,12 @@ void VideoStreamProperties::VideoStreamChangeCommand::undo()
vp.set_pixel_aspect_ratio(old_pixel_ar_);
vp.set_color_range(old_range_);
footage_->SetVideoParams(vp, video_index_);
footage_->set_video_params(vp, video_index_);
}
VideoStreamProperties::ImageSequenceChangeCommand::ImageSequenceChangeCommand(
Footage *footage, int video_index, int64_t start_index, int64_t duration,
const rational &frame_rate)
const Rational &frame_rate)
: footage_(footage)
, video_index_(video_index)
, new_start_index_(start_index)
@@ -263,14 +263,14 @@ VideoStreamProperties::ImageSequenceChangeCommand::ImageSequenceChangeCommand(
}
Project *
VideoStreamProperties::ImageSequenceChangeCommand::GetRelevantProject() const
VideoStreamProperties::ImageSequenceChangeCommand::get_relevant_project() const
{
return footage_->project();
}
void VideoStreamProperties::ImageSequenceChangeCommand::redo()
{
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
old_start_index_ = vp.start_time();
vp.set_start_time(new_start_index_);
@@ -282,19 +282,19 @@ void VideoStreamProperties::ImageSequenceChangeCommand::redo()
vp.set_frame_rate(new_frame_rate_);
vp.set_time_base(new_frame_rate_.flipped());
footage_->SetVideoParams(vp, video_index_);
footage_->set_video_params(vp, video_index_);
}
void VideoStreamProperties::ImageSequenceChangeCommand::undo()
{
VideoParams vp = footage_->GetVideoParams(video_index_);
VideoParams vp = footage_->get_video_params(video_index_);
vp.set_start_time(old_start_index_);
vp.set_duration(old_duration_);
vp.set_frame_rate(old_frame_rate_);
vp.set_time_base(old_frame_rate_.flipped());
footage_->SetVideoParams(vp, video_index_);
footage_->set_video_params(vp, video_index_);
}
}
@@ -19,8 +19,8 @@
***/
#ifndef VIDEOSTREAMPROPERTIES_H
#define VIDEOSTREAMPROPERTIES_H
#ifndef OAK_VIDEOSTREAMPROPERTIES_H
#define OAK_VIDEOSTREAMPROPERTIES_H
#include <QCheckBox>
#include <QComboBox>
@@ -38,9 +38,9 @@ class VideoStreamProperties : public StreamProperties {
public:
VideoStreamProperties(Footage *footage, int video_index);
virtual void Accept(MultiUndoCommand *parent) override;
virtual void accept(MultiUndoCommand *parent) override;
virtual bool SanityCheck() override;
virtual bool sanity_check() override;
private:
Footage *footage_;
@@ -92,10 +92,10 @@ private:
VideoStreamChangeCommand(Footage *footage, int video_index,
bool premultiplied, QString colorspace,
VideoParams::Interlacing interlacing,
const rational &pixel_ar,
const Rational &pixel_ar,
VideoParams::ColorRange range);
virtual Project *GetRelevantProject() const override;
virtual Project *get_relevant_project() const override;
protected:
virtual void redo() override;
@@ -108,13 +108,13 @@ private:
bool new_premultiplied_;
QString new_colorspace_;
VideoParams::Interlacing new_interlacing_;
rational new_pixel_ar_;
Rational new_pixel_ar_;
VideoParams::ColorRange new_range_;
bool old_premultiplied_;
QString old_colorspace_;
VideoParams::Interlacing old_interlacing_;
rational old_pixel_ar_;
Rational old_pixel_ar_;
VideoParams::ColorRange old_range_;
};
@@ -122,9 +122,9 @@ private:
public:
ImageSequenceChangeCommand(Footage *footage, int video_index,
int64_t start_index, int64_t duration,
const rational &frame_rate);
const Rational &frame_rate);
virtual Project *GetRelevantProject() const override;
virtual Project *get_relevant_project() const override;
protected:
virtual void redo() override;
@@ -140,11 +140,11 @@ private:
int64_t new_duration_;
int64_t old_duration_;
rational new_frame_rate_;
rational old_frame_rate_;
Rational new_frame_rate_;
Rational old_frame_rate_;
};
};
}
#endif // VIDEOSTREAMPROPERTIES_H
#endif // OAK_VIDEOSTREAMPROPERTIES_H
@@ -69,11 +69,11 @@ FootageRelinkDialog::FootageRelinkDialog(const QVector<Footage *> &footage,
QPushButton *item_browse_btn = new QPushButton(tr("Browse"));
item_browse_btn->setProperty("index", i);
connect(item_browse_btn, &QPushButton::clicked, this,
&FootageRelinkDialog::BrowseForFootage);
&FootageRelinkDialog::browse_for_footage);
item_actions_layout->addWidget(item_browse_btn);
item->setIcon(0, f->data(Node::ICON).value<QIcon>());
item->setText(0, f->GetLabel());
item->setIcon(0, f->data(Node::icon).value<QIcon>());
item->setText(0, f->get_label());
item->setText(1, f->filename());
table_->addTopLevelItem(item);
@@ -94,15 +94,15 @@ FootageRelinkDialog::FootageRelinkDialog(const QVector<Footage *> &footage,
setWindowTitle(tr("Relink Footage"));
}
void FootageRelinkDialog::UpdateFootageItem(int index)
void FootageRelinkDialog::update_footage_item(int index)
{
Footage *f = footage_.at(index);
QTreeWidgetItem *item = table_->topLevelItem(index);
item->setIcon(0, f->data(Node::ICON).value<QIcon>());
item->setIcon(0, f->data(Node::icon).value<QIcon>());
item->setText(1, f->filename());
}
void FootageRelinkDialog::BrowseForFootage()
void FootageRelinkDialog::browse_for_footage()
{
int index = sender()->property("index").toInt();
Footage *f = footage_.at(index);
@@ -110,8 +110,8 @@ void FootageRelinkDialog::BrowseForFootage()
QFileInfo info(f->filename());
QString new_fn = QFileDialog::getOpenFileName(
this, tr("Relink \"%1\"").arg(f->GetLabel()), info.absolutePath(),
Core::FootageFileDialogFilter());
this, tr("Relink \"%1\"").arg(f->get_label()), info.absolutePath(),
Core::footage_file_dialog_filter());
// Originally, this function would attempt to filter to the exact filename of the missing file.
// However, this would break on Windows if the filename had any spaces in it. The reason is
@@ -124,7 +124,7 @@ void FootageRelinkDialog::BrowseForFootage()
// We received a new filename
if (!new_fn.isEmpty()) {
if (!Core::IsFootageExtensionAllowed(new_fn)) {
if (!Core::is_footage_extension_allowed(new_fn)) {
QMessageBox::warning(
this, tr("Unsupported media"),
tr("This file type is not allowed by the current media type "
@@ -142,17 +142,17 @@ void FootageRelinkDialog::BrowseForFootage()
// but otherwise we assume the user knows what they're doing here.
// Set footage to valid and update icon
f->SetValid();
f->set_valid();
// Update item visually
UpdateFootageItem(index);
update_footage_item(index);
// Check all other footage files for matches
for (int it = 0; it < footage_.size(); it++) {
Footage *other_footage = footage_.at(it);
// Ignore current footage file and footage that's already valid of course
if (index != it && !other_footage->IsValid()) {
if (index != it && !other_footage->is_valid()) {
// Get footage path relative to original directory
QString relative_to_original =
original_dir.relativeFilePath(other_footage->filename());
@@ -168,8 +168,8 @@ void FootageRelinkDialog::BrowseForFootage()
// Check if file exists
if (QFileInfo::exists(absolute_to_new)) {
other_footage->set_filename(absolute_to_new);
other_footage->SetValid();
UpdateFootageItem(it);
other_footage->set_valid();
update_footage_item(it);
}
}
}
@@ -179,7 +179,7 @@ void FootageRelinkDialog::BrowseForFootage()
// jump to that footage so the user knows where it is.
int next_invalid = -1;
for (int i = 0; i < footage_.size(); i++) {
if (!footage_.at(i)->IsValid()) {
if (!footage_.at(i)->is_valid()) {
next_invalid = i;
break;
}
@@ -19,8 +19,8 @@
***/
#ifndef FOOTAGERELINKDIALOG_H
#define FOOTAGERELINKDIALOG_H
#ifndef OAK_FOOTAGERELINKDIALOG_H
#define OAK_FOOTAGERELINKDIALOG_H
#include <QDialog>
#include <QTreeWidget>
@@ -37,16 +37,16 @@ public:
QWidget *parent = nullptr);
private:
void UpdateFootageItem(int index);
void update_footage_item(int index);
QTreeWidget *table_;
QVector<Footage *> footage_;
private slots:
void BrowseForFootage();
void browse_for_footage();
};
}
#endif // FOOTAGERELINKDIALOG_H
#endif // OAK_FOOTAGERELINKDIALOG_H
@@ -32,7 +32,7 @@ namespace olive
{
KeyframePropertiesDialog::KeyframePropertiesDialog(
const std::vector<NodeKeyframe *> &keys, const rational &timebase,
const std::vector<NodeKeyframe *> &keys, const Rational &timebase,
QWidget *parent)
: QDialog(parent)
, keys_(keys)
@@ -47,8 +47,8 @@ KeyframePropertiesDialog::KeyframePropertiesDialog(
layout->addWidget(new QLabel("Time:"), row, 0);
time_slider_ = new RationalSlider();
time_slider_->SetDisplayType(RationalSlider::kTime);
time_slider_->SetTimebase(timebase_);
time_slider_->set_display_type(RationalSlider::k_time);
time_slider_->set_timebase(timebase_);
layout->addWidget(time_slider_, row, 1);
row++;
@@ -57,7 +57,7 @@ KeyframePropertiesDialog::KeyframePropertiesDialog(
type_select_ = new QComboBox();
connect(type_select_, SIGNAL(currentIndexChanged(int)), this,
SLOT(KeyTypeChanged(int)));
SLOT(key_type_changed(int)));
layout->addWidget(type_select_, row, 1);
row++;
@@ -150,9 +150,9 @@ KeyframePropertiesDialog::KeyframePropertiesDialog(
}
if (all_same_time) {
time_slider_->SetValue(keys_.front()->time());
time_slider_->set_value(keys_.front()->time());
} else {
time_slider_->SetTristate();
time_slider_->set_tristate();
}
time_slider_->setEnabled(can_set_time);
@@ -162,12 +162,12 @@ KeyframePropertiesDialog::KeyframePropertiesDialog(
type_select_->addItem(QStringLiteral("--"), -1);
// Ensure UI updates for the index being 0
KeyTypeChanged(0);
key_type_changed(0);
}
type_select_->addItem(tr("Linear"), NodeKeyframe::kLinear);
type_select_->addItem(tr("Hold"), NodeKeyframe::kHold);
type_select_->addItem(tr("Bezier"), NodeKeyframe::kBezier);
type_select_->addItem(tr("Linear"), NodeKeyframe::k_linear);
type_select_->addItem(tr("Hold"), NodeKeyframe::k_hold);
type_select_->addItem(tr("Bezier"), NodeKeyframe::k_bezier);
if (all_same_type) {
// If all keyframes are the same type, set it here
@@ -176,19 +176,19 @@ KeyframePropertiesDialog::KeyframePropertiesDialog(
type_select_->setCurrentIndex(i);
// Ensure UI updates for this index
KeyTypeChanged(i);
key_type_changed(i);
break;
}
}
}
SetUpBezierSlider(bezier_in_x_slider_, all_same_bezier_in_x,
set_up_bezier_slider(bezier_in_x_slider_, all_same_bezier_in_x,
keys_.front()->bezier_control_in().x());
SetUpBezierSlider(bezier_in_y_slider_, all_same_bezier_in_y,
set_up_bezier_slider(bezier_in_y_slider_, all_same_bezier_in_y,
keys_.front()->bezier_control_in().y());
SetUpBezierSlider(bezier_out_x_slider_, all_same_bezier_out_x,
set_up_bezier_slider(bezier_out_x_slider_, all_same_bezier_out_x,
keys_.front()->bezier_control_out().x());
SetUpBezierSlider(bezier_out_y_slider_, all_same_bezier_out_y,
set_up_bezier_slider(bezier_out_y_slider_, all_same_bezier_out_y,
keys_.front()->bezier_control_out().y());
row++;
@@ -205,11 +205,11 @@ void KeyframePropertiesDialog::accept()
{
MultiUndoCommand *command = new MultiUndoCommand();
rational new_time = time_slider_->GetValue();
Rational new_time = time_slider_->get_value();
int new_type = type_select_->currentData().toInt();
foreach (NodeKeyframe *key, keys_) {
if (time_slider_->isEnabled() && !time_slider_->IsTristate()) {
if (time_slider_->isEnabled() && !time_slider_->is_tristate()) {
command->add_child(
new NodeParamSetKeyframeTimeCommand(key, new_time));
}
@@ -221,14 +221,14 @@ void KeyframePropertiesDialog::accept()
if (bezier_group_->isEnabled()) {
command->add_child(new KeyframeSetBezierControlPoint(
key, NodeKeyframe::kInHandle,
QPointF(bezier_in_x_slider_->GetValue(),
bezier_in_y_slider_->GetValue())));
key, NodeKeyframe::k_in_handle,
QPointF(bezier_in_x_slider_->get_value(),
bezier_in_y_slider_->get_value())));
command->add_child(new KeyframeSetBezierControlPoint(
key, NodeKeyframe::kOutHandle,
QPointF(bezier_out_x_slider_->GetValue(),
bezier_out_y_slider_->GetValue())));
key, NodeKeyframe::k_out_handle,
QPointF(bezier_out_x_slider_->get_value(),
bezier_out_y_slider_->get_value())));
}
}
@@ -238,20 +238,20 @@ void KeyframePropertiesDialog::accept()
QDialog::accept();
}
void KeyframePropertiesDialog::SetUpBezierSlider(FloatSlider *slider,
void KeyframePropertiesDialog::set_up_bezier_slider(FloatSlider *slider,
bool all_same, double value)
{
if (all_same) {
slider->SetValue(value);
slider->set_value(value);
} else {
slider->SetTristate();
slider->set_tristate();
}
}
void KeyframePropertiesDialog::KeyTypeChanged(int index)
void KeyframePropertiesDialog::key_type_changed(int index)
{
bezier_group_->setEnabled(type_select_->itemData(index) ==
NodeKeyframe::kBezier);
NodeKeyframe::k_bezier);
}
}
@@ -19,8 +19,8 @@
***/
#ifndef KEYFRAMEPROPERTIESDIALOG_H
#define KEYFRAMEPROPERTIESDIALOG_H
#ifndef OAK_KEYFRAMEPROPERTIESDIALOG_H
#define OAK_KEYFRAMEPROPERTIESDIALOG_H
#include <QComboBox>
#include <QDialog>
@@ -37,18 +37,18 @@ class KeyframePropertiesDialog : public QDialog {
Q_OBJECT
public:
KeyframePropertiesDialog(const std::vector<NodeKeyframe *> &keys,
const rational &timebase,
const Rational &timebase,
QWidget *parent = nullptr);
public slots:
virtual void accept() override;
private:
void SetUpBezierSlider(FloatSlider *slider, bool all_same, double value);
void set_up_bezier_slider(FloatSlider *slider, bool all_same, double value);
const std::vector<NodeKeyframe *> &keys_;
rational timebase_;
Rational timebase_;
RationalSlider *time_slider_;
@@ -65,9 +65,9 @@ private:
FloatSlider *bezier_out_y_slider_;
private slots:
void KeyTypeChanged(int index);
void key_type_changed(int index);
};
}
#endif // KEYFRAMEPROPERTIESDIALOG_H
#endif // OAK_KEYFRAMEPROPERTIESDIALOG_H
@@ -35,7 +35,7 @@ namespace olive
#define super QDialog
MarkerPropertiesDialog::MarkerPropertiesDialog(
const std::vector<TimelineMarker *> &markers, const rational &timebase,
const std::vector<TimelineMarker *> &markers, const Rational &timebase,
QWidget *parent)
: super(parent)
, markers_(markers)
@@ -64,18 +64,18 @@ MarkerPropertiesDialog::MarkerPropertiesDialog(
}
if (markers.size() == 1) {
in_slider_->SetValue(markers.front()->time().in());
in_slider_->SetDisplayType(RationalSlider::kTime);
in_slider_->SetTimebase(timebase);
out_slider_->SetValue(markers.front()->time().out());
out_slider_->SetDisplayType(RationalSlider::kTime);
out_slider_->SetTimebase(timebase);
in_slider_->set_value(markers.front()->time().in());
in_slider_->set_display_type(RationalSlider::k_time);
in_slider_->set_timebase(timebase);
out_slider_->set_value(markers.front()->time().out());
out_slider_->set_display_type(RationalSlider::k_time);
out_slider_->set_timebase(timebase);
} else {
// Markers cannot be on the same time, so we disable setting time if multiple markers are selected
in_slider_->setEnabled(false);
in_slider_->SetTristate();
in_slider_->set_tristate();
out_slider_->setEnabled(false);
out_slider_->SetTristate();
out_slider_->set_tristate();
}
layout->addWidget(time_group, row, 0, 1, 2);
@@ -87,10 +87,10 @@ MarkerPropertiesDialog::MarkerPropertiesDialog(
color_menu_ = new ColorCodingComboBox();
layout->addWidget(color_menu_, row, 1);
color_menu_->SetColor(markers.front()->color());
color_menu_->set_color(markers.front()->color());
for (size_t i = 1; i < markers.size(); i++) {
if (markers.at(i)->color() != color_menu_->GetSelectedColor()) {
color_menu_->SetColor(-1);
if (markers.at(i)->color() != color_menu_->get_selected_color()) {
color_menu_->set_color(-1);
break;
}
}
@@ -100,7 +100,7 @@ MarkerPropertiesDialog::MarkerPropertiesDialog(
layout->addWidget(new QLabel(tr("Name:")), row, 0);
label_edit_ = new LineEditWithFocusSignal();
connect(label_edit_, &LineEditWithFocusSignal::Focused, this,
connect(label_edit_, &LineEditWithFocusSignal::focused, this,
[this] { label_edit_->setPlaceholderText(QString()); });
layout->addWidget(label_edit_, row, 1);
@@ -131,7 +131,7 @@ MarkerPropertiesDialog::MarkerPropertiesDialog(
void MarkerPropertiesDialog::accept()
{
if (in_slider_->isEnabled() &&
in_slider_->GetValue() > out_slider_->GetValue()) {
in_slider_->get_value() > out_slider_->get_value()) {
QMessageBox::critical(
this, tr("Invalid Values"),
tr("In point must be less than or equal to out point."));
@@ -140,7 +140,7 @@ void MarkerPropertiesDialog::accept()
MultiUndoCommand *command = new MultiUndoCommand();
int color = color_menu_->GetSelectedColor();
int color = color_menu_->get_selected_color();
foreach (TimelineMarker *m, markers_) {
if (color != -1) {
@@ -156,7 +156,7 @@ void MarkerPropertiesDialog::accept()
if (markers_.size() == 1) {
command->add_child(new MarkerChangeTimeCommand(
markers_.front(),
TimeRange(in_slider_->GetValue(), out_slider_->GetValue())));
TimeRange(in_slider_->get_value(), out_slider_->get_value())));
}
Core::instance()->undo_stack()->push(command, tr("Set Marker Properties"));
@@ -19,8 +19,8 @@
***/
#ifndef MARKERPROPERTIESDIALOG_H
#define MARKERPROPERTIESDIALOG_H
#ifndef OAK_MARKERPROPERTIESDIALOG_H
#define OAK_MARKERPROPERTIESDIALOG_H
#include <QDialog>
#include <QLineEdit>
@@ -44,18 +44,18 @@ protected:
virtual void focusInEvent(QFocusEvent *e) override
{
QLineEdit::focusInEvent(e);
emit Focused();
emit focused();
}
signals:
void Focused();
void focused();
};
class MarkerPropertiesDialog : public QDialog {
Q_OBJECT
public:
MarkerPropertiesDialog(const std::vector<TimelineMarker *> &markers,
const rational &timebase, QWidget *parent = nullptr);
const Rational &timebase, QWidget *parent = nullptr);
public slots:
virtual void accept() override;
@@ -74,4 +74,4 @@ private:
}
#endif // MARKERPROPERTIESDIALOG_H
#endif // OAK_MARKERPROPERTIESDIALOG_H
@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OTIOPROPERTIESDIALOG_H
#define OTIOPROPERTIESDIALOG_H
#ifndef OAK_OTIOPROPERTIESDIALOG_H
#define OAK_OTIOPROPERTIESDIALOG_H
#include <QDialog>
#include <QTreeWidget>
@@ -56,4 +56,4 @@ private slots:
} //namespace olive
#endif // OTIOPROPERTIESDIALOG_H
#endif // OAK_OTIOPROPERTIESDIALOG_H
+7 -7
View File
@@ -31,31 +31,31 @@ namespace olive
KeySequenceEditor::KeySequenceEditor(QWidget *parent, QAction *a)
: super(parent)
, action(a)
, action_(a)
{
setKeySequence(action->shortcut());
setKeySequence(action_->shortcut());
}
void KeySequenceEditor::set_action_shortcut()
{
action->setShortcut(keySequence());
action_->setShortcut(keySequence());
}
void KeySequenceEditor::reset_to_default()
{
setKeySequence(action->property("keydefault").toString());
setKeySequence(action_->property("keydefault").toString());
}
QString KeySequenceEditor::action_name()
{
return action->property("id").toString();
return action_->property("id").toString();
}
QString KeySequenceEditor::export_shortcut()
{
QKeySequence ks = keySequence();
if (ks != action->property("keydefault").value<QKeySequence>()) {
return action->property("id").toString() + "\t" + ks.toString();
if (ks != action_->property("keydefault").value<QKeySequence>()) {
return action_->property("id").toString() + "\t" + ks.toString();
}
return nullptr;
}
+4 -4
View File
@@ -19,8 +19,8 @@
***/
#ifndef KEYSEQUENCEEDITOR_H
#define KEYSEQUENCEEDITOR_H
#ifndef OAK_KEYSEQUENCEEDITOR_H
#define OAK_KEYSEQUENCEEDITOR_H
#include <QKeySequenceEdit>
@@ -106,9 +106,9 @@ private:
/**
* @brief Internal reference to the linked QAction
*/
QAction *action;
QAction *action_;
};
}
#endif // KEYSEQUENCEEDITOR_H
#endif // OAK_KEYSEQUENCEEDITOR_H
+16 -16
View File
@@ -44,32 +44,32 @@ PreferencesDialog::PreferencesDialog(MainWindow *main_window, int start_tab)
{
setWindowTitle(tr("Preferences"));
AddTab(new PreferencesGeneralTab(), tr("General"));
AddTab(new PreferencesAppearanceTab(), tr("Appearance"));
AddTab(new PreferencesAudioTab(), tr("Audio"));
AddTab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::kCategoryTimeline),
add_tab(new PreferencesGeneralTab(), tr("General"));
add_tab(new PreferencesAppearanceTab(), tr("Appearance"));
add_tab(new PreferencesAudioTab(), tr("Audio"));
add_tab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::k_category_timeline),
tr("Timeline"));
AddTab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::kCategoryPlayback),
add_tab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::k_category_playback),
tr("Playback"));
AddTab(new PreferencesBehaviorTab(PreferencesBehaviorTab::kCategoryProject),
add_tab(new PreferencesBehaviorTab(PreferencesBehaviorTab::k_category_project),
tr("Project"));
AddTab(new PreferencesBehaviorTab(PreferencesBehaviorTab::kCategoryNodes),
add_tab(new PreferencesBehaviorTab(PreferencesBehaviorTab::k_category_nodes),
tr("Nodes"));
AddTab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::kCategoryRendering),
add_tab(
new PreferencesBehaviorTab(PreferencesBehaviorTab::k_category_rendering),
tr("Rendering"));
AddTab(new PreferencesDiskTab(), tr("Disk"));
AddTab(new PreferencesLutTab(), tr("LUT"));
AddTab(new PreferencesKeyboardTab(main_window), tr("Keyboard"));
add_tab(new PreferencesDiskTab(), tr("Disk"));
add_tab(new PreferencesLutTab(), tr("LUT"));
add_tab(new PreferencesKeyboardTab(main_window), tr("Keyboard"));
SetCurrentTab(start_tab);
set_current_tab(start_tab);
}
void PreferencesDialog::AcceptEvent()
{
Config::Save();
Config::save();
}
}
+3 -3
View File
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H
#ifndef OAK_PREFERENCESDIALOG_H
#define OAK_PREFERENCESDIALOG_H
#include <QCheckBox>
#include <QDialog>
@@ -53,4 +53,4 @@ protected:
}
#endif // PREFERENCESDIALOG_H
#endif // OAK_PREFERENCESDIALOG_H
@@ -52,7 +52,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
for (i = themes.cbegin(); i != themes.cend(); i++) {
style_combobox_->addItem(i.value(), i.key());
if (StyleManager::GetStyle() == i.key()) {
if (StyleManager::get_style() == i.key()) {
style_combobox_->setCurrentIndex(style_combobox_->count() - 1);
}
}
@@ -68,14 +68,14 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
QGridLayout *color_layout = new QGridLayout(color_group);
for (int i = 0; i < Node::kCategoryCount; i++) {
for (int i = 0; i < Node::k_category_count; i++) {
QString cat_name =
Node::GetCategoryName(static_cast<Node::CategoryID>(i));
Node::get_category_name(static_cast<Node::CategoryID>(i));
color_layout->addWidget(new QLabel(cat_name), i, 0);
ColorCodingComboBox *ccc = new ColorCodingComboBox();
ccc->SetColor(
OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)).toInt());
ccc->set_color(
OAK_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)).toInt());
color_layout->addWidget(ccc, i, 1);
color_btns_.append(ccc);
}
@@ -93,7 +93,7 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
marker_layout->addWidget(new QLabel("Default Marker Color"), 0, 0);
marker_btn_ = new ColorCodingComboBox();
marker_btn_->SetColor(OLIVE_CONFIG("MarkerColor").toInt());
marker_btn_->set_color(OAK_CONFIG("MarkerColor").toInt());
marker_layout->addWidget(marker_btn_, 0, 1);
appearance_layout->addWidget(marker_group, row, 0, 1, 2);
@@ -102,23 +102,23 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
layout->addStretch();
}
void PreferencesAppearanceTab::Accept(MultiUndoCommand *command)
void PreferencesAppearanceTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
QString style_path = style_combobox_->currentData().toString();
if (style_path != StyleManager::GetStyle()) {
StyleManager::SetStyle(style_path);
OLIVE_CONFIG("Style") = style_path;
if (style_path != StyleManager::get_style()) {
StyleManager::set_style(style_path);
OAK_CONFIG("Style") = style_path;
}
for (int i = 0; i < color_btns_.size(); i++) {
OLIVE_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)) =
color_btns_.at(i)->GetSelectedColor();
OAK_CONFIG_STR(QStringLiteral("CatColor%1").arg(i)) =
color_btns_.at(i)->get_selected_color();
}
OLIVE_CONFIG("MarkerColor") = marker_btn_->GetSelectedColor();
OAK_CONFIG("MarkerColor") = marker_btn_->get_selected_color();
}
}
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESAPPEARANCETAB_H
#define PREFERENCESAPPEARANCETAB_H
#ifndef OAK_PREFERENCESAPPEARANCETAB_H
#define OAK_PREFERENCESAPPEARANCETAB_H
#include <QComboBox>
#include <QLineEdit>
@@ -38,7 +38,7 @@ class PreferencesAppearanceTab : public ConfigDialogBaseTab {
public:
PreferencesAppearanceTab();
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private:
/**
@@ -53,4 +53,4 @@ private:
}
#endif // PREFERENCESAPPEARANCETAB_H
#endif // OAK_PREFERENCESAPPEARANCETAB_H
@@ -48,15 +48,15 @@ PreferencesAudioTab::PreferencesAudioTab()
connect(audio_backend_combobox_,
static_cast<void (QComboBox::*)(int)>(
&QComboBox::currentIndexChanged),
this, &PreferencesAudioTab::RefreshDevices);
this, &PreferencesAudioTab::refresh_devices);
main_layout->addWidget(audio_backend_combobox_, row, 1);
audio_tab_layout->addLayout(main_layout);
}
audio_scrubbing_ = new QCheckBox(
PreferencesBehaviorTab::BehaviorPrefTr("Enable audio scrubbing"));
audio_scrubbing_->setChecked(OLIVE_CONFIG("AudioScrubbing").toBool());
PreferencesBehaviorTab::behavior_pref_tr("Enable audio scrubbing"));
audio_scrubbing_->setChecked(OAK_CONFIG("AudioScrubbing").toBool());
audio_tab_layout->addWidget(audio_scrubbing_);
{
@@ -95,8 +95,8 @@ PreferencesAudioTab::PreferencesAudioTab()
output_row, 0);
output_rate_combo_ = new SampleRateComboBox();
output_rate_combo_->SetSampleRate(
OLIVE_CONFIG("AudioOutputSampleRate").toInt());
output_rate_combo_->set_sample_rate(
OAK_CONFIG("AudioOutputSampleRate").toInt());
output_param_layout->addWidget(output_rate_combo_, output_row,
1);
@@ -106,8 +106,8 @@ PreferencesAudioTab::PreferencesAudioTab()
new QLabel(tr("Channel Layout:")), output_row, 0);
output_ch_layout_combo_ = new ChannelLayoutComboBox();
output_ch_layout_combo_->SetChannelLayout(
OLIVE_CONFIG("AudioOutputChannelLayout").toULongLong());
output_ch_layout_combo_->set_channel_layout(
OAK_CONFIG("AudioOutputChannelLayout").toULongLong());
output_param_layout->addWidget(output_ch_layout_combo_,
output_row, 1);
@@ -117,9 +117,9 @@ PreferencesAudioTab::PreferencesAudioTab()
output_row, 0);
output_fmt_combo_ = new SampleFormatComboBox();
output_fmt_combo_->SetPackedFormats();
output_fmt_combo_->SetSampleFormat(SampleFormat::from_string(
OLIVE_CONFIG("AudioOutputSampleFormat")
output_fmt_combo_->set_packed_formats();
output_fmt_combo_->set_sample_format(SampleFormat::from_string(
OAK_CONFIG("AudioOutputSampleFormat")
.toString()
.toStdString()));
output_param_layout->addWidget(output_fmt_combo_, output_row,
@@ -154,32 +154,32 @@ PreferencesAudioTab::PreferencesAudioTab()
fmt_layout->addWidget(new QLabel(tr("Format:")));
record_format_combo_ =
new ExportFormatComboBox(ExportFormatComboBox::kShowAudioOnly);
new ExportFormatComboBox(ExportFormatComboBox::k_show_audio_only);
record_format_combo_->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
record_format_combo_->SetFormat(static_cast<ExportFormat::Format>(
OLIVE_CONFIG("AudioRecordingFormat").toInt()));
record_format_combo_->set_format(static_cast<ExportFormat::Format>(
OAK_CONFIG("AudioRecordingFormat").toInt()));
fmt_layout->addWidget(record_format_combo_);
record_options_ = new ExportAudioTab();
record_options_->SetFormat(record_format_combo_->GetFormat());
record_options_->SetCodec(static_cast<ExportCodec::Codec>(
OLIVE_CONFIG("AudioRecordingCodec").toInt()));
record_options_->sample_rate_combobox()->SetSampleRate(
OLIVE_CONFIG("AudioRecordingSampleRate").toInt());
record_options_->channel_layout_combobox()->SetChannelLayout(
OLIVE_CONFIG("AudioRecordingChannelLayout").toULongLong());
record_options_->bit_rate_slider()->SetValue(
OLIVE_CONFIG("AudioRecordingBitRate").toInt());
record_options_->sample_format_combobox()->SetSampleFormat(
record_options_->set_format(record_format_combo_->get_format());
record_options_->set_codec(static_cast<ExportCodec::Codec>(
OAK_CONFIG("AudioRecordingCodec").toInt()));
record_options_->sample_rate_combobox()->set_sample_rate(
OAK_CONFIG("AudioRecordingSampleRate").toInt());
record_options_->channel_layout_combobox()->set_channel_layout(
OAK_CONFIG("AudioRecordingChannelLayout").toULongLong());
record_options_->bit_rate_slider()->set_value(
OAK_CONFIG("AudioRecordingBitRate").toInt());
record_options_->sample_format_combobox()->set_sample_format(
SampleFormat::from_string(
OLIVE_CONFIG("AudioRecordingSampleFormat")
OAK_CONFIG("AudioRecordingSampleFormat")
.toString()
.toStdString()));
recording_layout->addWidget(record_options_);
connect(record_format_combo_, &ExportFormatComboBox::FormatChanged,
record_options_, &ExportAudioTab::SetFormat);
connect(record_format_combo_, &ExportFormatComboBox::format_changed,
record_options_, &ExportAudioTab::set_format);
}
QHBoxLayout *refresh_layout = new QHBoxLayout();
@@ -190,16 +190,16 @@ PreferencesAudioTab::PreferencesAudioTab()
refresh_layout->addWidget(refresh_devices_btn_);
connect(refresh_devices_btn_, &QPushButton::clicked, this,
&PreferencesAudioTab::HardRefreshBackends);
&PreferencesAudioTab::hard_refresh_backends);
}
audio_tab_layout->addStretch();
// Populate lists
RefreshBackends();
refresh_backends();
}
void PreferencesAudioTab::Accept(MultiUndoCommand *command)
void PreferencesAudioTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
@@ -210,38 +210,38 @@ void PreferencesAudioTab::Accept(MultiUndoCommand *command)
audio_input_devices_->currentData().value<PaDeviceIndex>();
// Get device names, which seem to be the closest thing we have to a "unique identifier" for them
OLIVE_CONFIG("AudioOutput") = audio_output_devices_->currentText();
OLIVE_CONFIG("AudioInput") = audio_input_devices_->currentText();
OAK_CONFIG("AudioOutput") = audio_output_devices_->currentText();
OAK_CONFIG("AudioInput") = audio_input_devices_->currentText();
// Set devices to be used from now on
AudioManager::instance()->SetOutputDevice(output_device);
AudioManager::instance()->SetInputDevice(input_device);
AudioManager::instance()->set_output_device(output_device);
AudioManager::instance()->set_input_device(input_device);
OLIVE_CONFIG("AudioOutputSampleRate") = output_rate_combo_->GetSampleRate();
OLIVE_CONFIG("AudioOutputChannelLayout") =
QVariant::fromValue(output_ch_layout_combo_->GetChannelLayout());
OLIVE_CONFIG("AudioOutputSampleFormat") = QString::fromStdString(
output_fmt_combo_->GetSampleFormat().to_string());
OAK_CONFIG("AudioOutputSampleRate") = output_rate_combo_->get_sample_rate();
OAK_CONFIG("AudioOutputChannelLayout") =
QVariant::fromValue(output_ch_layout_combo_->get_channel_layout());
OAK_CONFIG("AudioOutputSampleFormat") = QString::fromStdString(
output_fmt_combo_->get_sample_format().to_string());
OLIVE_CONFIG("AudioRecordingFormat") = record_format_combo_->GetFormat();
OLIVE_CONFIG("AudioRecordingCodec") = record_options_->GetCodec();
OLIVE_CONFIG("AudioRecordingSampleRate") =
record_options_->sample_rate_combobox()->GetSampleRate();
OLIVE_CONFIG("AudioRecordingChannelLayout") = QVariant::fromValue(
record_options_->channel_layout_combobox()->GetChannelLayout());
OLIVE_CONFIG("AudioRecordingBitRate") =
QVariant::fromValue(record_options_->bit_rate_slider()->GetValue());
OLIVE_CONFIG("AudioRecordingSampleFormat") =
OAK_CONFIG("AudioRecordingFormat") = record_format_combo_->get_format();
OAK_CONFIG("AudioRecordingCodec") = record_options_->get_codec();
OAK_CONFIG("AudioRecordingSampleRate") =
record_options_->sample_rate_combobox()->get_sample_rate();
OAK_CONFIG("AudioRecordingChannelLayout") = QVariant::fromValue(
record_options_->channel_layout_combobox()->get_channel_layout());
OAK_CONFIG("AudioRecordingBitRate") =
QVariant::fromValue(record_options_->bit_rate_slider()->get_value());
OAK_CONFIG("AudioRecordingSampleFormat") =
QString::fromStdString(record_options_->sample_format_combobox()
->GetSampleFormat()
->get_sample_format()
.to_string());
emit AudioManager::instance() -> OutputParamsChanged();
emit AudioManager::instance() -> output_params_changed();
OLIVE_CONFIG("AudioScrubbing") = audio_scrubbing_->isChecked();
OAK_CONFIG("AudioScrubbing") = audio_scrubbing_->isChecked();
}
void PreferencesAudioTab::RefreshBackends()
void PreferencesAudioTab::refresh_backends()
{
audio_backend_combobox_->clear();
for (PaHostApiIndex i = 0, end = Pa_GetHostApiCount(); i < end; i++) {
@@ -250,12 +250,12 @@ void PreferencesAudioTab::RefreshBackends()
audio_backend_combobox_->addItem(info->name);
}
RefreshDevices();
refresh_devices();
AttemptToSetDevicesFromConfig();
attempt_to_set_devices_from_config();
}
void PreferencesAudioTab::RefreshDevices()
void PreferencesAudioTab::refresh_devices()
{
if (audio_backend_combobox_->count() == 0) {
return;
@@ -282,19 +282,19 @@ void PreferencesAudioTab::RefreshDevices()
}
}
void PreferencesAudioTab::HardRefreshBackends()
void PreferencesAudioTab::hard_refresh_backends()
{
AudioManager::instance()->HardReset();
RefreshBackends();
AudioManager::instance()->hard_reset();
refresh_backends();
}
void PreferencesAudioTab::AttemptToSetDevicesFromConfig()
void PreferencesAudioTab::attempt_to_set_devices_from_config()
{
// Load with currently active devices
PaDeviceIndex current_output_index =
AudioManager::instance()->GetOutputDevice();
AudioManager::instance()->get_output_device();
PaDeviceIndex current_input_index =
AudioManager::instance()->GetInputDevice();
AudioManager::instance()->get_input_device();
const PaDeviceInfo *current_output = nullptr, *current_input = nullptr;
if (current_output_index != paNoDevice) {
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESAUDIOTAB_H
#define PREFERENCESAUDIOTAB_H
#ifndef OAK_PREFERENCESAUDIOTAB_H
#define OAK_PREFERENCESAUDIOTAB_H
#include <QComboBox>
#include <QPushButton>
@@ -39,7 +39,7 @@ class PreferencesAudioTab : public ConfigDialogBaseTab {
public:
PreferencesAudioTab();
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private:
QComboBox *audio_backend_combobox_;
@@ -75,15 +75,15 @@ private:
QCheckBox *audio_scrubbing_;
private slots:
void RefreshBackends();
void refresh_backends();
void RefreshDevices();
void refresh_devices();
void HardRefreshBackends();
void hard_refresh_backends();
void AttemptToSetDevicesFromConfig();
void attempt_to_set_devices_from_config();
};
}
#endif // PREFERENCESAUDIOTAB_H
#endif // OAK_PREFERENCESAUDIOTAB_H
@@ -36,8 +36,8 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
layout->setAlignment(Qt::AlignTop);
switch (category_) {
case kCategoryTimeline:
AddItems({
case k_category_timeline:
add_items({
{ tr("Auto-Seek to Imported Clips"),
QStringLiteral("EnableSeekToImport") },
{ tr("Edit Tool Also Seeks"), QStringLiteral("EditToolAlsoSeeks") },
@@ -54,8 +54,8 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
});
break;
case kCategoryPlayback:
AddItems({
case k_category_playback:
add_items({
{ tr("Ask For Name When Setting Marker"),
QStringLiteral("SetNameWithMarker") },
{ tr("Automatically rewind at the end of a sequence"),
@@ -63,13 +63,13 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
});
break;
case kCategoryProject:
AddItem(tr("Drop Files on Media to Replace"),
case k_category_project:
add_item(tr("Drop Files on Media to Replace"),
QStringLiteral("DropFileOnMediaToReplace"));
break;
case kCategoryNodes:
AddItems({
case k_category_nodes:
add_items({
{ tr("Add Default Effects to New Clips"),
QStringLiteral("AddDefaultEffectsToClips") },
{ tr("Auto-Scale By Default"),
@@ -82,7 +82,7 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
});
break;
case kCategoryRendering: {
case k_category_rendering: {
QLabel *backend_label = new QLabel(tr("Graphics Backend"));
backend_label->setToolTip(
tr("Selects the graphics API Oak should request on next launch. "
@@ -96,7 +96,7 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
graphics_backend_combobox_->addItem(tr("Vulkan (experimental)"),
QStringLiteral("vulkan"));
const QString current_backend =
OLIVE_CONFIG("GraphicsBackend").toString().toLower();
OAK_CONFIG("GraphicsBackend").toString().toLower();
const int backend_index = graphics_backend_combobox_->findData(
current_backend.isEmpty() ? QStringLiteral("opengl") :
current_backend);
@@ -108,40 +108,40 @@ PreferencesBehaviorTab::PreferencesBehaviorTab(Category category)
backend_layout->addWidget(graphics_backend_combobox_, 1);
layout->addLayout(backend_layout);
AddItem(tr("Use glFinish"), QStringLiteral("UseGLFinish"));
add_item(tr("Use glFinish"), QStringLiteral("UseGLFinish"));
break;
}
}
}
void PreferencesBehaviorTab::Accept(MultiUndoCommand *command)
void PreferencesBehaviorTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
for (auto it = config_map_.cbegin(); it != config_map_.cend(); ++it) {
OLIVE_CONFIG_STR(it.value()) = it.key()->isChecked();
OAK_CONFIG_STR(it.value()) = it.key()->isChecked();
}
if (graphics_backend_combobox_) {
OLIVE_CONFIG("GraphicsBackend") =
OAK_CONFIG("GraphicsBackend") =
graphics_backend_combobox_->currentData().toString();
}
}
void PreferencesBehaviorTab::AddItems(const QVector<Item> &items)
void PreferencesBehaviorTab::add_items(const QVector<Item> &items)
{
for (const Item &i : items) {
AddItem(i.text, i.config_key, i.tooltip);
add_item(i.text, i.config_key, i.tooltip);
}
}
QCheckBox *PreferencesBehaviorTab::AddItem(const QString &text,
QCheckBox *PreferencesBehaviorTab::add_item(const QString &text,
const QString &config_key,
const QString &tooltip)
{
QCheckBox *checkbox = new QCheckBox(text);
checkbox->setToolTip(tooltip);
checkbox->setChecked(OLIVE_CONFIG_STR(config_key).toBool());
checkbox->setChecked(OAK_CONFIG_STR(config_key).toBool());
config_map_.insert(checkbox, config_key);
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESBEHAVIORTAB_H
#define PREFERENCESBEHAVIORTAB_H
#ifndef OAK_PREFERENCESBEHAVIORTAB_H
#define OAK_PREFERENCESBEHAVIORTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -36,18 +36,18 @@ class PreferencesBehaviorTab : public ConfigDialogBaseTab {
Q_OBJECT
public:
enum Category {
kCategoryTimeline,
kCategoryPlayback,
kCategoryProject,
kCategoryNodes,
kCategoryRendering
k_category_timeline,
k_category_playback,
k_category_project,
k_category_nodes,
k_category_rendering
};
PreferencesBehaviorTab(Category category);
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
static QString BehaviorPrefTr(const char *text)
static QString behavior_pref_tr(const char *text)
{
return QCoreApplication::translate("olive::PreferencesBehaviorTab",
text);
@@ -60,8 +60,8 @@ private:
QString tooltip = QString();
};
void AddItems(const QVector<Item> &items);
QCheckBox *AddItem(const QString &text, const QString &config_key,
void add_items(const QVector<Item> &items);
QCheckBox *add_item(const QString &text, const QString &config_key,
const QString &tooltip = QString());
QMap<QCheckBox *, QString> config_map_;
@@ -73,4 +73,4 @@ private:
}
#endif // PREFERENCESBEHAVIORTAB_H
#endif // OAK_PREFERENCESBEHAVIORTAB_H
@@ -38,7 +38,7 @@ PreferencesDiskTab::PreferencesDiskTab()
{
// Get default disk cache folder
default_disk_cache_folder_ =
DiskManager::instance()->GetDefaultCacheFolder();
DiskManager::instance()->get_default_cache_folder();
QVBoxLayout *outer_layout = new QVBoxLayout(this);
@@ -54,7 +54,7 @@ PreferencesDiskTab::PreferencesDiskTab()
row, 0);
disk_cache_location_ =
new PathWidget(default_disk_cache_folder_->GetPath());
new PathWidget(default_disk_cache_folder_->get_path());
disk_management_layout->addWidget(disk_cache_location_, row, 1);
row++;
@@ -62,7 +62,7 @@ PreferencesDiskTab::PreferencesDiskTab()
QPushButton *disk_cache_settings_btn =
new QPushButton(tr("Disk Cache Settings"));
connect(disk_cache_settings_btn, &QPushButton::clicked, this, [this]() {
DiskManager::instance()->ShowDiskCacheSettingsDialog(
DiskManager::instance()->show_disk_cache_settings_dialog(
disk_cache_location_->text(), this);
});
disk_management_layout->addWidget(disk_cache_settings_btn, row, 1);
@@ -78,19 +78,19 @@ PreferencesDiskTab::PreferencesDiskTab()
cache_behavior_layout->addWidget(new QLabel(tr("Cache Ahead:")), row, 0);
cache_ahead_slider_ = new FloatSlider();
cache_ahead_slider_->SetFormat(tr("%1 seconds"));
cache_ahead_slider_->SetMinimum(0);
cache_ahead_slider_->SetValue(
OLIVE_CONFIG("DiskCacheAhead").value<rational>().toDouble());
cache_ahead_slider_->set_format(tr("%1 seconds"));
cache_ahead_slider_->set_minimum(0);
cache_ahead_slider_->set_value(
OAK_CONFIG("DiskCacheAhead").value<Rational>().to_double());
cache_behavior_layout->addWidget(cache_ahead_slider_, row, 1);
cache_behavior_layout->addWidget(new QLabel(tr("Cache Behind:")), row, 2);
cache_behind_slider_ = new FloatSlider();
cache_behind_slider_->SetMinimum(0);
cache_behind_slider_->SetFormat(tr("%1 seconds"));
cache_behind_slider_->SetValue(
OLIVE_CONFIG("DiskCacheBehind").value<rational>().toDouble());
cache_behind_slider_->set_minimum(0);
cache_behind_slider_->set_format(tr("%1 seconds"));
cache_behind_slider_->set_value(
OAK_CONFIG("DiskCacheBehind").value<Rational>().to_double());
cache_behavior_layout->addWidget(cache_behind_slider_, row, 3);
row++;
@@ -103,25 +103,25 @@ PreferencesDiskTab::PreferencesDiskTab()
proxy_layout->addWidget(new QLabel(tr("Proxy Width:")), proxy_row, 0);
proxy_width_slider_ = new IntegerSlider();
proxy_width_slider_->SetMinimum(160);
proxy_width_slider_->SetMaximum(4096);
proxy_width_slider_->SetValue(OLIVE_CONFIG("ProxyWidth").value<int>());
proxy_width_slider_->set_minimum(160);
proxy_width_slider_->set_maximum(4096);
proxy_width_slider_->set_value(OAK_CONFIG("ProxyWidth").value<int>());
proxy_layout->addWidget(proxy_width_slider_, proxy_row, 1);
proxy_layout->addWidget(new QLabel(tr("Proxy Height:")), proxy_row, 2);
proxy_height_slider_ = new IntegerSlider();
proxy_height_slider_->SetMinimum(120);
proxy_height_slider_->SetMaximum(2160);
proxy_height_slider_->SetValue(OLIVE_CONFIG("ProxyHeight").value<int>());
proxy_height_slider_->set_minimum(120);
proxy_height_slider_->set_maximum(2160);
proxy_height_slider_->set_value(OAK_CONFIG("ProxyHeight").value<int>());
proxy_layout->addWidget(proxy_height_slider_, proxy_row, 3);
proxy_row++;
proxy_layout->addWidget(new QLabel(tr("Proxy CRF:")), proxy_row, 0);
proxy_crf_slider_ = new IntegerSlider();
proxy_crf_slider_->SetMinimum(0);
proxy_crf_slider_->SetMaximum(51);
proxy_crf_slider_->SetValue(OLIVE_CONFIG("ProxyCRF").value<int>());
proxy_crf_slider_->set_minimum(0);
proxy_crf_slider_->set_maximum(51);
proxy_crf_slider_->set_value(OAK_CONFIG("ProxyCRF").value<int>());
proxy_layout->addWidget(proxy_crf_slider_, proxy_row, 1);
proxy_layout->addWidget(new QLabel(tr("Proxy Preset:")), proxy_row, 2);
@@ -136,7 +136,7 @@ PreferencesDiskTab::PreferencesDiskTab()
for (const QString &preset : presets) {
proxy_preset_combo_->addItem(preset);
}
proxy_preset_combo_->setCurrentText(OLIVE_CONFIG("ProxyPreset").toString());
proxy_preset_combo_->setCurrentText(OAK_CONFIG("ProxyPreset").toString());
proxy_layout->addWidget(proxy_preset_combo_, proxy_row, 3);
proxy_row++;
@@ -144,7 +144,7 @@ PreferencesDiskTab::PreferencesDiskTab()
proxy_include_audio_checkbox_ =
new QCheckBox(tr("Include audio in proxies"));
proxy_include_audio_checkbox_->setChecked(
OLIVE_CONFIG("ProxyIncludeAudio").toBool());
OAK_CONFIG("ProxyIncludeAudio").toBool());
proxy_layout->addWidget(proxy_include_audio_checkbox_, proxy_row, 0, 1, 2);
proxy_row++;
@@ -152,7 +152,7 @@ PreferencesDiskTab::PreferencesDiskTab()
proxy_layout->addWidget(new QLabel(tr("ffmpeg Executable:")), proxy_row,
0);
proxy_ffmpeg_path_edit_ =
new QLineEdit(OLIVE_CONFIG("FFmpegPath").toString());
new QLineEdit(OAK_CONFIG("FFmpegPath").toString());
proxy_ffmpeg_path_edit_->setPlaceholderText(tr("Auto-detect"));
proxy_layout->addWidget(proxy_ffmpeg_path_edit_, proxy_row, 1);
@@ -169,18 +169,18 @@ PreferencesDiskTab::PreferencesDiskTab()
outer_layout->addStretch();
}
bool PreferencesDiskTab::Validate()
bool PreferencesDiskTab::validate()
{
if (disk_cache_location_->text() != default_disk_cache_folder_->GetPath()) {
if (disk_cache_location_->text() != default_disk_cache_folder_->get_path()) {
// Disk cache location is changing
// Check if the user is okay with invalidating the current cache
if (!DiskManager::ShowDiskCacheChangeConfirmationDialog(this)) {
if (!DiskManager::show_disk_cache_change_confirmation_dialog(this)) {
return false;
}
// Check validity of the new path
if (!FileFunctions::DirectoryIsValid(disk_cache_location_->text())) {
if (!FileFunctions::directory_is_valid(disk_cache_location_->text())) {
QMessageBox::critical(
this, tr("Disk Cache"),
tr("Failed to set disk cache location. Access was denied."));
@@ -191,28 +191,28 @@ bool PreferencesDiskTab::Validate()
return true;
}
void PreferencesDiskTab::Accept(MultiUndoCommand *command)
void PreferencesDiskTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
if (disk_cache_location_->text() != default_disk_cache_folder_->GetPath()) {
default_disk_cache_folder_->SetPath(disk_cache_location_->text());
if (disk_cache_location_->text() != default_disk_cache_folder_->get_path()) {
default_disk_cache_folder_->set_path(disk_cache_location_->text());
}
OLIVE_CONFIG("DiskCacheBehind") = QVariant::fromValue(
rational::fromDouble(cache_behind_slider_->GetValue()));
OLIVE_CONFIG("DiskCacheAhead") = QVariant::fromValue(
rational::fromDouble(cache_ahead_slider_->GetValue()));
OAK_CONFIG("DiskCacheBehind") = QVariant::fromValue(
Rational::from_double(cache_behind_slider_->get_value()));
OAK_CONFIG("DiskCacheAhead") = QVariant::fromValue(
Rational::from_double(cache_ahead_slider_->get_value()));
OLIVE_CONFIG("ProxyWidth") =
static_cast<int>(proxy_width_slider_->GetValue());
OLIVE_CONFIG("ProxyHeight") =
static_cast<int>(proxy_height_slider_->GetValue());
OLIVE_CONFIG("ProxyCRF") = static_cast<int>(proxy_crf_slider_->GetValue());
OLIVE_CONFIG("ProxyPreset") = proxy_preset_combo_->currentText();
OLIVE_CONFIG("ProxyIncludeAudio") =
OAK_CONFIG("ProxyWidth") =
static_cast<int>(proxy_width_slider_->get_value());
OAK_CONFIG("ProxyHeight") =
static_cast<int>(proxy_height_slider_->get_value());
OAK_CONFIG("ProxyCRF") = static_cast<int>(proxy_crf_slider_->get_value());
OAK_CONFIG("ProxyPreset") = proxy_preset_combo_->currentText();
OAK_CONFIG("ProxyIncludeAudio") =
proxy_include_audio_checkbox_->isChecked();
OLIVE_CONFIG("FFmpegPath") = proxy_ffmpeg_path_edit_->text().trimmed();
OAK_CONFIG("FFmpegPath") = proxy_ffmpeg_path_edit_->text().trimmed();
}
}
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESDISKTAB_H
#define PREFERENCESDISKTAB_H
#ifndef OAK_PREFERENCESDISKTAB_H
#define OAK_PREFERENCESDISKTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -41,9 +41,9 @@ class PreferencesDiskTab : public ConfigDialogBaseTab {
public:
PreferencesDiskTab();
virtual bool Validate() override;
virtual bool validate() override;
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private:
PathWidget *disk_cache_location_;
@@ -64,4 +64,4 @@ private:
}
#endif // PREFERENCESDISKTAB_H
#endif // OAK_PREFERENCESDISKTAB_H
@@ -53,10 +53,10 @@ PreferencesGeneralTab::PreferencesGeneralTab()
QDir language_dir(QStringLiteral(":/ts"));
QStringList languages = language_dir.entryList();
foreach (const QString &l, languages) {
AddLanguage(l);
add_language(l);
}
QString current_language = OLIVE_CONFIG("Language").toString();
QString current_language = OAK_CONFIG("Language").toString();
if (current_language.isEmpty()) {
// No configured language, use system language
current_language = QLocale::system().name();
@@ -86,11 +86,11 @@ PreferencesGeneralTab::PreferencesGeneralTab()
// ComboBox indices match enum indices
autoscroll_method_ = new QComboBox();
autoscroll_method_->addItem(tr("None"), AutoScroll::kNone);
autoscroll_method_->addItem(tr("Page Scrolling"), AutoScroll::kPage);
autoscroll_method_->addItem(tr("None"), AutoScroll::k_none);
autoscroll_method_->addItem(tr("Page Scrolling"), AutoScroll::k_page);
autoscroll_method_->addItem(tr("Smooth Scrolling"),
AutoScroll::kSmooth);
autoscroll_method_->setCurrentIndex(OLIVE_CONFIG("Autoscroll").toInt());
AutoScroll::k_smooth);
autoscroll_method_->setCurrentIndex(OAK_CONFIG("Autoscroll").toInt());
timeline_layout->addWidget(autoscroll_method_, row, 1);
row++;
@@ -100,7 +100,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
rectified_waveforms_ = new QCheckBox();
rectified_waveforms_->setChecked(
OLIVE_CONFIG("RectifiedWaveforms").toBool());
OAK_CONFIG("RectifiedWaveforms").toBool());
timeline_layout->addWidget(rectified_waveforms_, row, 1);
row++;
@@ -109,11 +109,11 @@ PreferencesGeneralTab::PreferencesGeneralTab()
new QLabel(tr("Default Still Image Length:")), row, 0);
default_still_length_ = new RationalSlider();
default_still_length_->SetMinimum(rational(100, 1000));
default_still_length_->SetTimebase(rational(100, 1000));
default_still_length_->SetFormat(tr("%1 seconds"));
default_still_length_->SetValue(
OLIVE_CONFIG("DefaultStillLength").value<rational>());
default_still_length_->set_minimum(Rational(100, 1000));
default_still_length_->set_timebase(Rational(100, 1000));
default_still_length_->set_format(tr("%1 seconds"));
default_still_length_->set_value(
OAK_CONFIG("DefaultStillLength").value<Rational>());
timeline_layout->addWidget(default_still_length_);
}
@@ -130,7 +130,7 @@ PreferencesGeneralTab::PreferencesGeneralTab()
autorecovery_enabled_ = new QCheckBox();
autorecovery_enabled_->setChecked(
OLIVE_CONFIG("AutorecoveryEnabled").toBool());
OAK_CONFIG("AutorecoveryEnabled").toBool());
autorecovery_layout->addWidget(autorecovery_enabled_, row, 1);
row++;
@@ -139,12 +139,12 @@ PreferencesGeneralTab::PreferencesGeneralTab()
new QLabel(tr("Auto-Recovery Interval:")), row, 0);
autorecovery_interval_ = new IntegerSlider();
autorecovery_interval_->SetMinimum(1);
autorecovery_interval_->SetMaximum(60);
autorecovery_interval_->SetFormat(
autorecovery_interval_->set_minimum(1);
autorecovery_interval_->set_maximum(60);
autorecovery_interval_->set_format(
QT_TRANSLATE_N_NOOP("olive::SliderBase", "%n minute(s)"), true);
autorecovery_interval_->SetValue(
OLIVE_CONFIG("AutorecoveryInterval").toLongLong());
autorecovery_interval_->set_value(
OAK_CONFIG("AutorecoveryInterval").toLongLong());
autorecovery_layout->addWidget(autorecovery_interval_, row, 1);
row++;
@@ -153,10 +153,10 @@ PreferencesGeneralTab::PreferencesGeneralTab()
new QLabel(tr("Maximum Versions Per Project:")), row, 0);
autorecovery_maximum_ = new IntegerSlider();
autorecovery_maximum_->SetMinimum(1);
autorecovery_maximum_->SetMaximum(1000);
autorecovery_maximum_->SetValue(
OLIVE_CONFIG("AutorecoveryMaximum").toLongLong());
autorecovery_maximum_->set_minimum(1);
autorecovery_maximum_->set_maximum(1000);
autorecovery_maximum_->set_value(
OAK_CONFIG("AutorecoveryMaximum").toLongLong());
autorecovery_layout->addWidget(autorecovery_maximum_, row, 1);
row++;
@@ -164,50 +164,50 @@ PreferencesGeneralTab::PreferencesGeneralTab()
QPushButton *browse_autorecoveries =
new QPushButton(tr("Browse Auto-Recoveries"));
connect(browse_autorecoveries, &QPushButton::clicked, Core::instance(),
&Core::BrowseAutoRecoveries);
&Core::browse_auto_recoveries);
autorecovery_layout->addWidget(browse_autorecoveries, row, 1);
}
{
QGroupBox *behavior_groupbox =
new QGroupBox(PreferencesBehaviorTab::BehaviorPrefTr("Behavior"));
new QGroupBox(PreferencesBehaviorTab::behavior_pref_tr("Behavior"));
QVBoxLayout *behavior_layout = new QVBoxLayout(behavior_groupbox);
layout->addWidget(behavior_groupbox);
hover_focus_ = new QCheckBox(
PreferencesBehaviorTab::BehaviorPrefTr("Enable hover focus"));
hover_focus_->setToolTip(PreferencesBehaviorTab::BehaviorPrefTr(
PreferencesBehaviorTab::behavior_pref_tr("Enable hover focus"));
hover_focus_->setToolTip(PreferencesBehaviorTab::behavior_pref_tr(
"Panels will be considered focused when the mouse cursor is over them without having to click them."));
hover_focus_->setChecked(OLIVE_CONFIG("HoverFocus").toBool());
hover_focus_->setChecked(OAK_CONFIG("HoverFocus").toBool());
behavior_layout->addWidget(hover_focus_);
slider_ladder_ = new QCheckBox(
PreferencesBehaviorTab::BehaviorPrefTr("Enable slider ladder"));
slider_ladder_->setChecked(OLIVE_CONFIG("UseSliderLadders").toBool());
PreferencesBehaviorTab::behavior_pref_tr("Enable slider ladder"));
slider_ladder_->setChecked(OAK_CONFIG("UseSliderLadders").toBool());
behavior_layout->addWidget(slider_ladder_);
scroll_zooms_ = new QCheckBox(PreferencesBehaviorTab::BehaviorPrefTr(
scroll_zooms_ = new QCheckBox(PreferencesBehaviorTab::behavior_pref_tr(
"Scrolling zooms by default"));
scroll_zooms_->setToolTip(PreferencesBehaviorTab::BehaviorPrefTr(
scroll_zooms_->setToolTip(PreferencesBehaviorTab::behavior_pref_tr(
"By default, scrolling will move the view around, and holding Ctrl/Cmd will make it zoom instead. "
"Enabling this will switch those, scrolling will zoom by default, and holding Ctrl/Cmd will move the view instead."));
scroll_zooms_->setChecked(OLIVE_CONFIG("ScrollZooms").toBool());
scroll_zooms_->setChecked(OAK_CONFIG("ScrollZooms").toBool());
behavior_layout->addWidget(scroll_zooms_);
}
layout->addStretch();
}
void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
void PreferencesGeneralTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
OLIVE_CONFIG("RectifiedWaveforms") = rectified_waveforms_->isChecked();
OAK_CONFIG("RectifiedWaveforms") = rectified_waveforms_->isChecked();
OLIVE_CONFIG("Autoscroll") = autoscroll_method_->currentData();
OAK_CONFIG("Autoscroll") = autoscroll_method_->currentData();
OLIVE_CONFIG("DefaultStillLength") =
QVariant::fromValue(default_still_length_->GetValue());
OAK_CONFIG("DefaultStillLength") =
QVariant::fromValue(default_still_length_->get_value());
QString set_language = language_combobox_->currentData().toString();
if (QLocale::system().name() == set_language) {
@@ -216,26 +216,26 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
}
// If the language has changed, set it now
if (OLIVE_CONFIG("Language").toString() != set_language) {
OLIVE_CONFIG("Language") = set_language;
Core::instance()->SetLanguage(
if (OAK_CONFIG("Language").toString() != set_language) {
OAK_CONFIG("Language") = set_language;
Core::instance()->set_language(
set_language.isEmpty() ? QLocale::system().name() : set_language);
}
OLIVE_CONFIG("AutorecoveryEnabled") = autorecovery_enabled_->isChecked();
OLIVE_CONFIG("AutorecoveryInterval") =
QVariant::fromValue(autorecovery_interval_->GetValue());
OLIVE_CONFIG("AutorecoveryMaximum") =
QVariant::fromValue(autorecovery_maximum_->GetValue());
Core::instance()->SetAutorecoveryInterval(
autorecovery_interval_->GetValue());
OAK_CONFIG("AutorecoveryEnabled") = autorecovery_enabled_->isChecked();
OAK_CONFIG("AutorecoveryInterval") =
QVariant::fromValue(autorecovery_interval_->get_value());
OAK_CONFIG("AutorecoveryMaximum") =
QVariant::fromValue(autorecovery_maximum_->get_value());
Core::instance()->set_autorecovery_interval(
autorecovery_interval_->get_value());
OLIVE_CONFIG("HoverFocus") = hover_focus_->isChecked();
OLIVE_CONFIG("UseSliderLadders") = slider_ladder_->isChecked();
OLIVE_CONFIG("ScrollZooms") = scroll_zooms_->isChecked();
OAK_CONFIG("HoverFocus") = hover_focus_->isChecked();
OAK_CONFIG("UseSliderLadders") = slider_ladder_->isChecked();
OAK_CONFIG("ScrollZooms") = scroll_zooms_->isChecked();
}
void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
void PreferencesGeneralTab::add_language(const QString &locale_name)
{
language_combobox_->addItem(tr("%1 (%2)").arg(
QLocale(locale_name).nativeLanguageName(), locale_name));
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESGENERALTAB_H
#define PREFERENCESGENERALTAB_H
#ifndef OAK_PREFERENCESGENERALTAB_H
#define OAK_PREFERENCESGENERALTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -39,10 +39,10 @@ class PreferencesGeneralTab : public ConfigDialogBaseTab {
public:
PreferencesGeneralTab();
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private:
void AddLanguage(const QString &locale_name);
void add_language(const QString &locale_name);
QComboBox *language_combobox_;
@@ -65,4 +65,4 @@ private:
}
#endif // PREFERENCESGENERALTAB_H
#endif // OAK_PREFERENCESGENERALTAB_H
@@ -81,7 +81,7 @@ PreferencesKeyboardTab::PreferencesKeyboardTab(MainWindow *main_window)
setup_kbd_shortcuts(main_window_->menuBar());
}
void PreferencesKeyboardTab::Accept(MultiUndoCommand *command)
void PreferencesKeyboardTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
@@ -90,7 +90,7 @@ void PreferencesKeyboardTab::Accept(MultiUndoCommand *command)
key_shortcut_fields_.at(i)->set_action_shortcut();
}
main_window_->SaveLayout();
main_window_->save_layout();
}
void PreferencesKeyboardTab::setup_kbd_shortcuts(QMenuBar *menubar)
@@ -19,8 +19,8 @@
***/
#ifndef PREFERENCESKEYBOARDTAB_H
#define PREFERENCESKEYBOARDTAB_H
#ifndef OAK_PREFERENCESKEYBOARDTAB_H
#define OAK_PREFERENCESKEYBOARDTAB_H
#include <QMenuBar>
#include <QTreeWidget>
@@ -38,7 +38,7 @@ class PreferencesKeyboardTab : public ConfigDialogBaseTab {
public:
PreferencesKeyboardTab(MainWindow *main_window);
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private slots:
/**
@@ -142,4 +142,4 @@ private:
}
#endif // PREFERENCESKEYBOARDTAB_H
#endif // OAK_PREFERENCESKEYBOARDTAB_H
@@ -46,7 +46,7 @@ PreferencesLutTab::PreferencesLutTab()
"these locations when picking a LUT file.")));
library_dirs_list_ = new QListWidget();
library_dirs_list_->addItems(LUTLibrary::GetDirectories());
library_dirs_list_->addItems(LUTLibrary::get_directories());
library_layout->addWidget(library_dirs_list_);
QHBoxLayout *button_layout = new QHBoxLayout();
@@ -74,7 +74,7 @@ PreferencesLutTab::PreferencesLutTab()
outer_layout->addStretch();
}
void PreferencesLutTab::Accept(MultiUndoCommand *command)
void PreferencesLutTab::accept(MultiUndoCommand *command)
{
Q_UNUSED(command)
@@ -83,7 +83,7 @@ void PreferencesLutTab::Accept(MultiUndoCommand *command)
dirs.append(library_dirs_list_->item(i)->text());
}
LUTLibrary::SetDirectories(dirs);
LUTLibrary::set_directories(dirs);
}
}
@@ -18,8 +18,8 @@
***/
#ifndef PREFERENCESLUTTAB_H
#define PREFERENCESLUTTAB_H
#ifndef OAK_PREFERENCESLUTTAB_H
#define OAK_PREFERENCESLUTTAB_H
#include <QListWidget>
@@ -33,7 +33,7 @@ class PreferencesLutTab : public ConfigDialogBaseTab {
public:
PreferencesLutTab();
virtual void Accept(MultiUndoCommand *command) override;
virtual void accept(MultiUndoCommand *command) override;
private:
QListWidget *library_dirs_list_;
@@ -41,4 +41,4 @@ private:
}
#endif // PREFERENCESLUTTAB_H
#endif // OAK_PREFERENCESLUTTAB_H
+18 -18
View File
@@ -65,20 +65,20 @@ ProgressDialog::ProgressDialog(const QString &message, const QString &title,
QPushButton *cancel_btn = new QPushButton(tr("Cancel"));
// Signal that derivatives can connect to
connect(cancel_btn, &QPushButton::clicked, this, &ProgressDialog::Cancelled,
connect(cancel_btn, &QPushButton::clicked, this, &ProgressDialog::cancelled,
Qt::DirectConnection);
// Stop updating the elapsed/remaining timers
connect(cancel_btn, &QPushButton::clicked, elapsed_timer_lbl_,
&ElapsedCounterWidget::Stop);
&ElapsedCounterWidget::stop);
// Disable the button so that users know they don't need to keep clicking it
connect(cancel_btn, &QPushButton::clicked, this,
&ProgressDialog::DisableSenderWidget);
&ProgressDialog::disable_sender_widget);
// Prevent the progress bar from continuing to move
connect(cancel_btn, &QPushButton::clicked, this,
&ProgressDialog::DisableProgressWidgets);
&ProgressDialog::disable_progress_widgets);
cancel_layout->addWidget(cancel_btn);
@@ -90,10 +90,10 @@ void ProgressDialog::showEvent(QShowEvent *e)
super::showEvent(e);
if (first_show_) {
elapsed_timer_lbl_->Start();
elapsed_timer_lbl_->start();
Core::instance()->main_window()->SetApplicationProgressStatus(
MainWindow::kProgressShow);
Core::instance()->main_window()->set_application_progress_status(
MainWindow::k_progress_show);
first_show_ = false;
}
@@ -103,15 +103,15 @@ void ProgressDialog::closeEvent(QCloseEvent *e)
{
super::closeEvent(e);
Core::instance()->main_window()->SetApplicationProgressStatus(
MainWindow::kProgressNone);
Core::instance()->main_window()->set_application_progress_status(
MainWindow::k_progress_none);
elapsed_timer_lbl_->Stop();
elapsed_timer_lbl_->stop();
first_show_ = true;
}
void ProgressDialog::SetProgress(double value)
void ProgressDialog::set_progress(double value)
{
if (!show_progress_) {
return;
@@ -120,16 +120,16 @@ void ProgressDialog::SetProgress(double value)
int percent = qRound(100.0 * value);
bar_->setValue(percent);
elapsed_timer_lbl_->SetProgress(value);
elapsed_timer_lbl_->set_progress(value);
Core::instance()->main_window()->SetApplicationProgressValue(percent);
Core::instance()->main_window()->set_application_progress_value(percent);
}
void ProgressDialog::ShowErrorMessage(const QString &title,
void ProgressDialog::show_error_message(const QString &title,
const QString &message)
{
Core::instance()->main_window()->SetApplicationProgressStatus(
MainWindow::kProgressError);
Core::instance()->main_window()->set_application_progress_status(
MainWindow::k_progress_error);
QMessageBox b(this);
b.setIcon(QMessageBox::Critical);
@@ -140,12 +140,12 @@ void ProgressDialog::ShowErrorMessage(const QString &title,
b.exec();
}
void ProgressDialog::DisableSenderWidget()
void ProgressDialog::disable_sender_widget()
{
static_cast<QWidget *>(sender())->setEnabled(false);
}
void ProgressDialog::DisableProgressWidgets()
void ProgressDialog::disable_progress_widgets()
{
show_progress_ = false;
}
+8 -8
View File
@@ -19,8 +19,8 @@
***/
#ifndef PROGRESSDIALOG_H
#define PROGRESSDIALOG_H
#ifndef OAK_PROGRESSDIALOG_H
#define OAK_PROGRESSDIALOG_H
#include <QDialog>
#include <QProgressBar>
@@ -43,13 +43,13 @@ protected:
virtual void closeEvent(QCloseEvent *) override;
public slots:
void SetProgress(double value);
void set_progress(double value);
signals:
void Cancelled();
void cancelled();
protected:
void ShowErrorMessage(const QString &title, const QString &message);
void show_error_message(const QString &title, const QString &message);
private:
QProgressBar *bar_;
@@ -61,11 +61,11 @@ private:
bool first_show_;
private slots:
void DisableSenderWidget();
void disable_sender_widget();
void DisableProgressWidgets();
void disable_progress_widgets();
};
}
#endif // PROGRESSDIALOG_H
#endif // OAK_PROGRESSDIALOG_H
@@ -82,10 +82,10 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(Project *p, QWidget *parent)
color_layout->addWidget(new QLabel(tr("Reference Space:")), row, 0);
reference_space_ = new QComboBox(this);
reference_space_->addItem(tr("Scene Linear"), OCIO::ROLE_SCENE_LINEAR);
reference_space_->addItem(tr("Scene Linear"), ocio::ROLE_SCENE_LINEAR);
reference_space_->addItem(tr("Compositing Log"),
OCIO::ROLE_COMPOSITING_LOG);
QtUtils::SetComboBoxData(reference_space_, p->GetColorReferenceSpace());
ocio::ROLE_COMPOSITING_LOG);
QtUtils::set_combo_box_data(reference_space_, p->get_color_reference_space());
color_layout->addWidget(reference_space_, row, 1, 1, 2);
row++;
@@ -93,14 +93,14 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(Project *p, QWidget *parent)
QPushButton *browse_btn = new QPushButton(tr("Browse"));
color_layout->addWidget(browse_btn, 0, 2);
connect(browse_btn, &QPushButton::clicked, this,
&ProjectPropertiesDialog::BrowseForOCIOConfig);
&ProjectPropertiesDialog::browse_for_ocio_config);
ocio_filename_->setText(
working_project_->color_manager()->GetConfigFilename());
working_project_->color_manager()->get_config_filename());
connect(ocio_filename_, &QLineEdit::textChanged, this,
&ProjectPropertiesDialog::OCIOFilenameUpdated);
OCIOFilenameUpdated();
&ProjectPropertiesDialog::ocio_filename_updated);
ocio_filename_updated();
tabs->addTab(color_group, tr("Color Management"));
@@ -116,37 +116,37 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(Project *p, QWidget *parent)
QButtonGroup *disk_cache_btn_group = new QButtonGroup();
// Create radio buttons and add to widget and button group
disk_cache_radios_[Project::kCacheUseDefaultLocation] =
disk_cache_radios_[Project::k_cache_use_default_location] =
new QRadioButton(tr("Use Default Location"));
disk_cache_radios_[Project::kCacheStoreAlongsideProject] =
disk_cache_radios_[Project::k_cache_store_alongside_project] =
new QRadioButton(tr("Store Alongside Project"));
disk_cache_radios_[Project::kCacheCustomPath] =
disk_cache_radios_[Project::k_cache_custom_path] =
new QRadioButton(tr("Use Custom Location:"));
for (int i = 0; i < kDiskCacheRadioCount; i++) {
for (int i = 0; i < k_disk_cache_radio_count; i++) {
disk_cache_btn_group->addButton(disk_cache_radios_[i]);
cache_layout->addWidget(disk_cache_radios_[i]);
}
// Create custom cache path widget
custom_cache_path_ =
new PathWidget(working_project_->GetCustomCachePath(), this);
new PathWidget(working_project_->get_custom_cache_path(), this);
custom_cache_path_->setEnabled(false);
cache_layout->addWidget(custom_cache_path_);
// Ensure custom cache path "enabled" is tied to the radio button being checked
connect(disk_cache_radios_[Project::kCacheCustomPath],
connect(disk_cache_radios_[Project::k_cache_custom_path],
&QRadioButton::toggled, custom_cache_path_,
&PathWidget::setEnabled);
// Check the radio button that should currently be active
disk_cache_radios_[working_project_->GetCacheLocationSetting()]
disk_cache_radios_[working_project_->get_cache_location_setting()]
->setChecked(true);
// Add disk cache settings button
QPushButton *disk_cache_settings_btn =
new QPushButton(tr("Disk Cache Settings"));
connect(disk_cache_settings_btn, &QPushButton::clicked, this,
&ProjectPropertiesDialog::OpenDiskCacheSettings);
&ProjectPropertiesDialog::open_disk_cache_settings);
cache_layout->addWidget(disk_cache_settings_btn);
tabs->addTab(cache_group, tr("Disk Cache"));
@@ -175,57 +175,57 @@ void ProjectPropertiesDialog::accept()
return;
}
if (disk_cache_radios_[Project::kCacheUseDefaultLocation]->isChecked()) {
if (disk_cache_radios_[Project::k_cache_use_default_location]->isChecked()) {
// Keep new cache path empty, which means default
} else if (disk_cache_radios_[Project::kCacheStoreAlongsideProject]
} else if (disk_cache_radios_[Project::k_cache_store_alongside_project]
->isChecked()) {
// Ensure alongside project path is valid
if (!VerifyPathAndWarnIfBad(
if (!verify_path_and_warn_if_bad(
working_project_->get_cache_alongside_project_path())) {
return;
}
} else {
// Ensure custom path is valid
if (!VerifyPathAndWarnIfBad(custom_cache_path_->text())) {
if (!verify_path_and_warn_if_bad(custom_cache_path_->text())) {
return;
}
}
if (custom_cache_path_->text() != working_project_->GetCustomCachePath()) {
if (custom_cache_path_->text() != working_project_->get_custom_cache_path()) {
// Check if the user is okay with invalidating the current cache
if (!DiskManager::ShowDiskCacheChangeConfirmationDialog(this)) {
if (!DiskManager::show_disk_cache_change_confirmation_dialog(this)) {
return;
}
working_project_->SetCustomCachePath(custom_cache_path_->text());
working_project_->set_custom_cache_path(custom_cache_path_->text());
emit DiskManager::instance() -> InvalidateProject(working_project_);
emit DiskManager::instance() -> invalidate_project(working_project_);
}
// This should ripple changes throughout the graph/cache that the color config has changed, and
// therefore should be done after the cache path is changed
if (working_project_->color_manager()->GetConfigFilename() !=
if (working_project_->color_manager()->get_config_filename() !=
ocio_filename_->text()) {
working_project_->color_manager()->SetConfigFilename(
working_project_->color_manager()->set_config_filename(
ocio_filename_->text());
}
if (working_project_->color_manager()->GetDefaultInputColorSpace() !=
if (working_project_->color_manager()->get_default_input_color_space() !=
default_input_colorspace_->currentText()) {
working_project_->color_manager()->SetDefaultInputColorSpace(
working_project_->color_manager()->set_default_input_color_space(
default_input_colorspace_->currentText());
}
if (working_project_->GetColorReferenceSpace() !=
if (working_project_->get_color_reference_space() !=
reference_space_->currentData().toString()) {
working_project_->SetColorReferenceSpace(
working_project_->set_color_reference_space(
reference_space_->currentData().toString());
}
super::accept();
}
bool ProjectPropertiesDialog::VerifyPathAndWarnIfBad(const QString &path)
bool ProjectPropertiesDialog::verify_path_and_warn_if_bad(const QString &path)
{
if (!FileFunctions::DirectoryIsValid(path)) {
if (!FileFunctions::directory_is_valid(path)) {
QMessageBox mb(this);
mb.setWindowModality(Qt::WindowModal);
mb.setIcon(QMessageBox::Critical);
@@ -240,7 +240,7 @@ bool ProjectPropertiesDialog::VerifyPathAndWarnIfBad(const QString &path)
return true;
}
void ProjectPropertiesDialog::BrowseForOCIOConfig()
void ProjectPropertiesDialog::browse_for_ocio_config()
{
QString fn = QFileDialog::getOpenFileName(
this, tr("Browse for OpenColorIO configuration"));
@@ -249,35 +249,35 @@ void ProjectPropertiesDialog::BrowseForOCIOConfig()
}
}
void ProjectPropertiesDialog::OCIOFilenameUpdated()
void ProjectPropertiesDialog::ocio_filename_updated()
{
default_input_colorspace_->clear();
try {
OCIO::ConstConfigRcPtr c;
ocio::ConstConfigRcPtr c;
if (ocio_filename_->text().isEmpty()) {
c = ColorManager::GetDefaultConfig();
c = ColorManager::get_default_config();
} else {
c = ColorManager::CreateConfigFromFile(ocio_filename_->text());
c = ColorManager::create_config_from_file(ocio_filename_->text());
}
ocio_filename_->setStyleSheet(QString());
ocio_config_is_valid_ = true;
// List input color spaces
QStringList input_cs = ColorManager::ListAvailableColorspaces(c);
QStringList input_cs = ColorManager::list_available_colorspaces(c);
foreach (QString cs, input_cs) {
default_input_colorspace_->addItem(cs);
if (cs ==
working_project_->color_manager()->GetDefaultInputColorSpace()) {
working_project_->color_manager()->get_default_input_color_space()) {
default_input_colorspace_->setCurrentIndex(
default_input_colorspace_->count() - 1);
}
}
} catch (OCIO::Exception &e) {
} catch (ocio::Exception &e) {
ocio_config_is_valid_ = false;
ocio_filename_->setStyleSheet(
QStringLiteral("QLineEdit {color: red;}"));
@@ -285,17 +285,17 @@ void ProjectPropertiesDialog::OCIOFilenameUpdated()
}
}
void ProjectPropertiesDialog::OpenDiskCacheSettings()
void ProjectPropertiesDialog::open_disk_cache_settings()
{
if (disk_cache_radios_[Project::kCacheUseDefaultLocation]->isChecked()) {
DiskManager::instance()->ShowDiskCacheSettingsDialog(
DiskManager::instance()->GetDefaultCacheFolder(), this);
} else if (disk_cache_radios_[Project::kCacheStoreAlongsideProject]
if (disk_cache_radios_[Project::k_cache_use_default_location]->isChecked()) {
DiskManager::instance()->show_disk_cache_settings_dialog(
DiskManager::instance()->get_default_cache_folder(), this);
} else if (disk_cache_radios_[Project::k_cache_store_alongside_project]
->isChecked()) {
DiskManager::instance()->ShowDiskCacheSettingsDialog(
DiskManager::instance()->show_disk_cache_settings_dialog(
working_project_->get_cache_alongside_project_path(), this);
} else {
DiskManager::instance()->ShowDiskCacheSettingsDialog(
DiskManager::instance()->show_disk_cache_settings_dialog(
custom_cache_path_->text(), this);
}
}
@@ -19,8 +19,8 @@
***/
#ifndef PROJECTPROPERTIESDIALOG_H
#define PROJECTPROPERTIESDIALOG_H
#ifndef OAK_PROJECTPROPERTIESDIALOG_H
#define OAK_PROJECTPROPERTIESDIALOG_H
#include <QCheckBox>
#include <QComboBox>
@@ -44,7 +44,7 @@ public slots:
virtual void accept() override;
private:
bool VerifyPathAndWarnIfBad(const QString &path);
bool verify_path_and_warn_if_bad(const QString &path);
Project *working_project_;
@@ -60,17 +60,17 @@ private:
PathWidget *custom_cache_path_;
static const int kDiskCacheRadioCount = 3;
QRadioButton *disk_cache_radios_[kDiskCacheRadioCount];
static const int k_disk_cache_radio_count = 3;
QRadioButton *disk_cache_radios_[k_disk_cache_radio_count];
private slots:
void BrowseForOCIOConfig();
void browse_for_ocio_config();
void OCIOFilenameUpdated();
void ocio_filename_updated();
void OpenDiskCacheSettings();
void open_disk_cache_settings();
};
}
#endif // PROJECTPROPERTIESDIALOG_H
#endif // OAK_PROJECTPROPERTIESDIALOG_H
+64 -64
View File
@@ -43,7 +43,7 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
setWindowTitle(tr("Proxy Settings"));
const ProxyManager::ProxyParams params =
ProxyManager::ProxyParamsFromConfig();
ProxyManager::proxy_params_from_config();
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -56,7 +56,7 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
footage_tree_->setHeaderLabels({ tr("Footage"), tr("Proxy State") });
footage_tree_->setRootIsDecorated(false);
footage_layout->addWidget(footage_tree_);
RefreshFootageList();
refresh_footage_list();
custom_params_checkbox_ =
new QCheckBox(tr("Use custom settings for selected footage"));
@@ -79,25 +79,25 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
settings_layout->addWidget(new QLabel(tr("Proxy Width:")), row, 0);
width_slider_ = new IntegerSlider();
width_slider_->SetMinimum(160);
width_slider_->SetMaximum(4096);
width_slider_->SetValue(params.width);
width_slider_->set_minimum(160);
width_slider_->set_maximum(4096);
width_slider_->set_value(params.width);
settings_layout->addWidget(width_slider_, row, 1);
settings_layout->addWidget(new QLabel(tr("Proxy Height:")), row, 2);
height_slider_ = new IntegerSlider();
height_slider_->SetMinimum(120);
height_slider_->SetMaximum(2160);
height_slider_->SetValue(params.height);
height_slider_->set_minimum(120);
height_slider_->set_maximum(2160);
height_slider_->set_value(params.height);
settings_layout->addWidget(height_slider_, row, 3);
row++;
settings_layout->addWidget(new QLabel(tr("Proxy CRF:")), row, 0);
crf_slider_ = new IntegerSlider();
crf_slider_->SetMinimum(0);
crf_slider_->SetMaximum(51);
crf_slider_->SetValue(params.crf);
crf_slider_->set_minimum(0);
crf_slider_->set_maximum(51);
crf_slider_->set_value(params.crf);
settings_layout->addWidget(crf_slider_, row, 1);
settings_layout->addWidget(new QLabel(tr("Proxy Preset:")), row, 2);
@@ -124,13 +124,13 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
row++;
settings_layout->addWidget(new QLabel(tr("ffmpeg Executable:")), row, 0);
ffmpeg_path_edit_ = new QLineEdit(OLIVE_CONFIG("FFmpegPath").toString());
ffmpeg_path_edit_ = new QLineEdit(OAK_CONFIG("FFmpegPath").toString());
ffmpeg_path_edit_->setPlaceholderText(tr("Auto-detect"));
settings_layout->addWidget(ffmpeg_path_edit_, row, 1);
QPushButton *ffmpeg_browse_btn = new QPushButton(tr("Browse..."));
connect(ffmpeg_browse_btn, &QPushButton::clicked, this,
&ProxyDialog::BrowseForFFmpeg);
&ProxyDialog::browse_for_f_fmpeg);
settings_layout->addWidget(ffmpeg_browse_btn, row, 2);
QHBoxLayout *button_layout = new QHBoxLayout();
@@ -139,12 +139,12 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
if (!footage_.isEmpty()) {
QPushButton *generate_btn = new QPushButton(tr("Generate Proxies"));
connect(generate_btn, &QPushButton::clicked, this,
&ProxyDialog::GenerateProxies);
&ProxyDialog::generate_proxies);
button_layout->addWidget(generate_btn);
QPushButton *delete_btn = new QPushButton(tr("Delete Proxies"));
connect(delete_btn, &QPushButton::clicked, this,
&ProxyDialog::DeleteProxies);
&ProxyDialog::delete_proxies);
button_layout->addWidget(delete_btn);
}
@@ -157,14 +157,14 @@ ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage)
void ProxyDialog::accept()
{
SaveGlobalSettings();
save_global_settings();
if (!footage_.isEmpty()) {
for (Footage *item : footage_) {
if (custom_params_checkbox_->isChecked()) {
item->SetCustomProxyParams(CurrentParams());
item->set_custom_proxy_params(current_params());
} else {
item->ClearCustomProxyParams();
item->clear_custom_proxy_params();
}
}
}
@@ -172,88 +172,88 @@ void ProxyDialog::accept()
QDialog::accept();
}
int ProxyDialog::ProxyWidth() const
int ProxyDialog::proxy_width() const
{
return static_cast<int>(width_slider_->GetValue());
return static_cast<int>(width_slider_->get_value());
}
int ProxyDialog::ProxyHeight() const
int ProxyDialog::proxy_height() const
{
return static_cast<int>(height_slider_->GetValue());
return static_cast<int>(height_slider_->get_value());
}
int ProxyDialog::ProxyCRF() const
int ProxyDialog::proxy_crf() const
{
return static_cast<int>(crf_slider_->GetValue());
return static_cast<int>(crf_slider_->get_value());
}
QString ProxyDialog::ProxyPreset() const
QString ProxyDialog::proxy_preset() const
{
return preset_combo_->currentText();
}
bool ProxyDialog::ProxyIncludeAudio() const
bool ProxyDialog::proxy_include_audio() const
{
return include_audio_checkbox_->isChecked();
}
QString ProxyDialog::FFmpegPath() const
QString ProxyDialog::f_fmpeg_path() const
{
return ffmpeg_path_edit_->text();
}
void ProxyDialog::SetProxyWidth(int width)
void ProxyDialog::set_proxy_width(int width)
{
width_slider_->SetValue(width);
width_slider_->set_value(width);
}
void ProxyDialog::SetProxyHeight(int height)
void ProxyDialog::set_proxy_height(int height)
{
height_slider_->SetValue(height);
height_slider_->set_value(height);
}
void ProxyDialog::SetProxyCRF(int crf)
void ProxyDialog::set_proxy_crf(int crf)
{
crf_slider_->SetValue(crf);
crf_slider_->set_value(crf);
}
void ProxyDialog::SetProxyPreset(const QString &preset)
void ProxyDialog::set_proxy_preset(const QString &preset)
{
preset_combo_->setCurrentText(preset);
}
void ProxyDialog::SetProxyIncludeAudio(bool include_audio)
void ProxyDialog::set_proxy_include_audio(bool include_audio)
{
include_audio_checkbox_->setChecked(include_audio);
}
void ProxyDialog::SetFFmpegPath(const QString &path)
void ProxyDialog::set_f_fmpeg_path(const QString &path)
{
ffmpeg_path_edit_->setText(path);
}
ProxyManager::ProxyParams ProxyDialog::CurrentParams() const
ProxyManager::ProxyParams ProxyDialog::current_params() const
{
ProxyManager::ProxyParams params = ProxyManager::ProxyParamsFromConfig();
params.width = static_cast<int>(width_slider_->GetValue());
params.height = static_cast<int>(height_slider_->GetValue());
params.crf = static_cast<int>(crf_slider_->GetValue());
ProxyManager::ProxyParams params = ProxyManager::proxy_params_from_config();
params.width = static_cast<int>(width_slider_->get_value());
params.height = static_cast<int>(height_slider_->get_value());
params.crf = static_cast<int>(crf_slider_->get_value());
params.preset = preset_combo_->currentText();
params.include_audio = include_audio_checkbox_->isChecked();
return params;
}
void ProxyDialog::SaveGlobalSettings()
void ProxyDialog::save_global_settings()
{
OLIVE_CONFIG("ProxyWidth") = static_cast<int>(width_slider_->GetValue());
OLIVE_CONFIG("ProxyHeight") = static_cast<int>(height_slider_->GetValue());
OLIVE_CONFIG("ProxyCRF") = static_cast<int>(crf_slider_->GetValue());
OLIVE_CONFIG("ProxyPreset") = preset_combo_->currentText();
OLIVE_CONFIG("ProxyIncludeAudio") = include_audio_checkbox_->isChecked();
OLIVE_CONFIG("FFmpegPath") = ffmpeg_path_edit_->text().trimmed();
OAK_CONFIG("ProxyWidth") = static_cast<int>(width_slider_->get_value());
OAK_CONFIG("ProxyHeight") = static_cast<int>(height_slider_->get_value());
OAK_CONFIG("ProxyCRF") = static_cast<int>(crf_slider_->get_value());
OAK_CONFIG("ProxyPreset") = preset_combo_->currentText();
OAK_CONFIG("ProxyIncludeAudio") = include_audio_checkbox_->isChecked();
OAK_CONFIG("FFmpegPath") = ffmpeg_path_edit_->text().trimmed();
}
void ProxyDialog::RefreshFootageList()
void ProxyDialog::refresh_footage_list()
{
if (!footage_tree_) {
return;
@@ -263,7 +263,7 @@ void ProxyDialog::RefreshFootageList()
for (const Footage *item : footage_) {
QTreeWidgetItem *tree_item = new QTreeWidgetItem(footage_tree_);
tree_item->setText(0, item->filename());
QString state = ProxyManager::ProxyStateToString(item->proxy_state());
QString state = ProxyManager::proxy_state_to_string(item->proxy_state());
if (item->has_custom_proxy_params()) {
state = tr("%1 (custom settings)").arg(state);
}
@@ -271,7 +271,7 @@ void ProxyDialog::RefreshFootageList()
}
}
void ProxyDialog::GenerateProxies()
void ProxyDialog::generate_proxies()
{
if (!ProxyManager::instance()) {
qWarning() << "ProxyDialog::GenerateProxies: ProxyManager unavailable";
@@ -279,7 +279,7 @@ void ProxyDialog::GenerateProxies()
}
for (Footage *item : footage_) {
const VideoParams video = item->GetFirstEnabledVideoStream();
const VideoParams video = item->get_first_enabled_video_stream();
if (!video.is_valid()) {
qWarning()
<< "ProxyDialog::GenerateProxies: skipping item with no valid video stream"
@@ -288,21 +288,21 @@ void ProxyDialog::GenerateProxies()
}
const ProxyManager::ProxyParams params =
custom_params_checkbox_->isChecked() ? CurrentParams()
: item->GetEffectiveProxyParams();
custom_params_checkbox_->isChecked() ? current_params()
: item->get_effective_proxy_params();
const ProxyManager::Proxy proxy =
ProxyManager::instance()->GetOrStartProxy(
ProxyManager::instance()->get_or_start_proxy(
item->project()->cache_path(), item->filename(),
video.stream_index(), params);
item->SetProxy(proxy.filename, proxy.state, video.stream_index(),
item->set_proxy(proxy.filename, proxy.state, video.stream_index(),
params.version, true);
item->InvalidateAll(Footage::kFilenameInput);
item->invalidate_all(Footage::k_filename_input);
}
RefreshFootageList();
refresh_footage_list();
}
void ProxyDialog::DeleteProxies()
void ProxyDialog::delete_proxies()
{
for (Footage *item : footage_) {
if (item->proxy_path().isEmpty()) {
@@ -310,15 +310,15 @@ void ProxyDialog::DeleteProxies()
}
QFile::remove(item->proxy_path());
QFile::remove(ProxyManager::GetWorkingProxyFilename(item->proxy_path()));
item->ClearProxy();
item->InvalidateAll(Footage::kFilenameInput);
QFile::remove(ProxyManager::get_working_proxy_filename(item->proxy_path()));
item->clear_proxy();
item->invalidate_all(Footage::k_filename_input);
}
RefreshFootageList();
refresh_footage_list();
}
void ProxyDialog::BrowseForFFmpeg()
void ProxyDialog::browse_for_f_fmpeg()
{
const QString file =
QFileDialog::getOpenFileName(this, tr("Select ffmpeg Executable"));
+21 -21
View File
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROXYDIALOG_H
#define PROXYDIALOG_H
#ifndef OAK_PROXYDIALOG_H
#define OAK_PROXYDIALOG_H
#include <QCheckBox>
#include <QComboBox>
@@ -39,36 +39,36 @@ public:
virtual void accept() override;
int ProxyWidth() const;
int proxy_width() const;
int ProxyHeight() const;
int proxy_height() const;
int ProxyCRF() const;
int proxy_crf() const;
QString ProxyPreset() const;
QString proxy_preset() const;
bool ProxyIncludeAudio() const;
bool proxy_include_audio() const;
QString FFmpegPath() const;
QString f_fmpeg_path() const;
void SetProxyWidth(int width);
void set_proxy_width(int width);
void SetProxyHeight(int height);
void set_proxy_height(int height);
void SetProxyCRF(int crf);
void set_proxy_crf(int crf);
void SetProxyPreset(const QString &preset);
void set_proxy_preset(const QString &preset);
void SetProxyIncludeAudio(bool include_audio);
void set_proxy_include_audio(bool include_audio);
void SetFFmpegPath(const QString &path);
void set_f_fmpeg_path(const QString &path);
private:
ProxyManager::ProxyParams CurrentParams() const;
ProxyManager::ProxyParams current_params() const;
void SaveGlobalSettings();
void save_global_settings();
void RefreshFootageList();
void refresh_footage_list();
QVector<Footage *> footage_;
@@ -89,13 +89,13 @@ private:
QLineEdit *ffmpeg_path_edit_;
private slots:
void GenerateProxies();
void generate_proxies();
void DeleteProxies();
void delete_proxies();
void BrowseForFFmpeg();
void browse_for_f_fmpeg();
};
}
#endif // PROXYDIALOG_H
#endif // OAK_PROXYDIALOG_H
+10 -10
View File
@@ -32,7 +32,7 @@ RenderCancelDialog::RenderCancelDialog(QWidget *parent)
{
}
void RenderCancelDialog::RunIfWorkersAreBusy()
void RenderCancelDialog::run_if_workers_are_busy()
{
if (busy_workers_ > 0) {
waiting_workers_ = busy_workers_;
@@ -41,41 +41,41 @@ void RenderCancelDialog::RunIfWorkersAreBusy()
}
}
void RenderCancelDialog::SetWorkerCount(int count)
void RenderCancelDialog::set_worker_count(int count)
{
total_workers_ = count;
UpdateProgress();
update_progress();
}
void RenderCancelDialog::WorkerStarted()
void RenderCancelDialog::worker_started()
{
busy_workers_++;
UpdateProgress();
update_progress();
}
void RenderCancelDialog::WorkerDone()
void RenderCancelDialog::worker_done()
{
busy_workers_--;
UpdateProgress();
update_progress();
}
void RenderCancelDialog::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
UpdateProgress();
update_progress();
}
void RenderCancelDialog::UpdateProgress()
void RenderCancelDialog::update_progress()
{
if (!total_workers_ || !isVisible()) {
return;
}
SetProgress(
set_progress(
qRound(100.0 * static_cast<double>(waiting_workers_ - busy_workers_) /
static_cast<double>(waiting_workers_)));
+8 -8
View File
@@ -19,8 +19,8 @@
***/
#ifndef RENDERCANCELDIALOG_H
#define RENDERCANCELDIALOG_H
#ifndef OAK_RENDERCANCELDIALOG_H
#define OAK_RENDERCANCELDIALOG_H
#include "dialog/progress/progress.h"
@@ -32,20 +32,20 @@ class RenderCancelDialog : public ProgressDialog {
public:
RenderCancelDialog(QWidget *parent = nullptr);
void RunIfWorkersAreBusy();
void run_if_workers_are_busy();
void SetWorkerCount(int count);
void set_worker_count(int count);
void WorkerStarted();
void worker_started();
public slots:
void WorkerDone();
void worker_done();
protected:
virtual void showEvent(QShowEvent *event) override;
private:
void UpdateProgress();
void update_progress();
int busy_workers_;
@@ -56,4 +56,4 @@ private:
}
#endif // RENDERCANCELDIALOG_H
#endif // OAK_RENDERCANCELDIALOG_H
+28 -28
View File
@@ -19,8 +19,8 @@
***/
#ifndef PRESETMANAGER_H
#define PRESETMANAGER_H
#ifndef OAK_PRESETMANAGER_H
#define OAK_PRESETMANAGER_H
#include <memory>
#include <QCoreApplication>
@@ -47,19 +47,19 @@ public:
{
}
const QString &GetName() const
const QString &get_name() const
{
return name_;
}
void SetName(const QString &s)
void set_name(const QString &s)
{
name_ = s;
}
virtual void Load(QXmlStreamReader *reader) = 0;
virtual void load(QXmlStreamReader *reader) = 0;
virtual void Save(QXmlStreamWriter *writer) const = 0;
virtual void save(QXmlStreamWriter *writer) const = 0;
private:
QString name_;
@@ -74,17 +74,17 @@ public:
, parent_(parent)
{
// Load custom preset data from file
QFile preset_file(GetCustomPresetFilename());
QFile preset_file(get_custom_preset_filename());
if (preset_file.open(QFile::ReadOnly)) {
QXmlStreamReader reader(&preset_file);
while (XMLReadNextStartElement(&reader)) {
while (xml_read_next_start_element(&reader)) {
if (reader.name() == QStringLiteral("presets")) {
while (XMLReadNextStartElement(&reader)) {
while (xml_read_next_start_element(&reader)) {
if (reader.name() == QStringLiteral("preset")) {
PresetPtr p = std::make_unique<T>();
p->Load(&reader);
p->load(&reader);
custom_preset_data_.append(p);
} else {
@@ -103,7 +103,7 @@ public:
~PresetManager()
{
// Save custom presets to disk
QFile preset_file(GetCustomPresetFilename());
QFile preset_file(get_custom_preset_filename());
if (preset_file.open(QFile::WriteOnly)) {
QXmlStreamWriter writer(&preset_file);
writer.setAutoFormatting(true);
@@ -115,7 +115,7 @@ public:
foreach (PresetPtr p, custom_preset_data_) {
writer.writeStartElement(QStringLiteral("preset"));
p->Save(&writer);
p->save(&writer);
writer.writeEndElement(); // preset
}
@@ -128,7 +128,7 @@ public:
}
}
QString GetPresetName(QString start) const
QString get_preset_name(QString start) const
{
bool ok;
@@ -163,25 +163,25 @@ public:
return start;
}
enum SaveStatus { kAppended, kReplaced, kNotSaved };
enum SaveStatus { k_appended, k_replaced, k_not_saved };
SaveStatus SavePreset(PresetPtr preset)
SaveStatus save_preset(PresetPtr preset)
{
QString preset_name;
int existing_preset;
forever
{
preset_name = GetPresetName(preset_name);
preset_name = get_preset_name(preset_name);
if (preset_name.isEmpty()) {
// Dialog cancelled - leave function entirely
return kNotSaved;
return k_not_saved;
}
existing_preset = -1;
for (int i = 0; i < custom_preset_data_.size(); i++) {
if (custom_preset_data_.at(i)->GetName() == preset_name) {
if (custom_preset_data_.at(i)->get_name() == preset_name) {
existing_preset = i;
break;
}
@@ -200,39 +200,39 @@ public:
}
}
preset->SetName(preset_name);
preset->set_name(preset_name);
if (existing_preset >= 0) {
custom_preset_data_.replace(existing_preset, preset);
return kReplaced;
return k_replaced;
} else {
custom_preset_data_.append(preset);
return kAppended;
return k_appended;
}
}
QString GetCustomPresetFilename() const
QString get_custom_preset_filename() const
{
return QDir(FileFunctions::GetConfigurationLocation())
return QDir(FileFunctions::get_configuration_location())
.filePath(preset_name_);
}
PresetPtr GetPreset(int index)
PresetPtr get_preset(int index)
{
return custom_preset_data_.at(index);
}
void DeletePreset(int index)
void delete_preset(int index)
{
custom_preset_data_.removeAt(index);
}
int GetNumberOfPresets() const
int get_number_of_presets() const
{
return custom_preset_data_.size();
}
const QVector<PresetPtr> &GetPresetData() const
const QVector<PresetPtr> &get_preset_data() const
{
return custom_preset_data_;
}
@@ -247,4 +247,4 @@ private:
}
#endif // PRESETMANAGER_H
#endif // OAK_PRESETMANAGER_H
+71 -71
View File
@@ -54,12 +54,12 @@ SequenceDialog::SequenceDialog(Sequence *s, Type t, QWidget *parent)
parameter_tab_ = new SequenceDialogParameterTab(sequence_);
splitter->addWidget(parameter_tab_);
connect(preset_tab_, &SequenceDialogPresetTab::PresetChanged,
parameter_tab_, &SequenceDialogParameterTab::PresetChanged);
connect(preset_tab_, &SequenceDialogPresetTab::PresetAccepted, this,
connect(preset_tab_, &SequenceDialogPresetTab::preset_changed,
parameter_tab_, &SequenceDialogParameterTab::preset_changed);
connect(preset_tab_, &SequenceDialogPresetTab::preset_accepted, this,
&SequenceDialog::accept);
connect(parameter_tab_, &SequenceDialogParameterTab::SaveParametersAsPreset,
preset_tab_, &SequenceDialogPresetTab::SaveParametersAsPreset);
connect(parameter_tab_, &SequenceDialogParameterTab::save_parameters_as_preset,
preset_tab_, &SequenceDialogPresetTab::save_parameters_as_preset);
// Set up name section
QHBoxLayout *name_layout = new QHBoxLayout();
@@ -78,28 +78,28 @@ SequenceDialog::SequenceDialog(Sequence *s, Type t, QWidget *parent)
connect(buttons, &QDialogButtonBox::rejected, this,
&SequenceDialog::reject);
connect(default_btn, &QPushButton::clicked, this,
&SequenceDialog::SetAsDefaultClicked);
&SequenceDialog::set_as_default_clicked);
layout->addWidget(buttons);
// Set window title based on type
switch (t) {
case kNew:
case k_new:
setWindowTitle(tr("New Sequence"));
break;
case kExisting:
setWindowTitle(tr("Editing \"%1\"").arg(sequence_->GetLabel()));
case k_existing:
setWindowTitle(tr("Editing \"%1\"").arg(sequence_->get_label()));
break;
}
name_field_->setText(sequence_->GetLabel());
name_field_->setText(sequence_->get_label());
}
void SequenceDialog::SetUndoable(bool u)
void SequenceDialog::set_undoable(bool u)
{
make_undoable_ = u;
}
void SequenceDialog::SetNameIsEditable(bool e)
void SequenceDialog::set_name_is_editable(bool e)
{
name_field_->setEnabled(e);
}
@@ -107,24 +107,24 @@ void SequenceDialog::SetNameIsEditable(bool e)
void SequenceDialog::accept()
{
if (name_field_->isEnabled() && name_field_->text().isEmpty()) {
QtUtils::MsgBox(this, QMessageBox::Critical,
QtUtils::msg_box(this, QMessageBox::Critical,
tr("Error editing Sequence"),
tr("Please enter a name for this Sequence."));
return;
}
if (!VideoParams::FormatIsFloat(
parameter_tab_->GetSelectedPreviewFormat()) &&
!OLIVE_CONFIG("PreviewNonFloatDontAskAgain").toBool()) {
if (!VideoParams::format_is_float(
parameter_tab_->get_selected_preview_format()) &&
!OAK_CONFIG("PreviewNonFloatDontAskAgain").toBool()) {
QMessageBox b(this);
QCheckBox *dont_show_again_ = new QCheckBox(tr("Don't ask me again"));
QCheckBox *dont_show_again = new QCheckBox(tr("Don't ask me again"));
b.setIcon(QMessageBox::Warning);
b.setWindowTitle(tr("Low Quality Preview"));
b.setText(tr(
"The preview resolution has been set to a non-float format. This may cause banding and clipping artifacts in the preview.\n\n"
"Do you wish to continue?"));
b.setCheckBox(dont_show_again_);
b.setCheckBox(dont_show_again);
b.addButton(QMessageBox::Yes);
b.addButton(QMessageBox::No);
@@ -133,70 +133,70 @@ void SequenceDialog::accept()
return;
}
if (dont_show_again_->isChecked()) {
OLIVE_CONFIG("PreviewNonFloatDontAskAgain") = true;
if (dont_show_again->isChecked()) {
OAK_CONFIG("PreviewNonFloatDontAskAgain") = true;
}
}
// Generate video and audio parameter structs from data
VideoParams video_params =
VideoParams(parameter_tab_->GetSelectedVideoWidth(),
parameter_tab_->GetSelectedVideoHeight(),
parameter_tab_->GetSelectedVideoFrameRate().flipped(),
parameter_tab_->GetSelectedPreviewFormat(),
VideoParams::kInternalChannelCount,
parameter_tab_->GetSelectedVideoPixelAspect(),
parameter_tab_->GetSelectedVideoInterlacingMode(),
parameter_tab_->GetSelectedPreviewResolution());
VideoParams(parameter_tab_->get_selected_video_width(),
parameter_tab_->get_selected_video_height(),
parameter_tab_->get_selected_video_frame_rate().flipped(),
parameter_tab_->get_selected_preview_format(),
VideoParams::k_internal_channel_count,
parameter_tab_->get_selected_video_pixel_aspect(),
parameter_tab_->get_selected_video_interlacing_mode(),
parameter_tab_->get_selected_preview_resolution());
AudioParams audio_params =
AudioParams(parameter_tab_->GetSelectedAudioSampleRate(),
parameter_tab_->GetSelectedAudioChannelLayout(),
Sequence::kDefaultSampleFormat);
AudioParams(parameter_tab_->get_selected_audio_sample_rate(),
parameter_tab_->get_selected_audio_channel_layout(),
Sequence::k_default_sample_format);
if (make_undoable_) {
// Make undoable command to change the parameters
SequenceParamCommand *param_command = new SequenceParamCommand(
sequence_, video_params, audio_params, name_field_->text(),
parameter_tab_->GetSelectedPreviewAutoCache());
parameter_tab_->get_selected_preview_auto_cache());
Core::instance()->undo_stack()->push(
param_command,
tr("Set Sequence Parameters For \"%1\"").arg(sequence_->GetLabel()));
tr("Set Sequence Parameters For \"%1\"").arg(sequence_->get_label()));
} else {
// Set sequence values directly with no undo command
sequence_->SetVideoParams(video_params);
sequence_->SetAudioParams(audio_params);
sequence_->SetLabel(name_field_->text());
sequence_->SetVideoAutoCacheEnabled(
parameter_tab_->GetSelectedPreviewAutoCache());
sequence_->set_video_params(video_params);
sequence_->set_audio_params(audio_params);
sequence_->set_label(name_field_->text());
sequence_->set_video_auto_cache_enabled(
parameter_tab_->get_selected_preview_auto_cache());
}
QDialog::accept();
}
void SequenceDialog::SetAsDefaultClicked()
void SequenceDialog::set_as_default_clicked()
{
if (QtUtils::MsgBox(
if (QtUtils::msg_box(
this, QMessageBox::Question, tr("Confirm Set As Default"),
tr("Are you sure you want to set the current parameters as defaults?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// Maybe replace with Preset system
OLIVE_CONFIG("DefaultSequenceWidth") =
parameter_tab_->GetSelectedVideoWidth();
OLIVE_CONFIG("DefaultSequenceHeight") =
parameter_tab_->GetSelectedVideoHeight();
OLIVE_CONFIG("DefaultSequencePixelAspect") =
QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect());
OLIVE_CONFIG("DefaultSequenceFrameRate") = QVariant::fromValue(
parameter_tab_->GetSelectedVideoFrameRate().flipped());
OLIVE_CONFIG("DefaultSequenceInterlacing") =
parameter_tab_->GetSelectedVideoInterlacingMode();
OLIVE_CONFIG("DefaultSequenceAudioFrequency") =
parameter_tab_->GetSelectedAudioSampleRate();
OLIVE_CONFIG("DefaultSequenceAudioLayout") = QVariant::fromValue(
parameter_tab_->GetSelectedAudioChannelLayout());
OAK_CONFIG("DefaultSequenceWidth") =
parameter_tab_->get_selected_video_width();
OAK_CONFIG("DefaultSequenceHeight") =
parameter_tab_->get_selected_video_height();
OAK_CONFIG("DefaultSequencePixelAspect") =
QVariant::fromValue(parameter_tab_->get_selected_video_pixel_aspect());
OAK_CONFIG("DefaultSequenceFrameRate") = QVariant::fromValue(
parameter_tab_->get_selected_video_frame_rate().flipped());
OAK_CONFIG("DefaultSequenceInterlacing") =
parameter_tab_->get_selected_video_interlacing_mode();
OAK_CONFIG("DefaultSequenceAudioFrequency") =
parameter_tab_->get_selected_audio_sample_rate();
OAK_CONFIG("DefaultSequenceAudioLayout") = QVariant::fromValue(
parameter_tab_->get_selected_audio_channel_layout());
}
}
@@ -208,40 +208,40 @@ SequenceDialog::SequenceParamCommand::SequenceParamCommand(
, new_audio_params_(audio_params)
, new_name_(name)
, new_autocache_(autocache)
, old_video_params_(s->GetVideoParams())
, old_audio_params_(s->GetAudioParams())
, old_name_(s->GetLabel())
, old_autocache_(s->IsVideoAutoCacheEnabled())
, old_video_params_(s->get_video_params())
, old_audio_params_(s->get_audio_params())
, old_name_(s->get_label())
, old_autocache_(s->is_video_auto_cache_enabled())
{
}
Project *SequenceDialog::SequenceParamCommand::GetRelevantProject() const
Project *SequenceDialog::SequenceParamCommand::get_relevant_project() const
{
return sequence_->project();
}
void SequenceDialog::SequenceParamCommand::redo()
{
if (sequence_->GetVideoParams() != new_video_params_) {
sequence_->SetVideoParams(new_video_params_);
if (sequence_->get_video_params() != new_video_params_) {
sequence_->set_video_params(new_video_params_);
}
if (sequence_->GetAudioParams() != new_audio_params_) {
sequence_->SetAudioParams(new_audio_params_);
if (sequence_->get_audio_params() != new_audio_params_) {
sequence_->set_audio_params(new_audio_params_);
}
sequence_->SetLabel(new_name_);
sequence_->SetVideoAutoCacheEnabled(new_autocache_);
sequence_->set_label(new_name_);
sequence_->set_video_auto_cache_enabled(new_autocache_);
}
void SequenceDialog::SequenceParamCommand::undo()
{
if (sequence_->GetVideoParams() != old_video_params_) {
sequence_->SetVideoParams(old_video_params_);
if (sequence_->get_video_params() != old_video_params_) {
sequence_->set_video_params(old_video_params_);
}
if (sequence_->GetAudioParams() != old_audio_params_) {
sequence_->SetAudioParams(old_audio_params_);
if (sequence_->get_audio_params() != old_audio_params_) {
sequence_->set_audio_params(old_audio_params_);
}
sequence_->SetLabel(old_name_);
sequence_->SetVideoAutoCacheEnabled(old_autocache_);
sequence_->set_label(old_name_);
sequence_->set_video_auto_cache_enabled(old_autocache_);
}
}
+9 -9
View File
@@ -19,8 +19,8 @@
***/
#ifndef SEQUENCEDIALOG_H
#define SEQUENCEDIALOG_H
#ifndef OAK_SEQUENCEDIALOG_H
#define OAK_SEQUENCEDIALOG_H
#include <QComboBox>
#include <QDialog>
@@ -54,7 +54,7 @@ public:
/**
* @brief Used to set the dialog mode of operation (see SequenceDialog())
*/
enum Type { kNew, kExisting };
enum Type { k_new, k_existing };
/**
* @brief SequenceDialog Constructor
@@ -68,21 +68,21 @@ public:
* @param parent
* QWidget parent
*/
SequenceDialog(Sequence *s, Type t = kExisting, QWidget *parent = nullptr);
SequenceDialog(Sequence *s, Type t = k_existing, QWidget *parent = nullptr);
/**
* @brief Set whether the parameter changes should be made into an undo command or not
*
* Defaults to true.
*/
void SetUndoable(bool u);
void set_undoable(bool u);
/**
* @brief Set whether the name of this Sequence can be edited with this dialog
*
* Defaults to true.
*/
void SetNameIsEditable(bool e);
void set_name_is_editable(bool e);
public slots:
/**
@@ -110,7 +110,7 @@ private:
const AudioParams &audio_params,
const QString &name, bool autocache);
virtual Project *GetRelevantProject() const override;
virtual Project *get_relevant_project() const override;
protected:
virtual void redo() override;
@@ -131,9 +131,9 @@ private:
};
private slots:
void SetAsDefaultClicked();
void set_as_default_clicked();
};
}
#endif // SEQUENCEDIALOG_H
#endif // OAK_SEQUENCEDIALOG_H
@@ -40,12 +40,12 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence *sequence,
QGridLayout *video_layout = new QGridLayout(video_group);
video_layout->addWidget(new QLabel(tr("Width:")), row, 0);
width_slider_ = new IntegerSlider();
width_slider_->SetMinimum(0);
width_slider_->set_minimum(0);
video_layout->addWidget(width_slider_, row, 1);
row++;
video_layout->addWidget(new QLabel(tr("Height:")), row, 0);
height_slider_ = new IntegerSlider();
height_slider_->SetMinimum(0);
height_slider_->set_minimum(0);
video_layout->addWidget(height_slider_, row, 1);
row++;
video_layout->addWidget(new QLabel(tr("Frame Rate:")), row, 0);
@@ -101,64 +101,64 @@ SequenceDialogParameterTab::SequenceDialogParameterTab(Sequence *sequence,
layout->addWidget(preview_group);
// Set values based on input sequence
VideoParams vp = sequence->GetVideoParams();
AudioParams ap = sequence->GetAudioParams();
width_slider_->SetValue(vp.width());
height_slider_->SetValue(vp.height());
framerate_combo_->SetFrameRate(vp.time_base().flipped());
pixelaspect_combo_->SetPixelAspectRatio(vp.pixel_aspect_ratio());
interlacing_combo_->SetInterlaceMode(vp.interlacing());
preview_resolution_field_->SetDivider(vp.divider());
preview_format_field_->SetPixelFormat(vp.format());
preview_autocache_field_->setChecked(sequence->IsVideoAutoCacheEnabled());
audio_sample_rate_field_->SetSampleRate(ap.sample_rate());
audio_channels_field_->SetChannelLayout(ap.channel_layout());
VideoParams vp = sequence->get_video_params();
AudioParams ap = sequence->get_audio_params();
width_slider_->set_value(vp.width());
height_slider_->set_value(vp.height());
framerate_combo_->set_frame_rate(vp.time_base().flipped());
pixelaspect_combo_->set_pixel_aspect_ratio(vp.pixel_aspect_ratio());
interlacing_combo_->set_interlace_mode(vp.interlacing());
preview_resolution_field_->set_divider(vp.divider());
preview_format_field_->set_pixel_format(vp.format());
preview_autocache_field_->setChecked(sequence->is_video_auto_cache_enabled());
audio_sample_rate_field_->set_sample_rate(ap.sample_rate());
audio_channels_field_->set_channel_layout(ap.channel_layout());
connect(
preview_resolution_field_,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &SequenceDialogParameterTab::UpdatePreviewResolutionLabel);
this, &SequenceDialogParameterTab::update_preview_resolution_label);
layout->addStretch();
QPushButton *save_preset_btn = new QPushButton(tr("Save Preset"));
connect(save_preset_btn, &QPushButton::clicked, this,
&SequenceDialogParameterTab::SavePresetClicked);
&SequenceDialogParameterTab::save_preset_clicked);
layout->addWidget(save_preset_btn);
UpdatePreviewResolutionLabel();
update_preview_resolution_label();
}
void SequenceDialogParameterTab::PresetChanged(const SequencePreset &preset)
void SequenceDialogParameterTab::preset_changed(const SequencePreset &preset)
{
width_slider_->SetValue(preset.width());
height_slider_->SetValue(preset.height());
framerate_combo_->SetFrameRate(preset.frame_rate());
pixelaspect_combo_->SetPixelAspectRatio(preset.pixel_aspect());
interlacing_combo_->SetInterlaceMode(preset.interlacing());
audio_sample_rate_field_->SetSampleRate(preset.sample_rate());
audio_channels_field_->SetChannelLayout(preset.channel_layout());
preview_resolution_field_->SetDivider(preset.preview_divider());
preview_format_field_->SetPixelFormat(preset.preview_format());
width_slider_->set_value(preset.width());
height_slider_->set_value(preset.height());
framerate_combo_->set_frame_rate(preset.frame_rate());
pixelaspect_combo_->set_pixel_aspect_ratio(preset.pixel_aspect());
interlacing_combo_->set_interlace_mode(preset.interlacing());
audio_sample_rate_field_->set_sample_rate(preset.sample_rate());
audio_channels_field_->set_channel_layout(preset.channel_layout());
preview_resolution_field_->set_divider(preset.preview_divider());
preview_format_field_->set_pixel_format(preset.preview_format());
preview_autocache_field_->setChecked(preset.preview_autocache());
}
void SequenceDialogParameterTab::SavePresetClicked()
void SequenceDialogParameterTab::save_preset_clicked()
{
emit SaveParametersAsPreset(SequencePreset(
QString(), GetSelectedVideoWidth(), GetSelectedVideoHeight(),
GetSelectedVideoFrameRate(), GetSelectedVideoPixelAspect(),
GetSelectedVideoInterlacingMode(), GetSelectedAudioSampleRate(),
GetSelectedAudioChannelLayout(), GetSelectedPreviewResolution(),
GetSelectedPreviewFormat(), GetSelectedPreviewAutoCache()));
emit save_parameters_as_preset(SequencePreset(
QString(), get_selected_video_width(), get_selected_video_height(),
get_selected_video_frame_rate(), get_selected_video_pixel_aspect(),
get_selected_video_interlacing_mode(), get_selected_audio_sample_rate(),
get_selected_audio_channel_layout(), get_selected_preview_resolution(),
get_selected_preview_format(), get_selected_preview_auto_cache()));
}
void SequenceDialogParameterTab::UpdatePreviewResolutionLabel()
void SequenceDialogParameterTab::update_preview_resolution_label()
{
VideoParams test_param(GetSelectedVideoWidth(), GetSelectedVideoHeight(),
PixelFormat::INVALID,
VideoParams::kInternalChannelCount, rational(1),
VideoParams::kInterlaceNone,
VideoParams test_param(get_selected_video_width(), get_selected_video_height(),
PixelFormat::invalid,
VideoParams::k_internal_channel_count, Rational(1),
VideoParams::k_interlace_none,
preview_resolution_field_->currentData().toInt());
preview_resolution_label_->setText(
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEQUENCEDIALOGPARAMETERTAB_H
#define SEQUENCEDIALOGPARAMETERTAB_H
#ifndef OAK_SEQUENCEDIALOGPARAMETERTAB_H
#define OAK_SEQUENCEDIALOGPARAMETERTAB_H
#include <QCheckBox>
#include <QComboBox>
@@ -37,52 +37,52 @@ class SequenceDialogParameterTab : public QWidget {
public:
SequenceDialogParameterTab(Sequence *sequence, QWidget *parent = nullptr);
int GetSelectedVideoWidth() const
int get_selected_video_width() const
{
return width_slider_->GetValue();
return width_slider_->get_value();
}
int GetSelectedVideoHeight() const
int get_selected_video_height() const
{
return height_slider_->GetValue();
return height_slider_->get_value();
}
rational GetSelectedVideoFrameRate() const
Rational get_selected_video_frame_rate() const
{
return framerate_combo_->GetFrameRate();
return framerate_combo_->get_frame_rate();
}
rational GetSelectedVideoPixelAspect() const
Rational get_selected_video_pixel_aspect() const
{
return pixelaspect_combo_->GetPixelAspectRatio();
return pixelaspect_combo_->get_pixel_aspect_ratio();
}
VideoParams::Interlacing GetSelectedVideoInterlacingMode() const
VideoParams::Interlacing get_selected_video_interlacing_mode() const
{
return interlacing_combo_->GetInterlaceMode();
return interlacing_combo_->get_interlace_mode();
}
int GetSelectedAudioSampleRate() const
int get_selected_audio_sample_rate() const
{
return audio_sample_rate_field_->GetSampleRate();
return audio_sample_rate_field_->get_sample_rate();
}
[[nodiscard]] uint64_t GetSelectedAudioChannelLayout() const
[[nodiscard]] uint64_t get_selected_audio_channel_layout() const
{
return audio_channels_field_->GetChannelLayout();
return audio_channels_field_->get_channel_layout();
}
int GetSelectedPreviewResolution() const
int get_selected_preview_resolution() const
{
return preview_resolution_field_->GetDivider();
return preview_resolution_field_->get_divider();
}
PixelFormat GetSelectedPreviewFormat() const
PixelFormat get_selected_preview_format() const
{
return preview_format_field_->GetPixelFormat();
return preview_format_field_->get_pixel_format();
}
bool GetSelectedPreviewAutoCache() const
bool get_selected_preview_auto_cache() const
{
//return preview_autocache_field_->isChecked();
// TEMP: Disable sequence auto-cache, wanna see if clip cache supersedes it.
@@ -90,10 +90,10 @@ public:
}
public slots:
void PresetChanged(const SequencePreset &preset);
void preset_changed(const SequencePreset &preset);
signals:
void SaveParametersAsPreset(const SequencePreset &preset);
void save_parameters_as_preset(const SequencePreset &preset);
private:
IntegerSlider *width_slider_;
@@ -119,11 +119,11 @@ private:
QCheckBox *preview_autocache_field_;
private slots:
void SavePresetClicked();
void save_preset_clicked();
void UpdatePreviewResolutionLabel();
void update_preview_resolution_label();
};
}
#endif // SEQUENCEDIALOGPARAMETERTAB_H
#endif // OAK_SEQUENCEDIALOGPARAMETERTAB_H
+85 -85
View File
@@ -38,9 +38,9 @@
namespace olive
{
const int kDataIsPreset = Qt::UserRole;
const int kDataPresetIsCustomRole = Qt::UserRole + 1;
const int kDataPresetDataRole = Qt::UserRole + 2;
const int k_data_is_preset = Qt::UserRole;
const int k_data_preset_is_custom_role = Qt::UserRole + 1;
const int k_data_preset_data_role = Qt::UserRole + 2;
SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget *parent)
: QWidget(parent)
@@ -54,124 +54,124 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget *parent)
preset_tree_->setHeaderLabel(tr("Preset"));
preset_tree_->setContextMenuPolicy(Qt::CustomContextMenu);
connect(preset_tree_, &QTreeWidget::customContextMenuRequested, this,
&SequenceDialogPresetTab::ShowContextMenu);
&SequenceDialogPresetTab::show_context_menu);
outer_layout->addWidget(preset_tree_);
connect(preset_tree_, &QTreeWidget::currentItemChanged, this,
&SequenceDialogPresetTab::SelectedItemChanged);
&SequenceDialogPresetTab::selected_item_changed);
connect(preset_tree_, &QTreeWidget::itemDoubleClicked, this,
&SequenceDialogPresetTab::ItemDoubleClicked);
&SequenceDialogPresetTab::item_double_clicked);
// Add "my presets" folder
my_presets_folder_ = CreateFolder(tr("My Presets"));
my_presets_folder_ = create_folder(tr("My Presets"));
preset_tree_->addTopLevelItem(my_presets_folder_);
// Add presets
preset_tree_->addTopLevelItem(
CreateHDPresetFolder(tr("4K UHD"), 3840, 2160, 2));
create_hd_preset_folder(tr("4K UHD"), 3840, 2160, 2));
preset_tree_->addTopLevelItem(
CreateHDPresetFolder(tr("1080p"), 1920, 1080, 1));
create_hd_preset_folder(tr("1080p"), 1920, 1080, 1));
preset_tree_->addTopLevelItem(
CreateHDPresetFolder(tr("720p"), 1280, 720, 1));
create_hd_preset_folder(tr("720p"), 1280, 720, 1));
preset_tree_->addTopLevelItem(
CreateSDPresetFolder(tr("NTSC"), 720, 480, rational(30000, 1001),
VideoParams::kPixelAspectNTSCStandard,
VideoParams::kPixelAspectNTSCWidescreen, 1));
create_sd_preset_folder(tr("NTSC"), 720, 480, Rational(30000, 1001),
VideoParams::k_pixel_aspect_ntsc_standard,
VideoParams::k_pixel_aspect_ntsc_widescreen, 1));
preset_tree_->addTopLevelItem(
CreateSDPresetFolder(tr("PAL"), 720, 576, rational(25, 1),
VideoParams::kPixelAspectPALStandard,
VideoParams::kPixelAspectPALWidescreen, 1));
create_sd_preset_folder(tr("PAL"), 720, 576, Rational(25, 1),
VideoParams::k_pixel_aspect_pal_standard,
VideoParams::k_pixel_aspect_pal_widescreen, 1));
// Load custom presets
for (int i = 0; i < GetNumberOfPresets(); i++) {
AddCustomItem(my_presets_folder_, GetPreset(i), i);
for (int i = 0; i < get_number_of_presets(); i++) {
add_custom_item(my_presets_folder_, get_preset(i), i);
}
}
void SequenceDialogPresetTab::SaveParametersAsPreset(SequencePreset preset)
void SequenceDialogPresetTab::save_parameters_as_preset(SequencePreset preset)
{
PresetPtr preset_ptr = std::make_shared<SequencePreset>(preset);
// If replaced, no need to make another item. If not saved, shared ptr will delete itself
if (SavePreset(preset_ptr) == kAppended) {
AddCustomItem(my_presets_folder_, preset_ptr, GetNumberOfPresets() - 1);
if (save_preset(preset_ptr) == k_appended) {
add_custom_item(my_presets_folder_, preset_ptr, get_number_of_presets() - 1);
}
}
QTreeWidgetItem *SequenceDialogPresetTab::CreateFolder(const QString &name)
QTreeWidgetItem *SequenceDialogPresetTab::create_folder(const QString &name)
{
QTreeWidgetItem *folder = new QTreeWidgetItem();
folder->setText(0, name);
folder->setIcon(0, icon::Folder);
folder->setIcon(0, icon::folder);
return folder;
}
QTreeWidgetItem *
SequenceDialogPresetTab::CreateHDPresetFolder(const QString &name, int width,
SequenceDialogPresetTab::create_hd_preset_folder(const QString &name, int width,
int height, int divider)
{
const PixelFormat default_format = static_cast<PixelFormat::Format>(
OLIVE_CONFIG("OfflinePixelFormat").toInt());
OAK_CONFIG("OfflinePixelFormat").toInt());
const bool default_autocache = false;
QTreeWidgetItem *parent = CreateFolder(name);
const uint64_t layout = kChannelLayoutStereo;
AddStandardItem(parent,
QTreeWidgetItem *parent = create_folder(name);
const uint64_t layout = k_channel_layout_stereo;
add_standard_item(parent,
std::make_shared<SequencePreset>(
tr("%1 23.976 FPS").arg(name), width, height,
rational(24000, 1001), VideoParams::kPixelAspectSquare,
VideoParams::kInterlaceNone, 48000, layout, divider,
Rational(24000, 1001), VideoParams::k_pixel_aspect_square,
VideoParams::k_interlace_none, 48000, layout, divider,
default_format, default_autocache));
AddStandardItem(parent,
add_standard_item(parent,
std::make_shared<SequencePreset>(
tr("%1 25 FPS").arg(name), width, height,
rational(25, 1), VideoParams::kPixelAspectSquare,
VideoParams::kInterlaceNone, 48000, layout, divider,
Rational(25, 1), VideoParams::k_pixel_aspect_square,
VideoParams::k_interlace_none, 48000, layout, divider,
default_format, default_autocache));
AddStandardItem(parent,
add_standard_item(parent,
std::make_shared<SequencePreset>(
tr("%1 29.97 FPS").arg(name), width, height,
rational(30000, 1001), VideoParams::kPixelAspectSquare,
VideoParams::kInterlaceNone, 48000, layout, divider,
Rational(30000, 1001), VideoParams::k_pixel_aspect_square,
VideoParams::k_interlace_none, 48000, layout, divider,
default_format, default_autocache));
AddStandardItem(parent,
add_standard_item(parent,
std::make_shared<SequencePreset>(
tr("%1 50 FPS").arg(name), width, height,
rational(50, 1), VideoParams::kPixelAspectSquare,
VideoParams::kInterlaceNone, 48000, layout, divider,
Rational(50, 1), VideoParams::k_pixel_aspect_square,
VideoParams::k_interlace_none, 48000, layout, divider,
default_format, default_autocache));
AddStandardItem(parent,
add_standard_item(parent,
std::make_shared<SequencePreset>(
tr("%1 59.94 FPS").arg(name), width, height,
rational(60000, 1001), VideoParams::kPixelAspectSquare,
VideoParams::kInterlaceNone, 48000, layout, divider,
Rational(60000, 1001), VideoParams::k_pixel_aspect_square,
VideoParams::k_interlace_none, 48000, layout, divider,
default_format, default_autocache));
return parent;
}
QTreeWidgetItem *SequenceDialogPresetTab::CreateSDPresetFolder(
const QString &name, int width, int height, const rational &frame_rate,
const rational &standard_par, const rational &wide_par, int divider)
QTreeWidgetItem *SequenceDialogPresetTab::create_sd_preset_folder(
const QString &name, int width, int height, const Rational &frame_rate,
const Rational &standard_par, const Rational &wide_par, int divider)
{
const PixelFormat default_format = static_cast<PixelFormat::Format>(
OLIVE_CONFIG("OfflinePixelFormat").toInt());
OAK_CONFIG("OfflinePixelFormat").toInt());
const bool default_autocache = false;
QTreeWidgetItem *parent = CreateFolder(name);
QTreeWidgetItem *parent = create_folder(name);
preset_tree_->addTopLevelItem(parent);
const uint64_t layout = kChannelLayoutStereo;
AddStandardItem(
const uint64_t layout = k_channel_layout_stereo;
add_standard_item(
parent, std::make_shared<SequencePreset>(
tr("%1 Standard").arg(name), width, height, frame_rate,
standard_par, VideoParams::kInterlacedBottomFirst, 48000,
standard_par, VideoParams::k_interlaced_bottom_first, 48000,
layout, divider, default_format, default_autocache));
AddStandardItem(
add_standard_item(
parent, std::make_shared<SequencePreset>(
tr("%1 Widescreen").arg(name), width, height, frame_rate,
wide_par, VideoParams::kInterlacedBottomFirst, 48000,
wide_par, VideoParams::k_interlaced_bottom_first, 48000,
layout, divider, default_format, default_autocache));
return parent;
}
QTreeWidgetItem *SequenceDialogPresetTab::GetSelectedItem()
QTreeWidgetItem *SequenceDialogPresetTab::get_selected_item()
{
QList<QTreeWidgetItem *> selected_items = preset_tree_->selectedItems();
@@ -182,114 +182,114 @@ QTreeWidgetItem *SequenceDialogPresetTab::GetSelectedItem()
}
}
QTreeWidgetItem *SequenceDialogPresetTab::GetSelectedCustomPreset()
QTreeWidgetItem *SequenceDialogPresetTab::get_selected_custom_preset()
{
QTreeWidgetItem *sel = GetSelectedItem();
QTreeWidgetItem *sel = get_selected_item();
if (sel && sel->data(0, kDataIsPreset).toBool() &&
sel->data(0, kDataPresetIsCustomRole).toBool()) {
if (sel && sel->data(0, k_data_is_preset).toBool() &&
sel->data(0, k_data_preset_is_custom_role).toBool()) {
return sel;
}
return nullptr;
}
void SequenceDialogPresetTab::AddStandardItem(QTreeWidgetItem *folder,
void SequenceDialogPresetTab::add_standard_item(QTreeWidgetItem *folder,
PresetPtr preset,
const QString &description)
{
int index = default_preset_data_.size();
default_preset_data_.append(preset);
AddItemInternal(folder, preset, false, index, description);
add_item_internal(folder, preset, false, index, description);
}
void SequenceDialogPresetTab::AddCustomItem(QTreeWidgetItem *folder,
void SequenceDialogPresetTab::add_custom_item(QTreeWidgetItem *folder,
PresetPtr preset, int index,
const QString &description)
{
AddItemInternal(folder, preset, true, index, description);
add_item_internal(folder, preset, true, index, description);
}
void SequenceDialogPresetTab::AddItemInternal(QTreeWidgetItem *folder,
void SequenceDialogPresetTab::add_item_internal(QTreeWidgetItem *folder,
PresetPtr preset, bool is_custom,
int index,
const QString &description)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, preset->GetName());
item->setIcon(0, icon::Video);
item->setText(0, preset->get_name());
item->setIcon(0, icon::video);
item->setToolTip(0, description);
item->setData(0, kDataIsPreset, true);
item->setData(0, kDataPresetIsCustomRole, is_custom);
item->setData(0, kDataPresetDataRole, index);
item->setData(0, k_data_is_preset, true);
item->setData(0, k_data_preset_is_custom_role, is_custom);
item->setData(0, k_data_preset_data_role, index);
folder->addChild(item);
}
void SequenceDialogPresetTab::SelectedItemChanged(QTreeWidgetItem *current,
void SequenceDialogPresetTab::selected_item_changed(QTreeWidgetItem *current,
QTreeWidgetItem *previous)
{
Q_UNUSED(previous)
if (current->data(0, kDataIsPreset).toBool()) {
int preset_index = current->data(0, kDataPresetDataRole).toInt();
if (current->data(0, k_data_is_preset).toBool()) {
int preset_index = current->data(0, k_data_preset_data_role).toInt();
PresetPtr preset_data =
(current->data(0, kDataPresetIsCustomRole).toBool()) ?
GetPreset(preset_index) :
(current->data(0, k_data_preset_is_custom_role).toBool()) ?
get_preset(preset_index) :
default_preset_data_.at(preset_index);
emit PresetChanged(*static_cast<SequencePreset *>(preset_data.get()));
emit preset_changed(*static_cast<SequencePreset *>(preset_data.get()));
}
}
void SequenceDialogPresetTab::ItemDoubleClicked(QTreeWidgetItem *item,
void SequenceDialogPresetTab::item_double_clicked(QTreeWidgetItem *item,
int column)
{
Q_UNUSED(column)
if (item->data(0, kDataIsPreset).toBool()) {
emit PresetAccepted();
if (item->data(0, k_data_is_preset).toBool()) {
emit preset_accepted();
}
}
void SequenceDialogPresetTab::ShowContextMenu()
void SequenceDialogPresetTab::show_context_menu()
{
QTreeWidgetItem *sel = GetSelectedCustomPreset();
QTreeWidgetItem *sel = get_selected_custom_preset();
if (sel) {
Menu m(this);
QAction *delete_action = m.addAction(tr("Delete Preset"));
connect(delete_action, &QAction::triggered, this,
&SequenceDialogPresetTab::DeleteSelectedPreset);
&SequenceDialogPresetTab::delete_selected_preset);
m.exec(QCursor::pos());
}
}
void SequenceDialogPresetTab::DeleteSelectedPreset()
void SequenceDialogPresetTab::delete_selected_preset()
{
QTreeWidgetItem *sel = GetSelectedCustomPreset();
QTreeWidgetItem *sel = get_selected_custom_preset();
if (sel) {
int preset_index = sel->data(0, kDataPresetDataRole).toInt();
int preset_index = sel->data(0, k_data_preset_data_role).toInt();
// Shift all items whose index was after this preset forward
for (int i = 0; i < my_presets_folder_->childCount(); i++) {
QTreeWidgetItem *custom_item = my_presets_folder_->child(i);
int this_item_index =
custom_item->data(0, kDataPresetDataRole).toInt();
custom_item->data(0, k_data_preset_data_role).toInt();
if (this_item_index > preset_index) {
custom_item->setData(0, kDataPresetDataRole,
custom_item->setData(0, k_data_preset_data_role,
this_item_index - 1);
}
}
// Remove the preset
DeletePreset(preset_index);
delete_preset(preset_index);
// Delete the item
delete sel;
+20 -20
View File
@@ -19,8 +19,8 @@
***/
#ifndef SEQUENCEDIALOGPRESETTAB_H
#define SEQUENCEDIALOGPRESETTAB_H
#ifndef OAK_SEQUENCEDIALOGPRESETTAB_H
#define OAK_SEQUENCEDIALOGPRESETTAB_H
#include <QLabel>
#include <QTreeWidget>
@@ -39,33 +39,33 @@ public:
SequenceDialogPresetTab(QWidget *parent = nullptr);
public slots:
void SaveParametersAsPreset(SequencePreset preset);
void save_parameters_as_preset(SequencePreset preset);
signals:
void PresetChanged(const SequencePreset &preset);
void preset_changed(const SequencePreset &preset);
void PresetAccepted();
void preset_accepted();
private:
QTreeWidgetItem *CreateFolder(const QString &name);
QTreeWidgetItem *create_folder(const QString &name);
QTreeWidgetItem *CreateHDPresetFolder(const QString &name, int width,
QTreeWidgetItem *create_hd_preset_folder(const QString &name, int width,
int height, int divider);
QTreeWidgetItem *CreateSDPresetFolder(
const QString &name, int width, int height, const rational &frame_rate,
const rational &standard_par, const rational &wide_par, int divider);
QTreeWidgetItem *create_sd_preset_folder(
const QString &name, int width, int height, const Rational &frame_rate,
const Rational &standard_par, const Rational &wide_par, int divider);
QTreeWidgetItem *GetSelectedItem();
QTreeWidgetItem *GetSelectedCustomPreset();
QTreeWidgetItem *get_selected_item();
QTreeWidgetItem *get_selected_custom_preset();
void AddStandardItem(QTreeWidgetItem *folder, PresetPtr preset,
void add_standard_item(QTreeWidgetItem *folder, PresetPtr preset,
const QString &description = QString());
void AddCustomItem(QTreeWidgetItem *folder, PresetPtr preset, int index,
void add_custom_item(QTreeWidgetItem *folder, PresetPtr preset, int index,
const QString &description = QString());
void AddItemInternal(QTreeWidgetItem *folder, PresetPtr preset,
void add_item_internal(QTreeWidgetItem *folder, PresetPtr preset,
bool is_custom, int index,
const QString &description = QString());
@@ -76,16 +76,16 @@ private:
QVector<PresetPtr> default_preset_data_;
private slots:
void SelectedItemChanged(QTreeWidgetItem *current,
void selected_item_changed(QTreeWidgetItem *current,
QTreeWidgetItem *previous);
void ItemDoubleClicked(QTreeWidgetItem *item, int column);
void item_double_clicked(QTreeWidgetItem *item, int column);
void ShowContextMenu();
void show_context_menu();
void DeleteSelectedPreset();
void delete_selected_preset();
};
}
#endif // SEQUENCEDIALOGPRESETTAB_H
#endif // OAK_SEQUENCEDIALOGPRESETTAB_H
+18 -18
View File
@@ -19,8 +19,8 @@
***/
#ifndef SEQUENCEPARAM_H
#define SEQUENCEPARAM_H
#ifndef OAK_SEQUENCEPARAM_H
#define OAK_SEQUENCEPARAM_H
#include <olive/core/core.h>
#include <QXmlStreamWriter>
@@ -37,7 +37,7 @@ public:
SequencePreset() = default;
SequencePreset(const QString &name, int width, int height,
const rational &frame_rate, const rational &pixel_aspect,
const Rational &frame_rate, const Rational &pixel_aspect,
VideoParams::Interlacing interlacing, int sample_rate,
uint64_t channel_layout, int preview_divider,
PixelFormat preview_format, bool preview_autocache)
@@ -52,23 +52,23 @@ public:
, preview_format_(preview_format)
, preview_autocache_(preview_autocache)
{
SetName(name);
set_name(name);
}
virtual void Load(QXmlStreamReader *reader) override
virtual void load(QXmlStreamReader *reader) override
{
while (XMLReadNextStartElement(reader)) {
while (xml_read_next_start_element(reader)) {
if (reader->name() == QStringLiteral("name")) {
SetName(reader->readElementText());
set_name(reader->readElementText());
} else if (reader->name() == QStringLiteral("width")) {
width_ = reader->readElementText().toInt();
} else if (reader->name() == QStringLiteral("height")) {
height_ = reader->readElementText().toInt();
} else if (reader->name() == QStringLiteral("framerate")) {
frame_rate_ = rational::fromString(
frame_rate_ = Rational::from_string(
reader->readElementText().toStdString());
} else if (reader->name() == QStringLiteral("pixelaspect")) {
pixel_aspect_ = rational::fromString(
pixel_aspect_ = Rational::from_string(
reader->readElementText().toStdString());
} else if (reader->name() == QStringLiteral("interlacing") ||
reader->name() == QStringLiteral("interlacing_")) {
@@ -93,19 +93,19 @@ public:
}
}
virtual void Save(QXmlStreamWriter *writer) const override
virtual void save(QXmlStreamWriter *writer) const override
{
writer->writeTextElement(QStringLiteral("name"), GetName());
writer->writeTextElement(QStringLiteral("name"), get_name());
writer->writeTextElement(QStringLiteral("width"),
QString::number(width_));
writer->writeTextElement(QStringLiteral("height"),
QString::number(height_));
writer->writeTextElement(
QStringLiteral("framerate"),
QString::fromStdString(frame_rate_.toString()));
QString::fromStdString(frame_rate_.to_string()));
writer->writeTextElement(
QStringLiteral("pixelaspect"),
QString::fromStdString(pixel_aspect_.toString()));
QString::fromStdString(pixel_aspect_.to_string()));
writer->writeTextElement(QStringLiteral("interlacing"),
QString::number(interlacing_));
writer->writeTextElement(QStringLiteral("samplerate"),
@@ -130,12 +130,12 @@ public:
return height_;
}
const rational &frame_rate() const
const Rational &frame_rate() const
{
return frame_rate_;
}
const rational &pixel_aspect() const
const Rational &pixel_aspect() const
{
return pixel_aspect_;
}
@@ -173,8 +173,8 @@ public:
private:
int width_;
int height_;
rational frame_rate_;
rational pixel_aspect_;
Rational frame_rate_;
Rational pixel_aspect_;
VideoParams::Interlacing interlacing_;
int sample_rate_;
uint64_t channel_layout_;
@@ -185,4 +185,4 @@ private:
}
#endif // SEQUENCEPARAM_H
#endif // OAK_SEQUENCEPARAM_H
@@ -36,7 +36,7 @@ namespace olive
#define super QDialog
SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips,
const rational &timebase,
const Rational &timebase,
QWidget *parent)
: super(parent)
, clips_(clips)
@@ -57,9 +57,9 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips,
speed_layout->addWidget(new QLabel(tr("Speed:")), row, 0);
speed_slider_ = new FloatSlider();
speed_slider_->SetDisplayType(FloatSlider::kPercentage);
connect(speed_slider_, &FloatSlider::ValueChanged, this,
&SpeedDurationDialog::SpeedChanged);
speed_slider_->set_display_type(FloatSlider::k_percentage);
connect(speed_slider_, &FloatSlider::value_changed, this,
&SpeedDurationDialog::speed_changed);
speed_layout->addWidget(speed_slider_, row, 1);
row++;
@@ -67,10 +67,10 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips,
speed_layout->addWidget(new QLabel(tr("Duration:")), row, 0);
dur_slider_ = new RationalSlider();
dur_slider_->SetTimebase(timebase);
dur_slider_->SetDisplayType(RationalSlider::kTime);
connect(dur_slider_, &RationalSlider::ValueChanged, this,
&SpeedDurationDialog::DurationChanged);
dur_slider_->set_timebase(timebase);
dur_slider_->set_display_type(RationalSlider::k_time);
connect(dur_slider_, &RationalSlider::value_changed, this,
&SpeedDurationDialog::duration_changed);
speed_layout->addWidget(dur_slider_, row, 1);
row++;
@@ -106,9 +106,9 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips,
loop_layout->addWidget(new QLabel(tr("Loop:")), row, 0);
loop_combo_ = new QComboBox();
loop_combo_->addItem(tr("None"), int(LoopMode::kLoopModeOff));
loop_combo_->addItem(tr("Loop"), int(LoopMode::kLoopModeLoop));
loop_combo_->addItem(tr("Clamp"), int(LoopMode::kLoopModeClamp));
loop_combo_->addItem(tr("None"), int(LoopMode::k_loop_mode_off));
loop_combo_->addItem(tr("Loop"), int(LoopMode::k_loop_mode_loop));
loop_combo_->addItem(tr("Clamp"), int(LoopMode::k_loop_mode_clamp));
loop_layout->addWidget(loop_combo_, row, 1);
}
@@ -157,15 +157,15 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips,
}
if (qIsNaN(start_speed_)) {
speed_slider_->SetTristate();
speed_slider_->set_tristate();
} else {
speed_slider_->SetValue(start_speed_);
speed_slider_->set_value(start_speed_);
}
if (start_duration_ == -1) {
dur_slider_->SetTristate();
dur_slider_->set_tristate();
} else {
dur_slider_->SetValue(start_duration_);
dur_slider_->set_value(start_duration_);
}
if (start_reverse_ == -1) {
@@ -195,16 +195,16 @@ void SpeedDurationDialog::accept()
TimelineRippleDeleteGapsAtRegionsCommand::RangeList ripple_ranges;
foreach (ClipBlock *c, clips_) {
rational proposed_length = c->length();
Rational proposed_length = c->length();
if (dur_slider_->IsTristate()) {
if (link_box_->isChecked() && !speed_slider_->IsTristate()) {
proposed_length = GetLengthAdjustment(c->length(), c->speed(),
speed_slider_->GetValue(),
if (dur_slider_->is_tristate()) {
if (link_box_->isChecked() && !speed_slider_->is_tristate()) {
proposed_length = get_length_adjustment(c->length(), c->speed(),
speed_slider_->get_value(),
timebase_);
}
} else {
proposed_length = dur_slider_->GetValue();
proposed_length = dur_slider_->get_value();
}
if (proposed_length != c->length()) {
@@ -220,7 +220,7 @@ void SpeedDurationDialog::accept()
if (proposed_length != c->length()) {
command->add_child(new BlockTrimCommand(
c->track(), c, proposed_length, Timeline::kTrimOut));
c->track(), c, proposed_length, Timeline::k_trim_out));
ripple_ranges.append(
{ c->track(),
TimeRange(c->in() + proposed_length, c->out()) });
@@ -234,23 +234,23 @@ void SpeedDurationDialog::accept()
}
// Set speed values
if (speed_slider_->IsTristate()) {
if (link_box_->isChecked() && !dur_slider_->IsTristate()) {
if (speed_slider_->is_tristate()) {
if (link_box_->isChecked() && !dur_slider_->is_tristate()) {
// Automatically determine speed from duration
foreach (ClipBlock *c, clips_) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(
NodeInput(c, ClipBlock::kSpeedInput)),
GetSpeedAdjustment(c->speed(), c->length(),
dur_slider_->GetValue())));
NodeInput(c, ClipBlock::k_speed_input)),
get_speed_adjustment(c->speed(), c->length(),
dur_slider_->get_value())));
}
}
} else {
// Set speeds to value of slider
foreach (ClipBlock *c, clips_) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(NodeInput(c, ClipBlock::kSpeedInput)),
speed_slider_->GetValue()));
NodeKeyframeTrackReference(NodeInput(c, ClipBlock::k_speed_input)),
speed_slider_->get_value()));
}
}
@@ -259,7 +259,7 @@ void SpeedDurationDialog::accept()
foreach (ClipBlock *c, clips_) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(
NodeInput(c, ClipBlock::kReverseInput)),
NodeInput(c, ClipBlock::k_reverse_input)),
reverse_box_->isChecked()));
}
}
@@ -269,7 +269,7 @@ void SpeedDurationDialog::accept()
foreach (ClipBlock *c, clips_) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(
NodeInput(c, ClipBlock::kMaintainAudioPitchInput)),
NodeInput(c, ClipBlock::k_maintain_audio_pitch_input)),
maintain_audio_pitch_box_->isChecked()));
}
}
@@ -278,7 +278,7 @@ void SpeedDurationDialog::accept()
foreach (ClipBlock *c, clips_) {
command->add_child(new NodeParamSetStandardValueCommand(
NodeKeyframeTrackReference(
NodeInput(c, ClipBlock::kLoopModeInput)),
NodeInput(c, ClipBlock::k_loop_mode_input)),
loop_combo_->currentData()));
}
}
@@ -286,54 +286,54 @@ void SpeedDurationDialog::accept()
QString name = (clips_.size() > 1) ?
tr("Set %1 Clip Properties").arg(clips_.size()) :
tr("Set Clip \"%1\" Properties")
.arg(clips_.first()->GetLabelOrName());
.arg(clips_.first()->get_label_or_name());
Core::instance()->undo_stack()->push(command, name);
super::accept();
}
rational SpeedDurationDialog::GetLengthAdjustment(
const rational &original_length, double original_speed, double new_speed,
const rational &timebase)
Rational SpeedDurationDialog::get_length_adjustment(
const Rational &original_length, double original_speed, double new_speed,
const Rational &timebase)
{
return Timecode::snap_time_to_timebase(
rational::fromDouble(original_length.toDouble() / new_speed *
Rational::from_double(original_length.to_double() / new_speed *
original_speed),
timebase);
}
double SpeedDurationDialog::GetSpeedAdjustment(double original_speed,
const rational &original_length,
const rational &new_length)
double SpeedDurationDialog::get_speed_adjustment(double original_speed,
const Rational &original_length,
const Rational &new_length)
{
return original_speed / new_length.toDouble() * original_length.toDouble();
return original_speed / new_length.to_double() * original_length.to_double();
}
void SpeedDurationDialog::SpeedChanged(double s)
void SpeedDurationDialog::speed_changed(double s)
{
if (!link_box_->isChecked()) {
return;
}
if (start_duration_ == -1) {
dur_slider_->SetTristate();
dur_slider_->set_tristate();
} else {
dur_slider_->SetValue(
GetLengthAdjustment(start_duration_, start_speed_, s, timebase_));
dur_slider_->set_value(
get_length_adjustment(start_duration_, start_speed_, s, timebase_));
}
}
void SpeedDurationDialog::DurationChanged(const rational &r)
void SpeedDurationDialog::duration_changed(const Rational &r)
{
if (!link_box_->isChecked()) {
return;
}
if (qIsNaN(start_speed_)) {
speed_slider_->SetTristate();
speed_slider_->set_tristate();
} else {
speed_slider_->SetValue(
GetSpeedAdjustment(start_speed_, start_duration_, r));
speed_slider_->set_value(
get_speed_adjustment(start_speed_, start_duration_, r));
}
}
+13 -13
View File
@@ -19,8 +19,8 @@
***/
#ifndef SPEEDDURATIONDIALOG_H
#define SPEEDDURATIONDIALOG_H
#ifndef OAK_SPEEDDURATIONDIALOG_H
#define OAK_SPEEDDURATIONDIALOG_H
#include <QCheckBox>
#include <QComboBox>
@@ -39,7 +39,7 @@ class SpeedDurationDialog : public QDialog {
Q_OBJECT
public:
explicit SpeedDurationDialog(const QVector<ClipBlock *> &clips,
const rational &timebase,
const Rational &timebase,
QWidget *parent = nullptr);
public slots:
@@ -48,13 +48,13 @@ public slots:
signals:
private:
static rational GetLengthAdjustment(const rational &original_length,
static Rational get_length_adjustment(const Rational &original_length,
double original_speed, double new_speed,
const rational &timebase);
const Rational &timebase);
static double GetSpeedAdjustment(double original_speed,
const rational &original_length,
const rational &new_length);
static double get_speed_adjustment(double original_speed,
const Rational &original_length,
const Rational &new_length);
QVector<ClipBlock *> clips_;
@@ -78,18 +78,18 @@ private:
double start_speed_;
rational start_duration_;
Rational start_duration_;
int start_loop_;
rational timebase_;
Rational timebase_;
private slots:
void SpeedChanged(double s);
void speed_changed(double s);
void DurationChanged(const rational &r);
void duration_changed(const Rational &r);
};
}
#endif // SPEEDDURATIONDIALOG_H
#endif // OAK_SPEEDDURATIONDIALOG_H
+9 -9
View File
@@ -30,7 +30,7 @@ namespace olive
#define super ProgressDialog
TaskDialog::TaskDialog(Task *task, const QString &title, QWidget *parent)
: super(task->GetTitle(), title, parent)
: super(task->get_title(), title, parent)
, task_(task)
, destroy_on_close_(true)
, already_shown_(false)
@@ -40,12 +40,12 @@ TaskDialog::TaskDialog(Task *task, const QString &title, QWidget *parent)
task_->setParent(this);
// Connect the save manager progress signal to the progress bar update on the dialog
connect(task_, &Task::ProgressChanged, this, &TaskDialog::SetProgress,
connect(task_, &Task::progress_changed, this, &TaskDialog::set_progress,
Qt::QueuedConnection);
// Connect cancel signal (must be a direct connection or it'll be queued after the task has
// already finished)
connect(this, &TaskDialog::Cancelled, task_, &Task::Cancel,
connect(this, &TaskDialog::cancelled, task_, &Task::Cancel,
Qt::DirectConnection);
}
@@ -59,12 +59,12 @@ void TaskDialog::showEvent(QShowEvent *e)
// Listen for when the task finishes
connect(task_watcher, &QFutureWatcher<bool>::finished, this,
&TaskDialog::TaskFinished, Qt::QueuedConnection);
&TaskDialog::task_finished, Qt::QueuedConnection);
// Run task in another thread with QtConcurrent
task_watcher->setFuture(
#if QT_VERSION_MAJOR >= 6
QtConcurrent::run(&Task::Start, task_)
QtConcurrent::run(&Task::start, task_)
#else
QtConcurrent::run(task_, &Task::Start)
#endif
@@ -94,7 +94,7 @@ void TaskDialog::closeEvent(QCloseEvent *e)
}
}
void TaskDialog::TaskFinished()
void TaskDialog::task_finished()
{
QFutureWatcher<bool> *task_watcher =
static_cast<QFutureWatcher<bool> *>(sender());
@@ -102,10 +102,10 @@ void TaskDialog::TaskFinished()
task_finished_ = true;
if (task_watcher->result()) {
emit TaskSucceeded(task_);
emit task_succeeded(task_);
} else {
ShowErrorMessage(tr("Task Failed"), task_->GetError());
emit TaskFailed(task_);
show_error_message(tr("Task Failed"), task_->get_error());
emit task_failed(task_);
}
task_watcher->deleteLater();
+8 -8
View File
@@ -19,8 +19,8 @@
***/
#ifndef TASKDIALOG_H
#define TASKDIALOG_H
#ifndef OAK_TASKDIALOG_H
#define OAK_TASKDIALOG_H
#include "dialog/progress/progress.h"
#include "task/task.h"
@@ -45,7 +45,7 @@ public:
*
* This is TRUE by default.
*/
void SetDestroyOnClose(bool e)
void set_destroy_on_close(bool e)
{
destroy_on_close_ = e;
}
@@ -53,7 +53,7 @@ public:
/**
* @brief Returns this dialog's task
*/
Task *GetTask() const
Task *get_task() const
{
return task_;
}
@@ -64,9 +64,9 @@ protected:
virtual void closeEvent(QCloseEvent *e) override;
signals:
void TaskSucceeded(Task *task);
void task_succeeded(Task *task);
void TaskFailed(Task *task);
void task_failed(Task *task);
private:
Task *task_;
@@ -78,9 +78,9 @@ private:
bool task_finished_;
private slots:
void TaskFinished();
void task_finished();
};
}
#endif // TASKDIALOG_H
#endif // OAK_TASKDIALOG_H
+3 -3
View File
@@ -19,8 +19,8 @@
***/
#ifndef RICHTEXTDIALOG_H
#define RICHTEXTDIALOG_H
#ifndef OAK_RICHTEXTDIALOG_H
#define OAK_RICHTEXTDIALOG_H
#include <QDialog>
#include <QFontComboBox>
@@ -48,4 +48,4 @@ private:
}
#endif // RICHTEXTDIALOG_H
#endif // OAK_RICHTEXTDIALOG_H