AppConfig: Remember previous Slic3r version

This commit is contained in:
Vojtech Kral 2018-05-17 16:19:40 +02:00
parent 9b4afb77d1
commit e783e00578
2 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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;
};