change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+179 -109
View File
@@ -27,7 +27,8 @@
#include "node/project.h"
#include "typeserializer.h"
namespace olive {
namespace olive
{
/**
* @brief An abstract base class for serializing/deserializing project data
@@ -35,167 +36,236 @@ namespace olive {
* The goal of this is to further abstract serialized project data from their
* in-memory representations.
*/
class ProjectSerializer
{
class ProjectSerializer {
public:
enum LoadType
{
kProject,
kOnlyNodes,
kOnlyClips,
kOnlyMarkers,
kOnlyKeyframes
};
enum LoadType {
kProject,
kOnlyNodes,
kOnlyClips,
kOnlyMarkers,
kOnlyKeyframes
};
ProjectSerializer() = default;
ProjectSerializer() = default;
virtual ~ProjectSerializer(){}
virtual ~ProjectSerializer()
{
}
DISABLE_COPY_MOVE(ProjectSerializer)
DISABLE_COPY_MOVE(ProjectSerializer)
enum ResultCode {
kSuccess,
kProjectTooOld,
kProjectTooNew,
kUnknownVersion,
kFileError,
kXmlError,
kOverwriteError,
kNoData
};
enum ResultCode {
kSuccess,
kProjectTooOld,
kProjectTooNew,
kUnknownVersion,
kFileError,
kXmlError,
kOverwriteError,
kNoData
};
using SerializedProperties = QHash<Node*, QMap<QString, QString> >;
using SerializedKeyframes = QHash<QString, QVector<NodeKeyframe*> >;
using SerializedProperties = QHash<Node *, QMap<QString, QString>>;
using SerializedKeyframes = QHash<QString, QVector<NodeKeyframe *>>;
class LoadData
{
public:
LoadData() = default;
class LoadData {
public:
LoadData() = default;
SerializedProperties properties;
SerializedProperties properties;
std::vector<TimelineMarker*> markers;
std::vector<TimelineMarker *> markers;
SerializedKeyframes keyframes;
SerializedKeyframes keyframes;
MainWindowLayoutInfo layout;
MainWindowLayoutInfo layout;
QVector<Node*> nodes;
QVector<Node *> nodes;
Node::OutputConnections promised_connections;
Node::OutputConnections promised_connections;
};
};
class Result {
public:
Result(const ResultCode &code)
: code_(code)
{
}
class Result
{
public:
Result(const ResultCode &code) :
code_(code)
{}
bool operator==(const ResultCode &code)
{
return code_ == code;
}
bool operator!=(const ResultCode &code)
{
return code_ != code;
}
bool operator==(const ResultCode &code) { return code_ == code; }
bool operator!=(const ResultCode &code) { return code_ != code; }
const ResultCode &code() const
{
return code_;
}
const ResultCode &code() const { return code_; }
const QString &GetDetails() const
{
return details_;
}
const QString &GetDetails() const { return details_; }
void SetDetails(const QString &s)
{
details_ = s;
}
void SetDetails(const QString &s) { details_ = s; }
const LoadData &GetLoadData() const
{
return load_data_;
}
const LoadData &GetLoadData() const { return load_data_; }
void SetLoadData(const LoadData &p)
{
load_data_ = p;
}
void SetLoadData(const LoadData &p) { load_data_ = p; }
private:
ResultCode code_;
private:
ResultCode code_;
QString details_;
QString details_;
LoadData load_data_;
};
LoadData load_data_;
class SaveData {
public:
SaveData(LoadType type, Project *project = nullptr,
const QString &filename = QString())
{
type_ = type;
project_ = project;
filename_ = filename;
}
};
Project *GetProject() const
{
return project_;
}
void SetProject(Project *p)
{
project_ = p;
}
class SaveData
{
public:
SaveData(LoadType type, Project *project = nullptr, const QString &filename = QString())
{
type_ = type;
project_ = project;
filename_ = filename;
}
const QString &GetFilename() const
{
return filename_;
}
void SetFilename(const QString &s)
{
filename_ = s;
}
Project *GetProject() const { return project_; }
void SetProject(Project *p) { project_ = p; }
LoadType type() const
{
return type_;
}
const QString &GetFilename() const { return filename_; }
void SetFilename(const QString &s) { filename_ = s; }
const MainWindowLayoutInfo &GetLayout() const
{
return layout_;
}
void SetLayout(const MainWindowLayoutInfo &layout)
{
layout_ = layout;
}
LoadType type() const { return type_; }
const QVector<Node *> &GetOnlySerializeNodes() const
{
return only_serialize_nodes_;
}
void SetOnlySerializeNodes(const QVector<Node *> &only)
{
only_serialize_nodes_ = only;
}
void SetOnlySerializeNodesAndResolveGroups(QVector<Node *> only);
const MainWindowLayoutInfo &GetLayout() const { return layout_; }
void SetLayout(const MainWindowLayoutInfo &layout) { layout_ = layout; }
const std::vector<TimelineMarker *> &GetOnlySerializeMarkers() const
{
return only_serialize_markers_;
}
void SetOnlySerializeMarkers(const std::vector<TimelineMarker *> &only)
{
only_serialize_markers_ = only;
}
const QVector<Node*> &GetOnlySerializeNodes() const { return only_serialize_nodes_; }
void SetOnlySerializeNodes(const QVector<Node*> &only) { only_serialize_nodes_ = only; }
void SetOnlySerializeNodesAndResolveGroups(QVector<Node*> only);
const std::vector<NodeKeyframe *> &GetOnlySerializeKeyframes() const
{
return only_serialize_keyframes_;
}
void SetOnlySerializeKeyframes(const std::vector<NodeKeyframe *> &only)
{
only_serialize_keyframes_ = only;
}
const std::vector<TimelineMarker*> &GetOnlySerializeMarkers() const { return only_serialize_markers_; }
void SetOnlySerializeMarkers(const std::vector<TimelineMarker*> &only) { only_serialize_markers_ = only; }
const SerializedProperties &GetProperties() const
{
return properties_;
}
void SetProperties(const SerializedProperties &p)
{
properties_ = p;
}
const std::vector<NodeKeyframe*> &GetOnlySerializeKeyframes() const { return only_serialize_keyframes_; }
void SetOnlySerializeKeyframes(const std::vector<NodeKeyframe*> &only) { only_serialize_keyframes_ = only; }
private:
LoadType type_;
const SerializedProperties &GetProperties() const { return properties_; }
void SetProperties(const SerializedProperties &p) { properties_ = p; }
Project *project_;
private:
LoadType type_;
QString filename_;
Project *project_;
MainWindowLayoutInfo layout_;
QString filename_;
QVector<Node *> only_serialize_nodes_;
MainWindowLayoutInfo layout_;
SerializedProperties properties_;
QVector<Node*> only_serialize_nodes_;
std::vector<TimelineMarker *> only_serialize_markers_;
SerializedProperties properties_;
std::vector<NodeKeyframe *> only_serialize_keyframes_;
};
std::vector<TimelineMarker*> only_serialize_markers_;
static void Initialize();
std::vector<NodeKeyframe*> only_serialize_keyframes_;
static void Destroy();
};
static Result Load(Project *project, const QString &filename,
LoadType load_type);
static Result Load(Project *project, QXmlStreamReader *read_device,
LoadType load_type);
static Result Paste(LoadType load_type, Project *project = nullptr);
static void Initialize();
static Result Save(const SaveData &data, bool compress);
static Result Save(QXmlStreamWriter *write_device, const SaveData &data);
static Result Copy(const SaveData &data);
static void Destroy();
static Result Load(Project *project, const QString &filename, LoadType load_type);
static Result Load(Project *project, QXmlStreamReader *read_device, LoadType load_type);
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 bool CheckCompressedID(QFile *file);
static bool CheckCompressedID(QFile *file);
protected:
virtual LoadData Load(Project *project, QXmlStreamReader *reader, LoadType load_type, void *reserved) const = 0;
virtual LoadData Load(Project *project, QXmlStreamReader *reader,
LoadType load_type, void *reserved) const = 0;
virtual void Save(QXmlStreamWriter *writer, const SaveData &data, void *reserved) const {}
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 IsCancelled() const;
private:
static Result LoadWithSerializerVersion(uint version, Project *project, QXmlStreamReader *reader, LoadType load_type);
static QVector<ProjectSerializer*> instances_;
static Result LoadWithSerializerVersion(uint version, Project *project,
QXmlStreamReader *reader,
LoadType load_type);
static QVector<ProjectSerializer *> instances_;
};
}