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:
@@ -32,41 +32,41 @@ namespace olive
|
||||
|
||||
#define super Node
|
||||
|
||||
const QString Folder::kChildInput = QStringLiteral("child_in");
|
||||
const QString Folder::k_child_input = QStringLiteral("child_in");
|
||||
|
||||
Folder::Folder()
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
set_flag(k_is_item);
|
||||
|
||||
AddInput(kChildInput, NodeValue::kNone,
|
||||
InputFlags(kInputFlagArray | kInputFlagNotKeyframable));
|
||||
add_input(k_child_input, NodeValue::k_none,
|
||||
InputFlags(k_input_flag_array | k_input_flag_not_keyframable));
|
||||
}
|
||||
|
||||
QVariant Folder::data(const DataType &d) const
|
||||
{
|
||||
if (d == ICON) {
|
||||
return icon::Folder;
|
||||
if (d == icon) {
|
||||
return icon::folder;
|
||||
}
|
||||
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
void Folder::Retranslate()
|
||||
void Folder::retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::retranslate();
|
||||
|
||||
SetInputName(kChildInput, tr("Children"));
|
||||
set_input_name(k_child_input, tr("Children"));
|
||||
}
|
||||
|
||||
Node *GetChildWithNameInternal(const Folder *n, const QString &s)
|
||||
Node *get_child_with_name_internal(const Folder *n, const QString &s)
|
||||
{
|
||||
for (int i = 0; i < n->item_child_count(); i++) {
|
||||
Node *child = n->item_child(i);
|
||||
|
||||
if (child->GetLabel() == s) {
|
||||
if (child->get_label() == s) {
|
||||
return child;
|
||||
} else if (Folder *subfolder = dynamic_cast<Folder *>(child)) {
|
||||
if (Node *n2 = GetChildWithNameInternal(subfolder, s)) {
|
||||
if (Node *n2 = get_child_with_name_internal(subfolder, s)) {
|
||||
return n2;
|
||||
}
|
||||
}
|
||||
@@ -75,18 +75,18 @@ Node *GetChildWithNameInternal(const Folder *n, const QString &s)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *Folder::GetChildWithName(const QString &s) const
|
||||
Node *Folder::get_child_with_name(const QString &s) const
|
||||
{
|
||||
return GetChildWithNameInternal(this, s);
|
||||
return get_child_with_name_internal(this, s);
|
||||
}
|
||||
|
||||
bool Folder::HasChildRecursive(Node *child) const
|
||||
bool Folder::has_child_recursive(Node *child) const
|
||||
{
|
||||
for (Node *i : item_children_) {
|
||||
if (i == child) {
|
||||
return true;
|
||||
} else if (Folder *f = dynamic_cast<Folder *>(i)) {
|
||||
if (f->HasChildRecursive(child)) {
|
||||
if (f->has_child_recursive(child)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -109,31 +109,31 @@ int Folder::index_of_child_in_array(Node *item) const
|
||||
void Folder::InputConnectedEvent(const QString &input, int element,
|
||||
Node *output)
|
||||
{
|
||||
if (input == kChildInput && element != -1) {
|
||||
if (input == k_child_input && element != -1) {
|
||||
Node *item = output;
|
||||
|
||||
// The insert index is always our "count" because we only support appending in our internal
|
||||
// model. For sorting/organizing, a QSortFilterProxyModel is used instead.
|
||||
emit BeginInsertItem(item, item_child_count());
|
||||
emit begin_insert_item(item, item_child_count());
|
||||
item_children_.append(item);
|
||||
item_element_index_.append(element);
|
||||
item->SetFolder(this);
|
||||
emit EndInsertItem();
|
||||
item->set_folder(this);
|
||||
emit end_insert_item();
|
||||
}
|
||||
}
|
||||
|
||||
void Folder::InputDisconnectedEvent(const QString &input, int element,
|
||||
Node *output)
|
||||
{
|
||||
if (input == kChildInput && element != -1) {
|
||||
if (input == k_child_input && element != -1) {
|
||||
Node *item = output;
|
||||
|
||||
int child_index = item_children_.indexOf(item);
|
||||
emit BeginRemoveItem(item, child_index);
|
||||
emit begin_remove_item(item, child_index);
|
||||
item_children_.removeAt(child_index);
|
||||
item_element_index_.removeAt(child_index);
|
||||
item->SetFolder(nullptr);
|
||||
emit EndRemoveItem();
|
||||
item->set_folder(nullptr);
|
||||
emit end_remove_item();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,25 +143,25 @@ FolderAddChild::FolderAddChild(Folder *folder, Node *child)
|
||||
{
|
||||
}
|
||||
|
||||
Project *FolderAddChild::GetRelevantProject() const
|
||||
Project *FolderAddChild::get_relevant_project() const
|
||||
{
|
||||
return folder_->project();
|
||||
}
|
||||
|
||||
void FolderAddChild::redo()
|
||||
{
|
||||
int array_index = folder_->InputArraySize(Folder::kChildInput);
|
||||
folder_->InputArrayAppend(Folder::kChildInput);
|
||||
Node::ConnectEdge(child_,
|
||||
NodeInput(folder_, Folder::kChildInput, array_index));
|
||||
int array_index = folder_->input_array_size(Folder::k_child_input);
|
||||
folder_->input_array_append(Folder::k_child_input);
|
||||
Node::connect_edge(child_,
|
||||
NodeInput(folder_, Folder::k_child_input, array_index));
|
||||
}
|
||||
|
||||
void FolderAddChild::undo()
|
||||
{
|
||||
Node::DisconnectEdge(
|
||||
child_, NodeInput(folder_, Folder::kChildInput,
|
||||
folder_->InputArraySize(Folder::kChildInput) - 1));
|
||||
folder_->InputArrayRemoveLast(Folder::kChildInput);
|
||||
Node::disconnect_edge(
|
||||
child_, NodeInput(folder_, Folder::k_child_input,
|
||||
folder_->input_array_size(Folder::k_child_input) - 1));
|
||||
folder_->input_array_remove_last(Folder::k_child_input);
|
||||
}
|
||||
|
||||
void Folder::RemoveElementCommand::redo()
|
||||
@@ -169,13 +169,13 @@ void Folder::RemoveElementCommand::redo()
|
||||
if (!subcommand_) {
|
||||
remove_index_ = folder_->index_of_child_in_array(child_);
|
||||
if (remove_index_ != -1) {
|
||||
NodeInput connected_input(folder_, Folder::kChildInput,
|
||||
NodeInput connected_input(folder_, Folder::k_child_input,
|
||||
remove_index_);
|
||||
subcommand_ = new MultiUndoCommand();
|
||||
subcommand_->add_child(new NodeEdgeRemoveCommand(
|
||||
folder_->GetConnectedOutput(connected_input), connected_input));
|
||||
folder_->get_connected_output(connected_input), connected_input));
|
||||
subcommand_->add_child(new NodeArrayRemoveCommand(
|
||||
folder_, Folder::kChildInput, remove_index_));
|
||||
folder_, Folder::k_child_input, remove_index_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FOLDER_H
|
||||
#define FOLDER_H
|
||||
#ifndef OAK_FOLDER_H
|
||||
#define OAK_FOLDER_H
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(Folder)
|
||||
|
||||
virtual QString Name() const override
|
||||
virtual QString name() const override
|
||||
{
|
||||
return tr("Folder");
|
||||
}
|
||||
@@ -50,27 +50,27 @@ public:
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.folder");
|
||||
}
|
||||
|
||||
virtual QVector<CategoryID> Category() const override
|
||||
virtual QVector<CategoryID> category() const override
|
||||
{
|
||||
return { kCategoryProject };
|
||||
return { k_category_project };
|
||||
}
|
||||
|
||||
virtual QString Description() const override
|
||||
virtual QString description() const override
|
||||
{
|
||||
return tr("Organize several items into a single collection.");
|
||||
}
|
||||
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
Node *GetChildWithName(const QString &s) const;
|
||||
bool ChildExistsWithName(const QString &s) const
|
||||
Node *get_child_with_name(const QString &s) const;
|
||||
bool child_exists_with_name(const QString &s) const
|
||||
{
|
||||
return GetChildWithName(s);
|
||||
return get_child_with_name(s);
|
||||
}
|
||||
|
||||
bool HasChildRecursive(Node *child) const;
|
||||
bool has_child_recursive(Node *child) const;
|
||||
|
||||
int item_child_count() const
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
int index_of_child_in_array(Node *item) const;
|
||||
|
||||
template <typename T> QVector<T *> ListChildrenOfType() const
|
||||
template <typename T> QVector<T *> list_children_of_type() const
|
||||
{
|
||||
QVector<T *> list;
|
||||
|
||||
@@ -106,14 +106,14 @@ public:
|
||||
|
||||
Folder *folder_test = dynamic_cast<Folder *>(node);
|
||||
if (folder_test) {
|
||||
list.append(folder_test->ListChildrenOfType<T>());
|
||||
list.append(folder_test->list_children_of_type<T>());
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static const QString kChildInput;
|
||||
static const QString k_child_input;
|
||||
|
||||
class RemoveElementCommand : public UndoCommand {
|
||||
public:
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
delete subcommand_;
|
||||
}
|
||||
|
||||
virtual Project *GetRelevantProject() const override
|
||||
virtual Project *get_relevant_project() const override
|
||||
{
|
||||
return folder_->project();
|
||||
}
|
||||
@@ -155,13 +155,13 @@ public:
|
||||
};
|
||||
|
||||
signals:
|
||||
void BeginInsertItem(Node *n, int index);
|
||||
void begin_insert_item(Node *n, int index);
|
||||
|
||||
void EndInsertItem();
|
||||
void end_insert_item();
|
||||
|
||||
void BeginRemoveItem(Node *n, int index);
|
||||
void begin_remove_item(Node *n, int index);
|
||||
|
||||
void EndRemoveItem();
|
||||
void end_remove_item();
|
||||
|
||||
protected:
|
||||
virtual void InputConnectedEvent(const QString &input, int element,
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static void ListOutputsOfTypeInternal(const Folder *n, QVector<T *> &list,
|
||||
static void list_outputs_of_type_internal(const Folder *n, QVector<T *> &list,
|
||||
bool recursive)
|
||||
{
|
||||
foreach (const Node::OutputConnection &c, n->output_connections()) {
|
||||
@@ -205,7 +205,7 @@ class FolderAddChild : public UndoCommand {
|
||||
public:
|
||||
FolderAddChild(Folder *folder, Node *child);
|
||||
|
||||
virtual Project *GetRelevantProject() const override;
|
||||
virtual Project *get_relevant_project() const override;
|
||||
|
||||
protected:
|
||||
virtual void redo() override;
|
||||
@@ -220,4 +220,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // FOLDER_H
|
||||
#endif // OAK_FOLDER_H
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const QString Footage::kFilenameInput = QStringLiteral("file_in");
|
||||
const QString Footage::k_filename_input = QStringLiteral("file_in");
|
||||
|
||||
#define super ViewerOutput
|
||||
|
||||
@@ -47,7 +47,7 @@ Footage::Footage(const QString &filename)
|
||||
, timestamp_(0)
|
||||
, has_source_start_time_(false)
|
||||
, proxy_enabled_(false)
|
||||
, proxy_state_(ProxyManager::kProxyMissing)
|
||||
, proxy_state_(ProxyManager::k_proxy_missing)
|
||||
, proxy_video_stream_index_(-1)
|
||||
, proxy_preset_version_(0)
|
||||
, has_custom_proxy_params_(false)
|
||||
@@ -55,13 +55,13 @@ Footage::Footage(const QString &filename)
|
||||
, cancelled_(nullptr)
|
||||
, total_stream_count_(0)
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
set_flag(k_is_item);
|
||||
|
||||
PrependInput(kFilenameInput, NodeValue::kFile,
|
||||
InputFlags(kInputFlagNotConnectable |
|
||||
kInputFlagNotKeyframable));
|
||||
prepend_input(k_filename_input, NodeValue::k_file,
|
||||
InputFlags(k_input_flag_not_connectable |
|
||||
k_input_flag_not_keyframable));
|
||||
|
||||
Clear();
|
||||
clear();
|
||||
|
||||
if (!filename.isEmpty()) {
|
||||
set_filename(filename);
|
||||
@@ -69,50 +69,50 @@ Footage::Footage(const QString &filename)
|
||||
|
||||
QTimer *check_timer = new QTimer(this);
|
||||
check_timer->setInterval(5000);
|
||||
connect(check_timer, &QTimer::timeout, this, &Footage::CheckFootage);
|
||||
connect(check_timer, &QTimer::timeout, this, &Footage::check_footage);
|
||||
check_timer->start();
|
||||
|
||||
connect(this->waveform_cache(), &AudioWaveformCache::Validated, this,
|
||||
&ViewerOutput::ConnectedWaveformChanged);
|
||||
connect(this->waveform_cache(), &AudioWaveformCache::validated, this,
|
||||
&ViewerOutput::connected_waveform_changed);
|
||||
}
|
||||
|
||||
void Footage::Retranslate()
|
||||
void Footage::retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::retranslate();
|
||||
|
||||
SetInputName(kFilenameInput, tr("Filename"));
|
||||
set_input_name(k_filename_input, tr("Filename"));
|
||||
}
|
||||
|
||||
void Footage::InputValueChangedEvent(const QString &input, int element)
|
||||
{
|
||||
if (input == kFilenameInput) {
|
||||
if (input == k_filename_input) {
|
||||
// Reset internal stream cache
|
||||
Clear();
|
||||
clear();
|
||||
|
||||
Reprobe();
|
||||
reprobe();
|
||||
} else {
|
||||
super::InputValueChangedEvent(input, element);
|
||||
}
|
||||
}
|
||||
|
||||
rational Footage::VerifyLengthInternal(Track::Type type) const
|
||||
Rational Footage::verify_length_internal(Track::Type type) const
|
||||
{
|
||||
if (type == Track::kVideo) {
|
||||
VideoParams first_stream = GetFirstEnabledVideoStream();
|
||||
if (type == Track::k_video) {
|
||||
VideoParams first_stream = get_first_enabled_video_stream();
|
||||
|
||||
if (first_stream.is_valid()) {
|
||||
return Timecode::timestamp_to_time(first_stream.duration(),
|
||||
first_stream.time_base());
|
||||
}
|
||||
} else if (type == Track::kAudio) {
|
||||
AudioParams first_stream = GetFirstEnabledAudioStream();
|
||||
} else if (type == Track::k_audio) {
|
||||
AudioParams first_stream = get_first_enabled_audio_stream();
|
||||
|
||||
if (first_stream.is_valid()) {
|
||||
return Timecode::timestamp_to_time(first_stream.duration(),
|
||||
first_stream.time_base());
|
||||
}
|
||||
} else if (type == Track::kSubtitle) {
|
||||
SubtitleParams first_stream = GetFirstEnabledSubtitleStream();
|
||||
} else if (type == Track::k_subtitle) {
|
||||
SubtitleParams first_stream = get_first_enabled_subtitle_stream();
|
||||
|
||||
if (first_stream.is_valid()) {
|
||||
return first_stream.duration();
|
||||
@@ -122,29 +122,29 @@ rational Footage::VerifyLengthInternal(Track::Type type) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString Footage::GetColorspaceToUse(const VideoParams ¶ms) const
|
||||
QString Footage::get_colorspace_to_use(const VideoParams ¶ms) const
|
||||
{
|
||||
if (params.colorspace().isEmpty()) {
|
||||
return project()->color_manager()->GetDefaultInputColorSpace();
|
||||
return project()->color_manager()->get_default_input_color_space();
|
||||
} else {
|
||||
return params.colorspace();
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::Clear()
|
||||
void Footage::clear()
|
||||
{
|
||||
// Clear all dynamically created inputs
|
||||
InputArrayResize(kVideoParamsInput, 0);
|
||||
InputArrayResize(kAudioParamsInput, 0);
|
||||
InputArrayResize(kSubtitleParamsInput, 0);
|
||||
input_array_resize(k_video_params_input, 0);
|
||||
input_array_resize(k_audio_params_input, 0);
|
||||
input_array_resize(k_subtitle_params_input, 0);
|
||||
|
||||
// Clear decoder link
|
||||
decoder_.clear();
|
||||
|
||||
has_source_start_time_ = false;
|
||||
source_start_time_ = rational();
|
||||
source_start_time_ = Rational();
|
||||
source_start_time_source_.clear();
|
||||
ClearProxy();
|
||||
clear_proxy();
|
||||
|
||||
// Clear total stream count
|
||||
total_stream_count_ = 0;
|
||||
@@ -153,19 +153,19 @@ void Footage::Clear()
|
||||
valid_ = false;
|
||||
}
|
||||
|
||||
void Footage::SetValid()
|
||||
void Footage::set_valid()
|
||||
{
|
||||
valid_ = true;
|
||||
}
|
||||
|
||||
QString Footage::filename() const
|
||||
{
|
||||
return GetStandardValue(kFilenameInput).toString();
|
||||
return get_standard_value(k_filename_input).toString();
|
||||
}
|
||||
|
||||
void Footage::set_filename(const QString &s)
|
||||
{
|
||||
SetStandardValue(kFilenameInput, s);
|
||||
set_standard_value(k_filename_input, s);
|
||||
}
|
||||
|
||||
const qint64 &Footage::timestamp() const
|
||||
@@ -178,50 +178,50 @@ void Footage::set_timestamp(const qint64 &t)
|
||||
timestamp_ = t;
|
||||
}
|
||||
|
||||
int Footage::GetStreamIndex(Track::Type type, int index) const
|
||||
int Footage::get_stream_index(Track::Type type, int index) const
|
||||
{
|
||||
switch (type) {
|
||||
case Track::kVideo:
|
||||
if (index >= 0 && index < GetVideoStreamCount()) {
|
||||
return GetVideoParams(index).stream_index();
|
||||
case Track::k_video:
|
||||
if (index >= 0 && index < get_video_stream_count()) {
|
||||
return get_video_params(index).stream_index();
|
||||
}
|
||||
break;
|
||||
case Track::kAudio:
|
||||
if (index >= 0 && index < GetAudioStreamCount()) {
|
||||
return GetAudioParams(index).stream_index();
|
||||
case Track::k_audio:
|
||||
if (index >= 0 && index < get_audio_stream_count()) {
|
||||
return get_audio_params(index).stream_index();
|
||||
}
|
||||
break;
|
||||
case Track::kSubtitle:
|
||||
if (index >= 0 && index < GetSubtitleStreamCount()) {
|
||||
return GetSubtitleParams(index).stream_index();
|
||||
case Track::k_subtitle:
|
||||
if (index >= 0 && index < get_subtitle_stream_count()) {
|
||||
return get_subtitle_params(index).stream_index();
|
||||
}
|
||||
break;
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
case Track::k_none:
|
||||
case Track::k_count:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Track::Reference Footage::GetReferenceFromRealIndex(int real_index) const
|
||||
Track::Reference Footage::get_reference_from_real_index(int real_index) const
|
||||
{
|
||||
// Check video streams
|
||||
for (int i = 0; i < GetVideoStreamCount(); i++) {
|
||||
if (GetVideoParams(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::kVideo, i);
|
||||
for (int i = 0; i < get_video_stream_count(); i++) {
|
||||
if (get_video_params(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::k_video, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetAudioStreamCount(); i++) {
|
||||
if (GetAudioParams(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::kAudio, i);
|
||||
for (int i = 0; i < get_audio_stream_count(); i++) {
|
||||
if (get_audio_params(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::k_audio, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetSubtitleStreamCount(); i++) {
|
||||
if (GetSubtitleParams(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::kSubtitle, i);
|
||||
for (int i = 0; i < get_subtitle_stream_count(); i++) {
|
||||
if (get_subtitle_params(i).stream_index() == real_index) {
|
||||
return Track::Reference(Track::k_subtitle, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,16 +233,16 @@ const QString &Footage::decoder() const
|
||||
return decoder_;
|
||||
}
|
||||
|
||||
void Footage::SetSourceStartTime(const rational &time, const QString &source)
|
||||
void Footage::set_source_start_time(const Rational &time, const QString &source)
|
||||
{
|
||||
source_start_time_ = time;
|
||||
source_start_time_source_ = source;
|
||||
has_source_start_time_ = true;
|
||||
}
|
||||
|
||||
void Footage::ClearSourceStartTime()
|
||||
void Footage::clear_source_start_time()
|
||||
{
|
||||
source_start_time_ = rational();
|
||||
source_start_time_ = Rational();
|
||||
source_start_time_source_.clear();
|
||||
has_source_start_time_ = false;
|
||||
}
|
||||
@@ -255,15 +255,15 @@ void Footage::set_proxy_enabled(bool enabled)
|
||||
if (Project *p = project()) {
|
||||
p->set_modified(true);
|
||||
}
|
||||
emit ProxySettingsChanged();
|
||||
emit proxy_settings_changed();
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::SetProxy(const QString &path, ProxyManager::ProxyState state,
|
||||
void Footage::set_proxy(const QString &path, ProxyManager::ProxyState state,
|
||||
int video_stream_index, int preset_version, bool enabled)
|
||||
{
|
||||
qDebug() << "Footage::SetProxy:" << filename() << "enabled=" << enabled
|
||||
<< "state=" << ProxyManager::ProxyStateToString(state)
|
||||
<< "state=" << ProxyManager::proxy_state_to_string(state)
|
||||
<< "path=" << path;
|
||||
proxy_path_ = path;
|
||||
proxy_state_ = state;
|
||||
@@ -273,30 +273,30 @@ void Footage::SetProxy(const QString &path, ProxyManager::ProxyState state,
|
||||
if (Project *p = project()) {
|
||||
p->set_modified(true);
|
||||
}
|
||||
emit ProxySettingsChanged();
|
||||
emit proxy_settings_changed();
|
||||
}
|
||||
|
||||
void Footage::ClearProxy()
|
||||
void Footage::clear_proxy()
|
||||
{
|
||||
proxy_enabled_ = false;
|
||||
proxy_path_.clear();
|
||||
proxy_state_ = ProxyManager::kProxyMissing;
|
||||
proxy_state_ = ProxyManager::k_proxy_missing;
|
||||
proxy_video_stream_index_ = -1;
|
||||
proxy_preset_version_ = 0;
|
||||
emit ProxySettingsChanged();
|
||||
emit proxy_settings_changed();
|
||||
}
|
||||
|
||||
void Footage::SetCustomProxyParams(const ProxyManager::ProxyParams ¶ms)
|
||||
void Footage::set_custom_proxy_params(const ProxyManager::ProxyParams ¶ms)
|
||||
{
|
||||
custom_proxy_params_ = params;
|
||||
has_custom_proxy_params_ = true;
|
||||
if (Project *p = project()) {
|
||||
p->set_modified(true);
|
||||
}
|
||||
emit ProxySettingsChanged();
|
||||
emit proxy_settings_changed();
|
||||
}
|
||||
|
||||
void Footage::ClearCustomProxyParams()
|
||||
void Footage::clear_custom_proxy_params()
|
||||
{
|
||||
if (has_custom_proxy_params_) {
|
||||
has_custom_proxy_params_ = false;
|
||||
@@ -304,22 +304,22 @@ void Footage::ClearCustomProxyParams()
|
||||
if (Project *p = project()) {
|
||||
p->set_modified(true);
|
||||
}
|
||||
emit ProxySettingsChanged();
|
||||
emit proxy_settings_changed();
|
||||
}
|
||||
}
|
||||
|
||||
ProxyManager::ProxyParams Footage::GetEffectiveProxyParams() const
|
||||
ProxyManager::ProxyParams Footage::get_effective_proxy_params() const
|
||||
{
|
||||
if (has_custom_proxy_params_) {
|
||||
return custom_proxy_params_;
|
||||
}
|
||||
|
||||
return ProxyManager::ProxyParamsFromConfig();
|
||||
return ProxyManager::proxy_params_from_config();
|
||||
}
|
||||
|
||||
QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
||||
QString Footage::describe_video_stream(const VideoParams ¶ms)
|
||||
{
|
||||
if (params.video_type() == VideoParams::kVideoTypeStill) {
|
||||
if (params.video_type() == VideoParams::k_video_type_still) {
|
||||
return tr("%1: Image - %2x%3")
|
||||
.arg(QString::number(params.stream_index()),
|
||||
QString::number(params.width()),
|
||||
@@ -332,7 +332,7 @@ QString Footage::DescribeVideoStream(const VideoParams ¶ms)
|
||||
}
|
||||
}
|
||||
|
||||
QString Footage::DescribeAudioStream(const AudioParams ¶ms)
|
||||
QString Footage::describe_audio_stream(const AudioParams ¶ms)
|
||||
{
|
||||
return tr("%1: Audio - %n Channel(s), %2Hz", nullptr,
|
||||
params.channel_count())
|
||||
@@ -340,48 +340,48 @@ QString Footage::DescribeAudioStream(const AudioParams ¶ms)
|
||||
QString::number(params.sample_rate()));
|
||||
}
|
||||
|
||||
QString Footage::DescribeSubtitleStream(const SubtitleParams ¶ms)
|
||||
QString Footage::describe_subtitle_stream(const SubtitleParams ¶ms)
|
||||
{
|
||||
return tr("%1: Subtitle").arg(QString::number(params.stream_index()));
|
||||
}
|
||||
|
||||
void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
void Footage::value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const
|
||||
{
|
||||
Q_UNUSED(globals)
|
||||
|
||||
// Pop filename from table
|
||||
QString file = value[kFilenameInput].toString();
|
||||
QString file = value[k_filename_input].to_string();
|
||||
|
||||
// If the file exists and the reference is valid, push a footage job to the renderer
|
||||
if (QFileInfo::exists(file)) {
|
||||
// Push length
|
||||
table->Push(NodeValue::kRational, QVariant::fromValue(GetLength()),
|
||||
table->push(NodeValue::k_rational, QVariant::fromValue(get_length()),
|
||||
this, QStringLiteral("length"));
|
||||
|
||||
// Push each stream as a footage job
|
||||
for (int i = 0; i < GetTotalStreamCount(); i++) {
|
||||
Track::Reference ref = GetReferenceFromRealIndex(i);
|
||||
for (int i = 0; i < get_total_stream_count(); i++) {
|
||||
Track::Reference ref = get_reference_from_real_index(i);
|
||||
FootageJob job(globals.time(), decoder_, filename(), ref.type(),
|
||||
GetLength(), globals.loop_mode());
|
||||
get_length(), globals.loop_mode());
|
||||
|
||||
if (ref.type() == Track::kVideo) {
|
||||
VideoParams vp = GetVideoParams(ref.index());
|
||||
if (ref.type() == Track::k_video) {
|
||||
VideoParams vp = get_video_params(ref.index());
|
||||
|
||||
if (proxy_enabled_ && !proxy_path_.isEmpty() &&
|
||||
proxy_video_stream_index_ == vp.stream_index() &&
|
||||
ProxyManager::GetProxyState(proxy_path_) ==
|
||||
ProxyManager::kProxyReady) {
|
||||
ProxyManager::get_proxy_state(proxy_path_) ==
|
||||
ProxyManager::k_proxy_ready) {
|
||||
job.set_proxy(proxy_path_, QStringLiteral("ffmpeg"), 0);
|
||||
}
|
||||
|
||||
// Ensure the colorspace is valid and not empty
|
||||
vp.set_colorspace(GetColorspaceToUse(vp));
|
||||
vp.set_colorspace(get_colorspace_to_use(vp));
|
||||
|
||||
// Adjust footage job's divider
|
||||
if (globals.vparams().divider() > 1) {
|
||||
// Use a divider appropriate for this target resolution
|
||||
int calculated = VideoParams::GetDividerForTargetResolution(
|
||||
int calculated = VideoParams::get_divider_for_target_resolution(
|
||||
vp.width(), vp.height(),
|
||||
globals.vparams().effective_width(),
|
||||
globals.vparams().effective_height());
|
||||
@@ -394,25 +394,25 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
|
||||
job.set_video_params(vp);
|
||||
|
||||
table->Push(NodeValue::kTexture, Texture::Job(vp, job), this,
|
||||
ref.ToString());
|
||||
} else if (ref.type() == Track::kAudio) {
|
||||
AudioParams ap = GetAudioParams(ref.index());
|
||||
table->push(NodeValue::k_texture, Texture::job(vp, job), this,
|
||||
ref.to_string());
|
||||
} else if (ref.type() == Track::k_audio) {
|
||||
AudioParams ap = get_audio_params(ref.index());
|
||||
job.set_audio_params(ap);
|
||||
job.set_cache_path(project()->cache_path());
|
||||
|
||||
// Proxies generated with audio contain the video stream at
|
||||
// index 0 followed by all source audio streams in source order
|
||||
if (proxy_enabled_ && !proxy_path_.isEmpty() &&
|
||||
ProxyManager::GetProxyState(proxy_path_) ==
|
||||
ProxyManager::kProxyReady &&
|
||||
ProxyManager::ProxyFilenameHasAudio(proxy_path_)) {
|
||||
ProxyManager::get_proxy_state(proxy_path_) ==
|
||||
ProxyManager::k_proxy_ready &&
|
||||
ProxyManager::proxy_filename_has_audio(proxy_path_)) {
|
||||
int audio_rank = 0;
|
||||
for (int i = 0; i < GetTotalStreamCount(); i++) {
|
||||
for (int i = 0; i < get_total_stream_count(); i++) {
|
||||
const Track::Reference other =
|
||||
GetReferenceFromRealIndex(i);
|
||||
if (other.type() == Track::kAudio &&
|
||||
GetAudioParams(other.index()).stream_index() <
|
||||
get_reference_from_real_index(i);
|
||||
if (other.type() == Track::k_audio &&
|
||||
get_audio_params(other.index()).stream_index() <
|
||||
ap.stream_index()) {
|
||||
audio_rank++;
|
||||
}
|
||||
@@ -421,82 +421,82 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
audio_rank + 1);
|
||||
}
|
||||
|
||||
table->Push(NodeValue::kSamples, QVariant::fromValue(job), this,
|
||||
ref.ToString());
|
||||
table->push(NodeValue::k_samples, QVariant::fromValue(job), this,
|
||||
ref.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString Footage::GetStreamTypeName(Track::Type type)
|
||||
QString Footage::get_stream_type_name(Track::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case Track::kVideo:
|
||||
case Track::k_video:
|
||||
return tr("Video");
|
||||
case Track::kAudio:
|
||||
case Track::k_audio:
|
||||
return tr("Audio");
|
||||
case Track::kSubtitle:
|
||||
case Track::k_subtitle:
|
||||
return tr("Subtitle");
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
case Track::k_none:
|
||||
case Track::k_count:
|
||||
break;
|
||||
}
|
||||
|
||||
return tr("Unknown");
|
||||
}
|
||||
|
||||
Node *Footage::GetConnectedTextureOutput()
|
||||
Node *Footage::get_connected_texture_output()
|
||||
{
|
||||
if (GetVideoStreamCount() > 0) {
|
||||
if (get_video_stream_count() > 0) {
|
||||
return this;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Node *Footage::GetConnectedSampleOutput()
|
||||
Node *Footage::get_connected_sample_output()
|
||||
{
|
||||
if (GetAudioStreamCount() > 0) {
|
||||
if (get_audio_stream_count() > 0) {
|
||||
return this;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool TimeIsOutOfBounds(const rational &time, const rational &length)
|
||||
bool time_is_out_of_bounds(const Rational &time, const Rational &length)
|
||||
{
|
||||
return time < 0 || time >= length;
|
||||
}
|
||||
|
||||
rational Footage::AdjustTimeByLoopMode(rational time, LoopMode loop_mode,
|
||||
const rational &length,
|
||||
Rational Footage::adjust_time_by_loop_mode(Rational time, LoopMode loop_mode,
|
||||
const Rational &length,
|
||||
VideoParams::Type type,
|
||||
const rational &timebase)
|
||||
const Rational &timebase)
|
||||
{
|
||||
if (type == VideoParams::kVideoTypeStill) {
|
||||
if (type == VideoParams::k_video_type_still) {
|
||||
// No looping for still images
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (TimeIsOutOfBounds(time, length)) {
|
||||
if (time_is_out_of_bounds(time, length)) {
|
||||
switch (loop_mode) {
|
||||
case LoopMode::kLoopModeOff:
|
||||
case LoopMode::k_loop_mode_off:
|
||||
// Return no time to indicate no frame should be shown here
|
||||
time = rational::NaN;
|
||||
time = Rational::na_n;
|
||||
break;
|
||||
case LoopMode::kLoopModeClamp:
|
||||
case LoopMode::k_loop_mode_clamp:
|
||||
if (length < timebase) {
|
||||
// No full frame fits in the range, so there is nothing to clamp to
|
||||
time = rational::NaN;
|
||||
time = Rational::na_n;
|
||||
} else {
|
||||
// Clamp footage time to length
|
||||
time = std::clamp(time, rational(0), length - timebase);
|
||||
time = std::clamp(time, Rational(0), length - timebase);
|
||||
}
|
||||
break;
|
||||
case LoopMode::kLoopModeLoop:
|
||||
case LoopMode::k_loop_mode_loop:
|
||||
if (length <= 0) {
|
||||
// Cannot loop around an empty range
|
||||
time = rational::NaN;
|
||||
time = Rational::na_n;
|
||||
} else {
|
||||
// Loop footage time around job length
|
||||
do {
|
||||
@@ -505,7 +505,7 @@ rational Footage::AdjustTimeByLoopMode(rational time, LoopMode loop_mode,
|
||||
} else {
|
||||
time += length;
|
||||
}
|
||||
} while (TimeIsOutOfBounds(time, length));
|
||||
} while (time_is_out_of_bounds(time, length));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -517,15 +517,15 @@ rational Footage::AdjustTimeByLoopMode(rational time, LoopMode loop_mode,
|
||||
QVariant Footage::data(const DataType &d) const
|
||||
{
|
||||
switch (d) {
|
||||
case CREATED_TIME: {
|
||||
case created_time: {
|
||||
QFileInfo info(filename());
|
||||
|
||||
if (info.exists()) {
|
||||
return QtUtils::GetCreationDate(info).toSecsSinceEpoch();
|
||||
return QtUtils::get_creation_date(info).toSecsSinceEpoch();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MODIFIED_TIME: {
|
||||
case modified_time: {
|
||||
QFileInfo info(filename());
|
||||
|
||||
if (info.exists()) {
|
||||
@@ -533,57 +533,57 @@ QVariant Footage::data(const DataType &d) const
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ICON: {
|
||||
if (valid_ && GetTotalStreamCount()) {
|
||||
case icon: {
|
||||
if (valid_ && get_total_stream_count()) {
|
||||
// Prioritize video > audio > image
|
||||
VideoParams s = GetFirstEnabledVideoStream();
|
||||
VideoParams s = get_first_enabled_video_stream();
|
||||
|
||||
if (s.is_valid() &&
|
||||
s.video_type() != VideoParams::kVideoTypeStill) {
|
||||
return icon::Video;
|
||||
} else if (HasEnabledAudioStreams()) {
|
||||
return icon::Audio;
|
||||
s.video_type() != VideoParams::k_video_type_still) {
|
||||
return icon::video;
|
||||
} else if (has_enabled_audio_streams()) {
|
||||
return icon::audio;
|
||||
} else if (s.is_valid() &&
|
||||
s.video_type() == VideoParams::kVideoTypeStill) {
|
||||
return icon::Image;
|
||||
} else if (HasEnabledSubtitleStreams()) {
|
||||
return icon::Subtitles;
|
||||
s.video_type() == VideoParams::k_video_type_still) {
|
||||
return icon::image;
|
||||
} else if (has_enabled_subtitle_streams()) {
|
||||
return icon::subtitles;
|
||||
}
|
||||
}
|
||||
|
||||
return icon::Error;
|
||||
return icon::error;
|
||||
}
|
||||
case TOOLTIP: {
|
||||
case tooltip: {
|
||||
if (valid_) {
|
||||
QString tip = tr("Filename: %1").arg(filename());
|
||||
|
||||
int vp_sz = GetVideoStreamCount();
|
||||
int vp_sz = get_video_stream_count();
|
||||
for (int i = 0; i < vp_sz; i++) {
|
||||
VideoParams p = GetVideoParams(i);
|
||||
VideoParams p = get_video_params(i);
|
||||
|
||||
if (p.enabled()) {
|
||||
tip.append("\n");
|
||||
tip.append(DescribeVideoStream(p));
|
||||
tip.append(describe_video_stream(p));
|
||||
}
|
||||
}
|
||||
|
||||
int ap_sz = GetAudioStreamCount();
|
||||
int ap_sz = get_audio_stream_count();
|
||||
for (int i = 0; i < ap_sz; i++) {
|
||||
AudioParams p = GetAudioParams(i);
|
||||
AudioParams p = get_audio_params(i);
|
||||
|
||||
if (p.enabled()) {
|
||||
tip.append("\n");
|
||||
tip.append(DescribeAudioStream(p));
|
||||
tip.append(describe_audio_stream(p));
|
||||
}
|
||||
}
|
||||
|
||||
int sp_sz = GetSubtitleStreamCount();
|
||||
int sp_sz = get_subtitle_stream_count();
|
||||
for (int i = 0; i < sp_sz; i++) {
|
||||
SubtitleParams p = GetSubtitleParams(i);
|
||||
SubtitleParams p = get_subtitle_params(i);
|
||||
|
||||
if (p.enabled()) {
|
||||
tip.append("\n");
|
||||
tip.append(DescribeSubtitleStream(p));
|
||||
tip.append(describe_subtitle_stream(p));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,14 +599,14 @@ QVariant Footage::data(const DataType &d) const
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
bool Footage::LoadCustom(QXmlStreamReader *reader, SerializedData *data)
|
||||
bool Footage::load_custom(QXmlStreamReader *reader, SerializedData *data)
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("timestamp")) {
|
||||
this->set_timestamp(reader->readElementText().toLongLong());
|
||||
} else if (reader->name() == QStringLiteral("proxy")) {
|
||||
bool enabled = false;
|
||||
ProxyManager::ProxyState state = ProxyManager::kProxyMissing;
|
||||
ProxyManager::ProxyState state = ProxyManager::k_proxy_missing;
|
||||
int stream = -1;
|
||||
int preset_version = 0;
|
||||
bool has_custom_params = false;
|
||||
@@ -618,7 +618,7 @@ bool Footage::LoadCustom(QXmlStreamReader *reader, SerializedData *data)
|
||||
enabled = (attr.value() == QStringLiteral("1") ||
|
||||
attr.value() == QStringLiteral("true"));
|
||||
} else if (attr.name() == QStringLiteral("state")) {
|
||||
state = ProxyManager::ProxyStateFromString(
|
||||
state = ProxyManager::proxy_state_from_string(
|
||||
attr.value().toString());
|
||||
} else if (attr.name() == QStringLiteral("stream")) {
|
||||
stream = attr.value().toInt();
|
||||
@@ -647,12 +647,12 @@ bool Footage::LoadCustom(QXmlStreamReader *reader, SerializedData *data)
|
||||
}
|
||||
|
||||
if (has_custom_params) {
|
||||
SetCustomProxyParams(custom_params);
|
||||
set_custom_proxy_params(custom_params);
|
||||
}
|
||||
|
||||
const QString path = reader->readElementText();
|
||||
if (!path.isEmpty()) {
|
||||
SetProxy(path, state, stream, preset_version, enabled);
|
||||
set_proxy(path, state, stream, preset_version, enabled);
|
||||
} else if (enabled) {
|
||||
set_proxy_enabled(true);
|
||||
}
|
||||
@@ -674,12 +674,12 @@ bool Footage::LoadCustom(QXmlStreamReader *reader, SerializedData *data)
|
||||
const int numerator = split.at(0).toInt(&numerator_ok);
|
||||
const int denominator = split.at(1).toInt(&denominator_ok);
|
||||
if (numerator_ok && denominator_ok && denominator) {
|
||||
SetSourceStartTime(rational(numerator, denominator),
|
||||
set_source_start_time(Rational(numerator, denominator),
|
||||
source);
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("viewer")) {
|
||||
if (!ViewerOutput::LoadCustom(reader, data)) {
|
||||
if (!ViewerOutput::load_custom(reader, data)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -690,12 +690,12 @@ bool Footage::LoadCustom(QXmlStreamReader *reader, SerializedData *data)
|
||||
// The cached lengths are not serialized. Recompute them from the stream
|
||||
// parameters that were just loaded so that worker processes and any code
|
||||
// that reads GetLength() before InvalidateCache() runs sees valid values.
|
||||
VerifyLength();
|
||||
verify_length();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Footage::SaveCustom(QXmlStreamWriter *writer) const
|
||||
void Footage::save_custom(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("timestamp"),
|
||||
QString::number(this->timestamp()));
|
||||
@@ -706,7 +706,7 @@ void Footage::SaveCustom(QXmlStreamWriter *writer) const
|
||||
proxy_enabled_ ? QStringLiteral("1") :
|
||||
QStringLiteral("0"));
|
||||
writer->writeAttribute(QStringLiteral("state"),
|
||||
ProxyManager::ProxyStateToString(proxy_state_));
|
||||
ProxyManager::proxy_state_to_string(proxy_state_));
|
||||
writer->writeAttribute(QStringLiteral("stream"),
|
||||
QString::number(proxy_video_stream_index_));
|
||||
writer->writeAttribute(QStringLiteral("preset"),
|
||||
@@ -748,36 +748,36 @@ void Footage::SaveCustom(QXmlStreamWriter *writer) const
|
||||
|
||||
writer->writeStartElement(QStringLiteral("viewer"));
|
||||
|
||||
ViewerOutput::SaveCustom(writer);
|
||||
ViewerOutput::save_custom(writer);
|
||||
|
||||
writer->writeEndElement(); // viewer
|
||||
}
|
||||
|
||||
void Footage::AddedToGraphEvent(Project *p)
|
||||
{
|
||||
connect(p->color_manager(), &ColorManager::DefaultInputChanged, this,
|
||||
&Footage::DefaultColorSpaceChanged);
|
||||
connect(p->color_manager(), &ColorManager::default_input_changed, this,
|
||||
&Footage::default_color_space_changed);
|
||||
if (ProxyManager::instance()) {
|
||||
connect(ProxyManager::instance(), &ProxyManager::ProxyReady, this,
|
||||
&Footage::ProxyReady);
|
||||
connect(ProxyManager::instance(), &ProxyManager::ProxyFinished, this,
|
||||
&Footage::ProxyFinished);
|
||||
connect(ProxyManager::instance(), &ProxyManager::proxy_ready, this,
|
||||
&Footage::proxy_ready);
|
||||
connect(ProxyManager::instance(), &ProxyManager::proxy_finished, this,
|
||||
&Footage::proxy_finished);
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::RemovedFromGraphEvent(Project *p)
|
||||
{
|
||||
disconnect(p->color_manager(), &ColorManager::DefaultInputChanged, this,
|
||||
&Footage::DefaultColorSpaceChanged);
|
||||
disconnect(p->color_manager(), &ColorManager::default_input_changed, this,
|
||||
&Footage::default_color_space_changed);
|
||||
if (ProxyManager::instance()) {
|
||||
disconnect(ProxyManager::instance(), &ProxyManager::ProxyReady, this,
|
||||
&Footage::ProxyReady);
|
||||
disconnect(ProxyManager::instance(), &ProxyManager::ProxyFinished, this,
|
||||
&Footage::ProxyFinished);
|
||||
disconnect(ProxyManager::instance(), &ProxyManager::proxy_ready, this,
|
||||
&Footage::proxy_ready);
|
||||
disconnect(ProxyManager::instance(), &ProxyManager::proxy_finished, this,
|
||||
&Footage::proxy_finished);
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::Reprobe()
|
||||
void Footage::reprobe()
|
||||
{
|
||||
// Determine if file still exists
|
||||
QString filename = this->filename();
|
||||
@@ -797,91 +797,91 @@ void Footage::Reprobe()
|
||||
QString meta_cache_file =
|
||||
QDir(QStandardPaths::writableLocation(
|
||||
QStandardPaths::CacheLocation))
|
||||
.filePath(FileFunctions::GetUniqueFileIdentifier(filename));
|
||||
.filePath(FileFunctions::get_unique_file_identifier(filename));
|
||||
|
||||
FootageDescription footage_info;
|
||||
|
||||
// Try to load footage info from cache
|
||||
if (!QFileInfo::exists(meta_cache_file) ||
|
||||
!footage_info.Load(meta_cache_file)) {
|
||||
!footage_info.load(meta_cache_file)) {
|
||||
// Probe and create cache
|
||||
QVector<DecoderPtr> decoder_list =
|
||||
Decoder::ReceiveListOfAllDecoders();
|
||||
Decoder::receive_list_of_all_decoders();
|
||||
|
||||
foreach (DecoderPtr decoder, decoder_list) {
|
||||
footage_info = decoder->Probe(filename, cancelled_);
|
||||
footage_info = decoder->probe(filename, cancelled_);
|
||||
|
||||
if (footage_info.IsValid()) {
|
||||
if (footage_info.is_valid()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancelled_ || !cancelled_->HeardCancel()) {
|
||||
if (!cancelled_ || !cancelled_->heard_cancel()) {
|
||||
// Only cache successful probes; caching a failed probe
|
||||
// would make every future load re-use the invalid metadata
|
||||
if (footage_info.IsValid() &&
|
||||
!footage_info.Save(meta_cache_file)) {
|
||||
if (footage_info.is_valid() &&
|
||||
!footage_info.save(meta_cache_file)) {
|
||||
qWarning()
|
||||
<< "Failed to save stream cache, footage will have to be re-probed";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (footage_info.IsValid()) {
|
||||
if (footage_info.is_valid()) {
|
||||
decoder_ = footage_info.decoder();
|
||||
|
||||
InputArrayResize(kVideoParamsInput,
|
||||
footage_info.GetVideoStreams().size());
|
||||
for (int i = 0; i < footage_info.GetVideoStreams().size();
|
||||
input_array_resize(k_video_params_input,
|
||||
footage_info.get_video_streams().size());
|
||||
for (int i = 0; i < footage_info.get_video_streams().size();
|
||||
i++) {
|
||||
VideoParams video_stream =
|
||||
footage_info.GetVideoStreams().at(i);
|
||||
footage_info.get_video_streams().at(i);
|
||||
|
||||
if (i < InputArraySize(kVideoParamsInput)) {
|
||||
VideoParams existing = this->GetVideoParams(i);
|
||||
if (i < input_array_size(k_video_params_input)) {
|
||||
VideoParams existing = this->get_video_params(i);
|
||||
if (existing.is_valid()) {
|
||||
video_stream =
|
||||
MergeVideoStream(video_stream, existing);
|
||||
merge_video_stream(video_stream, existing);
|
||||
}
|
||||
}
|
||||
|
||||
SetStream(Track::kVideo, QVariant::fromValue(video_stream),
|
||||
set_stream(Track::k_video, QVariant::fromValue(video_stream),
|
||||
i);
|
||||
}
|
||||
|
||||
InputArrayResize(kAudioParamsInput,
|
||||
footage_info.GetAudioStreams().size());
|
||||
for (int i = 0; i < footage_info.GetAudioStreams().size();
|
||||
input_array_resize(k_audio_params_input,
|
||||
footage_info.get_audio_streams().size());
|
||||
for (int i = 0; i < footage_info.get_audio_streams().size();
|
||||
i++) {
|
||||
SetStream(Track::kAudio,
|
||||
set_stream(Track::k_audio,
|
||||
QVariant::fromValue(
|
||||
footage_info.GetAudioStreams().at(i)),
|
||||
footage_info.get_audio_streams().at(i)),
|
||||
i);
|
||||
}
|
||||
|
||||
InputArrayResize(kSubtitleParamsInput,
|
||||
footage_info.GetSubtitleStreams().size());
|
||||
for (int i = 0; i < footage_info.GetSubtitleStreams().size();
|
||||
input_array_resize(k_subtitle_params_input,
|
||||
footage_info.get_subtitle_streams().size());
|
||||
for (int i = 0; i < footage_info.get_subtitle_streams().size();
|
||||
i++) {
|
||||
SetStream(Track::kSubtitle,
|
||||
set_stream(Track::k_subtitle,
|
||||
QVariant::fromValue(
|
||||
footage_info.GetSubtitleStreams().at(i)),
|
||||
footage_info.get_subtitle_streams().at(i)),
|
||||
i);
|
||||
}
|
||||
|
||||
total_stream_count_ = footage_info.GetStreamCount();
|
||||
if (footage_info.HasSourceStartTime()) {
|
||||
SetSourceStartTime(footage_info.source_start_time(),
|
||||
total_stream_count_ = footage_info.get_stream_count();
|
||||
if (footage_info.has_source_start_time()) {
|
||||
set_source_start_time(footage_info.source_start_time(),
|
||||
footage_info.source_start_time_source());
|
||||
}
|
||||
|
||||
SetValid();
|
||||
set_valid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VideoParams Footage::MergeVideoStream(const VideoParams &base,
|
||||
VideoParams Footage::merge_video_stream(const VideoParams &base,
|
||||
const VideoParams &over)
|
||||
{
|
||||
VideoParams merged = base;
|
||||
@@ -892,7 +892,7 @@ VideoParams Footage::MergeVideoStream(const VideoParams &base,
|
||||
merged.set_premultiplied_alpha(over.premultiplied_alpha());
|
||||
merged.set_video_type(over.video_type());
|
||||
merged.set_color_range(over.color_range());
|
||||
if (merged.video_type() == VideoParams::kVideoTypeImageSequence) {
|
||||
if (merged.video_type() == VideoParams::k_video_type_image_sequence) {
|
||||
merged.set_start_time(over.start_time());
|
||||
merged.set_duration(over.duration());
|
||||
merged.set_frame_rate(over.frame_rate());
|
||||
@@ -902,7 +902,7 @@ VideoParams Footage::MergeVideoStream(const VideoParams &base,
|
||||
return merged;
|
||||
}
|
||||
|
||||
void Footage::CheckFootage()
|
||||
void Footage::check_footage()
|
||||
{
|
||||
// Don't check files if not the active window
|
||||
if (qApp->activeWindow()) {
|
||||
@@ -921,39 +921,39 @@ void Footage::CheckFootage()
|
||||
|
||||
if (current_file_timestamp != timestamp()) {
|
||||
// File has changed!
|
||||
Clear();
|
||||
Reprobe();
|
||||
InvalidateAll(kFilenameInput);
|
||||
clear();
|
||||
reprobe();
|
||||
invalidate_all(k_filename_input);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::DefaultColorSpaceChanged()
|
||||
void Footage::default_color_space_changed()
|
||||
{
|
||||
bool inv = false;
|
||||
int sz = GetVideoStreamCount();
|
||||
int sz = get_video_stream_count();
|
||||
for (int i = 0; i < sz; i++) {
|
||||
// Check if any of our streams are using the default colorspace
|
||||
if (GetVideoParams(i).colorspace().isEmpty()) {
|
||||
if (get_video_params(i).colorspace().isEmpty()) {
|
||||
inv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (inv) {
|
||||
InvalidateAll(kVideoParamsInput);
|
||||
invalidate_all(k_video_params_input);
|
||||
}
|
||||
}
|
||||
|
||||
void Footage::ProxyReady(const QString &source_filename, int stream_index,
|
||||
void Footage::proxy_ready(const QString &source_filename, int stream_index,
|
||||
const QString &proxy_filename)
|
||||
{
|
||||
ProxyFinished(source_filename, stream_index, proxy_filename,
|
||||
ProxyManager::kProxyReady);
|
||||
proxy_finished(source_filename, stream_index, proxy_filename,
|
||||
ProxyManager::k_proxy_ready);
|
||||
}
|
||||
|
||||
void Footage::ProxyFinished(const QString &source_filename, int stream_index,
|
||||
void Footage::proxy_finished(const QString &source_filename, int stream_index,
|
||||
const QString &proxy_filename,
|
||||
ProxyManager::ProxyState state)
|
||||
{
|
||||
@@ -964,7 +964,7 @@ void Footage::ProxyFinished(const QString &source_filename, int stream_index,
|
||||
}
|
||||
|
||||
proxy_state_ = state;
|
||||
InvalidateAll(kFilenameInput);
|
||||
invalidate_all(k_filename_input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FOOTAGE_H
|
||||
#define FOOTAGE_H
|
||||
#ifndef OAK_FOOTAGE_H
|
||||
#define OAK_FOOTAGE_H
|
||||
|
||||
#include <olive/core/core.h>
|
||||
#include <QList>
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(Footage)
|
||||
|
||||
virtual QString Name() const override
|
||||
virtual QString name() const override
|
||||
{
|
||||
return tr("Media");
|
||||
}
|
||||
@@ -63,18 +63,18 @@ public:
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.footage");
|
||||
}
|
||||
|
||||
virtual QVector<CategoryID> Category() const override
|
||||
virtual QVector<CategoryID> category() const override
|
||||
{
|
||||
return { kCategoryProject };
|
||||
return { k_category_project };
|
||||
}
|
||||
|
||||
virtual QString Description() const override
|
||||
virtual QString description() const override
|
||||
{
|
||||
return tr(
|
||||
"Import video, audio, or still image files into the composition.");
|
||||
}
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
/**
|
||||
* @brief Reset Footage state ready for running through Probe() again
|
||||
@@ -86,9 +86,9 @@ public:
|
||||
* In most cases, you'll be using olive::ProbeMedia() for re-probing which already runs Clear(), so you won't need
|
||||
* to worry about this.
|
||||
*/
|
||||
void Clear();
|
||||
void clear();
|
||||
|
||||
bool IsValid() const
|
||||
bool is_valid() const
|
||||
{
|
||||
return valid_;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
/**
|
||||
* @brief Sets this footage to valid and ready to use
|
||||
*/
|
||||
void SetValid();
|
||||
void set_valid();
|
||||
|
||||
/**
|
||||
* @brief Return the current filename of this Footage object
|
||||
@@ -134,18 +134,18 @@ public:
|
||||
*/
|
||||
void set_timestamp(const qint64 &t);
|
||||
|
||||
void SetCancelPointer(CancelAtom *c)
|
||||
void set_cancel_pointer(CancelAtom *c)
|
||||
{
|
||||
cancelled_ = c;
|
||||
}
|
||||
|
||||
int GetStreamIndex(Track::Type type, int index) const;
|
||||
int GetStreamIndex(const Track::Reference &ref) const
|
||||
int get_stream_index(Track::Type type, int index) const;
|
||||
int get_stream_index(const Track::Reference &ref) const
|
||||
{
|
||||
return GetStreamIndex(ref.type(), ref.index());
|
||||
return get_stream_index(ref.type(), ref.index());
|
||||
}
|
||||
|
||||
Track::Reference GetReferenceFromRealIndex(int real_index) const;
|
||||
Track::Reference get_reference_from_real_index(int real_index) const;
|
||||
|
||||
/**
|
||||
* @brief Get the Decoder ID set when this Footage was probed
|
||||
@@ -156,12 +156,12 @@ public:
|
||||
*/
|
||||
const QString &decoder() const;
|
||||
|
||||
bool HasSourceStartTime() const
|
||||
bool has_source_start_time() const
|
||||
{
|
||||
return has_source_start_time_;
|
||||
}
|
||||
|
||||
const rational &source_start_time() const
|
||||
const Rational &source_start_time() const
|
||||
{
|
||||
return source_start_time_;
|
||||
}
|
||||
@@ -171,12 +171,12 @@ public:
|
||||
return source_start_time_source_;
|
||||
}
|
||||
|
||||
void SetSourceStartTime(const rational &time, const QString &source);
|
||||
void set_source_start_time(const Rational &time, const QString &source);
|
||||
|
||||
/**
|
||||
* @brief Removes any source start time (auto-detected or manual)
|
||||
*/
|
||||
void ClearSourceStartTime();
|
||||
void clear_source_start_time();
|
||||
|
||||
bool proxy_enabled() const
|
||||
{
|
||||
@@ -205,10 +205,10 @@ public:
|
||||
return proxy_state_;
|
||||
}
|
||||
|
||||
void SetProxy(const QString &path, ProxyManager::ProxyState state,
|
||||
void set_proxy(const QString &path, ProxyManager::ProxyState state,
|
||||
int video_stream_index, int preset_version, bool enabled);
|
||||
|
||||
void ClearProxy();
|
||||
void clear_proxy();
|
||||
|
||||
/**
|
||||
* @brief Returns true if this footage uses its own proxy parameters
|
||||
@@ -227,53 +227,53 @@ public:
|
||||
/**
|
||||
* @brief Sets per-footage proxy parameters, overriding the global settings
|
||||
*/
|
||||
void SetCustomProxyParams(const ProxyManager::ProxyParams ¶ms);
|
||||
void set_custom_proxy_params(const ProxyManager::ProxyParams ¶ms);
|
||||
|
||||
/**
|
||||
* @brief Reverts this footage to using the global proxy settings
|
||||
*/
|
||||
void ClearCustomProxyParams();
|
||||
void clear_custom_proxy_params();
|
||||
|
||||
/**
|
||||
* @brief Returns the custom proxy parameters if set, otherwise the
|
||||
* parameters from the global application config
|
||||
*/
|
||||
ProxyManager::ProxyParams GetEffectiveProxyParams() const;
|
||||
ProxyManager::ProxyParams get_effective_proxy_params() const;
|
||||
|
||||
static QString DescribeVideoStream(const VideoParams ¶ms);
|
||||
static QString DescribeAudioStream(const AudioParams ¶ms);
|
||||
static QString DescribeSubtitleStream(const SubtitleParams ¶ms);
|
||||
static QString describe_video_stream(const VideoParams ¶ms);
|
||||
static QString describe_audio_stream(const AudioParams ¶ms);
|
||||
static QString describe_subtitle_stream(const SubtitleParams ¶ms);
|
||||
|
||||
virtual void Value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
virtual void value(const NodeValueRow &value, const NodeGlobals &globals,
|
||||
NodeValueTable *table) const override;
|
||||
|
||||
static QString GetStreamTypeName(Track::Type type);
|
||||
static QString get_stream_type_name(Track::Type type);
|
||||
|
||||
virtual Node *GetConnectedTextureOutput() override;
|
||||
virtual Node *get_connected_texture_output() override;
|
||||
|
||||
virtual Node *GetConnectedSampleOutput() override;
|
||||
virtual Node *get_connected_sample_output() override;
|
||||
|
||||
static rational AdjustTimeByLoopMode(rational time, LoopMode loop_mode,
|
||||
const rational &length,
|
||||
static Rational adjust_time_by_loop_mode(Rational time, LoopMode loop_mode,
|
||||
const Rational &length,
|
||||
VideoParams::Type type,
|
||||
const rational &timebase);
|
||||
const Rational &timebase);
|
||||
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
virtual int GetTotalStreamCount() const override
|
||||
virtual int get_total_stream_count() const override
|
||||
{
|
||||
return total_stream_count_;
|
||||
}
|
||||
|
||||
virtual bool LoadCustom(QXmlStreamReader *reader,
|
||||
virtual bool load_custom(QXmlStreamReader *reader,
|
||||
SerializedData *data) override;
|
||||
virtual void SaveCustom(QXmlStreamWriter *writer) const override;
|
||||
virtual void save_custom(QXmlStreamWriter *writer) const override;
|
||||
|
||||
signals:
|
||||
void ProxySettingsChanged();
|
||||
void proxy_settings_changed();
|
||||
|
||||
public:
|
||||
static const QString kFilenameInput;
|
||||
static const QString k_filename_input;
|
||||
|
||||
virtual void AddedToGraphEvent(Project *p) override;
|
||||
virtual void RemovedFromGraphEvent(Project *p) override;
|
||||
@@ -282,14 +282,14 @@ protected:
|
||||
virtual void InputValueChangedEvent(const QString &input,
|
||||
int element) override;
|
||||
|
||||
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
||||
virtual Rational verify_length_internal(Track::Type type) const override;
|
||||
|
||||
private:
|
||||
QString GetColorspaceToUse(const VideoParams ¶ms) const;
|
||||
QString get_colorspace_to_use(const VideoParams ¶ms) const;
|
||||
|
||||
void Reprobe();
|
||||
void reprobe();
|
||||
|
||||
VideoParams MergeVideoStream(const VideoParams &base,
|
||||
VideoParams merge_video_stream(const VideoParams &base,
|
||||
const VideoParams &over);
|
||||
|
||||
/**
|
||||
@@ -302,7 +302,7 @@ private:
|
||||
*/
|
||||
QString decoder_;
|
||||
|
||||
rational source_start_time_;
|
||||
Rational source_start_time_;
|
||||
|
||||
QString source_start_time_source_;
|
||||
|
||||
@@ -329,17 +329,17 @@ private:
|
||||
int total_stream_count_;
|
||||
|
||||
private slots:
|
||||
void CheckFootage();
|
||||
void check_footage();
|
||||
|
||||
void DefaultColorSpaceChanged();
|
||||
void default_color_space_changed();
|
||||
|
||||
void ProxyReady(const QString &source_filename, int stream_index,
|
||||
void proxy_ready(const QString &source_filename, int stream_index,
|
||||
const QString &proxy_filename);
|
||||
void ProxyFinished(const QString &source_filename, int stream_index,
|
||||
void proxy_finished(const QString &source_filename, int stream_index,
|
||||
const QString &proxy_filename,
|
||||
ProxyManager::ProxyState state);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // FOOTAGE_H
|
||||
#endif // OAK_FOOTAGE_H
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
bool FootageDescription::Load(const QString &filename)
|
||||
bool FootageDescription::load(const QString &filename)
|
||||
{
|
||||
// Reset self
|
||||
*this = FootageDescription();
|
||||
@@ -43,7 +43,7 @@ bool FootageDescription::Load(const QString &filename)
|
||||
|
||||
bool found_streamcache = false;
|
||||
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
while (xml_read_next_start_element(&reader)) {
|
||||
if (reader.name() == QStringLiteral("streamcache")) {
|
||||
found_streamcache = true;
|
||||
// Default to first version of metadata (which wasn't versioned at all)
|
||||
@@ -58,12 +58,12 @@ bool FootageDescription::Load(const QString &filename)
|
||||
}
|
||||
}
|
||||
|
||||
if (version != kFootageMetaVersion) {
|
||||
if (version != k_footage_meta_version) {
|
||||
// If this is a different version, discard so we can probe new data
|
||||
return false;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
while (xml_read_next_start_element(&reader)) {
|
||||
if (reader.name() == QStringLiteral("decoder")) {
|
||||
decoder_ = reader.readElementText();
|
||||
} else if (reader.name() ==
|
||||
@@ -81,7 +81,7 @@ bool FootageDescription::Load(const QString &filename)
|
||||
const QStringList split =
|
||||
reader.readElementText().split('/');
|
||||
if (split.size() == 2) {
|
||||
SetSourceStartTime(rational(split.at(0).toInt(),
|
||||
set_source_start_time(Rational(split.at(0).toInt(),
|
||||
split.at(1).toInt()),
|
||||
source);
|
||||
}
|
||||
@@ -95,21 +95,21 @@ bool FootageDescription::Load(const QString &filename)
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
while (xml_read_next_start_element(&reader)) {
|
||||
if (reader.name() == QStringLiteral("video")) {
|
||||
VideoParams vp;
|
||||
vp.Load(&reader);
|
||||
AddVideoStream(vp);
|
||||
vp.load(&reader);
|
||||
add_video_stream(vp);
|
||||
} else if (reader.name() ==
|
||||
QStringLiteral("audio")) {
|
||||
AudioParams ap =
|
||||
TypeSerializer::LoadAudioParams(&reader);
|
||||
AddAudioStream(ap);
|
||||
TypeSerializer::load_audio_params(&reader);
|
||||
add_audio_stream(ap);
|
||||
} else if (reader.name() ==
|
||||
QStringLiteral("subtitle")) {
|
||||
SubtitleParams sp;
|
||||
sp.Load(&reader);
|
||||
AddSubtitleStream(sp);
|
||||
sp.load(&reader);
|
||||
add_subtitle_stream(sp);
|
||||
} else {
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
@@ -137,7 +137,7 @@ bool FootageDescription::Load(const QString &filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FootageDescription::Save(const QString &filename) const
|
||||
bool FootageDescription::save(const QString &filename) const
|
||||
{
|
||||
QFile file(filename);
|
||||
|
||||
@@ -152,7 +152,7 @@ bool FootageDescription::Save(const QString &filename) const
|
||||
writer.writeStartElement(QStringLiteral("streamcache"));
|
||||
|
||||
writer.writeAttribute(QStringLiteral("version"),
|
||||
QString::number(kFootageMetaVersion));
|
||||
QString::number(k_footage_meta_version));
|
||||
|
||||
writer.writeTextElement(QStringLiteral("decoder"), decoder_);
|
||||
|
||||
@@ -173,19 +173,19 @@ bool FootageDescription::Save(const QString &filename) const
|
||||
|
||||
foreach (const VideoParams &vp, video_streams_) {
|
||||
writer.writeStartElement(QStringLiteral("video"));
|
||||
vp.Save(&writer);
|
||||
vp.save(&writer);
|
||||
writer.writeEndElement(); // video
|
||||
}
|
||||
|
||||
foreach (const AudioParams &ap, audio_streams_) {
|
||||
writer.writeStartElement(QStringLiteral("audio"));
|
||||
TypeSerializer::SaveAudioParams(&writer, ap);
|
||||
TypeSerializer::save_audio_params(&writer, ap);
|
||||
writer.writeEndElement(); // audio
|
||||
}
|
||||
|
||||
foreach (const SubtitleParams &sp, subtitle_streams_) {
|
||||
writer.writeStartElement(QStringLiteral("subtitle"));
|
||||
sp.Save(&writer);
|
||||
sp.save(&writer);
|
||||
writer.writeEndElement(); // audio
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FOOTAGEDESCRIPTION_H
|
||||
#define FOOTAGEDESCRIPTION_H
|
||||
#ifndef OAK_FOOTAGEDESCRIPTION_H
|
||||
#define OAK_FOOTAGEDESCRIPTION_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
bool is_valid() const
|
||||
{
|
||||
return !decoder_.isEmpty() &&
|
||||
(!video_streams_.isEmpty() || !audio_streams_.isEmpty() ||
|
||||
@@ -52,41 +52,41 @@ public:
|
||||
return decoder_;
|
||||
}
|
||||
|
||||
void AddVideoStream(const VideoParams &video_params)
|
||||
void add_video_stream(const VideoParams &video_params)
|
||||
{
|
||||
Q_ASSERT(!HasStreamIndex(video_params.stream_index()));
|
||||
Q_ASSERT(!has_stream_index(video_params.stream_index()));
|
||||
|
||||
video_streams_.append(video_params);
|
||||
}
|
||||
|
||||
void AddAudioStream(const AudioParams &audio_params)
|
||||
void add_audio_stream(const AudioParams &audio_params)
|
||||
{
|
||||
Q_ASSERT(!HasStreamIndex(audio_params.stream_index()));
|
||||
Q_ASSERT(!has_stream_index(audio_params.stream_index()));
|
||||
|
||||
audio_streams_.append(audio_params);
|
||||
}
|
||||
|
||||
void AddSubtitleStream(const SubtitleParams &sub_params)
|
||||
void add_subtitle_stream(const SubtitleParams &sub_params)
|
||||
{
|
||||
Q_ASSERT(!HasStreamIndex(sub_params.stream_index()));
|
||||
Q_ASSERT(!has_stream_index(sub_params.stream_index()));
|
||||
|
||||
subtitle_streams_.append(sub_params);
|
||||
}
|
||||
|
||||
Track::Type GetTypeOfStream(int index)
|
||||
Track::Type get_type_of_stream(int index)
|
||||
{
|
||||
if (StreamIsVideo(index)) {
|
||||
return Track::kVideo;
|
||||
} else if (StreamIsAudio(index)) {
|
||||
return Track::kAudio;
|
||||
} else if (StreamIsSubtitle(index)) {
|
||||
return Track::kSubtitle;
|
||||
if (stream_is_video(index)) {
|
||||
return Track::k_video;
|
||||
} else if (stream_is_audio(index)) {
|
||||
return Track::k_audio;
|
||||
} else if (stream_is_subtitle(index)) {
|
||||
return Track::k_subtitle;
|
||||
} else {
|
||||
return Track::kNone;
|
||||
return Track::k_none;
|
||||
}
|
||||
}
|
||||
|
||||
bool StreamIsVideo(int index) const
|
||||
bool stream_is_video(int index) const
|
||||
{
|
||||
foreach (const VideoParams &vp, video_streams_) {
|
||||
if (vp.stream_index() == index) {
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StreamIsAudio(int index) const
|
||||
bool stream_is_audio(int index) const
|
||||
{
|
||||
foreach (const AudioParams &ap, audio_streams_) {
|
||||
if (ap.stream_index() == index) {
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StreamIsSubtitle(int index) const
|
||||
bool stream_is_subtitle(int index) const
|
||||
{
|
||||
foreach (const SubtitleParams &sp, subtitle_streams_) {
|
||||
if (sp.stream_index() == index) {
|
||||
@@ -119,34 +119,34 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasStreamIndex(int index) const
|
||||
bool has_stream_index(int index) const
|
||||
{
|
||||
return StreamIsVideo(index) || StreamIsAudio(index) ||
|
||||
StreamIsSubtitle(index);
|
||||
return stream_is_video(index) || stream_is_audio(index) ||
|
||||
stream_is_subtitle(index);
|
||||
}
|
||||
|
||||
int GetStreamCount() const
|
||||
int get_stream_count() const
|
||||
{
|
||||
return total_stream_count_;
|
||||
}
|
||||
void SetStreamCount(int s)
|
||||
void set_stream_count(int s)
|
||||
{
|
||||
total_stream_count_ = s;
|
||||
}
|
||||
|
||||
void SetSourceStartTime(const rational &time, const QString &source)
|
||||
void set_source_start_time(const Rational &time, const QString &source)
|
||||
{
|
||||
source_start_time_ = time;
|
||||
source_start_time_source_ = source;
|
||||
has_source_start_time_ = true;
|
||||
}
|
||||
|
||||
bool HasSourceStartTime() const
|
||||
bool has_source_start_time() const
|
||||
{
|
||||
return has_source_start_time_;
|
||||
}
|
||||
|
||||
const rational &source_start_time() const
|
||||
const Rational &source_start_time() const
|
||||
{
|
||||
return source_start_time_;
|
||||
}
|
||||
@@ -156,39 +156,39 @@ public:
|
||||
return source_start_time_source_;
|
||||
}
|
||||
|
||||
bool Load(const QString &filename);
|
||||
bool load(const QString &filename);
|
||||
|
||||
bool Save(const QString &filename) const;
|
||||
bool save(const QString &filename) const;
|
||||
|
||||
const QVector<VideoParams> &GetVideoStreams() const
|
||||
const QVector<VideoParams> &get_video_streams() const
|
||||
{
|
||||
return video_streams_;
|
||||
}
|
||||
QVector<VideoParams> &GetVideoStreams()
|
||||
QVector<VideoParams> &get_video_streams()
|
||||
{
|
||||
return video_streams_;
|
||||
}
|
||||
|
||||
const QVector<AudioParams> &GetAudioStreams() const
|
||||
const QVector<AudioParams> &get_audio_streams() const
|
||||
{
|
||||
return audio_streams_;
|
||||
}
|
||||
QVector<AudioParams> &GetAudioStreams()
|
||||
QVector<AudioParams> &get_audio_streams()
|
||||
{
|
||||
return audio_streams_;
|
||||
}
|
||||
|
||||
const QVector<SubtitleParams> &GetSubtitleStreams() const
|
||||
const QVector<SubtitleParams> &get_subtitle_streams() const
|
||||
{
|
||||
return subtitle_streams_;
|
||||
}
|
||||
QVector<SubtitleParams> &GetSubtitleStreams()
|
||||
QVector<SubtitleParams> &get_subtitle_streams()
|
||||
{
|
||||
return subtitle_streams_;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr unsigned kFootageMetaVersion = 7;
|
||||
static constexpr unsigned k_footage_meta_version = 7;
|
||||
|
||||
QString decoder_;
|
||||
|
||||
@@ -200,7 +200,7 @@ private:
|
||||
|
||||
int total_stream_count_;
|
||||
|
||||
rational source_start_time_;
|
||||
Rational source_start_time_;
|
||||
|
||||
QString source_start_time_source_;
|
||||
|
||||
@@ -209,4 +209,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // FOOTAGEDESCRIPTION_H
|
||||
#endif // OAK_FOOTAGEDESCRIPTION_H
|
||||
|
||||
@@ -30,33 +30,33 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const QString Sequence::kTrackInputFormat = QStringLiteral("track_in_%1");
|
||||
const QString Sequence::k_track_input_format = QStringLiteral("track_in_%1");
|
||||
|
||||
#define super ViewerOutput
|
||||
|
||||
Sequence::Sequence()
|
||||
{
|
||||
SetFlag(kIsItem);
|
||||
set_flag(k_is_item);
|
||||
|
||||
// Create TrackList instances
|
||||
track_lists_.resize(Track::kCount);
|
||||
track_lists_.resize(Track::k_count);
|
||||
|
||||
for (int i = 0; i < Track::kCount; i++) {
|
||||
for (int i = 0; i < Track::k_count; i++) {
|
||||
// Create track input
|
||||
QString track_input_id = kTrackInputFormat.arg(i);
|
||||
QString track_input_id = k_track_input_format.arg(i);
|
||||
|
||||
AddInput(track_input_id, NodeValue::kNone,
|
||||
InputFlags(kInputFlagNotKeyframable | kInputFlagArray |
|
||||
kInputFlagHidden | kInputFlagIgnoreInvalidations));
|
||||
add_input(track_input_id, NodeValue::k_none,
|
||||
InputFlags(k_input_flag_not_keyframable | k_input_flag_array |
|
||||
k_input_flag_hidden | k_input_flag_ignore_invalidations));
|
||||
|
||||
TrackList *list =
|
||||
new TrackList(this, static_cast<Track::Type>(i), track_input_id);
|
||||
track_lists_.replace(i, list);
|
||||
connect(list, &TrackList::TrackListChanged, this,
|
||||
&Sequence::UpdateTrackCache);
|
||||
connect(list, &TrackList::LengthChanged, this, &Sequence::VerifyLength);
|
||||
connect(list, &TrackList::TrackAdded, this, &Sequence::TrackAdded);
|
||||
connect(list, &TrackList::TrackRemoved, this, &Sequence::TrackRemoved);
|
||||
connect(list, &TrackList::track_list_changed, this,
|
||||
&Sequence::update_track_cache);
|
||||
connect(list, &TrackList::length_changed, this, &Sequence::verify_length);
|
||||
connect(list, &TrackList::track_added, this, &Sequence::track_added);
|
||||
connect(list, &TrackList::track_removed, this, &Sequence::track_removed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ void Sequence::add_default_nodes(MultiUndoCommand *command)
|
||||
{
|
||||
// Create tracks and connect them to the viewer
|
||||
UndoCommand *video_track_command =
|
||||
new TimelineAddTrackCommand(track_list(Track::kVideo));
|
||||
new TimelineAddTrackCommand(track_list(Track::k_video));
|
||||
UndoCommand *audio_track_command =
|
||||
new TimelineAddTrackCommand(track_list(Track::kAudio));
|
||||
new TimelineAddTrackCommand(track_list(Track::k_audio));
|
||||
|
||||
if (command) {
|
||||
command->add_child(video_track_command);
|
||||
@@ -81,19 +81,19 @@ void Sequence::add_default_nodes(MultiUndoCommand *command)
|
||||
|
||||
QVariant Sequence::data(const DataType &d) const
|
||||
{
|
||||
if (d == ICON) {
|
||||
return icon::Sequence;
|
||||
if (d == icon) {
|
||||
return icon::sequence;
|
||||
}
|
||||
|
||||
return super::data(d);
|
||||
}
|
||||
|
||||
QVector<Track *> Sequence::GetUnlockedTracks() const
|
||||
QVector<Track *> Sequence::get_unlocked_tracks() const
|
||||
{
|
||||
QVector<Track *> tracks = GetTracks();
|
||||
QVector<Track *> tracks = get_tracks();
|
||||
|
||||
for (int i = 0; i < tracks.size(); i++) {
|
||||
if (tracks.at(i)->IsLocked()) {
|
||||
if (tracks.at(i)->is_locked()) {
|
||||
tracks.removeAt(i);
|
||||
i--;
|
||||
}
|
||||
@@ -102,56 +102,56 @@ QVector<Track *> Sequence::GetUnlockedTracks() const
|
||||
return tracks;
|
||||
}
|
||||
|
||||
void Sequence::Retranslate()
|
||||
void Sequence::retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
super::retranslate();
|
||||
|
||||
for (int i = 0; i < Track::kCount; i++) {
|
||||
for (int i = 0; i < Track::k_count; i++) {
|
||||
QString input_name;
|
||||
|
||||
switch (static_cast<Track::Type>(i)) {
|
||||
case Track::kVideo:
|
||||
case Track::k_video:
|
||||
input_name = tr("Video Tracks");
|
||||
break;
|
||||
case Track::kAudio:
|
||||
case Track::k_audio:
|
||||
input_name = tr("Audio Tracks");
|
||||
break;
|
||||
case Track::kSubtitle:
|
||||
case Track::k_subtitle:
|
||||
input_name = tr("Subtitle Tracks");
|
||||
break;
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
case Track::k_none:
|
||||
case Track::k_count:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!input_name.isEmpty()) {
|
||||
SetInputName(kTrackInputFormat.arg(i), input_name);
|
||||
set_input_name(k_track_input_format.arg(i), input_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::InvalidateCache(const TimeRange &range, const QString &from,
|
||||
void Sequence::invalidate_cache(const TimeRange &range, const QString &from,
|
||||
int element, InvalidateCacheOptions options)
|
||||
{
|
||||
if (from == kTrackInputFormat.arg(Track::kSubtitle)) {
|
||||
emit SubtitlesChanged(range);
|
||||
if (from == k_track_input_format.arg(Track::k_subtitle)) {
|
||||
emit subtitles_changed(range);
|
||||
}
|
||||
|
||||
super::InvalidateCache(range, from, element, options);
|
||||
super::invalidate_cache(range, from, element, options);
|
||||
}
|
||||
|
||||
rational Sequence::VerifyLengthInternal(Track::Type type) const
|
||||
Rational Sequence::verify_length_internal(Track::Type type) const
|
||||
{
|
||||
if (!track_lists_.isEmpty()) {
|
||||
switch (type) {
|
||||
case Track::kVideo:
|
||||
return track_lists_.at(Track::kVideo)->GetTotalLength();
|
||||
case Track::kAudio:
|
||||
return track_lists_.at(Track::kAudio)->GetTotalLength();
|
||||
case Track::kSubtitle:
|
||||
return track_lists_.at(Track::kSubtitle)->GetTotalLength();
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
case Track::k_video:
|
||||
return track_lists_.at(Track::k_video)->get_total_length();
|
||||
case Track::k_audio:
|
||||
return track_lists_.at(Track::k_audio)->get_total_length();
|
||||
case Track::k_subtitle:
|
||||
return track_lists_.at(Track::k_subtitle)->get_total_length();
|
||||
case Track::k_none:
|
||||
case Track::k_count:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void Sequence::InputConnectedEvent(const QString &input, int element,
|
||||
foreach (TrackList *list, track_lists_) {
|
||||
if (list->track_input() == input) {
|
||||
// Return because we found our input
|
||||
list->TrackConnected(output, element);
|
||||
list->track_connected(output, element);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void Sequence::InputDisconnectedEvent(const QString &input, int element,
|
||||
foreach (TrackList *list, track_lists_) {
|
||||
if (list->track_input() == input) {
|
||||
// Return because we found our input
|
||||
list->TrackDisconnected(output, element);
|
||||
list->track_disconnected(output, element);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -187,12 +187,12 @@ void Sequence::InputDisconnectedEvent(const QString &input, int element,
|
||||
super::InputDisconnectedEvent(input, element, output);
|
||||
}
|
||||
|
||||
void Sequence::UpdateTrackCache()
|
||||
void Sequence::update_track_cache()
|
||||
{
|
||||
track_cache_.clear();
|
||||
|
||||
foreach (TrackList *list, track_lists_) {
|
||||
foreach (Track *track, list->GetTracks()) {
|
||||
foreach (Track *track, list->get_tracks()) {
|
||||
track_cache_.append(track);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SEQUENCE_H
|
||||
#define SEQUENCE_H
|
||||
#ifndef OAK_SEQUENCE_H
|
||||
#define OAK_SEQUENCE_H
|
||||
|
||||
#include "node/output/track/tracklist.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(Sequence)
|
||||
|
||||
virtual QString Name() const override
|
||||
virtual QString name() const override
|
||||
{
|
||||
return tr("Sequence");
|
||||
}
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.sequence");
|
||||
}
|
||||
|
||||
virtual QVector<CategoryID> Category() const override
|
||||
virtual QVector<CategoryID> category() const override
|
||||
{
|
||||
return { kCategoryProject };
|
||||
return { k_category_project };
|
||||
}
|
||||
|
||||
virtual QString Description() const override
|
||||
virtual QString description() const override
|
||||
{
|
||||
return tr(
|
||||
"A series of cuts that result in an edited video. Also called a timeline.");
|
||||
@@ -63,36 +63,36 @@ public:
|
||||
|
||||
virtual QVariant data(const DataType &d) const override;
|
||||
|
||||
const QVector<Track *> &GetTracks() const
|
||||
const QVector<Track *> &get_tracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
|
||||
Track *GetTrackFromReference(const Track::Reference &track_ref) const
|
||||
Track *get_track_from_reference(const Track::Reference &track_ref) const
|
||||
{
|
||||
if (track_ref.type() < 0 || track_ref.type() >= track_lists_.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
return track_lists_.at(track_ref.type())->GetTrackAt(track_ref.index());
|
||||
return track_lists_.at(track_ref.type())->get_track_at(track_ref.index());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Same as GetTracks() but omits tracks that are locked.
|
||||
*/
|
||||
QVector<Track *> GetUnlockedTracks() const;
|
||||
QVector<Track *> get_unlocked_tracks() const;
|
||||
|
||||
TrackList *track_list(Track::Type type) const
|
||||
{
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
virtual void InvalidateCache(const TimeRange &range, const QString &from,
|
||||
virtual void invalidate_cache(const TimeRange &range, const QString &from,
|
||||
int element,
|
||||
InvalidateCacheOptions options) override;
|
||||
|
||||
static const QString kTrackInputFormat;
|
||||
static const QString k_track_input_format;
|
||||
|
||||
protected:
|
||||
virtual void InputConnectedEvent(const QString &input, int element,
|
||||
@@ -101,13 +101,13 @@ protected:
|
||||
virtual void InputDisconnectedEvent(const QString &input, int element,
|
||||
Node *output) override;
|
||||
|
||||
virtual rational VerifyLengthInternal(Track::Type type) const override;
|
||||
virtual Rational verify_length_internal(Track::Type type) const override;
|
||||
|
||||
signals:
|
||||
void TrackAdded(Track *track);
|
||||
void TrackRemoved(Track *track);
|
||||
void track_added(Track *track);
|
||||
void track_removed(Track *track);
|
||||
|
||||
void SubtitlesChanged(const TimeRange &range);
|
||||
void subtitles_changed(const TimeRange &range);
|
||||
|
||||
private:
|
||||
QVector<TrackList *> track_lists_;
|
||||
@@ -115,9 +115,9 @@ private:
|
||||
QVector<Track *> track_cache_;
|
||||
|
||||
private slots:
|
||||
void UpdateTrackCache();
|
||||
void update_track_cache();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SEQUENCE_H
|
||||
#endif // OAK_SEQUENCE_H
|
||||
|
||||
@@ -38,29 +38,29 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
QVector<ProjectSerializer *> ProjectSerializer::instances_;
|
||||
QVector<ProjectSerializer *> ProjectSerializer::instances;
|
||||
|
||||
void ProjectSerializer::Initialize()
|
||||
void ProjectSerializer::initialize()
|
||||
{
|
||||
// Make sure to order these from oldest to newest
|
||||
|
||||
// FIXME: Implement this - yes it's a 0.1 project loader
|
||||
//instances_.append(new ProjectSerializer190219);
|
||||
|
||||
instances_.append(new ProjectSerializer210528);
|
||||
instances_.append(new ProjectSerializer210907);
|
||||
instances_.append(new ProjectSerializer211228);
|
||||
instances_.append(new ProjectSerializer220403);
|
||||
instances_.append(new ProjectSerializer230220);
|
||||
instances.append(new ProjectSerializer210528);
|
||||
instances.append(new ProjectSerializer210907);
|
||||
instances.append(new ProjectSerializer211228);
|
||||
instances.append(new ProjectSerializer220403);
|
||||
instances.append(new ProjectSerializer230220);
|
||||
}
|
||||
|
||||
void ProjectSerializer::Destroy()
|
||||
void ProjectSerializer::destroy()
|
||||
{
|
||||
qDeleteAll(instances_);
|
||||
instances_.clear();
|
||||
qDeleteAll(instances);
|
||||
instances.clear();
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
ProjectSerializer::Result ProjectSerializer::load(Project *project,
|
||||
const QString &filename,
|
||||
LoadType load_type)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
// Some project files are compressed, marked with "OVEC" at the beginning of the file. Check for
|
||||
// that signature now.
|
||||
std::unique_ptr<QXmlStreamReader> reader;
|
||||
if (CheckCompressedID(&project_file)) {
|
||||
if (check_compressed_id(&project_file)) {
|
||||
// File is compressed, decompress into memory
|
||||
QByteArray b;
|
||||
b = qUncompress(project_file.readAll());
|
||||
@@ -80,38 +80,38 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
reader.reset(new QXmlStreamReader(&project_file));
|
||||
}
|
||||
|
||||
Result inner_result = Load(project, reader.get(), load_type);
|
||||
Result inner_result = load(project, reader.get(), load_type);
|
||||
|
||||
project_file.close();
|
||||
|
||||
if (inner_result.code() != kSuccess) {
|
||||
if (inner_result.code() != k_success) {
|
||||
return inner_result;
|
||||
}
|
||||
|
||||
if (reader->hasError()) {
|
||||
Result r(kXmlError);
|
||||
r.SetDetails(reader->errorString());
|
||||
Result r(k_xml_error);
|
||||
r.set_details(reader->errorString());
|
||||
return r;
|
||||
} else {
|
||||
return inner_result;
|
||||
}
|
||||
} else {
|
||||
Result r(kFileError);
|
||||
r.SetDetails(QStringLiteral("Unable to open '%1': %2")
|
||||
Result r(k_file_error);
|
||||
r.set_details(QStringLiteral("Unable to open '%1': %2")
|
||||
.arg(filename, project_file.errorString()));
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
ProjectSerializer::Result ProjectSerializer::load(Project *project,
|
||||
QXmlStreamReader *reader,
|
||||
LoadType load_type)
|
||||
{
|
||||
// Determine project version
|
||||
uint version = 0;
|
||||
Result res = kUnknownVersion;
|
||||
Result res = k_unknown_version;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("olive") ||
|
||||
reader->name() == QStringLiteral("project")) { // 0.1 projects only
|
||||
|
||||
@@ -123,25 +123,25 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("url")) { // 230220+ projects
|
||||
if (project) {
|
||||
project->SetSavedURL(attr.value().toString());
|
||||
project->set_saved_url(attr.value().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("version")) { // projects <= 220403
|
||||
version = reader->readElementText().toUInt();
|
||||
} else if (reader->name() ==
|
||||
QStringLiteral("url")) { // projects <= 220403
|
||||
if (project) {
|
||||
project->SetSavedURL(reader->readElementText());
|
||||
project->set_saved_url(reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
} else {
|
||||
// Handle any other value with the serializer
|
||||
res = LoadWithSerializerVersion(version, project, reader,
|
||||
res = load_with_serializer_version(version, project, reader,
|
||||
load_type);
|
||||
}
|
||||
}
|
||||
@@ -153,24 +153,24 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project,
|
||||
return res;
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Paste(LoadType load_type,
|
||||
ProjectSerializer::Result ProjectSerializer::paste(LoadType load_type,
|
||||
Project *project)
|
||||
{
|
||||
QString clipboard = Core::PasteStringFromClipboard();
|
||||
QString clipboard = Core::paste_string_from_clipboard();
|
||||
if (clipboard.isEmpty()) {
|
||||
return kNoData;
|
||||
return k_no_data;
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(clipboard);
|
||||
|
||||
return ProjectSerializer::Load(project, &reader, load_type);
|
||||
return ProjectSerializer::load(project, &reader, load_type);
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Save(const SaveData &data,
|
||||
ProjectSerializer::Result ProjectSerializer::save(const SaveData &data,
|
||||
bool compress)
|
||||
{
|
||||
QString temp_save =
|
||||
FileFunctions::GetSafeTemporaryFilename(data.GetFilename());
|
||||
FileFunctions::get_safe_temporary_filename(data.get_filename());
|
||||
|
||||
QFile project_file(temp_save);
|
||||
|
||||
@@ -178,10 +178,10 @@ ProjectSerializer::Result ProjectSerializer::Save(const SaveData &data,
|
||||
QByteArray b;
|
||||
QXmlStreamWriter writer(&b);
|
||||
|
||||
Result inner_result = Save(&writer, data);
|
||||
Result inner_result = save(&writer, data);
|
||||
|
||||
if (writer.hasError()) {
|
||||
Result r(kXmlError);
|
||||
Result r(k_xml_error);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -194,27 +194,27 @@ ProjectSerializer::Result ProjectSerializer::Save(const SaveData &data,
|
||||
|
||||
project_file.close();
|
||||
|
||||
if (inner_result != kSuccess) {
|
||||
if (inner_result != k_success) {
|
||||
return inner_result;
|
||||
}
|
||||
|
||||
// Save was successful, we can now rewrite the original file
|
||||
if (FileFunctions::RenameFileAllowOverwrite(temp_save,
|
||||
data.GetFilename())) {
|
||||
return kSuccess;
|
||||
if (FileFunctions::rename_file_allow_overwrite(temp_save,
|
||||
data.get_filename())) {
|
||||
return k_success;
|
||||
} else {
|
||||
Result r(kOverwriteError);
|
||||
r.SetDetails(temp_save);
|
||||
Result r(k_overwrite_error);
|
||||
r.set_details(temp_save);
|
||||
return r;
|
||||
}
|
||||
} else {
|
||||
Result r(kFileError);
|
||||
r.SetDetails(temp_save);
|
||||
Result r(k_file_error);
|
||||
r.set_details(temp_save);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Save(QXmlStreamWriter *writer,
|
||||
ProjectSerializer::Result ProjectSerializer::save(QXmlStreamWriter *writer,
|
||||
const SaveData &data)
|
||||
{
|
||||
writer->setAutoFormatting(true);
|
||||
@@ -225,106 +225,106 @@ ProjectSerializer::Result ProjectSerializer::Save(QXmlStreamWriter *writer,
|
||||
|
||||
// By default, save as last serializer which, assuming the instances are ordered correctly,
|
||||
// will be the newest file format. But we may allow saving as older versions later on.
|
||||
ProjectSerializer *serializer = instances_.last();
|
||||
ProjectSerializer *serializer = instances.last();
|
||||
|
||||
// Version is stored in YYMMDD from whenever the project format was last changed
|
||||
// Allows easy integer math for checking project versions.
|
||||
writer->writeAttribute(QStringLiteral("version"),
|
||||
QString::number(serializer->Version()));
|
||||
QString::number(serializer->version()));
|
||||
|
||||
if (!data.GetFilename().isEmpty()) {
|
||||
writer->writeAttribute("url", data.GetFilename());
|
||||
if (!data.get_filename().isEmpty()) {
|
||||
writer->writeAttribute("url", data.get_filename());
|
||||
}
|
||||
|
||||
serializer->Save(writer, data, nullptr);
|
||||
serializer->save(writer, data, nullptr);
|
||||
|
||||
writer->writeEndElement(); // olive
|
||||
|
||||
writer->writeEndDocument();
|
||||
|
||||
if (writer->hasError()) {
|
||||
return kXmlError;
|
||||
return k_xml_error;
|
||||
}
|
||||
|
||||
return kSuccess;
|
||||
return k_success;
|
||||
}
|
||||
|
||||
ProjectSerializer::Result ProjectSerializer::Copy(const SaveData &data)
|
||||
ProjectSerializer::Result ProjectSerializer::copy(const SaveData &data)
|
||||
{
|
||||
QString copy_str;
|
||||
QXmlStreamWriter writer(©_str);
|
||||
|
||||
ProjectSerializer::Result res = ProjectSerializer::Save(&writer, data);
|
||||
ProjectSerializer::Result res = ProjectSerializer::save(&writer, data);
|
||||
|
||||
if (res == kSuccess) {
|
||||
Core::CopyStringToClipboard(copy_str);
|
||||
if (res == k_success) {
|
||||
Core::copy_string_to_clipboard(copy_str);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool ProjectSerializer::CheckCompressedID(QFile *file)
|
||||
bool ProjectSerializer::check_compressed_id(QFile *file)
|
||||
{
|
||||
QByteArray b = file->read(4);
|
||||
return !memcmp(b.data(), "OVEC", 4);
|
||||
}
|
||||
|
||||
bool ProjectSerializer::IsCancelled() const
|
||||
bool ProjectSerializer::is_cancelled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectSerializer::Result
|
||||
ProjectSerializer::LoadWithSerializerVersion(uint version, Project *project,
|
||||
ProjectSerializer::load_with_serializer_version(uint version, Project *project,
|
||||
QXmlStreamReader *reader,
|
||||
LoadType load_type)
|
||||
{
|
||||
// Failed to find version in file
|
||||
if (version == 0) {
|
||||
return kUnknownVersion;
|
||||
return k_unknown_version;
|
||||
}
|
||||
|
||||
// We should now have the version, if we have a serializer for it, use it to load the project
|
||||
ProjectSerializer *serializer = nullptr;
|
||||
|
||||
foreach (ProjectSerializer *s, instances_) {
|
||||
if (version == s->Version()) {
|
||||
foreach (ProjectSerializer *s, instances) {
|
||||
if (version == s->version()) {
|
||||
serializer = s;
|
||||
break;
|
||||
} else if (version < s->Version()) {
|
||||
} else if (version < s->version()) {
|
||||
// Assuming the instance list is in order, if the project version is less than any version
|
||||
// we find, we must not support it anymore
|
||||
return kProjectTooOld;
|
||||
return k_project_too_old;
|
||||
}
|
||||
}
|
||||
|
||||
if (serializer) {
|
||||
LoadData ld = serializer->Load(project, reader, load_type, nullptr);
|
||||
Result r(kSuccess);
|
||||
LoadData ld = serializer->load(project, reader, load_type, nullptr);
|
||||
Result r(k_success);
|
||||
if (reader->hasError()) {
|
||||
r = Result(kXmlError);
|
||||
r.SetDetails(
|
||||
r = Result(k_xml_error);
|
||||
r.set_details(
|
||||
QCoreApplication::translate("Serializer", "%1 on line %2")
|
||||
.arg(reader->errorString(),
|
||||
QString::number(reader->lineNumber())));
|
||||
}
|
||||
r.SetLoadData(ld);
|
||||
r.set_load_data(ld);
|
||||
return r;
|
||||
} else {
|
||||
// Reached the end of the list with no serializer, assume too new
|
||||
return kProjectTooNew;
|
||||
return k_project_too_new;
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer::SaveData::SetOnlySerializeNodesAndResolveGroups(
|
||||
void ProjectSerializer::SaveData::set_only_serialize_nodes_and_resolve_groups(
|
||||
QVector<Node *> nodes)
|
||||
{
|
||||
// For any groups, add children
|
||||
for (int i = 0; i < nodes.size(); i++) {
|
||||
// If this is a group, add the child nodes too
|
||||
if (NodeGroup *g = dynamic_cast<NodeGroup *>(nodes.at(i))) {
|
||||
for (auto it = g->GetContextPositions().cbegin();
|
||||
it != g->GetContextPositions().cend(); it++) {
|
||||
for (auto it = g->get_context_positions().cbegin();
|
||||
it != g->get_context_positions().cend(); it++) {
|
||||
if (!nodes.contains(it.key())) {
|
||||
nodes.append(it.key());
|
||||
}
|
||||
@@ -332,7 +332,7 @@ void ProjectSerializer::SaveData::SetOnlySerializeNodesAndResolveGroups(
|
||||
}
|
||||
}
|
||||
|
||||
SetOnlySerializeNodes(nodes);
|
||||
set_only_serialize_nodes(nodes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSERIALIZER_H
|
||||
#define PROJECTSERIALIZER_H
|
||||
#ifndef OAK_PROJECTSERIALIZER_H
|
||||
#define OAK_PROJECTSERIALIZER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace olive
|
||||
class ProjectSerializer {
|
||||
public:
|
||||
enum LoadType {
|
||||
kProject,
|
||||
kOnlyNodes,
|
||||
kOnlyClips,
|
||||
kOnlyMarkers,
|
||||
kOnlyKeyframes
|
||||
k_project,
|
||||
k_only_nodes,
|
||||
k_only_clips,
|
||||
k_only_markers,
|
||||
k_only_keyframes
|
||||
};
|
||||
|
||||
ProjectSerializer() = default;
|
||||
@@ -56,14 +56,14 @@ public:
|
||||
DISABLE_COPY_MOVE(ProjectSerializer)
|
||||
|
||||
enum ResultCode {
|
||||
kSuccess,
|
||||
kProjectTooOld,
|
||||
kProjectTooNew,
|
||||
kUnknownVersion,
|
||||
kFileError,
|
||||
kXmlError,
|
||||
kOverwriteError,
|
||||
kNoData
|
||||
k_success,
|
||||
k_project_too_old,
|
||||
k_project_too_new,
|
||||
k_unknown_version,
|
||||
k_file_error,
|
||||
k_xml_error,
|
||||
k_overwrite_error,
|
||||
k_no_data
|
||||
};
|
||||
|
||||
using SerializedProperties = QHash<Node *, QMap<QString, QString>>;
|
||||
@@ -111,22 +111,22 @@ public:
|
||||
return code_;
|
||||
}
|
||||
|
||||
const QString &GetDetails() const
|
||||
const QString &get_details() const
|
||||
{
|
||||
return details_;
|
||||
}
|
||||
|
||||
void SetDetails(const QString &s)
|
||||
void set_details(const QString &s)
|
||||
{
|
||||
details_ = s;
|
||||
}
|
||||
|
||||
const LoadData &GetLoadData() const
|
||||
const LoadData &get_load_data() const
|
||||
{
|
||||
return load_data_;
|
||||
}
|
||||
|
||||
void SetLoadData(const LoadData &p)
|
||||
void set_load_data(const LoadData &p)
|
||||
{
|
||||
load_data_ = p;
|
||||
}
|
||||
@@ -149,20 +149,20 @@ public:
|
||||
filename_ = filename;
|
||||
}
|
||||
|
||||
Project *GetProject() const
|
||||
Project *get_project() const
|
||||
{
|
||||
return project_;
|
||||
}
|
||||
void SetProject(Project *p)
|
||||
void set_project(Project *p)
|
||||
{
|
||||
project_ = p;
|
||||
}
|
||||
|
||||
const QString &GetFilename() const
|
||||
const QString &get_filename() const
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
void SetFilename(const QString &s)
|
||||
void set_filename(const QString &s)
|
||||
{
|
||||
filename_ = s;
|
||||
}
|
||||
@@ -172,48 +172,48 @@ public:
|
||||
return type_;
|
||||
}
|
||||
|
||||
const MainWindowLayoutInfo &GetLayout() const
|
||||
const MainWindowLayoutInfo &get_layout() const
|
||||
{
|
||||
return layout_;
|
||||
}
|
||||
void SetLayout(const MainWindowLayoutInfo &layout)
|
||||
void set_layout(const MainWindowLayoutInfo &layout)
|
||||
{
|
||||
layout_ = layout;
|
||||
}
|
||||
|
||||
const QVector<Node *> &GetOnlySerializeNodes() const
|
||||
const QVector<Node *> &get_only_serialize_nodes() const
|
||||
{
|
||||
return only_serialize_nodes_;
|
||||
}
|
||||
void SetOnlySerializeNodes(const QVector<Node *> &only)
|
||||
void set_only_serialize_nodes(const QVector<Node *> &only)
|
||||
{
|
||||
only_serialize_nodes_ = only;
|
||||
}
|
||||
void SetOnlySerializeNodesAndResolveGroups(QVector<Node *> only);
|
||||
void set_only_serialize_nodes_and_resolve_groups(QVector<Node *> only);
|
||||
|
||||
const std::vector<TimelineMarker *> &GetOnlySerializeMarkers() const
|
||||
const std::vector<TimelineMarker *> &get_only_serialize_markers() const
|
||||
{
|
||||
return only_serialize_markers_;
|
||||
}
|
||||
void SetOnlySerializeMarkers(const std::vector<TimelineMarker *> &only)
|
||||
void set_only_serialize_markers(const std::vector<TimelineMarker *> &only)
|
||||
{
|
||||
only_serialize_markers_ = only;
|
||||
}
|
||||
|
||||
const std::vector<NodeKeyframe *> &GetOnlySerializeKeyframes() const
|
||||
const std::vector<NodeKeyframe *> &get_only_serialize_keyframes() const
|
||||
{
|
||||
return only_serialize_keyframes_;
|
||||
}
|
||||
void SetOnlySerializeKeyframes(const std::vector<NodeKeyframe *> &only)
|
||||
void set_only_serialize_keyframes(const std::vector<NodeKeyframe *> &only)
|
||||
{
|
||||
only_serialize_keyframes_ = only;
|
||||
}
|
||||
|
||||
const SerializedProperties &GetProperties() const
|
||||
const SerializedProperties &get_properties() const
|
||||
{
|
||||
return properties_;
|
||||
}
|
||||
void SetProperties(const SerializedProperties &p)
|
||||
void set_properties(const SerializedProperties &p)
|
||||
{
|
||||
properties_ = p;
|
||||
}
|
||||
@@ -236,43 +236,43 @@ public:
|
||||
std::vector<NodeKeyframe *> only_serialize_keyframes_;
|
||||
};
|
||||
|
||||
static void Initialize();
|
||||
static void initialize();
|
||||
|
||||
static void Destroy();
|
||||
static void destroy();
|
||||
|
||||
static Result Load(Project *project, const QString &filename,
|
||||
static Result load(Project *project, const QString &filename,
|
||||
LoadType load_type);
|
||||
static Result Load(Project *project, QXmlStreamReader *read_device,
|
||||
static Result load(Project *project, QXmlStreamReader *read_device,
|
||||
LoadType load_type);
|
||||
static Result Paste(LoadType load_type, Project *project = nullptr);
|
||||
static Result paste(LoadType load_type, Project *project = nullptr);
|
||||
|
||||
static Result Save(const SaveData &data, bool compress);
|
||||
static Result Save(QXmlStreamWriter *write_device, const SaveData &data);
|
||||
static Result Copy(const SaveData &data);
|
||||
static Result save(const SaveData &data, bool compress);
|
||||
static Result save(QXmlStreamWriter *write_device, const SaveData &data);
|
||||
static Result copy(const SaveData &data);
|
||||
|
||||
static bool CheckCompressedID(QFile *file);
|
||||
static bool check_compressed_id(QFile *file);
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const = 0;
|
||||
|
||||
virtual void Save(QXmlStreamWriter *writer, const SaveData &data,
|
||||
virtual void save(QXmlStreamWriter *writer, const SaveData &data,
|
||||
void *reserved) const
|
||||
{
|
||||
}
|
||||
|
||||
virtual uint Version() const = 0;
|
||||
virtual uint version() const = 0;
|
||||
|
||||
bool IsCancelled() const;
|
||||
bool is_cancelled() const;
|
||||
|
||||
private:
|
||||
static Result LoadWithSerializerVersion(uint version, Project *project,
|
||||
static Result load_with_serializer_version(uint version, Project *project,
|
||||
QXmlStreamReader *reader,
|
||||
LoadType load_type);
|
||||
|
||||
static QVector<ProjectSerializer *> instances_;
|
||||
static QVector<ProjectSerializer *> instances;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTSERIALIZER_H
|
||||
#endif // OAK_PROJECTSERIALIZER_H
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer::LoadData
|
||||
ProjectSerializer190219::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer190219::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
return LoadData();
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSERIALIZER190219_H
|
||||
#define PROJECTSERIALIZER190219_H
|
||||
#ifndef OAK_PROJECTSERIALIZER190219_H
|
||||
#define OAK_PROJECTSERIALIZER190219_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
ProjectSerializer190219() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 190219;
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer210528::LoadData
|
||||
ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer210528::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
XMLNodeData xml_node_data;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("uuid")) {
|
||||
project->SetUuid(QUuid::fromString(reader->readElementText()));
|
||||
project->set_uuid(QUuid::fromString(reader->readElementText()));
|
||||
|
||||
} else if (reader->name() == QStringLiteral("nodes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
bool is_root = false;
|
||||
bool is_cm = false;
|
||||
@@ -73,16 +73,16 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
project->Initialize();
|
||||
project->initialize();
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
LoadColorManager(reader, project);
|
||||
load_color_manager(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else if (is_settings) {
|
||||
LoadProjectSettings(reader, project);
|
||||
load_project_settings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
node = NodeFactory::create_from_id(id);
|
||||
}
|
||||
|
||||
if (!handled_elsewhere) {
|
||||
@@ -91,7 +91,7 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
<< "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
load_node(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("positions")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("context")) {
|
||||
quintptr context_ptr = 0;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -119,18 +119,18 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
qWarning() << "Failed to find pointer for context";
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr node_ptr;
|
||||
Node::Position node_pos;
|
||||
|
||||
if (LoadPosition(reader, &node_ptr,
|
||||
if (load_position(reader, &node_ptr,
|
||||
&node_pos)) {
|
||||
Node *node =
|
||||
xml_node_data.node_ptrs.value(node_ptr);
|
||||
|
||||
if (node) {
|
||||
context->SetNodePositionInContext(
|
||||
context->set_node_position_in_context(
|
||||
node, node_pos);
|
||||
} else {
|
||||
qWarning()
|
||||
@@ -156,18 +156,18 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
// Make connections
|
||||
PostConnect(xml_node_data);
|
||||
post_connect(xml_node_data);
|
||||
|
||||
// Resolve tracks
|
||||
for (Node *n : project->nodes()) {
|
||||
n->SetCachesEnabled(true);
|
||||
n->set_caches_enabled(true);
|
||||
|
||||
if (Track *t = dynamic_cast<Track *>(n)) {
|
||||
for (int i = 0; i < t->InputArraySize(Track::kBlockInput); i++) {
|
||||
for (int i = 0; i < t->input_array_size(Track::k_block_input); i++) {
|
||||
Block *b = static_cast<Block *>(
|
||||
t->GetConnectedOutput(Track::kBlockInput, i));
|
||||
t->get_connected_output(Track::k_block_input, i));
|
||||
if (!b->track()) {
|
||||
t->AppendBlock(b);
|
||||
t->append_block(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,25 +176,25 @@ ProjectSerializer210528::Load(Project *project, QXmlStreamReader *reader,
|
||||
return LoadData();
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void ProjectSerializer210528::load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
LoadInput(node, reader, xml_node_data);
|
||||
load_input(node, reader, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("ptr")) {
|
||||
xml_node_data.node_ptrs.insert(
|
||||
reader->readElementText().toULongLong(), node);
|
||||
} else if (reader->name() == QStringLiteral("label")) {
|
||||
node->SetLabel(reader->readElementText());
|
||||
node->set_label(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("color")) {
|
||||
node->SetOverrideColor(reader->readElementText().toInt());
|
||||
node->set_override_color(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("links")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("link")) {
|
||||
xml_node_data.block_links.append(
|
||||
{ node, reader->readElementText().toULongLong() });
|
||||
@@ -203,11 +203,11 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("custom")) {
|
||||
LoadNodeCustom(reader, node, xml_node_data);
|
||||
load_node_custom(reader, node, xml_node_data);
|
||||
|
||||
} else if (reader->name() == QStringLiteral("connections")) {
|
||||
// Load connections
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("connection")) {
|
||||
QString param_id;
|
||||
int ele = -1;
|
||||
@@ -224,7 +224,7 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
QString output_node_id;
|
||||
QString output_param_id;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
output_node_id = reader->readElementText();
|
||||
} else if (reader->name() == QStringLiteral("output")) {
|
||||
@@ -242,7 +242,7 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("hints")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("hint")) {
|
||||
QString input;
|
||||
int element = -1;
|
||||
@@ -257,8 +257,8 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
|
||||
Node::ValueHint vh;
|
||||
LoadValueHint(&vh, reader);
|
||||
node->SetValueHintForInput(input, vh, element);
|
||||
load_value_hint(&vh, reader);
|
||||
node->set_value_hint_for_input(input, vh, element);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -271,10 +271,10 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadColorManager(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_color_manager(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -289,11 +289,11 @@ void ProjectSerializer210528::LoadColorManager(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("reference_space")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -335,18 +335,18 @@ void ProjectSerializer210528::LoadColorManager(QXmlStreamReader *reader,
|
||||
};
|
||||
int num_value = value.toInt();
|
||||
value = list.at(num_value);
|
||||
project->SetDefaultInputColorSpace(value);
|
||||
project->set_default_input_color_space(value);
|
||||
} else if (id == QStringLiteral("reference_space")) {
|
||||
// Reference space
|
||||
if (value == QStringLiteral("1")) {
|
||||
value = OCIO::ROLE_COMPOSITING_LOG;
|
||||
value = ocio::ROLE_COMPOSITING_LOG;
|
||||
} else {
|
||||
value = OCIO::ROLE_SCENE_LINEAR;
|
||||
value = ocio::ROLE_SCENE_LINEAR;
|
||||
}
|
||||
project->SetColorReferenceSpace(value);
|
||||
project->set_color_reference_space(value);
|
||||
} else {
|
||||
// Config filename
|
||||
project->SetColorConfigFilename(value);
|
||||
project->set_color_config_filename(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -357,10 +357,10 @@ void ProjectSerializer210528::LoadColorManager(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_project_settings(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -374,11 +374,11 @@ void ProjectSerializer210528::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -396,10 +396,10 @@ void ProjectSerializer210528::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(
|
||||
project->set_cache_location_setting(
|
||||
static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
project->set_custom_cache_path(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -410,7 +410,7 @@ void ProjectSerializer210528::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
@@ -430,34 +430,34 @@ void ProjectSerializer210528::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!node->HasInputWithID(param_id)) {
|
||||
if (!node->has_input_with_id(param_id)) {
|
||||
qWarning() << "Failed to load parameter that didn't exist:" << param_id;
|
||||
reader->skipCurrentElement();
|
||||
return;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
// Load primary immediate
|
||||
LoadImmediate(reader, node, param_id, -1, xml_node_data);
|
||||
load_immediate(reader, node, param_id, -1, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("subelements")) {
|
||||
// Load subelements
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("count")) {
|
||||
node->InputArrayResize(param_id, attr.value().toInt());
|
||||
node->input_array_resize(param_id, attr.value().toInt());
|
||||
}
|
||||
}
|
||||
|
||||
int element_counter = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("element")) {
|
||||
LoadImmediate(reader, node, param_id, element_counter,
|
||||
load_immediate(reader, node, param_id, element_counter,
|
||||
xml_node_data);
|
||||
|
||||
element_counter++;
|
||||
@@ -471,46 +471,46 @@ void ProjectSerializer210528::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_immediate(QXmlStreamReader *reader,
|
||||
Node *node, const QString &input,
|
||||
int element,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
|
||||
NodeValue::Type data_type = node->GetInputDataType(input);
|
||||
NodeValue::Type data_type = node->get_input_data_type(input);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
// Load standard value
|
||||
int val_index = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
QVariant value_on_track;
|
||||
|
||||
if (data_type == NodeValue::kVideoParams) {
|
||||
if (data_type == NodeValue::k_video_params) {
|
||||
VideoParams vp;
|
||||
vp.Load(reader);
|
||||
vp.load(reader);
|
||||
value_on_track = QVariant::fromValue(vp);
|
||||
} else if (data_type == NodeValue::kAudioParams) {
|
||||
} else if (data_type == NodeValue::k_audio_params) {
|
||||
AudioParams ap =
|
||||
TypeSerializer::LoadAudioParams(reader);
|
||||
TypeSerializer::load_audio_params(reader);
|
||||
value_on_track = QVariant::fromValue(ap);
|
||||
} else {
|
||||
QString value_text = reader->readElementText();
|
||||
|
||||
if (!value_text.isEmpty()) {
|
||||
value_on_track = NodeValue::StringToValue(
|
||||
value_on_track = NodeValue::string_to_value(
|
||||
data_type, value_text, true);
|
||||
}
|
||||
}
|
||||
|
||||
node->SetSplitStandardValueOnTrack(input, val_index,
|
||||
node->set_split_standard_value_on_track(input, val_index,
|
||||
value_on_track, element);
|
||||
|
||||
val_index++;
|
||||
@@ -519,34 +519,34 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("keyframing") &&
|
||||
node->IsInputKeyframable(input)) {
|
||||
node->SetInputIsKeyframing(input, reader->readElementText().toInt(),
|
||||
node->is_input_keyframable(input)) {
|
||||
node->set_input_is_keyframing(input, reader->readElementText().toInt(),
|
||||
element);
|
||||
} else if (reader->name() == QStringLiteral("keyframes")) {
|
||||
int track = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("key")) {
|
||||
QString key_input;
|
||||
rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::kLinear;
|
||||
Rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::k_linear;
|
||||
QVariant key_value;
|
||||
QPointF key_in_handle;
|
||||
QPointF key_out_handle;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (IsCancelled()) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
key_input = attr.value().toString();
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("time")) {
|
||||
key_time = rational::fromString(
|
||||
key_time = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("type")) {
|
||||
@@ -577,7 +577,7 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
key_value = NodeValue::StringToValue(
|
||||
key_value = NodeValue::string_to_value(
|
||||
data_type, reader->readElementText(), true);
|
||||
|
||||
NodeKeyframe *key = new NodeKeyframe(
|
||||
@@ -596,16 +596,16 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("csinput")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_input"),
|
||||
node->set_input_property(input, QStringLiteral("col_input"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csdisplay")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_display"),
|
||||
node->set_input_property(input, QStringLiteral("col_display"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csview")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_view"),
|
||||
node->set_input_property(input, QStringLiteral("col_view"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("cslook")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_look"),
|
||||
node->set_input_property(input, QStringLiteral("col_look"),
|
||||
reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -613,7 +613,7 @@ void ProjectSerializer210528::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectSerializer210528::LoadPosition(QXmlStreamReader *reader,
|
||||
bool ProjectSerializer210528::load_position(QXmlStreamReader *reader,
|
||||
quintptr *node_ptr,
|
||||
Node::Position *pos) const
|
||||
{
|
||||
@@ -630,7 +630,7 @@ bool ProjectSerializer210528::LoadPosition(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("x")) {
|
||||
pos->position.setX(reader->readElementText().toDouble());
|
||||
got_pos_x = true;
|
||||
@@ -647,7 +647,7 @@ bool ProjectSerializer210528::LoadPosition(QXmlStreamReader *reader,
|
||||
return got_node_ptr && got_pos_x && got_pos_y;
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::PostConnect(const XMLNodeData &xml_node_data) const
|
||||
void ProjectSerializer210528::post_connect(const XMLNodeData &xml_node_data) const
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection &con,
|
||||
xml_node_data.desired_connections) {
|
||||
@@ -655,9 +655,9 @@ void ProjectSerializer210528::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
// Use output param as hint tag since we grandfathered those in
|
||||
Node::ValueHint hint(con.output_param);
|
||||
|
||||
Node::ConnectEdge(out, con.input);
|
||||
Node::connect_edge(out, con.input);
|
||||
|
||||
con.input.node()->SetValueHintForInput(con.input.input(), hint,
|
||||
con.input.node()->set_value_hint_for_input(con.input.input(), hint,
|
||||
con.input.element());
|
||||
}
|
||||
}
|
||||
@@ -666,26 +666,26 @@ void ProjectSerializer210528::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
Node *a = l.block;
|
||||
Node *b = xml_node_data.node_ptrs.value(l.link);
|
||||
|
||||
Node::Link(a, b);
|
||||
Node::link(a, b);
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::GroupLink &l, xml_node_data.group_input_links) {
|
||||
if (Node *input_node = xml_node_data.node_ptrs.value(l.input_node)) {
|
||||
NodeInput resolved(input_node, l.input_id, l.input_element);
|
||||
|
||||
l.group->AddInputPassthrough(resolved);
|
||||
l.group->add_input_passthrough(resolved);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = xml_node_data.group_output_links.cbegin();
|
||||
it != xml_node_data.group_output_links.cend(); it++) {
|
||||
if (Node *output_node = xml_node_data.node_ptrs.value(it.value())) {
|
||||
it.key()->SetOutputPassthrough(output_node);
|
||||
it.key()->set_output_passthrough(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_node_custom(QXmlStreamReader *reader,
|
||||
Node *node,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
@@ -693,9 +693,9 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput *>(node)) {
|
||||
Footage *footage = dynamic_cast<Footage *>(node);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("points")) {
|
||||
LoadTimelinePoints(reader, viewer);
|
||||
load_timeline_points(reader, viewer);
|
||||
} else if (reader->name() == QStringLiteral("timestamp") &&
|
||||
footage) {
|
||||
footage->set_timestamp(reader->readElementText().toLongLong());
|
||||
@@ -705,24 +705,24 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (Track *track = dynamic_cast<Track *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
track->SetTrackHeight(reader->readElementText().toDouble());
|
||||
track->set_track_height(reader->readElementText().toDouble());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (NodeGroup *group = dynamic_cast<NodeGroup *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthroughs")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthrough")) {
|
||||
XMLNodeData::GroupLink link;
|
||||
|
||||
link.group = group;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
link.input_node =
|
||||
reader->readElementText().toULongLong();
|
||||
@@ -756,25 +756,25 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("markers")) {
|
||||
LoadMarkerList(reader, points->GetMarkers());
|
||||
load_marker_list(reader, points->get_markers());
|
||||
} else if (reader->name() == QStringLiteral("workarea")) {
|
||||
LoadWorkArea(reader, points->GetWorkArea());
|
||||
load_work_area(reader, points->get_work_area());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadWorkArea(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const
|
||||
{
|
||||
rational range_in = workarea->in();
|
||||
rational range_out = workarea->out();
|
||||
Rational range_in = workarea->in();
|
||||
Rational range_out = workarea->out();
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
@@ -782,10 +782,10 @@ void ProjectSerializer210528::LoadWorkArea(QXmlStreamReader *reader,
|
||||
workarea->set_enabled(attr.value() != QStringLiteral("0"));
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
range_in =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
range_out =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,28 +798,28 @@ void ProjectSerializer210528::LoadWorkArea(QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210528::load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
QString name;
|
||||
rational in, out;
|
||||
Rational in, out;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("name")) {
|
||||
name = attr.value().toString();
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
in = rational::fromString(
|
||||
in = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
out = rational::fromString(
|
||||
out = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(),
|
||||
new TimelineMarker(OAK_CONFIG("MarkerColor").toInt(),
|
||||
TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
@@ -827,14 +827,14 @@ void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadValueHint(Node::ValueHint *hint,
|
||||
void ProjectSerializer210528::load_value_hint(Node::ValueHint *hint,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
QVector<NodeValue::Type> types;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("types")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("type")) {
|
||||
types.append(static_cast<NodeValue::Type>(
|
||||
reader->readElementText().toInt()));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SERIALIZER210528_H
|
||||
#define SERIALIZER210528_H
|
||||
#ifndef OAK_SERIALIZER210528_H
|
||||
#define OAK_SERIALIZER210528_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
ProjectSerializer210528() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 210528;
|
||||
}
|
||||
@@ -67,38 +67,38 @@ private:
|
||||
QHash<NodeGroup *, quintptr> group_output_links;
|
||||
};
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadColorManager(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_color_manager(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_project_settings(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node,
|
||||
void load_immediate(QXmlStreamReader *reader, Node *node,
|
||||
const QString &input, int element,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
bool load_position(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
Node::Position *pos) const;
|
||||
|
||||
void PostConnect(const XMLNodeData &xml_node_data) const;
|
||||
void post_connect(const XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadNodeCustom(QXmlStreamReader *reader, Node *node,
|
||||
void load_node_custom(QXmlStreamReader *reader, Node *node,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const;
|
||||
|
||||
void LoadWorkArea(QXmlStreamReader *reader,
|
||||
void load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const;
|
||||
|
||||
void LoadMarkerList(QXmlStreamReader *reader,
|
||||
void load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const;
|
||||
|
||||
void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
void load_value_hint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer210907::LoadData
|
||||
ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer210907::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
XMLNodeData xml_node_data;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("uuid")) {
|
||||
project->SetUuid(QUuid::fromString(reader->readElementText()));
|
||||
project->set_uuid(QUuid::fromString(reader->readElementText()));
|
||||
|
||||
} else if (reader->name() == QStringLiteral("nodes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
bool is_root = false;
|
||||
bool is_cm = false;
|
||||
@@ -73,16 +73,16 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
project->Initialize();
|
||||
project->initialize();
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
LoadColorManager(reader, project);
|
||||
load_color_manager(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else if (is_settings) {
|
||||
LoadProjectSettings(reader, project);
|
||||
load_project_settings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
node = NodeFactory::create_from_id(id);
|
||||
}
|
||||
|
||||
if (!handled_elsewhere) {
|
||||
@@ -91,7 +91,7 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
<< "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
load_node(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("positions")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("context")) {
|
||||
quintptr context_ptr = 0;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -119,18 +119,18 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
qWarning() << "Failed to find pointer for context";
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr node_ptr;
|
||||
Node::Position node_pos;
|
||||
|
||||
if (LoadPosition(reader, &node_ptr,
|
||||
if (load_position(reader, &node_ptr,
|
||||
&node_pos)) {
|
||||
Node *node =
|
||||
xml_node_data.node_ptrs.value(node_ptr);
|
||||
|
||||
if (node) {
|
||||
context->SetNodePositionInContext(
|
||||
context->set_node_position_in_context(
|
||||
node, node_pos);
|
||||
} else {
|
||||
qWarning()
|
||||
@@ -156,18 +156,18 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
// Make connections
|
||||
PostConnect(xml_node_data);
|
||||
post_connect(xml_node_data);
|
||||
|
||||
// Resolve tracks
|
||||
for (Node *n : project->nodes()) {
|
||||
n->SetCachesEnabled(true);
|
||||
n->set_caches_enabled(true);
|
||||
|
||||
if (Track *t = dynamic_cast<Track *>(n)) {
|
||||
for (int i = 0; i < t->InputArraySize(Track::kBlockInput); i++) {
|
||||
for (int i = 0; i < t->input_array_size(Track::k_block_input); i++) {
|
||||
Block *b = static_cast<Block *>(
|
||||
t->GetConnectedOutput(Track::kBlockInput, i));
|
||||
t->get_connected_output(Track::k_block_input, i));
|
||||
if (!b->track()) {
|
||||
t->AppendBlock(b);
|
||||
t->append_block(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,25 +176,25 @@ ProjectSerializer210907::Load(Project *project, QXmlStreamReader *reader,
|
||||
return LoadData();
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void ProjectSerializer210907::load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
LoadInput(node, reader, xml_node_data);
|
||||
load_input(node, reader, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("ptr")) {
|
||||
xml_node_data.node_ptrs.insert(
|
||||
reader->readElementText().toULongLong(), node);
|
||||
} else if (reader->name() == QStringLiteral("label")) {
|
||||
node->SetLabel(reader->readElementText());
|
||||
node->set_label(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("color")) {
|
||||
node->SetOverrideColor(reader->readElementText().toInt());
|
||||
node->set_override_color(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("links")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("link")) {
|
||||
xml_node_data.block_links.append(
|
||||
{ node, reader->readElementText().toULongLong() });
|
||||
@@ -203,11 +203,11 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("custom")) {
|
||||
LoadNodeCustom(reader, node, xml_node_data);
|
||||
load_node_custom(reader, node, xml_node_data);
|
||||
|
||||
} else if (reader->name() == QStringLiteral("connections")) {
|
||||
// Load connections
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("connection")) {
|
||||
QString param_id;
|
||||
int ele = -1;
|
||||
@@ -223,7 +223,7 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
|
||||
QString output_node_id;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("output")) {
|
||||
output_node_id = reader->readElementText();
|
||||
} else {
|
||||
@@ -239,7 +239,7 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("hints")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("hint")) {
|
||||
QString input;
|
||||
int element = -1;
|
||||
@@ -254,8 +254,8 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
|
||||
Node::ValueHint vh;
|
||||
LoadValueHint(&vh, reader);
|
||||
node->SetValueHintForInput(input, vh, element);
|
||||
load_value_hint(&vh, reader);
|
||||
node->set_value_hint_for_input(input, vh, element);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -268,10 +268,10 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadColorManager(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_color_manager(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -286,11 +286,11 @@ void ProjectSerializer210907::LoadColorManager(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("reference_space")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -332,18 +332,18 @@ void ProjectSerializer210907::LoadColorManager(QXmlStreamReader *reader,
|
||||
};
|
||||
int num_value = value.toInt();
|
||||
value = list.at(num_value);
|
||||
project->SetDefaultInputColorSpace(value);
|
||||
project->set_default_input_color_space(value);
|
||||
} else if (id == QStringLiteral("reference_space")) {
|
||||
// Reference space
|
||||
if (value == QStringLiteral("1")) {
|
||||
value = OCIO::ROLE_COMPOSITING_LOG;
|
||||
value = ocio::ROLE_COMPOSITING_LOG;
|
||||
} else {
|
||||
value = OCIO::ROLE_SCENE_LINEAR;
|
||||
value = ocio::ROLE_SCENE_LINEAR;
|
||||
}
|
||||
project->SetColorReferenceSpace(value);
|
||||
project->set_color_reference_space(value);
|
||||
} else {
|
||||
// Config filename
|
||||
project->SetColorConfigFilename(value);
|
||||
project->set_color_config_filename(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -354,10 +354,10 @@ void ProjectSerializer210907::LoadColorManager(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_project_settings(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -371,11 +371,11 @@ void ProjectSerializer210907::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -393,10 +393,10 @@ void ProjectSerializer210907::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(
|
||||
project->set_cache_location_setting(
|
||||
static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
project->set_custom_cache_path(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -407,7 +407,7 @@ void ProjectSerializer210907::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
@@ -427,34 +427,34 @@ void ProjectSerializer210907::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!node->HasInputWithID(param_id)) {
|
||||
if (!node->has_input_with_id(param_id)) {
|
||||
qWarning() << "Failed to load parameter that didn't exist:" << param_id;
|
||||
reader->skipCurrentElement();
|
||||
return;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
// Load primary immediate
|
||||
LoadImmediate(reader, node, param_id, -1, xml_node_data);
|
||||
load_immediate(reader, node, param_id, -1, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("subelements")) {
|
||||
// Load subelements
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("count")) {
|
||||
node->InputArrayResize(param_id, attr.value().toInt());
|
||||
node->input_array_resize(param_id, attr.value().toInt());
|
||||
}
|
||||
}
|
||||
|
||||
int element_counter = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("element")) {
|
||||
LoadImmediate(reader, node, param_id, element_counter,
|
||||
load_immediate(reader, node, param_id, element_counter,
|
||||
xml_node_data);
|
||||
|
||||
element_counter++;
|
||||
@@ -468,46 +468,46 @@ void ProjectSerializer210907::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_immediate(QXmlStreamReader *reader,
|
||||
Node *node, const QString &input,
|
||||
int element,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
|
||||
NodeValue::Type data_type = node->GetInputDataType(input);
|
||||
NodeValue::Type data_type = node->get_input_data_type(input);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
// Load standard value
|
||||
int val_index = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
QVariant value_on_track;
|
||||
|
||||
if (data_type == NodeValue::kVideoParams) {
|
||||
if (data_type == NodeValue::k_video_params) {
|
||||
VideoParams vp;
|
||||
vp.Load(reader);
|
||||
vp.load(reader);
|
||||
value_on_track = QVariant::fromValue(vp);
|
||||
} else if (data_type == NodeValue::kAudioParams) {
|
||||
} else if (data_type == NodeValue::k_audio_params) {
|
||||
AudioParams ap =
|
||||
TypeSerializer::LoadAudioParams(reader);
|
||||
TypeSerializer::load_audio_params(reader);
|
||||
value_on_track = QVariant::fromValue(ap);
|
||||
} else {
|
||||
QString value_text = reader->readElementText();
|
||||
|
||||
if (!value_text.isEmpty()) {
|
||||
value_on_track = NodeValue::StringToValue(
|
||||
value_on_track = NodeValue::string_to_value(
|
||||
data_type, value_text, true);
|
||||
}
|
||||
}
|
||||
|
||||
node->SetSplitStandardValueOnTrack(input, val_index,
|
||||
node->set_split_standard_value_on_track(input, val_index,
|
||||
value_on_track, element);
|
||||
|
||||
val_index++;
|
||||
@@ -516,34 +516,34 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("keyframing") &&
|
||||
node->IsInputKeyframable(input)) {
|
||||
node->SetInputIsKeyframing(input, reader->readElementText().toInt(),
|
||||
node->is_input_keyframable(input)) {
|
||||
node->set_input_is_keyframing(input, reader->readElementText().toInt(),
|
||||
element);
|
||||
} else if (reader->name() == QStringLiteral("keyframes")) {
|
||||
int track = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("key")) {
|
||||
QString key_input;
|
||||
rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::kLinear;
|
||||
Rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::k_linear;
|
||||
QVariant key_value;
|
||||
QPointF key_in_handle;
|
||||
QPointF key_out_handle;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (IsCancelled()) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
key_input = attr.value().toString();
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("time")) {
|
||||
key_time = rational::fromString(
|
||||
key_time = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("type")) {
|
||||
@@ -574,7 +574,7 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
key_value = NodeValue::StringToValue(
|
||||
key_value = NodeValue::string_to_value(
|
||||
data_type, reader->readElementText(), true);
|
||||
|
||||
NodeKeyframe *key = new NodeKeyframe(
|
||||
@@ -593,16 +593,16 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("csinput")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_input"),
|
||||
node->set_input_property(input, QStringLiteral("col_input"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csdisplay")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_display"),
|
||||
node->set_input_property(input, QStringLiteral("col_display"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csview")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_view"),
|
||||
node->set_input_property(input, QStringLiteral("col_view"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("cslook")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_look"),
|
||||
node->set_input_property(input, QStringLiteral("col_look"),
|
||||
reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -610,7 +610,7 @@ void ProjectSerializer210907::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectSerializer210907::LoadPosition(QXmlStreamReader *reader,
|
||||
bool ProjectSerializer210907::load_position(QXmlStreamReader *reader,
|
||||
quintptr *node_ptr,
|
||||
Node::Position *pos) const
|
||||
{
|
||||
@@ -627,7 +627,7 @@ bool ProjectSerializer210907::LoadPosition(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("x")) {
|
||||
pos->position.setX(reader->readElementText().toDouble());
|
||||
got_pos_x = true;
|
||||
@@ -644,12 +644,12 @@ bool ProjectSerializer210907::LoadPosition(QXmlStreamReader *reader,
|
||||
return got_node_ptr && got_pos_x && got_pos_y;
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::PostConnect(const XMLNodeData &xml_node_data) const
|
||||
void ProjectSerializer210907::post_connect(const XMLNodeData &xml_node_data) const
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection &con,
|
||||
xml_node_data.desired_connections) {
|
||||
if (Node *out = xml_node_data.node_ptrs.value(con.output_node)) {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
Node::connect_edge(out, con.input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,26 +657,26 @@ void ProjectSerializer210907::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
Node *a = l.block;
|
||||
Node *b = xml_node_data.node_ptrs.value(l.link);
|
||||
|
||||
Node::Link(a, b);
|
||||
Node::link(a, b);
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::GroupLink &l, xml_node_data.group_input_links) {
|
||||
if (Node *input_node = xml_node_data.node_ptrs.value(l.input_node)) {
|
||||
NodeInput resolved(input_node, l.input_id, l.input_element);
|
||||
|
||||
l.group->AddInputPassthrough(resolved);
|
||||
l.group->add_input_passthrough(resolved);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = xml_node_data.group_output_links.cbegin();
|
||||
it != xml_node_data.group_output_links.cend(); it++) {
|
||||
if (Node *output_node = xml_node_data.node_ptrs.value(it.value())) {
|
||||
it.key()->SetOutputPassthrough(output_node);
|
||||
it.key()->set_output_passthrough(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_node_custom(QXmlStreamReader *reader,
|
||||
Node *node,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
@@ -684,9 +684,9 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput *>(node)) {
|
||||
Footage *footage = dynamic_cast<Footage *>(node);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("points")) {
|
||||
LoadTimelinePoints(reader, viewer);
|
||||
load_timeline_points(reader, viewer);
|
||||
} else if (reader->name() == QStringLiteral("timestamp") &&
|
||||
footage) {
|
||||
footage->set_timestamp(reader->readElementText().toLongLong());
|
||||
@@ -696,24 +696,24 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (Track *track = dynamic_cast<Track *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
track->SetTrackHeight(reader->readElementText().toDouble());
|
||||
track->set_track_height(reader->readElementText().toDouble());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (NodeGroup *group = dynamic_cast<NodeGroup *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthroughs")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthrough")) {
|
||||
XMLNodeData::GroupLink link;
|
||||
|
||||
link.group = group;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
link.input_node =
|
||||
reader->readElementText().toULongLong();
|
||||
@@ -747,25 +747,25 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("markers")) {
|
||||
LoadMarkerList(reader, points->GetMarkers());
|
||||
load_marker_list(reader, points->get_markers());
|
||||
} else if (reader->name() == QStringLiteral("workarea")) {
|
||||
LoadWorkArea(reader, points->GetWorkArea());
|
||||
load_work_area(reader, points->get_work_area());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadWorkArea(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const
|
||||
{
|
||||
rational range_in = workarea->in();
|
||||
rational range_out = workarea->out();
|
||||
Rational range_in = workarea->in();
|
||||
Rational range_out = workarea->out();
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
@@ -773,10 +773,10 @@ void ProjectSerializer210907::LoadWorkArea(QXmlStreamReader *reader,
|
||||
workarea->set_enabled(attr.value() != QStringLiteral("0"));
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
range_in =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
range_out =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,28 +789,28 @@ void ProjectSerializer210907::LoadWorkArea(QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader,
|
||||
void ProjectSerializer210907::load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
QString name;
|
||||
rational in, out;
|
||||
Rational in, out;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("name")) {
|
||||
name = attr.value().toString();
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
in = rational::fromString(
|
||||
in = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
out = rational::fromString(
|
||||
out = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(),
|
||||
new TimelineMarker(OAK_CONFIG("MarkerColor").toInt(),
|
||||
TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
@@ -818,14 +818,14 @@ void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadValueHint(Node::ValueHint *hint,
|
||||
void ProjectSerializer210907::load_value_hint(Node::ValueHint *hint,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
QVector<NodeValue::Type> types;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("types")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("type")) {
|
||||
types.append(static_cast<NodeValue::Type>(
|
||||
reader->readElementText().toInt()));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SERIALIZER210907_H
|
||||
#define SERIALIZER210907_H
|
||||
#ifndef OAK_SERIALIZER210907_H
|
||||
#define OAK_SERIALIZER210907_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
ProjectSerializer210907() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 210907;
|
||||
}
|
||||
@@ -66,38 +66,38 @@ private:
|
||||
QHash<NodeGroup *, quintptr> group_output_links;
|
||||
};
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadColorManager(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_color_manager(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_project_settings(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node,
|
||||
void load_immediate(QXmlStreamReader *reader, Node *node,
|
||||
const QString &input, int element,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
bool load_position(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
Node::Position *pos) const;
|
||||
|
||||
void PostConnect(const XMLNodeData &xml_node_data) const;
|
||||
void post_connect(const XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadNodeCustom(QXmlStreamReader *reader, Node *node,
|
||||
void load_node_custom(QXmlStreamReader *reader, Node *node,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const;
|
||||
|
||||
void LoadWorkArea(QXmlStreamReader *reader,
|
||||
void load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const;
|
||||
|
||||
void LoadMarkerList(QXmlStreamReader *reader,
|
||||
void load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const;
|
||||
|
||||
void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
void load_value_hint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,19 +29,19 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer211228::LoadData
|
||||
ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer211228::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
QMap<quintptr, QMap<QString, QString>> properties;
|
||||
QMap<quintptr, QMap<quintptr, Node::Position>> positions;
|
||||
XMLNodeData xml_node_data;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("uuid")) {
|
||||
project->SetUuid(QUuid::fromString(reader->readElementText()));
|
||||
project->set_uuid(QUuid::fromString(reader->readElementText()));
|
||||
|
||||
} else if (reader->name() == QStringLiteral("nodes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
bool is_root = false;
|
||||
bool is_cm = false;
|
||||
@@ -75,16 +75,16 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
project->Initialize();
|
||||
project->initialize();
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
LoadColorManager(reader, project);
|
||||
load_color_manager(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else if (is_settings) {
|
||||
LoadProjectSettings(reader, project);
|
||||
load_project_settings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
node = NodeFactory::create_from_id(id);
|
||||
}
|
||||
|
||||
if (!handled_elsewhere) {
|
||||
@@ -93,7 +93,7 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
<< "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
load_node(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("positions")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("context")) {
|
||||
quintptr context_ptr = 0;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -116,12 +116,12 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (context_ptr) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr node_ptr;
|
||||
Node::Position node_pos;
|
||||
|
||||
if (LoadPosition(reader, &node_ptr,
|
||||
if (load_position(reader, &node_ptr,
|
||||
&node_pos)) {
|
||||
if (node_ptr) {
|
||||
positions[context_ptr].insert(node_ptr,
|
||||
@@ -148,7 +148,7 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("properties")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr ptr = 0;
|
||||
|
||||
@@ -164,7 +164,7 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
if (ptr) {
|
||||
QMap<QString, QString> properties_for_node;
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
properties_for_node.insert(
|
||||
reader->name().toString(),
|
||||
reader->readElementText());
|
||||
@@ -189,14 +189,14 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
for (auto jt = it.value().cbegin(); jt != it.value().cend(); jt++) {
|
||||
Node *n = xml_node_data.node_ptrs.value(jt.key());
|
||||
if (n) {
|
||||
ctx->SetNodePositionInContext(n, jt.value());
|
||||
ctx->set_node_position_in_context(n, jt.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make connections
|
||||
PostConnect(xml_node_data);
|
||||
post_connect(xml_node_data);
|
||||
|
||||
LoadData load_data;
|
||||
load_data.node_ptrs = xml_node_data.node_ptrs;
|
||||
@@ -212,14 +212,14 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
// Resolve tracks
|
||||
for (Node *n : project->nodes()) {
|
||||
n->SetCachesEnabled(true);
|
||||
n->set_caches_enabled(true);
|
||||
|
||||
if (Track *t = dynamic_cast<Track *>(n)) {
|
||||
for (int i = 0; i < t->InputArraySize(Track::kBlockInput); i++) {
|
||||
for (int i = 0; i < t->input_array_size(Track::k_block_input); i++) {
|
||||
Block *b = static_cast<Block *>(
|
||||
t->GetConnectedOutput(Track::kBlockInput, i));
|
||||
t->get_connected_output(Track::k_block_input, i));
|
||||
if (!b->track()) {
|
||||
t->AppendBlock(b);
|
||||
t->append_block(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,28 +228,28 @@ ProjectSerializer211228::Load(Project *project, QXmlStreamReader *reader,
|
||||
return load_data;
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void ProjectSerializer211228::load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
LoadInput(node, reader, xml_node_data);
|
||||
load_input(node, reader, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("ptr")) {
|
||||
quintptr ptr = reader->readElementText().toULongLong();
|
||||
xml_node_data.node_ptrs.insert(ptr, node);
|
||||
} else if (reader->name() == QStringLiteral("label")) {
|
||||
node->SetLabel(reader->readElementText());
|
||||
node->set_label(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("uuid")) {
|
||||
xml_node_data.node_uuids.insert(
|
||||
node, QUuid::fromString(reader->readElementText()));
|
||||
} else if (reader->name() == QStringLiteral("color")) {
|
||||
node->SetOverrideColor(reader->readElementText().toInt());
|
||||
node->set_override_color(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("links")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("link")) {
|
||||
xml_node_data.block_links.append(
|
||||
{ node, reader->readElementText().toULongLong() });
|
||||
@@ -258,10 +258,10 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("custom")) {
|
||||
LoadNodeCustom(reader, node, xml_node_data);
|
||||
load_node_custom(reader, node, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("connections")) {
|
||||
// Load connections
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("connection")) {
|
||||
QString param_id;
|
||||
int ele = -1;
|
||||
@@ -277,7 +277,7 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
|
||||
QString output_node_id;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("output")) {
|
||||
output_node_id = reader->readElementText();
|
||||
} else {
|
||||
@@ -293,7 +293,7 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("hints")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("hint")) {
|
||||
QString input;
|
||||
int element = -1;
|
||||
@@ -308,8 +308,8 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
|
||||
Node::ValueHint vh;
|
||||
LoadValueHint(&vh, reader);
|
||||
node->SetValueHintForInput(input, vh, element);
|
||||
load_value_hint(&vh, reader);
|
||||
node->set_value_hint_for_input(input, vh, element);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -322,10 +322,10 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadColorManager(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_color_manager(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -340,11 +340,11 @@ void ProjectSerializer211228::LoadColorManager(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("reference_space")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -386,18 +386,18 @@ void ProjectSerializer211228::LoadColorManager(QXmlStreamReader *reader,
|
||||
};
|
||||
int num_value = value.toInt();
|
||||
value = list.at(num_value);
|
||||
project->SetDefaultInputColorSpace(value);
|
||||
project->set_default_input_color_space(value);
|
||||
} else if (id == QStringLiteral("reference_space")) {
|
||||
// Reference space
|
||||
if (value == QStringLiteral("1")) {
|
||||
value = OCIO::ROLE_COMPOSITING_LOG;
|
||||
value = ocio::ROLE_COMPOSITING_LOG;
|
||||
} else {
|
||||
value = OCIO::ROLE_SCENE_LINEAR;
|
||||
value = ocio::ROLE_SCENE_LINEAR;
|
||||
}
|
||||
project->SetColorReferenceSpace(value);
|
||||
project->set_color_reference_space(value);
|
||||
} else {
|
||||
// Config filename
|
||||
project->SetColorConfigFilename(value);
|
||||
project->set_color_config_filename(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -408,10 +408,10 @@ void ProjectSerializer211228::LoadColorManager(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_project_settings(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -425,11 +425,11 @@ void ProjectSerializer211228::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -447,10 +447,10 @@ void ProjectSerializer211228::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(
|
||||
project->set_cache_location_setting(
|
||||
static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
project->set_custom_cache_path(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -461,7 +461,7 @@ void ProjectSerializer211228::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
@@ -481,34 +481,34 @@ void ProjectSerializer211228::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!node->HasInputWithID(param_id)) {
|
||||
if (!node->has_input_with_id(param_id)) {
|
||||
qWarning() << "Failed to load parameter that didn't exist:" << param_id;
|
||||
reader->skipCurrentElement();
|
||||
return;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
// Load primary immediate
|
||||
LoadImmediate(reader, node, param_id, -1, xml_node_data);
|
||||
load_immediate(reader, node, param_id, -1, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("subelements")) {
|
||||
// Load subelements
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("count")) {
|
||||
node->InputArrayResize(param_id, attr.value().toInt());
|
||||
node->input_array_resize(param_id, attr.value().toInt());
|
||||
}
|
||||
}
|
||||
|
||||
int element_counter = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("element")) {
|
||||
LoadImmediate(reader, node, param_id, element_counter,
|
||||
load_immediate(reader, node, param_id, element_counter,
|
||||
xml_node_data);
|
||||
|
||||
element_counter++;
|
||||
@@ -522,46 +522,46 @@ void ProjectSerializer211228::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_immediate(QXmlStreamReader *reader,
|
||||
Node *node, const QString &input,
|
||||
int element,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
|
||||
NodeValue::Type data_type = node->GetInputDataType(input);
|
||||
NodeValue::Type data_type = node->get_input_data_type(input);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
// Load standard value
|
||||
int val_index = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
QVariant value_on_track;
|
||||
|
||||
if (data_type == NodeValue::kVideoParams) {
|
||||
if (data_type == NodeValue::k_video_params) {
|
||||
VideoParams vp;
|
||||
vp.Load(reader);
|
||||
vp.load(reader);
|
||||
value_on_track = QVariant::fromValue(vp);
|
||||
} else if (data_type == NodeValue::kAudioParams) {
|
||||
} else if (data_type == NodeValue::k_audio_params) {
|
||||
AudioParams ap =
|
||||
TypeSerializer::LoadAudioParams(reader);
|
||||
TypeSerializer::load_audio_params(reader);
|
||||
value_on_track = QVariant::fromValue(ap);
|
||||
} else {
|
||||
QString value_text = reader->readElementText();
|
||||
|
||||
if (!value_text.isEmpty()) {
|
||||
value_on_track = NodeValue::StringToValue(
|
||||
value_on_track = NodeValue::string_to_value(
|
||||
data_type, value_text, true);
|
||||
}
|
||||
}
|
||||
|
||||
node->SetSplitStandardValueOnTrack(input, val_index,
|
||||
node->set_split_standard_value_on_track(input, val_index,
|
||||
value_on_track, element);
|
||||
|
||||
val_index++;
|
||||
@@ -570,34 +570,34 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("keyframing") &&
|
||||
node->IsInputKeyframable(input)) {
|
||||
node->SetInputIsKeyframing(input, reader->readElementText().toInt(),
|
||||
node->is_input_keyframable(input)) {
|
||||
node->set_input_is_keyframing(input, reader->readElementText().toInt(),
|
||||
element);
|
||||
} else if (reader->name() == QStringLiteral("keyframes")) {
|
||||
int track = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("key")) {
|
||||
QString key_input;
|
||||
rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::kLinear;
|
||||
Rational key_time;
|
||||
NodeKeyframe::Type key_type = NodeKeyframe::k_linear;
|
||||
QVariant key_value;
|
||||
QPointF key_in_handle;
|
||||
QPointF key_out_handle;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (IsCancelled()) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
key_input = attr.value().toString();
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("time")) {
|
||||
key_time = rational::fromString(
|
||||
key_time = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() ==
|
||||
QStringLiteral("type")) {
|
||||
@@ -628,7 +628,7 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
key_value = NodeValue::StringToValue(
|
||||
key_value = NodeValue::string_to_value(
|
||||
data_type, reader->readElementText(), true);
|
||||
|
||||
NodeKeyframe *key = new NodeKeyframe(
|
||||
@@ -647,16 +647,16 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("csinput")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_input"),
|
||||
node->set_input_property(input, QStringLiteral("col_input"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csdisplay")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_display"),
|
||||
node->set_input_property(input, QStringLiteral("col_display"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csview")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_view"),
|
||||
node->set_input_property(input, QStringLiteral("col_view"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("cslook")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_look"),
|
||||
node->set_input_property(input, QStringLiteral("col_look"),
|
||||
reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -664,7 +664,7 @@ void ProjectSerializer211228::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectSerializer211228::LoadPosition(QXmlStreamReader *reader,
|
||||
bool ProjectSerializer211228::load_position(QXmlStreamReader *reader,
|
||||
quintptr *node_ptr,
|
||||
Node::Position *pos) const
|
||||
{
|
||||
@@ -681,7 +681,7 @@ bool ProjectSerializer211228::LoadPosition(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("x")) {
|
||||
pos->position.setX(reader->readElementText().toDouble());
|
||||
got_pos_x = true;
|
||||
@@ -698,12 +698,12 @@ bool ProjectSerializer211228::LoadPosition(QXmlStreamReader *reader,
|
||||
return got_node_ptr && got_pos_x && got_pos_y;
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::PostConnect(const XMLNodeData &xml_node_data) const
|
||||
void ProjectSerializer211228::post_connect(const XMLNodeData &xml_node_data) const
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection &con,
|
||||
xml_node_data.desired_connections) {
|
||||
if (Node *out = xml_node_data.node_ptrs.value(con.output_node)) {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
Node::connect_edge(out, con.input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,26 +711,26 @@ void ProjectSerializer211228::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
Node *a = l.block;
|
||||
Node *b = xml_node_data.node_ptrs.value(l.link);
|
||||
|
||||
Node::Link(a, b);
|
||||
Node::link(a, b);
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::GroupLink &l, xml_node_data.group_input_links) {
|
||||
if (Node *input_node = xml_node_data.node_ptrs.value(l.input_node)) {
|
||||
NodeInput resolved(input_node, l.input_id, l.input_element);
|
||||
|
||||
l.group->AddInputPassthrough(resolved);
|
||||
l.group->add_input_passthrough(resolved);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = xml_node_data.group_output_links.cbegin();
|
||||
it != xml_node_data.group_output_links.cend(); it++) {
|
||||
if (Node *output_node = xml_node_data.node_ptrs.value(it.value())) {
|
||||
it.key()->SetOutputPassthrough(output_node);
|
||||
it.key()->set_output_passthrough(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_node_custom(QXmlStreamReader *reader,
|
||||
Node *node,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
@@ -738,9 +738,9 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput *>(node)) {
|
||||
Footage *footage = dynamic_cast<Footage *>(node);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("points")) {
|
||||
LoadTimelinePoints(reader, viewer);
|
||||
load_timeline_points(reader, viewer);
|
||||
} else if (reader->name() == QStringLiteral("timestamp") &&
|
||||
footage) {
|
||||
footage->set_timestamp(reader->readElementText().toLongLong());
|
||||
@@ -750,24 +750,24 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (Track *track = dynamic_cast<Track *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
track->SetTrackHeight(reader->readElementText().toDouble());
|
||||
track->set_track_height(reader->readElementText().toDouble());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (NodeGroup *group = dynamic_cast<NodeGroup *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthroughs")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthrough")) {
|
||||
XMLNodeData::GroupLink link;
|
||||
|
||||
link.group = group;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
link.input_node =
|
||||
reader->readElementText().toULongLong();
|
||||
@@ -801,25 +801,25 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("markers")) {
|
||||
LoadMarkerList(reader, points->GetMarkers());
|
||||
load_marker_list(reader, points->get_markers());
|
||||
} else if (reader->name() == QStringLiteral("workarea")) {
|
||||
LoadWorkArea(reader, points->GetWorkArea());
|
||||
load_work_area(reader, points->get_work_area());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadWorkArea(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const
|
||||
{
|
||||
rational range_in = workarea->in();
|
||||
rational range_out = workarea->out();
|
||||
Rational range_in = workarea->in();
|
||||
Rational range_out = workarea->out();
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
@@ -827,10 +827,10 @@ void ProjectSerializer211228::LoadWorkArea(QXmlStreamReader *reader,
|
||||
workarea->set_enabled(attr.value() != QStringLiteral("0"));
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
range_in =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
range_out =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,28 +843,28 @@ void ProjectSerializer211228::LoadWorkArea(QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader,
|
||||
void ProjectSerializer211228::load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
QString name;
|
||||
rational in, out;
|
||||
Rational in, out;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("name")) {
|
||||
name = attr.value().toString();
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
in = rational::fromString(
|
||||
in = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
out = rational::fromString(
|
||||
out = Rational::from_string(
|
||||
attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
new TimelineMarker(OLIVE_CONFIG("MarkerColor").toInt(),
|
||||
new TimelineMarker(OAK_CONFIG("MarkerColor").toInt(),
|
||||
TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
@@ -872,14 +872,14 @@ void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadValueHint(Node::ValueHint *hint,
|
||||
void ProjectSerializer211228::load_value_hint(Node::ValueHint *hint,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
QVector<NodeValue::Type> types;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("types")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("type")) {
|
||||
types.append(static_cast<NodeValue::Type>(
|
||||
reader->readElementText().toInt()));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SERIALIZER211228_H
|
||||
#define SERIALIZER211228_H
|
||||
#ifndef OAK_SERIALIZER211228_H
|
||||
#define OAK_SERIALIZER211228_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
ProjectSerializer211228() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 211228;
|
||||
}
|
||||
@@ -67,40 +67,40 @@ private:
|
||||
QHash<Node *, QUuid> node_uuids;
|
||||
};
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadColorManager(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_color_manager(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_project_settings(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node,
|
||||
void load_immediate(QXmlStreamReader *reader, Node *node,
|
||||
const QString &input, int element,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
bool load_position(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
Node::Position *pos) const;
|
||||
|
||||
void PostConnect(const XMLNodeData &xml_node_data) const;
|
||||
void post_connect(const XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadNodeCustom(QXmlStreamReader *reader, Node *node,
|
||||
void load_node_custom(QXmlStreamReader *reader, Node *node,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *points) const;
|
||||
|
||||
void LoadWorkArea(QXmlStreamReader *reader,
|
||||
void load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const;
|
||||
|
||||
void LoadMarkerList(QXmlStreamReader *reader,
|
||||
void load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const;
|
||||
|
||||
void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
void load_value_hint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SERIALIZER211228_H
|
||||
#endif // OAK_SERIALIZER211228_H
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer220403::LoadData
|
||||
ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer220403::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
QMap<quintptr, QMap<QString, QString>> properties;
|
||||
@@ -38,36 +38,36 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
LoadData load_data;
|
||||
|
||||
if ((load_type == kProject &&
|
||||
if ((load_type == k_project &&
|
||||
reader->name() == QStringLiteral("project")) ||
|
||||
((load_type == kOnlyNodes &&
|
||||
((load_type == k_only_nodes &&
|
||||
reader->name() == QStringLiteral("nodes")) ||
|
||||
(load_type == kOnlyClips &&
|
||||
(load_type == k_only_clips &&
|
||||
reader->name() == QStringLiteral("timeline"))) ||
|
||||
(load_type == kOnlyKeyframes &&
|
||||
(load_type == k_only_keyframes &&
|
||||
reader->name() == QStringLiteral("keyframes")) ||
|
||||
(load_type == kOnlyMarkers &&
|
||||
(load_type == k_only_markers &&
|
||||
reader->name() == QStringLiteral("markers"))) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("layout")) {
|
||||
// Since the main window's functions have to occur in the GUI thread (and we're likely
|
||||
// loading in a secondary thread), we load all necessary data into a separate struct so we
|
||||
// can continue loading and queue it with the main window so it can handle the data
|
||||
// appropriately in its own thread.
|
||||
|
||||
load_data.layout = MainWindowLayoutInfo::fromXml(
|
||||
load_data.layout = MainWindowLayoutInfo::from_xml(
|
||||
reader, xml_node_data.node_ptrs);
|
||||
|
||||
} else if (reader->name() == QStringLiteral("uuid")) {
|
||||
if (project) {
|
||||
project->SetUuid(
|
||||
project->set_uuid(
|
||||
QUuid::fromString(reader->readElementText()));
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("nodes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
bool is_root = false;
|
||||
bool is_cm = false;
|
||||
@@ -106,16 +106,16 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
project->Initialize();
|
||||
project->initialize();
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
LoadColorManager(reader, project);
|
||||
load_color_manager(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else if (is_settings) {
|
||||
LoadProjectSettings(reader, project);
|
||||
load_project_settings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
node = NodeFactory::create_from_id(id);
|
||||
}
|
||||
|
||||
if (!handled_elsewhere) {
|
||||
@@ -124,7 +124,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
<< "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
load_node(node, xml_node_data, reader);
|
||||
if (project) {
|
||||
node->setParent(project);
|
||||
} else {
|
||||
@@ -139,7 +139,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("keyframes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
QString node_id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -152,13 +152,13 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
Node *n = nullptr;
|
||||
if (!node_id.isEmpty()) {
|
||||
n = NodeFactory::CreateFromID(node_id);
|
||||
n = NodeFactory::create_from_id(node_id);
|
||||
}
|
||||
|
||||
if (!n) {
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString input_id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -174,7 +174,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (
|
||||
XMLReadNextStartElement(reader)) {
|
||||
xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("element")) {
|
||||
QString element_id;
|
||||
@@ -193,7 +193,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (
|
||||
XMLReadNextStartElement(
|
||||
xml_read_next_start_element(
|
||||
reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral(
|
||||
@@ -218,7 +218,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
->skipCurrentElement();
|
||||
} else {
|
||||
while (
|
||||
XMLReadNextStartElement(
|
||||
xml_read_next_start_element(
|
||||
reader)) {
|
||||
if (reader
|
||||
->name() ==
|
||||
@@ -236,10 +236,10 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
track_id
|
||||
.toInt());
|
||||
|
||||
LoadKeyframe(
|
||||
load_keyframe(
|
||||
reader,
|
||||
key,
|
||||
n->GetInputDataType(
|
||||
n->get_input_data_type(
|
||||
input_id));
|
||||
|
||||
load_data
|
||||
@@ -277,10 +277,10 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("markers")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
TimelineMarker *marker = new TimelineMarker();
|
||||
LoadMarker(reader, marker);
|
||||
load_marker(reader, marker);
|
||||
load_data.markers.push_back(marker);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -288,7 +288,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("positions")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("context")) {
|
||||
quintptr context_ptr = 0;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -300,12 +300,12 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (context_ptr) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr node_ptr;
|
||||
Node::Position node_pos;
|
||||
|
||||
if (LoadPosition(reader, &node_ptr,
|
||||
if (load_position(reader, &node_ptr,
|
||||
&node_pos)) {
|
||||
if (node_ptr) {
|
||||
positions[context_ptr].insert(
|
||||
@@ -332,7 +332,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("properties")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr ptr = 0;
|
||||
|
||||
@@ -348,7 +348,7 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
if (ptr) {
|
||||
QMap<QString, QString> properties_for_node;
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
properties_for_node.insert(
|
||||
reader->name().toString(),
|
||||
reader->readElementText());
|
||||
@@ -374,14 +374,14 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
for (auto jt = it.value().cbegin(); jt != it.value().cend(); jt++) {
|
||||
Node *n = xml_node_data.node_ptrs.value(jt.key());
|
||||
if (n) {
|
||||
ctx->SetNodePositionInContext(n, jt.value());
|
||||
ctx->set_node_position_in_context(n, jt.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make connections
|
||||
PostConnect(xml_node_data);
|
||||
post_connect(xml_node_data);
|
||||
|
||||
load_data.node_ptrs = xml_node_data.node_ptrs;
|
||||
load_data.node_uuids = xml_node_data.node_uuids;
|
||||
@@ -397,14 +397,14 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
// Re-enable caches and resolve tracks
|
||||
const QVector<Node *> &nodes = project ? project->nodes() : load_data.nodes;
|
||||
for (Node *n : nodes) {
|
||||
n->SetCachesEnabled(true);
|
||||
n->set_caches_enabled(true);
|
||||
|
||||
if (Track *t = dynamic_cast<Track *>(n)) {
|
||||
for (int i = 0; i < t->InputArraySize(Track::kBlockInput); i++) {
|
||||
for (int i = 0; i < t->input_array_size(Track::k_block_input); i++) {
|
||||
Block *b = static_cast<Block *>(
|
||||
t->GetConnectedOutput(Track::kBlockInput, i));
|
||||
t->get_connected_output(Track::k_block_input, i));
|
||||
if (!b->track()) {
|
||||
t->AppendBlock(b);
|
||||
t->append_block(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,8 +412,8 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
// Clear duplicate label (to facilitate #2147)
|
||||
if (ClipBlock *c = dynamic_cast<ClipBlock *>(n)) {
|
||||
if (c->connected_viewer() &&
|
||||
c->GetLabel() == c->connected_viewer()->GetLabel()) {
|
||||
c->SetLabel(QString());
|
||||
c->get_label() == c->connected_viewer()->get_label()) {
|
||||
c->set_label(QString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,28 +421,28 @@ ProjectSerializer220403::Load(Project *project, QXmlStreamReader *reader,
|
||||
return load_data;
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void ProjectSerializer220403::load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
LoadInput(node, reader, xml_node_data);
|
||||
load_input(node, reader, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("ptr")) {
|
||||
quintptr ptr = reader->readElementText().toULongLong();
|
||||
xml_node_data.node_ptrs.insert(ptr, node);
|
||||
} else if (reader->name() == QStringLiteral("label")) {
|
||||
node->SetLabel(reader->readElementText());
|
||||
node->set_label(reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("uuid")) {
|
||||
xml_node_data.node_uuids.insert(
|
||||
node, QUuid::fromString(reader->readElementText()));
|
||||
} else if (reader->name() == QStringLiteral("color")) {
|
||||
node->SetOverrideColor(reader->readElementText().toInt());
|
||||
node->set_override_color(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("links")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("link")) {
|
||||
xml_node_data.block_links.append(
|
||||
{ node, reader->readElementText().toULongLong() });
|
||||
@@ -451,10 +451,10 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("custom")) {
|
||||
LoadNodeCustom(reader, node, xml_node_data);
|
||||
load_node_custom(reader, node, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("connections")) {
|
||||
// Load connections
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("connection")) {
|
||||
QString param_id;
|
||||
int ele = -1;
|
||||
@@ -470,7 +470,7 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
|
||||
QString output_node_id;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("output")) {
|
||||
output_node_id = reader->readElementText();
|
||||
} else {
|
||||
@@ -486,7 +486,7 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("hints")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("hint")) {
|
||||
QString input;
|
||||
int element = -1;
|
||||
@@ -501,25 +501,25 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
}
|
||||
|
||||
Node::ValueHint vh;
|
||||
LoadValueHint(&vh, reader);
|
||||
node->SetValueHintForInput(input, vh, element);
|
||||
load_value_hint(&vh, reader);
|
||||
node->set_value_hint_for_input(input, vh, element);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("caches")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("audio")) {
|
||||
node->audio_playback_cache()->SetUuid(
|
||||
node->audio_playback_cache()->set_uuid(
|
||||
QUuid::fromString(reader->readElementText()));
|
||||
} else if (reader->name() == QStringLiteral("video")) {
|
||||
node->video_frame_cache()->SetUuid(
|
||||
node->video_frame_cache()->set_uuid(
|
||||
QUuid::fromString(reader->readElementText()));
|
||||
} else if (reader->name() == QStringLiteral("thumb")) {
|
||||
node->thumbnail_cache()->SetUuid(
|
||||
node->thumbnail_cache()->set_uuid(
|
||||
QUuid::fromString(reader->readElementText()));
|
||||
} else if (reader->name() == QStringLiteral("waveform")) {
|
||||
node->waveform_cache()->SetUuid(
|
||||
node->waveform_cache()->set_uuid(
|
||||
QUuid::fromString(reader->readElementText()));
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -533,10 +533,10 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadColorManager(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_color_manager(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -551,11 +551,11 @@ void ProjectSerializer220403::LoadColorManager(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("reference_space")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -596,18 +596,18 @@ void ProjectSerializer220403::LoadColorManager(QXmlStreamReader *reader,
|
||||
};
|
||||
int num_value = value.toInt();
|
||||
value = list.at(num_value);
|
||||
project->SetDefaultInputColorSpace(value);
|
||||
project->set_default_input_color_space(value);
|
||||
} else if (id == QStringLiteral("reference_space")) {
|
||||
// Reference space
|
||||
if (value == QStringLiteral("1")) {
|
||||
value = OCIO::ROLE_COMPOSITING_LOG;
|
||||
value = ocio::ROLE_COMPOSITING_LOG;
|
||||
} else {
|
||||
value = OCIO::ROLE_SCENE_LINEAR;
|
||||
value = ocio::ROLE_SCENE_LINEAR;
|
||||
}
|
||||
project->SetColorReferenceSpace(value);
|
||||
project->set_color_reference_space(value);
|
||||
} else {
|
||||
// Config filename
|
||||
project->SetColorConfigFilename(value);
|
||||
project->set_color_config_filename(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -618,10 +618,10 @@ void ProjectSerializer220403::LoadColorManager(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_project_settings(QXmlStreamReader *reader,
|
||||
Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -635,11 +635,11 @@ void ProjectSerializer220403::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
@@ -657,10 +657,10 @@ void ProjectSerializer220403::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(
|
||||
project->set_cache_location_setting(
|
||||
static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
project->set_custom_cache_path(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -671,7 +671,7 @@ void ProjectSerializer220403::LoadProjectSettings(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
if (dynamic_cast<NodeGroup *>(node)) {
|
||||
@@ -697,34 +697,34 @@ void ProjectSerializer220403::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!node->HasInputWithID(param_id)) {
|
||||
if (!node->has_input_with_id(param_id)) {
|
||||
qWarning() << "Failed to load parameter that didn't exist:" << param_id;
|
||||
reader->skipCurrentElement();
|
||||
return;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
// Load primary immediate
|
||||
LoadImmediate(reader, node, param_id, -1, xml_node_data);
|
||||
load_immediate(reader, node, param_id, -1, xml_node_data);
|
||||
} else if (reader->name() == QStringLiteral("subelements")) {
|
||||
// Load subelements
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("count")) {
|
||||
node->InputArrayResize(param_id, attr.value().toInt());
|
||||
node->input_array_resize(param_id, attr.value().toInt());
|
||||
}
|
||||
}
|
||||
|
||||
int element_counter = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("element")) {
|
||||
LoadImmediate(reader, node, param_id, element_counter,
|
||||
load_immediate(reader, node, param_id, element_counter,
|
||||
xml_node_data);
|
||||
|
||||
element_counter++;
|
||||
@@ -738,54 +738,54 @@ void ProjectSerializer220403::LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_immediate(QXmlStreamReader *reader,
|
||||
Node *node, const QString &input,
|
||||
int element,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
Q_UNUSED(xml_node_data)
|
||||
|
||||
NodeValue::Type data_type = node->GetInputDataType(input);
|
||||
NodeValue::Type data_type = node->get_input_data_type(input);
|
||||
|
||||
// HACK: SubtitleParams contain the actual subtitle data, so loading/replacing it will overwrite
|
||||
// the valid subtitles. We hack around it by simply skipping loading subtitles, we'll see
|
||||
// if this ends up being an issue in the future.
|
||||
if (data_type == NodeValue::kSubtitleParams) {
|
||||
if (data_type == NodeValue::k_subtitle_params) {
|
||||
reader->skipCurrentElement();
|
||||
return;
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
// Load standard value
|
||||
int val_index = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
QVariant value_on_track;
|
||||
|
||||
if (data_type == NodeValue::kVideoParams) {
|
||||
if (data_type == NodeValue::k_video_params) {
|
||||
VideoParams vp;
|
||||
vp.Load(reader);
|
||||
vp.load(reader);
|
||||
value_on_track = QVariant::fromValue(vp);
|
||||
} else if (data_type == NodeValue::kAudioParams) {
|
||||
} else if (data_type == NodeValue::k_audio_params) {
|
||||
AudioParams ap =
|
||||
TypeSerializer::LoadAudioParams(reader);
|
||||
TypeSerializer::load_audio_params(reader);
|
||||
value_on_track = QVariant::fromValue(ap);
|
||||
} else {
|
||||
QString value_text = reader->readElementText();
|
||||
|
||||
if (!value_text.isEmpty()) {
|
||||
value_on_track = NodeValue::StringToValue(
|
||||
value_on_track = NodeValue::string_to_value(
|
||||
data_type, value_text, true);
|
||||
}
|
||||
}
|
||||
|
||||
node->SetSplitStandardValueOnTrack(input, val_index,
|
||||
node->set_split_standard_value_on_track(input, val_index,
|
||||
value_on_track, element);
|
||||
|
||||
val_index++;
|
||||
@@ -794,20 +794,20 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("keyframing") &&
|
||||
node->IsInputKeyframable(input)) {
|
||||
node->SetInputIsKeyframing(input, reader->readElementText().toInt(),
|
||||
node->is_input_keyframable(input)) {
|
||||
node->set_input_is_keyframing(input, reader->readElementText().toInt(),
|
||||
element);
|
||||
} else if (reader->name() == QStringLiteral("keyframes")) {
|
||||
int track = 0;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (IsCancelled()) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader,
|
||||
key->set_element(element);
|
||||
key->set_track(track);
|
||||
|
||||
LoadKeyframe(reader, key, data_type);
|
||||
load_keyframe(reader, key, data_type);
|
||||
key->setParent(node);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -830,16 +830,16 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
} else if (reader->name() == QStringLiteral("csinput")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_input"),
|
||||
node->set_input_property(input, QStringLiteral("col_input"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csdisplay")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_display"),
|
||||
node->set_input_property(input, QStringLiteral("col_display"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("csview")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_view"),
|
||||
node->set_input_property(input, QStringLiteral("col_view"),
|
||||
reader->readElementText());
|
||||
} else if (reader->name() == QStringLiteral("cslook")) {
|
||||
node->SetInputProperty(input, QStringLiteral("col_look"),
|
||||
node->set_input_property(input, QStringLiteral("col_look"),
|
||||
reader->readElementText());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
@@ -847,7 +847,7 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_keyframe(QXmlStreamReader *reader,
|
||||
NodeKeyframe *key,
|
||||
NodeValue::Type data_type) const
|
||||
{
|
||||
@@ -857,7 +857,7 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader,
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (IsCancelled()) {
|
||||
if (is_cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader,
|
||||
key_input = attr.value().toString();
|
||||
} else if (attr.name() == QStringLiteral("time")) {
|
||||
key->set_time(
|
||||
rational::fromString(attr.value().toString().toStdString()));
|
||||
Rational::from_string(attr.value().toString().toStdString()));
|
||||
} else if (attr.name() == QStringLiteral("type")) {
|
||||
key->set_type_no_bezier_adj(
|
||||
static_cast<NodeKeyframe::Type>(attr.value().toInt()));
|
||||
@@ -881,13 +881,13 @@ void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
key->set_value(
|
||||
NodeValue::StringToValue(data_type, reader->readElementText(), true));
|
||||
NodeValue::string_to_value(data_type, reader->readElementText(), true));
|
||||
|
||||
key->set_bezier_control_in(key_in_handle);
|
||||
key->set_bezier_control_out(key_out_handle);
|
||||
}
|
||||
|
||||
bool ProjectSerializer220403::LoadPosition(QXmlStreamReader *reader,
|
||||
bool ProjectSerializer220403::load_position(QXmlStreamReader *reader,
|
||||
quintptr *node_ptr,
|
||||
Node::Position *pos) const
|
||||
{
|
||||
@@ -904,7 +904,7 @@ bool ProjectSerializer220403::LoadPosition(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("x")) {
|
||||
pos->position.setX(reader->readElementText().toDouble());
|
||||
got_pos_x = true;
|
||||
@@ -921,12 +921,12 @@ bool ProjectSerializer220403::LoadPosition(QXmlStreamReader *reader,
|
||||
return got_node_ptr && got_pos_x && got_pos_y;
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::PostConnect(const XMLNodeData &xml_node_data) const
|
||||
void ProjectSerializer220403::post_connect(const XMLNodeData &xml_node_data) const
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection &con,
|
||||
xml_node_data.desired_connections) {
|
||||
if (Node *out = xml_node_data.node_ptrs.value(con.output_node)) {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
Node::connect_edge(out, con.input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -934,29 +934,29 @@ void ProjectSerializer220403::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
Node *a = l.block;
|
||||
Node *b = xml_node_data.node_ptrs.value(l.link);
|
||||
|
||||
Node::Link(a, b);
|
||||
Node::link(a, b);
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::GroupLink &l, xml_node_data.group_input_links) {
|
||||
if (Node *input_node = xml_node_data.node_ptrs.value(l.input_node)) {
|
||||
NodeInput resolved(input_node, l.input_id, l.input_element);
|
||||
|
||||
l.group->AddInputPassthrough(resolved, l.passthrough_id);
|
||||
l.group->add_input_passthrough(resolved, l.passthrough_id);
|
||||
|
||||
l.group->SetInputFlag(l.passthrough_id,
|
||||
l.group->set_input_flag(l.passthrough_id,
|
||||
InputFlag(l.custom_flags.value()));
|
||||
|
||||
if (!l.custom_name.isEmpty()) {
|
||||
l.group->SetInputName(l.passthrough_id, l.custom_name);
|
||||
l.group->set_input_name(l.passthrough_id, l.custom_name);
|
||||
}
|
||||
|
||||
l.group->SetInputDataType(l.passthrough_id, l.data_type);
|
||||
l.group->set_input_data_type(l.passthrough_id, l.data_type);
|
||||
|
||||
l.group->SetDefaultValue(l.passthrough_id, l.default_val);
|
||||
l.group->set_default_value(l.passthrough_id, l.default_val);
|
||||
|
||||
for (auto it = l.custom_properties.cbegin();
|
||||
it != l.custom_properties.cend(); it++) {
|
||||
l.group->SetInputProperty(l.passthrough_id, it.key(),
|
||||
l.group->set_input_property(l.passthrough_id, it.key(),
|
||||
it.value());
|
||||
}
|
||||
}
|
||||
@@ -965,12 +965,12 @@ void ProjectSerializer220403::PostConnect(const XMLNodeData &xml_node_data) cons
|
||||
for (auto it = xml_node_data.group_output_links.cbegin();
|
||||
it != xml_node_data.group_output_links.cend(); it++) {
|
||||
if (Node *output_node = xml_node_data.node_ptrs.value(it.value())) {
|
||||
it.key()->SetOutputPassthrough(output_node);
|
||||
it.key()->set_output_passthrough(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_node_custom(QXmlStreamReader *reader,
|
||||
Node *node,
|
||||
XMLNodeData &xml_node_data) const
|
||||
{
|
||||
@@ -978,9 +978,9 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput *>(node)) {
|
||||
Footage *footage = dynamic_cast<Footage *>(node);
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("points")) {
|
||||
LoadTimelinePoints(reader, viewer);
|
||||
load_timeline_points(reader, viewer);
|
||||
} else if (reader->name() == QStringLiteral("timestamp") &&
|
||||
footage) {
|
||||
footage->set_timestamp(reader->readElementText().toLongLong());
|
||||
@@ -990,24 +990,24 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
|
||||
} else if (Track *track = dynamic_cast<Track *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
track->SetTrackHeight(reader->readElementText().toDouble());
|
||||
track->set_track_height(reader->readElementText().toDouble());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (NodeGroup *group = dynamic_cast<NodeGroup *>(node)) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthroughs")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("inputpassthrough")) {
|
||||
XMLNodeData::GroupLink link;
|
||||
|
||||
link.group = group;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
link.input_node =
|
||||
reader->readElementText().toULongLong();
|
||||
@@ -1029,23 +1029,23 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
reader->readElementText().toULongLong());
|
||||
} else if (reader->name() ==
|
||||
QStringLiteral("type")) {
|
||||
link.data_type = NodeValue::GetDataTypeFromName(
|
||||
link.data_type = NodeValue::get_data_type_from_name(
|
||||
reader->readElementText());
|
||||
} else if (reader->name() ==
|
||||
QStringLiteral("default")) {
|
||||
link.default_val = NodeValue::StringToValue(
|
||||
link.default_val = NodeValue::string_to_value(
|
||||
link.data_type, reader->readElementText(),
|
||||
false);
|
||||
} else if (reader->name() ==
|
||||
QStringLiteral("properties")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("property")) {
|
||||
QString key;
|
||||
QString value;
|
||||
|
||||
while (
|
||||
XMLReadNextStartElement(reader)) {
|
||||
xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("key")) {
|
||||
key = reader->readElementText();
|
||||
@@ -1090,33 +1090,33 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *viewer) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("markers")) {
|
||||
LoadMarkerList(reader, viewer->GetMarkers());
|
||||
load_marker_list(reader, viewer->get_markers());
|
||||
} else if (reader->name() == QStringLiteral("workarea")) {
|
||||
LoadWorkArea(reader, viewer->GetWorkArea());
|
||||
load_work_area(reader, viewer->get_work_area());
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadMarker(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_marker(QXmlStreamReader *reader,
|
||||
TimelineMarker *marker) const
|
||||
{
|
||||
rational in, out;
|
||||
Rational in, out;
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
if (attr.name() == QStringLiteral("name")) {
|
||||
marker->set_name(attr.value().toString());
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
in = rational::fromString(attr.value().toString().toStdString());
|
||||
in = Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
out = rational::fromString(attr.value().toString().toStdString());
|
||||
out = Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("color")) {
|
||||
marker->set_color(attr.value().toInt());
|
||||
}
|
||||
@@ -1128,11 +1128,11 @@ void ProjectSerializer220403::LoadMarker(QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadWorkArea(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const
|
||||
{
|
||||
rational range_in = workarea->in();
|
||||
rational range_out = workarea->out();
|
||||
Rational range_in = workarea->in();
|
||||
Rational range_out = workarea->out();
|
||||
|
||||
XMLAttributeLoop(reader, attr)
|
||||
{
|
||||
@@ -1140,10 +1140,10 @@ void ProjectSerializer220403::LoadWorkArea(QXmlStreamReader *reader,
|
||||
workarea->set_enabled(attr.value() != QStringLiteral("0"));
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
range_in =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
} else if (attr.name() == QStringLiteral("out")) {
|
||||
range_out =
|
||||
rational::fromString(attr.value().toString().toStdString());
|
||||
Rational::from_string(attr.value().toString().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1156,27 +1156,27 @@ void ProjectSerializer220403::LoadWorkArea(QXmlStreamReader *reader,
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadMarkerList(QXmlStreamReader *reader,
|
||||
void ProjectSerializer220403::load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
TimelineMarker *marker = new TimelineMarker(markers);
|
||||
LoadMarker(reader, marker);
|
||||
load_marker(reader, marker);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadValueHint(Node::ValueHint *hint,
|
||||
void ProjectSerializer220403::load_value_hint(Node::ValueHint *hint,
|
||||
QXmlStreamReader *reader) const
|
||||
{
|
||||
QVector<NodeValue::Type> types;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("types")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("type")) {
|
||||
types.append(static_cast<NodeValue::Type>(
|
||||
reader->readElementText().toInt()));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SERIALIZER220403_H
|
||||
#define SERIALIZER220403_H
|
||||
#ifndef OAK_SERIALIZER220403_H
|
||||
#define OAK_SERIALIZER220403_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
ProjectSerializer220403() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 220403;
|
||||
}
|
||||
@@ -73,45 +73,45 @@ private:
|
||||
QHash<Node *, QUuid> node_uuids;
|
||||
};
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data,
|
||||
void load_node(Node *node, XMLNodeData &xml_node_data,
|
||||
QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadColorManager(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_color_manager(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader *reader, Project *project) const;
|
||||
void load_project_settings(QXmlStreamReader *reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader *reader,
|
||||
void load_input(Node *node, QXmlStreamReader *reader,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node,
|
||||
void load_immediate(QXmlStreamReader *reader, Node *node,
|
||||
const QString &input, int element,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadKeyframe(QXmlStreamReader *reader, NodeKeyframe *key,
|
||||
void load_keyframe(QXmlStreamReader *reader, NodeKeyframe *key,
|
||||
NodeValue::Type data_type) const;
|
||||
|
||||
bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
bool load_position(QXmlStreamReader *reader, quintptr *node_ptr,
|
||||
Node::Position *pos) const;
|
||||
|
||||
void PostConnect(const XMLNodeData &xml_node_data) const;
|
||||
void post_connect(const XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadNodeCustom(QXmlStreamReader *reader, Node *node,
|
||||
void load_node_custom(QXmlStreamReader *reader, Node *node,
|
||||
XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadTimelinePoints(QXmlStreamReader *reader,
|
||||
void load_timeline_points(QXmlStreamReader *reader,
|
||||
ViewerOutput *viewer) const;
|
||||
|
||||
void LoadMarker(QXmlStreamReader *reader, TimelineMarker *marker) const;
|
||||
void load_marker(QXmlStreamReader *reader, TimelineMarker *marker) const;
|
||||
|
||||
void LoadWorkArea(QXmlStreamReader *reader,
|
||||
void load_work_area(QXmlStreamReader *reader,
|
||||
TimelineWorkArea *workarea) const;
|
||||
|
||||
void LoadMarkerList(QXmlStreamReader *reader,
|
||||
void load_marker_list(QXmlStreamReader *reader,
|
||||
TimelineMarkerList *markers) const;
|
||||
|
||||
void LoadValueHint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
void load_value_hint(Node::ValueHint *hint, QXmlStreamReader *reader) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SERIALIZER220403_H
|
||||
#endif // OAK_SERIALIZER220403_H
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace olive
|
||||
{
|
||||
|
||||
ProjectSerializer230220::LoadData
|
||||
ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
ProjectSerializer230220::load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const
|
||||
{
|
||||
QMap<quintptr, QMap<QString, QString>> properties;
|
||||
@@ -42,29 +42,29 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
SerializedData project_data;
|
||||
|
||||
switch (load_type) {
|
||||
case kProject: {
|
||||
case k_project: {
|
||||
if (reader->name() == QStringLiteral("project")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("project")) {
|
||||
project_data = project->Load(reader);
|
||||
project_data = project->load(reader);
|
||||
load_data.node_ptrs = project_data.node_ptrs;
|
||||
} else if (reader->name() == QStringLiteral("layout")) {
|
||||
load_data.layout = MainWindowLayoutInfo::fromXml(
|
||||
load_data.layout = MainWindowLayoutInfo::from_xml(
|
||||
reader, project_data.node_ptrs);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
PostConnect(project->nodes(), &project_data);
|
||||
post_connect(project->nodes(), &project_data);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kOnlyMarkers: {
|
||||
case k_only_markers: {
|
||||
if (reader->name() == QStringLiteral("markers")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("marker")) {
|
||||
TimelineMarker *marker = new TimelineMarker();
|
||||
marker->load(reader);
|
||||
@@ -78,9 +78,9 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kOnlyKeyframes: {
|
||||
case k_only_keyframes: {
|
||||
if (reader->name() == QStringLiteral("keyframes")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
QString node_id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -93,13 +93,13 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
Node *n = nullptr;
|
||||
if (!node_id.isEmpty()) {
|
||||
n = NodeFactory::CreateFromID(node_id);
|
||||
n = NodeFactory::create_from_id(node_id);
|
||||
}
|
||||
|
||||
if (!n) {
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString input_id;
|
||||
XMLAttributeLoop(reader, attr)
|
||||
@@ -113,7 +113,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
if (input_id.isEmpty()) {
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral("element")) {
|
||||
QString element_id;
|
||||
@@ -130,7 +130,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
if (element_id.isEmpty()) {
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
while (XMLReadNextStartElement(
|
||||
while (xml_read_next_start_element(
|
||||
reader)) {
|
||||
if (reader->name() ==
|
||||
QStringLiteral(
|
||||
@@ -154,7 +154,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
->skipCurrentElement();
|
||||
} else {
|
||||
while (
|
||||
XMLReadNextStartElement(
|
||||
xml_read_next_start_element(
|
||||
reader)) {
|
||||
if (reader
|
||||
->name() ==
|
||||
@@ -173,7 +173,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
key->load(
|
||||
reader,
|
||||
n->GetInputDataType(
|
||||
n->get_input_data_type(
|
||||
input_id));
|
||||
|
||||
load_data
|
||||
@@ -214,15 +214,15 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case kOnlyClips:
|
||||
case kOnlyNodes: {
|
||||
if ((load_type == kOnlyNodes &&
|
||||
case k_only_clips:
|
||||
case k_only_nodes: {
|
||||
if ((load_type == k_only_nodes &&
|
||||
reader->name() == QStringLiteral("nodes")) ||
|
||||
(load_type == kOnlyClips &&
|
||||
(load_type == k_only_clips &&
|
||||
reader->name() == QStringLiteral("timeline"))) {
|
||||
QMap<quintptr, Node *> skipped_items;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
QString id;
|
||||
quintptr ptr = 0;
|
||||
@@ -262,13 +262,13 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
if (dependency_of_item) {
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
Node *node = NodeFactory::CreateFromID(id);
|
||||
Node *node = NodeFactory::create_from_id(id);
|
||||
if (!node) {
|
||||
qWarning()
|
||||
<< "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
if (project && node->IsItem() && ptr) {
|
||||
if (project && node->is_item() && ptr) {
|
||||
// If we're pasting an object into the same project, we should re-use the item
|
||||
// rather than duplicate.
|
||||
Node *existing =
|
||||
@@ -288,8 +288,8 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
if (node) {
|
||||
// Disable cache while node is being loaded (we'll re-enable it later)
|
||||
node->SetCachesEnabled(false);
|
||||
node->Load(reader, &project_data);
|
||||
node->set_caches_enabled(false);
|
||||
node->load(reader, &project_data);
|
||||
load_data.nodes.append(node);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
load_data.node_ptrs = project_data.node_ptrs;
|
||||
} else if (reader->name() == QStringLiteral("properties")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("node")) {
|
||||
quintptr ptr = 0;
|
||||
|
||||
@@ -314,7 +314,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
|
||||
if (ptr) {
|
||||
QMap<QString, QString> properties_for_node;
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
properties_for_node.insert(
|
||||
reader->name().toString(),
|
||||
reader->readElementText());
|
||||
@@ -354,7 +354,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
}
|
||||
}
|
||||
|
||||
PostConnect(load_data.nodes, &project_data);
|
||||
post_connect(load_data.nodes, &project_data);
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -365,7 +365,7 @@ ProjectSerializer230220::Load(Project *project, QXmlStreamReader *reader,
|
||||
return load_data;
|
||||
}
|
||||
|
||||
void WriteNodeMap(QXmlStreamWriter *writer, Node *node,
|
||||
void write_node_map(QXmlStreamWriter *writer, Node *node,
|
||||
const QVector<Node *> &nodes)
|
||||
{
|
||||
writer->writeStartElement(QStringLiteral("node"));
|
||||
@@ -375,23 +375,23 @@ void WriteNodeMap(QXmlStreamWriter *writer, Node *node,
|
||||
|
||||
for (auto oc : node->output_connections()) {
|
||||
if (nodes.contains(oc.second.node())) {
|
||||
WriteNodeMap(writer, oc.second.node(), nodes);
|
||||
write_node_map(writer, oc.second.node(), nodes);
|
||||
}
|
||||
}
|
||||
|
||||
writer->writeEndElement();
|
||||
}
|
||||
|
||||
void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
void ProjectSerializer230220::save(QXmlStreamWriter *writer,
|
||||
const SaveData &data, void *reserved) const
|
||||
{
|
||||
if (!data.GetOnlySerializeMarkers().empty()) {
|
||||
if (!data.get_only_serialize_markers().empty()) {
|
||||
writer->writeStartElement(QStringLiteral("markers"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("version"), QString::number(1));
|
||||
|
||||
for (auto it = data.GetOnlySerializeMarkers().cbegin();
|
||||
it != data.GetOnlySerializeMarkers().cend(); it++) {
|
||||
for (auto it = data.get_only_serialize_markers().cbegin();
|
||||
it != data.get_only_serialize_markers().cend(); it++) {
|
||||
TimelineMarker *marker = *it;
|
||||
writer->writeStartElement(QStringLiteral("marker"));
|
||||
marker->save(writer);
|
||||
@@ -399,7 +399,7 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // markers
|
||||
} else if (!data.GetOnlySerializeKeyframes().empty()) {
|
||||
} else if (!data.get_only_serialize_keyframes().empty()) {
|
||||
writer->writeStartElement(QStringLiteral("keyframes"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("version"), QString::number(1));
|
||||
@@ -409,8 +409,8 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
QHash<QString, QMap<int, QMap<int, QVector<NodeKeyframe *>>>>>
|
||||
organized;
|
||||
|
||||
for (auto it = data.GetOnlySerializeKeyframes().cbegin();
|
||||
it != data.GetOnlySerializeKeyframes().cend(); it++) {
|
||||
for (auto it = data.get_only_serialize_keyframes().cbegin();
|
||||
it != data.get_only_serialize_keyframes().cend(); it++) {
|
||||
NodeKeyframe *key = *it;
|
||||
organized[key->parent()->id()][key->input()][key->element()]
|
||||
[key->track()]
|
||||
@@ -445,7 +445,7 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
|
||||
for (NodeKeyframe *key : keys) {
|
||||
writer->writeStartElement(QStringLiteral("key"));
|
||||
key->save(writer, key->parent()->GetInputDataType(
|
||||
key->save(writer, key->parent()->get_input_data_type(
|
||||
key->input()));
|
||||
writer->writeEndElement(); // key
|
||||
}
|
||||
@@ -463,8 +463,8 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // keyframes
|
||||
} else if (!data.GetOnlySerializeNodes().empty()) {
|
||||
if (data.type() == kOnlyClips) {
|
||||
} else if (!data.get_only_serialize_nodes().empty()) {
|
||||
if (data.type() == k_only_clips) {
|
||||
writer->writeStartElement(QStringLiteral("timeline"));
|
||||
} else {
|
||||
writer->writeStartElement(QStringLiteral("nodes"));
|
||||
@@ -472,12 +472,12 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
|
||||
writer->writeAttribute(QStringLiteral("version"), QString::number(1));
|
||||
|
||||
for (Node *n : data.GetOnlySerializeNodes()) {
|
||||
for (Node *n : data.get_only_serialize_nodes()) {
|
||||
writer->writeStartElement(QStringLiteral("node"));
|
||||
|
||||
QStringList item_list;
|
||||
for (Node *i : data.GetOnlySerializeNodes()) {
|
||||
if (i->IsItem() && i->InputsFrom(n, true)) {
|
||||
for (Node *i : data.get_only_serialize_nodes()) {
|
||||
if (i->is_item() && i->inputs_from(n, true)) {
|
||||
item_list.append(
|
||||
QString::number(reinterpret_cast<quintptr>(i)));
|
||||
}
|
||||
@@ -487,14 +487,14 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
item_list.join(','));
|
||||
}
|
||||
|
||||
n->Save(writer);
|
||||
n->save(writer);
|
||||
writer->writeEndElement(); // node
|
||||
}
|
||||
|
||||
if (!data.GetProperties().empty()) {
|
||||
if (!data.get_properties().empty()) {
|
||||
writer->writeStartElement(QStringLiteral("properties"));
|
||||
for (auto it = data.GetProperties().cbegin();
|
||||
it != data.GetProperties().cend(); it++) {
|
||||
for (auto it = data.get_properties().cbegin();
|
||||
it != data.get_properties().cend(); it++) {
|
||||
writer->writeStartElement(QStringLiteral("node"));
|
||||
|
||||
writer->writeAttribute(
|
||||
@@ -512,15 +512,15 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
}
|
||||
|
||||
writer->writeEndElement(); // nodes
|
||||
} else if (Project *project = data.GetProject()) {
|
||||
} else if (Project *project = data.get_project()) {
|
||||
writer->writeStartElement(QStringLiteral("project"));
|
||||
|
||||
writer->writeStartElement(QStringLiteral("project"));
|
||||
project->Save(writer);
|
||||
project->save(writer);
|
||||
writer->writeEndElement(); // project
|
||||
|
||||
writer->writeStartElement(QStringLiteral("layout"));
|
||||
data.GetLayout().toXml(writer);
|
||||
data.get_layout().to_xml(writer);
|
||||
writer->writeEndElement(); // layout
|
||||
|
||||
writer->writeEndElement(); // project
|
||||
@@ -529,13 +529,13 @@ void ProjectSerializer230220::Save(QXmlStreamWriter *writer,
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer230220::PostConnect(const QVector<Node *> &nodes,
|
||||
void ProjectSerializer230220::post_connect(const QVector<Node *> &nodes,
|
||||
SerializedData *project_data) const
|
||||
{
|
||||
foreach (const SerializedData::SerializedConnection &con,
|
||||
project_data->desired_connections) {
|
||||
if (Node *out = project_data->node_ptrs.value(con.output_node)) {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
Node::connect_edge(out, con.input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ void ProjectSerializer230220::PostConnect(const QVector<Node *> &nodes,
|
||||
Node *a = l.block;
|
||||
Node *b = project_data->node_ptrs.value(l.link);
|
||||
|
||||
Node::Link(a, b);
|
||||
Node::link(a, b);
|
||||
}
|
||||
|
||||
for (auto it = nodes.cbegin(); it != nodes.cend(); it++) {
|
||||
@@ -551,7 +551,7 @@ void ProjectSerializer230220::PostConnect(const QVector<Node *> &nodes,
|
||||
|
||||
n->PostLoadEvent(project_data);
|
||||
|
||||
n->SetCachesEnabled(true);
|
||||
n->set_caches_enabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSERIALIZER230220_H
|
||||
#define PROJECTSERIALIZER230220_H
|
||||
#ifndef OAK_PROJECTSERIALIZER230220_H
|
||||
#define OAK_PROJECTSERIALIZER230220_H
|
||||
|
||||
#include "serializer.h"
|
||||
|
||||
@@ -32,22 +32,22 @@ public:
|
||||
ProjectSerializer230220() = default;
|
||||
|
||||
protected:
|
||||
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
|
||||
virtual LoadData load(Project *project, QXmlStreamReader *reader,
|
||||
LoadType load_type, void *reserved) const override;
|
||||
|
||||
virtual void Save(QXmlStreamWriter *writer, const SaveData &data,
|
||||
virtual void save(QXmlStreamWriter *writer, const SaveData &data,
|
||||
void *reserved) const override;
|
||||
|
||||
virtual uint Version() const override
|
||||
virtual uint version() const override
|
||||
{
|
||||
return 230220;
|
||||
}
|
||||
|
||||
private:
|
||||
void PostConnect(const QVector<Node *> &nodes,
|
||||
void post_connect(const QVector<Node *> &nodes,
|
||||
SerializedData *project_data) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTSERIALIZER230220_H
|
||||
#endif // OAK_PROJECTSERIALIZER230220_H
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
namespace olive
|
||||
{
|
||||
|
||||
AudioParams TypeSerializer::LoadAudioParams(QXmlStreamReader *reader)
|
||||
AudioParams TypeSerializer::load_audio_params(QXmlStreamReader *reader)
|
||||
{
|
||||
AudioParams a;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
while (xml_read_next_start_element(reader)) {
|
||||
if (reader->name() == QStringLiteral("samplerate")) {
|
||||
a.set_sample_rate(reader->readElementText().toInt());
|
||||
} else if (reader->name() == QStringLiteral("channellayout")) {
|
||||
@@ -44,7 +44,7 @@ AudioParams TypeSerializer::LoadAudioParams(QXmlStreamReader *reader)
|
||||
a.set_duration(reader->readElementText().toLongLong());
|
||||
} else if (reader->name() == QStringLiteral("timebase")) {
|
||||
a.set_time_base(
|
||||
rational::fromString(reader->readElementText().toStdString()));
|
||||
Rational::from_string(reader->readElementText().toStdString()));
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ AudioParams TypeSerializer::LoadAudioParams(QXmlStreamReader *reader)
|
||||
return a;
|
||||
}
|
||||
|
||||
void TypeSerializer::SaveAudioParams(QXmlStreamWriter *writer,
|
||||
void TypeSerializer::save_audio_params(QXmlStreamWriter *writer,
|
||||
const AudioParams &a)
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("samplerate"),
|
||||
@@ -69,7 +69,7 @@ void TypeSerializer::SaveAudioParams(QXmlStreamWriter *writer,
|
||||
writer->writeTextElement(QStringLiteral("duration"),
|
||||
QString::number(a.duration()));
|
||||
writer->writeTextElement(QStringLiteral("timebase"),
|
||||
QString::fromStdString(a.time_base().toString()));
|
||||
QString::fromStdString(a.time_base().to_string()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TYPESERIALIZER_H
|
||||
#define TYPESERIALIZER_H
|
||||
#ifndef OAK_TYPESERIALIZER_H
|
||||
#define OAK_TYPESERIALIZER_H
|
||||
|
||||
#include <olive/core/core.h>
|
||||
#include <QXmlStreamReader>
|
||||
@@ -37,10 +37,10 @@ class TypeSerializer {
|
||||
public:
|
||||
TypeSerializer() = default;
|
||||
|
||||
static AudioParams LoadAudioParams(QXmlStreamReader *reader);
|
||||
static void SaveAudioParams(QXmlStreamWriter *writer, const AudioParams &a);
|
||||
static AudioParams load_audio_params(QXmlStreamReader *reader);
|
||||
static void save_audio_params(QXmlStreamWriter *writer, const AudioParams &a);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TYPESERIALIZER_H
|
||||
#endif // OAK_TYPESERIALIZER_H
|
||||
|
||||
Reference in New Issue
Block a user