From 3960f54e9cc65e0f2e7e17c9d3a770c5b9d1065f Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Thu, 6 Jan 2022 12:50:40 -0800 Subject: [PATCH] code: moved project version related variables to project class --- app/core.cpp | 1 - app/core.h | 2 -- app/node/nodecopypaste.cpp | 2 +- app/node/project/project.cpp | 6 ++++++ app/node/project/project.h | 3 +++ app/task/project/load/load.cpp | 6 +++--- app/task/project/save/save.cpp | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index 79aadb211..5d7c80009 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -75,7 +75,6 @@ namespace olive { Core* Core::instance_ = nullptr; -const uint Core::kProjectVersion = 211228; Core::Core(const CoreParams& params) : main_window_(nullptr), diff --git a/app/core.h b/app/core.h index 003e9e3f3..4779d34dc 100644 --- a/app/core.h +++ b/app/core.h @@ -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 diff --git a/app/node/nodecopypaste.cpp b/app/node/nodecopypaste.cpp index 190146472..a48f296cc 100644 --- a/app/node/nodecopypaste.cpp +++ b/app/node/nodecopypaste.cpp @@ -39,7 +39,7 @@ void NodeCopyPasteService::CopyNodesToClipboard(QVector 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 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; diff --git a/app/task/project/save/save.cpp b/app/task/project/save/save.cpp index 06c59a7b9..052552ce0 100644 --- a/app/task/project/save/save.cpp +++ b/app/task/project/save/save.cpp @@ -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);