project: remove ProjectSettings
This commit is contained in:
+11
-14
@@ -56,11 +56,6 @@ Project::Project() :
|
||||
color_manager_->setParent(this);
|
||||
AddDefaultNode(color_manager_);
|
||||
|
||||
// Same with project settings
|
||||
settings_ = new ProjectSettingsNode();
|
||||
settings_->setParent(this);
|
||||
AddDefaultNode(settings_);
|
||||
|
||||
connect(color_manager(), &ColorManager::ValueChanged,
|
||||
this, &Project::ColorManagerValueChanged);
|
||||
}
|
||||
@@ -125,8 +120,6 @@ SerializedData Project::Load(QXmlStreamReader *reader)
|
||||
node = this->root();
|
||||
} else if (is_cm) {
|
||||
node = this->color_manager();
|
||||
} else if (is_settings) {
|
||||
node = this->settings();
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
@@ -174,8 +167,6 @@ void Project::Save(QXmlStreamWriter *writer) const
|
||||
writer->writeAttribute(QStringLiteral("root"), QStringLiteral("1"));
|
||||
} else if (node == this->color_manager()) {
|
||||
writer->writeAttribute(QStringLiteral("cm"), QStringLiteral("1"));
|
||||
} else if (node == this->settings()) {
|
||||
writer->writeAttribute(QStringLiteral("settings"), QStringLiteral("1"));
|
||||
}
|
||||
|
||||
node->Save(writer);
|
||||
@@ -337,20 +328,20 @@ QString Project::get_cache_alongside_project_path() const
|
||||
|
||||
QString Project::cache_path() const
|
||||
{
|
||||
ProjectSettingsNode::CacheSetting setting = settings_->GetCacheSetting();
|
||||
CacheSetting setting = GetCacheLocationSetting();
|
||||
|
||||
switch (setting) {
|
||||
case ProjectSettingsNode::kCacheUseDefaultLocation:
|
||||
case kCacheUseDefaultLocation:
|
||||
break;
|
||||
case ProjectSettingsNode::kCacheCustomPath:
|
||||
case kCacheCustomPath:
|
||||
{
|
||||
QString cache_path = settings_->GetCustomCachePath();
|
||||
QString cache_path = GetCustomCachePath();
|
||||
if (cache_path.isEmpty()) {
|
||||
return cache_path;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectSettingsNode::kCacheStoreAlongsideProject:
|
||||
case kCacheStoreAlongsideProject:
|
||||
{
|
||||
QString alongside = get_cache_alongside_project_path();
|
||||
if (!alongside.isEmpty()) {
|
||||
@@ -373,6 +364,12 @@ Project *Project::GetProjectFromObject(const QObject *o)
|
||||
return QtUtils::GetParentOfType<Project>(o);
|
||||
}
|
||||
|
||||
void Project::SetSetting(const QString &key, const QString &value)
|
||||
{
|
||||
settings_.insert(key, value);
|
||||
emit SettingChanged(key, value);
|
||||
}
|
||||
|
||||
void Project::ColorManagerValueChanged(const NodeInput &input, const TimeRange &range)
|
||||
{
|
||||
Q_UNUSED(input)
|
||||
|
||||
+21
-4
@@ -28,7 +28,6 @@
|
||||
#include "node/color/colormanager/colormanager.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "node/project/footage/footage.h"
|
||||
#include "node/project/projectsettings/projectsettings.h"
|
||||
#include "window/mainwindow/mainwindowlayoutinfo.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -48,6 +47,12 @@ class Project : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum CacheSetting {
|
||||
kCacheUseDefaultLocation,
|
||||
kCacheStoreAlongsideProject,
|
||||
kCacheCustomPath
|
||||
};
|
||||
|
||||
Project();
|
||||
|
||||
virtual ~Project() override;
|
||||
@@ -83,7 +88,6 @@ public:
|
||||
|
||||
Folder* root() const { return root_; }
|
||||
ColorManager* color_manager() const { return color_manager_; }
|
||||
ProjectSettingsNode* settings() const { return settings_; }
|
||||
|
||||
bool is_modified() const { return is_modified_; }
|
||||
void set_modified(bool e);
|
||||
@@ -131,8 +135,19 @@ public:
|
||||
*/
|
||||
static Project *GetProjectFromObject(const QObject *o);
|
||||
|
||||
static void CopySettings(Project *from, Project *to) { to->settings_ = from->settings_; }
|
||||
|
||||
static const QString kItemMimeType;
|
||||
|
||||
QString GetSetting(const QString &key) const { return settings_.value(key); }
|
||||
void SetSetting(const QString &key, const QString &value);
|
||||
|
||||
CacheSetting GetCacheLocationSetting() const { return static_cast<CacheSetting>(GetSetting(QStringLiteral("cachesetting")).toInt()); }
|
||||
void SetCacheLocationSetting(CacheSetting s) { SetSetting(QStringLiteral("cachesetting"), QString::number(s)); }
|
||||
|
||||
QString GetCustomCachePath() const { return GetSetting(QStringLiteral("customcachepath")); }
|
||||
void SetCustomCachePath(const QString &path) { SetSetting(QStringLiteral("customcachepath"), path); }
|
||||
|
||||
signals:
|
||||
void NameChanged();
|
||||
|
||||
@@ -162,6 +177,8 @@ signals:
|
||||
|
||||
void GroupChangedOutputPassthrough(NodeGroup *group, Node *output);
|
||||
|
||||
void SettingChanged(const QString &key, const QString &value);
|
||||
|
||||
protected:
|
||||
void AddDefaultNode(Node* n)
|
||||
{
|
||||
@@ -181,8 +198,6 @@ private:
|
||||
|
||||
ColorManager* color_manager_;
|
||||
|
||||
ProjectSettingsNode* settings_;
|
||||
|
||||
bool is_modified_;
|
||||
|
||||
bool autorecovery_saved_;
|
||||
@@ -191,6 +206,8 @@ private:
|
||||
|
||||
QVector<Node*> default_nodes_;
|
||||
|
||||
QMap<QString, QString> settings_;
|
||||
|
||||
private slots:
|
||||
void ColorManagerValueChanged(const NodeInput& input, const TimeRange& range);
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
add_subdirectory(folder)
|
||||
add_subdirectory(footage)
|
||||
add_subdirectory(projectsettings)
|
||||
add_subdirectory(sequence)
|
||||
add_subdirectory(serializer)
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2022 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
node/project/projectsettings/projectsettings.cpp
|
||||
node/project/projectsettings/projectsettings.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -1,64 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2022 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "projectsettings.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
const QString ProjectSettingsNode::kCacheSetting = QStringLiteral("cache_setting");
|
||||
const QString ProjectSettingsNode::kCachePath = QStringLiteral("cache_path");
|
||||
|
||||
#define super Node
|
||||
|
||||
ProjectSettingsNode::ProjectSettingsNode()
|
||||
{
|
||||
AddInput(kCacheSetting, NodeValue::kCombo, 0, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
|
||||
AddInput(kCachePath, NodeValue::kFile, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||
SetInputProperty(kCachePath, QStringLiteral("directory"), true);
|
||||
UpdateCachePathEnabled();
|
||||
}
|
||||
|
||||
void ProjectSettingsNode::Retranslate()
|
||||
{
|
||||
super::Retranslate();
|
||||
|
||||
SetInputName(kCacheSetting, tr("Disk Cache Location"));
|
||||
SetInputName(kCachePath, tr("Disk Cache Path"));
|
||||
SetComboBoxStrings(kCacheSetting, {tr("Use Default Location"), tr("Store Alongside Project"), tr("Use Custom Location")});
|
||||
SetInputProperty(kCachePath, QStringLiteral("placeholder"), tr("(default)"));
|
||||
}
|
||||
|
||||
void ProjectSettingsNode::InputValueChangedEvent(const QString &input, int element)
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
if (input == kCacheSetting) {
|
||||
UpdateCachePathEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsNode::UpdateCachePathEnabled()
|
||||
{
|
||||
CacheSetting setting = GetCacheSetting();
|
||||
SetInputProperty(kCachePath, QStringLiteral("enabled"), (setting == kCacheCustomPath));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2022 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PROJECTSETTINGSNODE_H
|
||||
#define PROJECTSETTINGSNODE_H
|
||||
|
||||
#include "node/node.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ProjectSettingsNode : public Node
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectSettingsNode();
|
||||
|
||||
NODE_DEFAULT_FUNCTIONS(ProjectSettingsNode)
|
||||
|
||||
virtual QString Name() const override
|
||||
{
|
||||
return tr("Project Settings");
|
||||
}
|
||||
|
||||
virtual QString id() const override
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.projectsettings");
|
||||
}
|
||||
|
||||
virtual QVector<CategoryID> Category() const override
|
||||
{
|
||||
return {kCategoryProject};
|
||||
}
|
||||
|
||||
virtual QString Description() const override
|
||||
{
|
||||
return tr("Settings used throughout the project.");
|
||||
}
|
||||
|
||||
enum CacheSetting {
|
||||
kCacheUseDefaultLocation,
|
||||
kCacheStoreAlongsideProject,
|
||||
kCacheCustomPath
|
||||
};
|
||||
|
||||
static const QString kCacheSetting;
|
||||
static const QString kCachePath;
|
||||
|
||||
virtual void Retranslate() override;
|
||||
|
||||
CacheSetting GetCacheSetting() const
|
||||
{
|
||||
return static_cast<CacheSetting>(GetStandardValue(kCacheSetting).toInt());
|
||||
}
|
||||
|
||||
QString GetCustomCachePath() const
|
||||
{
|
||||
return GetStandardValue(kCachePath).toString();
|
||||
}
|
||||
|
||||
void SetCustomCachePath(const QString& s)
|
||||
{
|
||||
SetStandardValue(kCachePath, s);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void InputValueChangedEvent(const QString &input, int element) override;
|
||||
|
||||
private:
|
||||
void UpdateCachePathEnabled();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTSETTINGSNODE_H
|
||||
@@ -63,23 +63,27 @@ ProjectSerializer210528::LoadData ProjectSerializer210528::Load(Project *project
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
Node* node;
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
node = project->color_manager();
|
||||
} else if (is_settings) {
|
||||
node = project->settings();
|
||||
LoadProjectSettings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
if (!handled_elsewhere) {
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -253,6 +257,54 @@ void ProjectSerializer210528::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadProjectSettings(QXmlStreamReader *reader, Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
id = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting") || id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210528::LoadInput(Node *node, QXmlStreamReader *reader, XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
|
||||
@@ -68,6 +68,8 @@ private:
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const;
|
||||
|
||||
@@ -63,23 +63,27 @@ ProjectSerializer210907::LoadData ProjectSerializer210907::Load(Project *project
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
Node* node;
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
node = project->color_manager();
|
||||
} else if (is_settings) {
|
||||
node = project->settings();
|
||||
LoadProjectSettings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
if (!handled_elsewhere) {
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -250,6 +254,54 @@ void ProjectSerializer210907::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadProjectSettings(QXmlStreamReader *reader, Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
id = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting") || id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer210907::LoadInput(Node *node, QXmlStreamReader *reader, XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
|
||||
@@ -67,6 +67,8 @@ private:
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const;
|
||||
|
||||
@@ -65,23 +65,27 @@ ProjectSerializer211228::LoadData ProjectSerializer211228::Load(Project *project
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
Node* node;
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
node = project->color_manager();
|
||||
} else if (is_settings) {
|
||||
node = project->settings();
|
||||
LoadProjectSettings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
if (!handled_elsewhere) {
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -300,6 +304,54 @@ void ProjectSerializer211228::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadProjectSettings(QXmlStreamReader *reader, Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
id = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting") || id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer211228::LoadInput(Node *node, QXmlStreamReader *reader, XMLNodeData &xml_node_data) const
|
||||
{
|
||||
QString param_id;
|
||||
|
||||
@@ -68,6 +68,8 @@ private:
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const;
|
||||
|
||||
@@ -84,30 +84,26 @@ ProjectSerializer220403::LoadData ProjectSerializer220403::Load(Project *project
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
Node* node;
|
||||
bool handled_elsewhere = false;
|
||||
|
||||
if (is_root) {
|
||||
node = project->root();
|
||||
} else if (is_cm) {
|
||||
node = project->color_manager();
|
||||
} else if (is_settings) {
|
||||
node = project->settings();
|
||||
LoadProjectSettings(reader, project);
|
||||
handled_elsewhere = true;
|
||||
} else {
|
||||
node = NodeFactory::CreateFromID(id);
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
// Disable cache while node is being loaded (we'll re-enable it later)
|
||||
node->SetCachesEnabled(false);
|
||||
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
|
||||
if (project) {
|
||||
node->setParent(project);
|
||||
if (!handled_elsewhere) {
|
||||
if (!node) {
|
||||
qWarning() << "Failed to find node with ID" << id;
|
||||
reader->skipCurrentElement();
|
||||
} else {
|
||||
load_data.nodes.append(node);
|
||||
LoadNode(node, xml_node_data, reader);
|
||||
node->setParent(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,6 +452,54 @@ void ProjectSerializer220403::LoadNode(Node *node, XMLNodeData &xml_node_data, Q
|
||||
node->LoadFinishedEvent();
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadProjectSettings(QXmlStreamReader *reader, Project *project) const
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("input")) {
|
||||
QString id;
|
||||
XMLAttributeLoop(reader, attr) {
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
id = attr.value().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting") || id == QStringLiteral("cache_path")) {
|
||||
QString value;
|
||||
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("primary")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("standard")) {
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("track")) {
|
||||
value = reader->readElementText();
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (id == QStringLiteral("cache_setting")) {
|
||||
project->SetCacheLocationSetting(static_cast<Project::CacheSetting>(value.toInt()));
|
||||
} else {
|
||||
project->SetCustomCachePath(value);
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
} else {
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSerializer220403::LoadInput(Node *node, QXmlStreamReader *reader, XMLNodeData &xml_node_data) const
|
||||
{
|
||||
if (dynamic_cast<NodeGroup*>(node)) {
|
||||
|
||||
@@ -74,6 +74,8 @@ private:
|
||||
|
||||
void LoadNode(Node *node, XMLNodeData &xml_node_data, QXmlStreamReader *reader) const;
|
||||
|
||||
void LoadProjectSettings(QXmlStreamReader* reader, Project *project) const;
|
||||
|
||||
void LoadInput(Node *node, QXmlStreamReader* reader, XMLNodeData &xml_node_data) const;
|
||||
|
||||
void LoadImmediate(QXmlStreamReader *reader, Node *node, const QString& input, int element, XMLNodeData& xml_node_data) const;
|
||||
|
||||
Reference in New Issue
Block a user