diff options
author | Vojtech Kral <vojtech@kral.hk> | 2019-08-09 18:01:37 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2019-08-19 18:04:14 +0300 |
commit | 745182988d5edc06ef3d9c0ea1a2265a04d79a88 (patch) | |
tree | c24dabe4be88957374849bc6818188f90b77b909 /src/slic3r/Config | |
parent | b5dd13b9879eb1d149ed1c4f3f15fb10abd112a5 (diff) |
Refactor: Move Semver from slice3r to libslic3r
A static symbol Slic3r::SEMVER is introduced, which holds
the running slicer's Semver object.
This is mainly done to make testing updater behaviour
_much_ easier. Additionaly to cleanup some questionable code
(Semver was being parsed multiple times / in multiple places
in the frontend.)
Diffstat (limited to 'src/slic3r/Config')
-rw-r--r-- | src/slic3r/Config/Snapshot.cpp | 2 | ||||
-rw-r--r-- | src/slic3r/Config/Snapshot.hpp | 2 | ||||
-rw-r--r-- | src/slic3r/Config/Version.cpp | 3 | ||||
-rw-r--r-- | src/slic3r/Config/Version.hpp | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/src/slic3r/Config/Snapshot.cpp b/src/slic3r/Config/Snapshot.cpp index b208554b5..3757ec25b 100644 --- a/src/slic3r/Config/Snapshot.cpp +++ b/src/slic3r/Config/Snapshot.cpp @@ -366,7 +366,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot: // Snapshot header. snapshot.time_captured = Slic3r::Utils::get_current_time_utc(); snapshot.id = Slic3r::Utils::format_time_ISO8601Z(snapshot.time_captured); - snapshot.slic3r_version_captured = *Semver::parse(SLIC3R_VERSION); // XXX: have Semver Slic3r version + snapshot.slic3r_version_captured = Slic3r::SEMVER; snapshot.comment = comment; snapshot.reason = reason; // Active presets at the time of the snapshot. diff --git a/src/slic3r/Config/Snapshot.hpp b/src/slic3r/Config/Snapshot.hpp index a916dfe92..9a7391691 100644 --- a/src/slic3r/Config/Snapshot.hpp +++ b/src/slic3r/Config/Snapshot.hpp @@ -8,8 +8,8 @@ #include <boost/filesystem.hpp> +#include "libslic3r/Semver.hpp" #include "Version.hpp" -#include "../Utils/Semver.hpp" namespace Slic3r { diff --git a/src/slic3r/Config/Version.cpp b/src/slic3r/Config/Version.cpp index 865884c6f..175abff69 100644 --- a/src/slic3r/Config/Version.cpp +++ b/src/slic3r/Config/Version.cpp @@ -15,7 +15,6 @@ namespace Slic3r { namespace GUI { namespace Config { -static const Semver s_current_slic3r_semver(SLIC3R_VERSION); // Optimized lexicographic compare of two pre-release versions, ignoring the numeric suffix. static int compare_prerelease(const char *p1, const char *p2) @@ -64,7 +63,7 @@ bool Version::is_slic3r_supported(const Semver &slic3r_version) const bool Version::is_current_slic3r_supported() const { - return this->is_slic3r_supported(s_current_slic3r_semver); + return this->is_slic3r_supported(Slic3r::SEMVER); } #if 0 diff --git a/src/slic3r/Config/Version.hpp b/src/slic3r/Config/Version.hpp index 560bc29c2..19c565ffb 100644 --- a/src/slic3r/Config/Version.hpp +++ b/src/slic3r/Config/Version.hpp @@ -7,7 +7,7 @@ #include <boost/filesystem.hpp> #include "libslic3r/FileParserError.hpp" -#include "../Utils/Semver.hpp" +#include "libslic3r/Semver.hpp" namespace Slic3r { namespace GUI { |