code: moved project version related variables to project class
This commit is contained in:
@@ -75,7 +75,6 @@
|
||||
namespace olive {
|
||||
|
||||
Core* Core::instance_ = nullptr;
|
||||
const uint Core::kProjectVersion = 211228;
|
||||
|
||||
Core::Core(const CoreParams& params) :
|
||||
main_window_(nullptr),
|
||||
|
||||
@@ -316,8 +316,6 @@ public:
|
||||
|
||||
void OpenNodeInViewer(ViewerOutput* viewer);
|
||||
|
||||
static const uint kProjectVersion;
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Starts an open file dialog to load a project from file
|
||||
|
||||
@@ -39,7 +39,7 @@ void NodeCopyPasteService::CopyNodesToClipboard(QVector<Node *> nodes, void *use
|
||||
writer.writeStartDocument();
|
||||
writer.writeStartElement(QStringLiteral("olive"));
|
||||
|
||||
writer.writeTextElement(QStringLiteral("version"), QString::number(Core::kProjectVersion));
|
||||
writer.writeTextElement(QStringLiteral("version"), QString::number(Project::kProjectVersion));
|
||||
|
||||
writer.writeStartElement(QStringLiteral("nodes"));
|
||||
for (int i=0; i<nodes.size(); i++) {
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
// This is the project version that Olive will save
|
||||
const uint Project::kProjectVersion = 211228;
|
||||
|
||||
// This is the minimum project version that Olive can load
|
||||
const uint Project::kProjectMinimumVersion = 210528;
|
||||
|
||||
Project::Project() :
|
||||
is_modified_(false),
|
||||
autorecovery_saved_(true)
|
||||
|
||||
@@ -85,6 +85,9 @@ public:
|
||||
static bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos);
|
||||
static void SavePosition(QXmlStreamWriter *writer, Node *node, const Node::Position &pos);
|
||||
|
||||
static const uint kProjectVersion;
|
||||
static const uint kProjectMinimumVersion;
|
||||
|
||||
signals:
|
||||
void NameChanged();
|
||||
|
||||
|
||||
@@ -54,11 +54,11 @@ bool ProjectLoadTask::Run()
|
||||
if (!ok) {
|
||||
SetError(tr("Failed to parse project version."));
|
||||
return false;
|
||||
} else if (project_version > Core::kProjectVersion) {
|
||||
} else if (project_version > Project::kProjectVersion) {
|
||||
// Project is newer than we support
|
||||
SetError(tr("This project is newer than this version of Olive and cannot be opened."));
|
||||
SetError(tr("This project is from a newer version of Olive and cannot be opened in this version."));
|
||||
return false;
|
||||
} else if (project_version < 210528) { // Change this if we drop support for a project version
|
||||
} else if (project_version < Project::kProjectMinimumVersion) { // Change this if we drop support for a project version
|
||||
// Project is older than we support
|
||||
SetError(tr("This project is from a version of Olive that is no longer supported in this version."));
|
||||
return false;
|
||||
|
||||
@@ -54,7 +54,7 @@ bool ProjectSaveTask::Run()
|
||||
|
||||
// Version is stored in YYMMDD from whenever the project format was last changed
|
||||
// Allows easy integer math for checking project versions.
|
||||
writer.writeTextElement(QStringLiteral("version"), QString::number(Core::kProjectVersion));
|
||||
writer.writeTextElement(QStringLiteral("version"), QString::number(Project::kProjectVersion));
|
||||
|
||||
writer.writeTextElement("url", using_filename);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user