From e783e005787f5ed91da1a15e9a30e81923af965e Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Thu, 17 May 2018 16:19:40 +0200 Subject: [PATCH] AppConfig: Remember previous Slic3r version --- xs/src/slic3r/GUI/AppConfig.cpp | 1 + xs/src/slic3r/GUI/AppConfig.hpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/xs/src/slic3r/GUI/AppConfig.cpp b/xs/src/slic3r/GUI/AppConfig.cpp index 70f4ba110..c1c90fb72 100644 --- a/xs/src/slic3r/GUI/AppConfig.cpp +++ b/xs/src/slic3r/GUI/AppConfig.cpp @@ -100,6 +100,7 @@ void AppConfig::load() auto ini_ver = Semver::parse(get("version")); m_legacy_datadir = false; if (ini_ver) { + m_orig_version = *ini_ver; // Make 1.40.0 alphas compare well ini_ver->set_metadata(boost::none); ini_ver->set_prerelease(boost::none); diff --git a/xs/src/slic3r/GUI/AppConfig.hpp b/xs/src/slic3r/GUI/AppConfig.hpp index 16469f0e9..a9d8f9307 100644 --- a/xs/src/slic3r/GUI/AppConfig.hpp +++ b/xs/src/slic3r/GUI/AppConfig.hpp @@ -13,7 +13,13 @@ namespace Slic3r { class AppConfig { public: - AppConfig() : m_dirty(false), m_legacy_datadir(false) { this->reset(); } + AppConfig() : + m_dirty(false), + m_orig_version(Semver::invalid()), + m_legacy_datadir(false) + { + this->reset(); + } // Clear and reset to defaults. void reset(); @@ -100,6 +106,10 @@ public: // This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file. std::string version_check_url() const; + // Returns the original Slic3r version found in the ini file before it was overwritten + // by the current version + Semver orig_version() const { return m_orig_version; } + // Does the config file exist? static bool exists(); @@ -110,6 +120,8 @@ private: VendorMap m_vendors; // Has any value been modified since the config.ini has been last saved or loaded? bool m_dirty; + // Original version found in the ini file before it was overwritten + Semver m_orig_version; // Whether the existing version is before system profiles & configuration updating bool m_legacy_datadir; };