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:
@@ -41,25 +41,25 @@ ProjectImportTask::ProjectImportTask(Folder *folder,
|
||||
filenames_.append(QFileInfo(f));
|
||||
}
|
||||
|
||||
file_count_ = Core::CountFilesInFileList(filenames_);
|
||||
file_count_ = Core::count_files_in_file_list(filenames_);
|
||||
|
||||
SetTitle(tr("Importing %n file(s)", nullptr, file_count_));
|
||||
set_title(tr("Importing %n file(s)", nullptr, file_count_));
|
||||
}
|
||||
|
||||
const int &ProjectImportTask::GetFileCount() const
|
||||
const int &ProjectImportTask::get_file_count() const
|
||||
{
|
||||
return file_count_;
|
||||
}
|
||||
|
||||
bool ProjectImportTask::Run()
|
||||
bool ProjectImportTask::run()
|
||||
{
|
||||
command_ = new MultiUndoCommand();
|
||||
|
||||
int imported = 0;
|
||||
|
||||
Import(folder_, filenames_, imported, command_);
|
||||
import(folder_, filenames_, imported, command_);
|
||||
|
||||
if (IsCancelled()) {
|
||||
if (is_cancelled()) {
|
||||
delete command_;
|
||||
command_ = nullptr;
|
||||
return false;
|
||||
@@ -68,15 +68,15 @@ bool ProjectImportTask::Run()
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectImportTask::Import(Folder *folder, QFileInfoList import,
|
||||
void ProjectImportTask::import(Folder *folder, QFileInfoList entries,
|
||||
int &counter, MultiUndoCommand *parent_command)
|
||||
{
|
||||
for (int i = 0; i < import.size(); i++) {
|
||||
if (IsCancelled()) {
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
if (is_cancelled()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const QFileInfo &file_info = import.at(i);
|
||||
const QFileInfo &file_info = entries.at(i);
|
||||
|
||||
// Check if this file is a directory
|
||||
if (file_info.isDir()) {
|
||||
@@ -99,31 +99,31 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import,
|
||||
// Create a folder corresponding to the directory
|
||||
Folder *f = new Folder();
|
||||
|
||||
f->SetLabel(file_info.fileName());
|
||||
f->set_label(file_info.fileName());
|
||||
|
||||
// Create undoable command that adds the items to the model
|
||||
AddItemToFolder(folder, f, parent_command);
|
||||
add_item_to_folder(folder, f, parent_command);
|
||||
|
||||
// Recursively follow this path
|
||||
Import(f, entry_list, counter, parent_command);
|
||||
import(f, entry_list, counter, parent_command);
|
||||
}
|
||||
|
||||
} else {
|
||||
Footage *footage = new Footage();
|
||||
|
||||
footage->SetCancelPointer(this->GetCancelAtom());
|
||||
footage->set_cancel_pointer(this->get_cancel_atom());
|
||||
|
||||
footage->set_filename(file_info.absoluteFilePath());
|
||||
footage->SetLabel(file_info.fileName());
|
||||
footage->set_label(file_info.fileName());
|
||||
|
||||
footage->SetCancelPointer(nullptr);
|
||||
footage->set_cancel_pointer(nullptr);
|
||||
|
||||
if (footage->IsValid()) {
|
||||
if (footage->is_valid()) {
|
||||
// See if this footage is an image sequence
|
||||
ValidateImageSequence(footage, import, i);
|
||||
validate_image_sequence(footage, entries, i);
|
||||
|
||||
// Create undoable command that adds the items to the model
|
||||
AddItemToFolder(folder, footage, parent_command);
|
||||
add_item_to_folder(folder, footage, parent_command);
|
||||
|
||||
// Add to vector
|
||||
imported_footage_.push_back(footage);
|
||||
@@ -136,13 +136,13 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import,
|
||||
|
||||
counter++;
|
||||
|
||||
emit ProgressChanged(static_cast<double>(counter) /
|
||||
emit progress_changed(static_cast<double>(counter) /
|
||||
static_cast<double>(file_count_));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectImportTask::ValidateImageSequence(Footage *footage,
|
||||
void ProjectImportTask::validate_image_sequence(Footage *footage,
|
||||
QFileInfoList &info_list,
|
||||
int index)
|
||||
{
|
||||
@@ -150,51 +150,51 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage,
|
||||
//
|
||||
// By this point we've established that video contains a single still image stream. Now we'll
|
||||
// see if it ends with numbers.
|
||||
if (Decoder::GetImageSequenceDigitCount(footage->filename()) > 0 &&
|
||||
if (Decoder::get_image_sequence_digit_count(footage->filename()) > 0 &&
|
||||
!image_sequence_ignore_files_.contains(footage->filename()) &&
|
||||
footage->InputArraySize(Footage::kVideoParamsInput)) {
|
||||
VideoParams video_stream = footage->GetVideoParams(0);
|
||||
footage->input_array_size(Footage::k_video_params_input)) {
|
||||
VideoParams video_stream = footage->get_video_params(0);
|
||||
QSize dim(video_stream.width(), video_stream.height());
|
||||
|
||||
int64_t ind = Decoder::GetImageSequenceIndex(footage->filename());
|
||||
int64_t ind = Decoder::get_image_sequence_index(footage->filename());
|
||||
|
||||
// Check if files around exist around it with that follow a sequence
|
||||
QString previous_img_fn = Decoder::TransformImageSequenceFileName(
|
||||
QString previous_img_fn = Decoder::transform_image_sequence_file_name(
|
||||
footage->filename(), ind - 1);
|
||||
QString next_img_fn = Decoder::TransformImageSequenceFileName(
|
||||
QString next_img_fn = Decoder::transform_image_sequence_file_name(
|
||||
footage->filename(), ind + 1);
|
||||
|
||||
Footage *previous_file = new Footage(previous_img_fn);
|
||||
Footage *next_file = new Footage(next_img_fn);
|
||||
|
||||
// Finally see if these files have the same dimensions
|
||||
if ((previous_file->IsValid() &&
|
||||
CompareStillImageSize(previous_file, dim)) ||
|
||||
(next_file->IsValid() && CompareStillImageSize(next_file, dim))) {
|
||||
if ((previous_file->is_valid() &&
|
||||
compare_still_image_size(previous_file, dim)) ||
|
||||
(next_file->is_valid() && compare_still_image_size(next_file, dim))) {
|
||||
// By this point, we've established this file is a still image with a number at the end of
|
||||
// the filename surrounded by adjacent numbers. It could be a still image! But let's ask the
|
||||
// user just in case...
|
||||
bool is_sequence;
|
||||
|
||||
QMetaObject::invokeMethod(Core::instance(), "ConfirmImageSequence",
|
||||
QMetaObject::invokeMethod(Core::instance(), "confirm_image_sequence",
|
||||
Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, is_sequence),
|
||||
Q_ARG(QString, footage->filename()));
|
||||
|
||||
int64_t seq_index =
|
||||
Decoder::GetImageSequenceIndex(footage->filename());
|
||||
Decoder::get_image_sequence_index(footage->filename());
|
||||
|
||||
// Heuristic to find the first and last images (users can always override this later in
|
||||
// FootagePropertiesDialog)
|
||||
int64_t start_index =
|
||||
GetImageSequenceLimit(footage->filename(), seq_index, false);
|
||||
get_image_sequence_limit(footage->filename(), seq_index, false);
|
||||
int64_t end_index =
|
||||
GetImageSequenceLimit(footage->filename(), seq_index, true);
|
||||
get_image_sequence_limit(footage->filename(), seq_index, true);
|
||||
|
||||
// Depending on the user's choice, either remove them from the list or don't ask for the
|
||||
// remainders
|
||||
for (int64_t j = start_index; j <= end_index; j++) {
|
||||
QString entry_fn = Decoder::TransformImageSequenceFileName(
|
||||
QString entry_fn = Decoder::transform_image_sequence_file_name(
|
||||
footage->filename(), j);
|
||||
|
||||
if (is_sequence) {
|
||||
@@ -215,17 +215,17 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage,
|
||||
if (is_sequence) {
|
||||
// User has confirmed it is a still image, let's set it accordingly.
|
||||
video_stream.set_video_type(
|
||||
VideoParams::kVideoTypeImageSequence);
|
||||
VideoParams::k_video_type_image_sequence);
|
||||
|
||||
rational default_timebase =
|
||||
OLIVE_CONFIG("DefaultSequenceFrameRate").value<rational>();
|
||||
Rational default_timebase =
|
||||
OAK_CONFIG("DefaultSequenceFrameRate").value<Rational>();
|
||||
video_stream.set_time_base(default_timebase);
|
||||
video_stream.set_frame_rate(default_timebase.flipped());
|
||||
|
||||
video_stream.set_start_time(start_index);
|
||||
video_stream.set_duration(end_index - start_index + 1);
|
||||
|
||||
footage->SetVideoParams(video_stream, 0);
|
||||
footage->set_video_params(video_stream, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,44 +234,44 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectImportTask::AddItemToFolder(Folder *folder, Node *item,
|
||||
void ProjectImportTask::add_item_to_folder(Folder *folder, Node *item,
|
||||
MultiUndoCommand *command)
|
||||
{
|
||||
// Create undoable command that adds the items to the model
|
||||
Project *project = folder_->project();
|
||||
|
||||
NodeAddCommand *nac = new NodeAddCommand(project, item);
|
||||
nac->PushToThread(project->thread());
|
||||
nac->push_to_thread(project->thread());
|
||||
command->add_child(nac);
|
||||
|
||||
command->add_child(new FolderAddChild(folder, item));
|
||||
}
|
||||
|
||||
bool ProjectImportTask::ItemIsStillImageFootageOnly(Footage *footage)
|
||||
bool ProjectImportTask::item_is_still_image_footage_only(Footage *footage)
|
||||
{
|
||||
if (footage->GetTotalStreamCount() != 1) {
|
||||
if (footage->get_total_stream_count() != 1) {
|
||||
// Footage with more than one stream (usually video+audio) most likely isn't an image sequence
|
||||
return false;
|
||||
}
|
||||
|
||||
VideoParams vp = footage->GetVideoParams(0);
|
||||
VideoParams vp = footage->get_video_params(0);
|
||||
|
||||
// Footage must be valid and video stream must be a still image to be an image sequence
|
||||
return vp.is_valid() && vp.video_type() == VideoParams::kVideoTypeStill;
|
||||
return vp.is_valid() && vp.video_type() == VideoParams::k_video_type_still;
|
||||
}
|
||||
|
||||
bool ProjectImportTask::CompareStillImageSize(Footage *footage, const QSize &sz)
|
||||
bool ProjectImportTask::compare_still_image_size(Footage *footage, const QSize &sz)
|
||||
{
|
||||
if (!ItemIsStillImageFootageOnly(footage)) {
|
||||
if (!item_is_still_image_footage_only(footage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
VideoParams stream = footage->GetVideoParams(0);
|
||||
VideoParams stream = footage->get_video_params(0);
|
||||
|
||||
return stream.width() == sz.width() && stream.height() == sz.height();
|
||||
}
|
||||
|
||||
int64_t ProjectImportTask::GetImageSequenceLimit(const QString &start_fn,
|
||||
int64_t ProjectImportTask::get_image_sequence_limit(const QString &start_fn,
|
||||
int64_t start, bool up)
|
||||
{
|
||||
QString test_filename;
|
||||
@@ -286,7 +286,7 @@ int64_t ProjectImportTask::GetImageSequenceLimit(const QString &start_fn,
|
||||
}
|
||||
|
||||
test_filename =
|
||||
Decoder::TransformImageSequenceFileName(start_fn, test_index);
|
||||
Decoder::transform_image_sequence_file_name(start_fn, test_index);
|
||||
|
||||
if (!QFileInfo::exists(test_filename)) {
|
||||
// Reached end of index
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTIMPORTMANAGER_H
|
||||
#define PROJECTIMPORTMANAGER_H
|
||||
#ifndef OAK_PROJECTIMPORTMANAGER_H
|
||||
#define OAK_PROJECTIMPORTMANAGER_H
|
||||
|
||||
#include <QFileInfoList>
|
||||
#include <QUndoCommand>
|
||||
@@ -37,45 +37,45 @@ class ProjectImportTask : public Task {
|
||||
public:
|
||||
ProjectImportTask(Folder *folder, const QStringList &filenames);
|
||||
|
||||
const int &GetFileCount() const;
|
||||
const int &get_file_count() const;
|
||||
|
||||
MultiUndoCommand *GetCommand() const
|
||||
MultiUndoCommand *get_command() const
|
||||
{
|
||||
return command_;
|
||||
}
|
||||
|
||||
const QStringList &GetInvalidFiles() const
|
||||
const QStringList &get_invalid_files() const
|
||||
{
|
||||
return invalid_files_;
|
||||
}
|
||||
|
||||
bool HasInvalidFiles() const
|
||||
bool has_invalid_files() const
|
||||
{
|
||||
return !invalid_files_.isEmpty();
|
||||
}
|
||||
|
||||
const QVector<Footage *> &GetImportedFootage() const
|
||||
const QVector<Footage *> &get_imported_footage() const
|
||||
{
|
||||
return imported_footage_;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
virtual bool run() override;
|
||||
|
||||
private:
|
||||
void Import(Folder *folder, QFileInfoList import, int &counter,
|
||||
void import(Folder *folder, QFileInfoList entries, int &counter,
|
||||
MultiUndoCommand *parent_command);
|
||||
|
||||
void ValidateImageSequence(Footage *footage, QFileInfoList &info_list,
|
||||
void validate_image_sequence(Footage *footage, QFileInfoList &info_list,
|
||||
int index);
|
||||
|
||||
void AddItemToFolder(Folder *folder, Node *item, MultiUndoCommand *command);
|
||||
void add_item_to_folder(Folder *folder, Node *item, MultiUndoCommand *command);
|
||||
|
||||
static bool ItemIsStillImageFootageOnly(Footage *footage);
|
||||
static bool item_is_still_image_footage_only(Footage *footage);
|
||||
|
||||
static bool CompareStillImageSize(Footage *footage, const QSize &sz);
|
||||
static bool compare_still_image_size(Footage *footage, const QSize &sz);
|
||||
|
||||
static int64_t GetImageSequenceLimit(const QString &start_fn, int64_t start,
|
||||
static int64_t get_image_sequence_limit(const QString &start_fn, int64_t start,
|
||||
bool up);
|
||||
|
||||
MultiUndoCommand *command_;
|
||||
@@ -95,4 +95,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTIMPORTMANAGER_H
|
||||
#endif // OAK_PROJECTIMPORTMANAGER_H
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTIMPORTERRORDIALOG_H
|
||||
#define PROJECTIMPORTERRORDIALOG_H
|
||||
#ifndef OAK_PROJECTIMPORTERRORDIALOG_H
|
||||
#define OAK_PROJECTIMPORTERRORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
@@ -38,4 +38,4 @@ public:
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTIMPORTERRORDIALOG_H
|
||||
#endif // OAK_PROJECTIMPORTERRORDIALOG_H
|
||||
|
||||
@@ -33,51 +33,51 @@ ProjectLoadTask::ProjectLoadTask(const QString &filename)
|
||||
{
|
||||
}
|
||||
|
||||
bool ProjectLoadTask::Run()
|
||||
bool ProjectLoadTask::run()
|
||||
{
|
||||
project_ = new Project();
|
||||
|
||||
project_->set_filename(GetFilename());
|
||||
project_->set_filename(get_filename());
|
||||
|
||||
ProjectSerializer::Result result = ProjectSerializer::Load(
|
||||
project_, GetFilename(), ProjectSerializer::kProject);
|
||||
ProjectSerializer::Result result = ProjectSerializer::load(
|
||||
project_, get_filename(), ProjectSerializer::k_project);
|
||||
|
||||
layout_ = result.GetLoadData().layout;
|
||||
layout_ = result.get_load_data().layout;
|
||||
|
||||
switch (result.code()) {
|
||||
case ProjectSerializer::kSuccess:
|
||||
case ProjectSerializer::k_success:
|
||||
break;
|
||||
case ProjectSerializer::kProjectTooOld:
|
||||
SetError(tr(
|
||||
case ProjectSerializer::k_project_too_old:
|
||||
set_error(tr(
|
||||
"This project is from a version of Oak Video Editor that is no longer supported in this version."));
|
||||
break;
|
||||
case ProjectSerializer::kProjectTooNew:
|
||||
SetError(tr(
|
||||
case ProjectSerializer::k_project_too_new:
|
||||
set_error(tr(
|
||||
"This project is from a newer version of Oak Video Editor and cannot be opened in this version."));
|
||||
break;
|
||||
case ProjectSerializer::kUnknownVersion:
|
||||
SetError(tr("Failed to determine project version."));
|
||||
case ProjectSerializer::k_unknown_version:
|
||||
set_error(tr("Failed to determine project version."));
|
||||
break;
|
||||
case ProjectSerializer::kFileError:
|
||||
SetError(
|
||||
tr("Failed to read file \"%1\" for reading.").arg(GetFilename()));
|
||||
case ProjectSerializer::k_file_error:
|
||||
set_error(
|
||||
tr("Failed to read file \"%1\" for reading.").arg(get_filename()));
|
||||
break;
|
||||
case ProjectSerializer::kXmlError:
|
||||
SetError(
|
||||
case ProjectSerializer::k_xml_error:
|
||||
set_error(
|
||||
tr("Failed to read XML document. File may be corrupt. Error was: %1")
|
||||
.arg(result.GetDetails()));
|
||||
.arg(result.get_details()));
|
||||
break;
|
||||
case ProjectSerializer::kNoData:
|
||||
SetError(tr("Failed to find any data to parse."));
|
||||
case ProjectSerializer::k_no_data:
|
||||
set_error(tr("Failed to find any data to parse."));
|
||||
break;
|
||||
|
||||
// Errors that should never be thrown by a load
|
||||
case ProjectSerializer::kOverwriteError:
|
||||
SetError(tr("Unknown error."));
|
||||
case ProjectSerializer::k_overwrite_error:
|
||||
set_error(tr("Unknown error."));
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == ProjectSerializer::kSuccess) {
|
||||
if (result == ProjectSerializer::k_success) {
|
||||
project_->moveToThread(qApp->thread());
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTLOADMANAGER_H
|
||||
#define PROJECTLOADMANAGER_H
|
||||
#ifndef OAK_PROJECTLOADMANAGER_H
|
||||
#define OAK_PROJECTLOADMANAGER_H
|
||||
|
||||
#include "loadbasetask.h"
|
||||
#include "window/mainwindow/mainwindowlayoutinfo.h"
|
||||
@@ -34,9 +34,9 @@ public:
|
||||
ProjectLoadTask(const QString &filename);
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
virtual bool run() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTLOADMANAGER_H
|
||||
#endif // OAK_PROJECTLOADMANAGER_H
|
||||
|
||||
@@ -28,7 +28,7 @@ ProjectLoadBaseTask::ProjectLoadBaseTask(const QString &filename)
|
||||
: project_(nullptr)
|
||||
, filename_(filename)
|
||||
{
|
||||
SetTitle(tr("Loading '%1'").arg(filename));
|
||||
set_title(tr("Loading '%1'").arg(filename));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTLOADBASETASK_H
|
||||
#define PROJECTLOADBASETASK_H
|
||||
#ifndef OAK_PROJECTLOADBASETASK_H
|
||||
#define OAK_PROJECTLOADBASETASK_H
|
||||
|
||||
#include "node/project.h"
|
||||
#include "task/task.h"
|
||||
@@ -33,17 +33,17 @@ class ProjectLoadBaseTask : public Task {
|
||||
public:
|
||||
ProjectLoadBaseTask(const QString &filename);
|
||||
|
||||
Project *GetLoadedProject() const
|
||||
Project *get_loaded_project() const
|
||||
{
|
||||
return project_;
|
||||
}
|
||||
|
||||
const QString &GetFilename() const
|
||||
const QString &get_filename() const
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
|
||||
const MainWindowLayoutInfo &GetLoadedLayout() const
|
||||
const MainWindowLayoutInfo &get_loaded_layout() const
|
||||
{
|
||||
return layout_;
|
||||
}
|
||||
|
||||
@@ -221,17 +221,17 @@ bool LoadOTIOTask::Run()
|
||||
|
||||
track->AppendBlock(block);
|
||||
|
||||
rational start_time;
|
||||
rational duration;
|
||||
Rational start_time;
|
||||
Rational duration;
|
||||
|
||||
if (otio_block->schema_name() == "Clip" ||
|
||||
otio_block->schema_name() == "Gap") {
|
||||
start_time = rational::fromDouble(
|
||||
start_time = Rational::fromDouble(
|
||||
static_cast<OTIO::Item *>(otio_block)
|
||||
->source_range()
|
||||
->start_time()
|
||||
.to_seconds());
|
||||
duration = rational::fromDouble(
|
||||
duration = Rational::fromDouble(
|
||||
static_cast<OTIO::Item *>(otio_block)
|
||||
->source_range()
|
||||
->duration()
|
||||
@@ -262,9 +262,9 @@ bool LoadOTIOTask::Run()
|
||||
|
||||
// Set how far the transition eats into the previous clip
|
||||
transition_block->set_offsets_and_length(
|
||||
rational::fromRationalTime(
|
||||
Rational::fromRationalTime(
|
||||
otio_block_transition->in_offset()),
|
||||
rational::fromRationalTime(
|
||||
Rational::fromRationalTime(
|
||||
otio_block_transition->out_offset()));
|
||||
|
||||
if (previous_block) {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef OTIODECODER_H
|
||||
#define OTIODECODER_H
|
||||
#ifndef OAK_OTIODECODER_H
|
||||
#define OAK_OTIODECODER_H
|
||||
|
||||
#ifdef USE_OTIO
|
||||
|
||||
@@ -44,4 +44,4 @@ protected:
|
||||
|
||||
#endif
|
||||
|
||||
#endif // OTIODECODER_H
|
||||
#endif // OAK_OTIODECODER_H
|
||||
|
||||
@@ -36,50 +36,50 @@ ProjectSaveTask::ProjectSaveTask(Project *project, bool use_compression)
|
||||
: project_(project)
|
||||
, use_compression_(use_compression)
|
||||
{
|
||||
SetTitle(tr("Saving '%1'").arg(project->filename()));
|
||||
set_title(tr("Saving '%1'").arg(project->filename()));
|
||||
}
|
||||
|
||||
bool ProjectSaveTask::Run()
|
||||
bool ProjectSaveTask::run()
|
||||
{
|
||||
QString using_filename = override_filename_.isEmpty() ?
|
||||
project_->filename() :
|
||||
override_filename_;
|
||||
|
||||
ProjectSerializer::SaveData data(ProjectSerializer::kProject);
|
||||
ProjectSerializer::SaveData data(ProjectSerializer::k_project);
|
||||
|
||||
data.SetFilename(using_filename);
|
||||
data.SetProject(project_);
|
||||
data.SetLayout(layout_);
|
||||
data.set_filename(using_filename);
|
||||
data.set_project(project_);
|
||||
data.set_layout(layout_);
|
||||
|
||||
ProjectSerializer::Result result =
|
||||
ProjectSerializer::Save(data, use_compression_);
|
||||
ProjectSerializer::save(data, use_compression_);
|
||||
|
||||
bool success = false;
|
||||
|
||||
switch (result.code()) {
|
||||
case ProjectSerializer::kSuccess:
|
||||
case ProjectSerializer::k_success:
|
||||
success = true;
|
||||
break;
|
||||
case ProjectSerializer::kXmlError:
|
||||
SetError(tr("Failed to write XML data."));
|
||||
case ProjectSerializer::k_xml_error:
|
||||
set_error(tr("Failed to write XML data."));
|
||||
break;
|
||||
case ProjectSerializer::kFileError:
|
||||
SetError(tr("Failed to open file \"%1\" for writing.")
|
||||
.arg(result.GetDetails()));
|
||||
case ProjectSerializer::k_file_error:
|
||||
set_error(tr("Failed to open file \"%1\" for writing.")
|
||||
.arg(result.get_details()));
|
||||
break;
|
||||
case ProjectSerializer::kOverwriteError:
|
||||
SetError(
|
||||
case ProjectSerializer::k_overwrite_error:
|
||||
set_error(
|
||||
tr("Failed to overwrite \"%1\". Project has been saved as \"%2\" instead.")
|
||||
.arg(using_filename, result.GetDetails()));
|
||||
.arg(using_filename, result.get_details()));
|
||||
success = true;
|
||||
break;
|
||||
|
||||
// Errors that should never be thrown by a save
|
||||
case ProjectSerializer::kProjectTooNew:
|
||||
case ProjectSerializer::kProjectTooOld:
|
||||
case ProjectSerializer::kUnknownVersion:
|
||||
case ProjectSerializer::kNoData:
|
||||
SetError(tr("Unknown error."));
|
||||
case ProjectSerializer::k_project_too_new:
|
||||
case ProjectSerializer::k_project_too_old:
|
||||
case ProjectSerializer::k_unknown_version:
|
||||
case ProjectSerializer::k_no_data:
|
||||
set_error(tr("Unknown error."));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSAVEMANAGER_H
|
||||
#define PROJECTSAVEMANAGER_H
|
||||
#ifndef OAK_PROJECTSAVEMANAGER_H
|
||||
#define OAK_PROJECTSAVEMANAGER_H
|
||||
|
||||
#include "node/project.h"
|
||||
#include "task/task.h"
|
||||
@@ -33,23 +33,23 @@ class ProjectSaveTask : public Task {
|
||||
public:
|
||||
ProjectSaveTask(Project *project, bool use_compression);
|
||||
|
||||
Project *GetProject() const
|
||||
Project *get_project() const
|
||||
{
|
||||
return project_;
|
||||
}
|
||||
|
||||
void SetOverrideFilename(const QString &filename)
|
||||
void set_override_filename(const QString &filename)
|
||||
{
|
||||
override_filename_ = filename;
|
||||
}
|
||||
|
||||
void SetLayout(const MainWindowLayoutInfo &layout)
|
||||
void set_layout(const MainWindowLayoutInfo &layout)
|
||||
{
|
||||
layout_ = layout;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
virtual bool run() override;
|
||||
|
||||
private:
|
||||
Project *project_;
|
||||
@@ -63,4 +63,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTSAVEMANAGER_H
|
||||
#endif // OAK_PROJECTSAVEMANAGER_H
|
||||
|
||||
@@ -125,7 +125,7 @@ OTIO::Timeline *SaveOTIOTask::SerializeTimeline(Sequence *sequence)
|
||||
}
|
||||
|
||||
OTIO::Track *SaveOTIOTask::SerializeTrack(Track *track, double sequence_rate,
|
||||
rational max_track_length)
|
||||
Rational max_track_length)
|
||||
{
|
||||
auto otio_track = new OTIO::Track();
|
||||
|
||||
@@ -246,7 +246,7 @@ bool SaveOTIOTask::SerializeTrackList(TrackList *list,
|
||||
{
|
||||
OTIO::ErrorStatus es;
|
||||
|
||||
rational max_track_length = RATIONAL_MIN;
|
||||
Rational max_track_length = RATIONAL_MIN;
|
||||
|
||||
foreach (Track *track, list->GetTracks()) {
|
||||
if (track->track_length() > max_track_length) {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSAVEASOTIOTASK_H
|
||||
#define PROJECTSAVEASOTIOTASK_H
|
||||
#ifndef OAK_PROJECTSAVEASOTIOTASK_H
|
||||
#define OAK_PROJECTSAVEASOTIOTASK_H
|
||||
|
||||
#ifdef USE_OTIO
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
OTIO::Timeline *SerializeTimeline(Sequence *sequence);
|
||||
|
||||
OTIO::Track *SerializeTrack(Track *track, double sequence_rate,
|
||||
rational max_track_length);
|
||||
Rational max_track_length);
|
||||
|
||||
bool SerializeTrackList(TrackList *list, OTIO::Timeline *otio_timeline,
|
||||
double sequence_rate);
|
||||
@@ -58,4 +58,4 @@ private:
|
||||
|
||||
#endif
|
||||
|
||||
#endif // PROJECTSAVEASOTIOTASK_H
|
||||
#endif // OAK_PROJECTSAVEASOTIOTASK_H
|
||||
|
||||
Reference in New Issue
Block a user