Merge branch 'master' of https://github.com/prusa3d/Slic3r into opengl_to_cpp

This commit is contained in:
Enrico Turri 2018-05-18 08:32:09 +02:00
commit d85fd5501c
4 changed files with 22 additions and 3 deletions

View File

@ -1933,7 +1933,10 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
"support_material_tool", "acceleration", "adjust_overhang_flow", "support_material_tool", "acceleration", "adjust_overhang_flow",
"standby_temperature", "scale", "rotate", "duplicate", "duplicate_grid", "standby_temperature", "scale", "rotate", "duplicate", "duplicate_grid",
"start_perimeters_at_concave_points", "start_perimeters_at_non_overhang", "randomize_start", "start_perimeters_at_concave_points", "start_perimeters_at_non_overhang", "randomize_start",
"seal_position", "vibration_limit", "bed_size", "octoprint_host", "seal_position", "vibration_limit", "bed_size",
// Maybe one day we will rename octoprint_host to print_host as it has been done in the upstream Slic3r.
// Commenting this out fixes github issue #869 for now.
// "octoprint_host",
"print_center", "g0", "threads", "pressure_advance", "wipe_tower_per_color_wipe" "print_center", "g0", "threads", "pressure_advance", "wipe_tower_per_color_wipe"
}; };

View File

@ -100,6 +100,7 @@ void AppConfig::load()
auto ini_ver = Semver::parse(get("version")); auto ini_ver = Semver::parse(get("version"));
m_legacy_datadir = false; m_legacy_datadir = false;
if (ini_ver) { if (ini_ver) {
m_orig_version = *ini_ver;
// Make 1.40.0 alphas compare well // Make 1.40.0 alphas compare well
ini_ver->set_metadata(boost::none); ini_ver->set_metadata(boost::none);
ini_ver->set_prerelease(boost::none); ini_ver->set_prerelease(boost::none);

View File

@ -13,7 +13,13 @@ namespace Slic3r {
class AppConfig class AppConfig
{ {
public: 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. // Clear and reset to defaults.
void reset(); void reset();
@ -95,11 +101,16 @@ public:
// Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating) // Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating)
bool legacy_datadir() const { return m_legacy_datadir; } bool legacy_datadir() const { return m_legacy_datadir; }
bool set_legacy_datadir(bool value) { m_legacy_datadir = value; }
// Get the Slic3r version check url. // Get the Slic3r version check url.
// This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file. // This returns a hardcoded string unless it is overriden by "version_check_url" in the ini file.
std::string version_check_url() const; 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? // Does the config file exist?
static bool exists(); static bool exists();
@ -110,6 +121,8 @@ private:
VendorMap m_vendors; VendorMap m_vendors;
// Has any value been modified since the config.ini has been last saved or loaded? // Has any value been modified since the config.ini has been last saved or loaded?
bool m_dirty; 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 // Whether the existing version is before system profiles & configuration updating
bool m_legacy_datadir; bool m_legacy_datadir;
}; };

View File

@ -835,7 +835,9 @@ bool ConfigWizard::run(PresetBundle *preset_bundle, const PresetUpdater *updater
{ {
BOOST_LOG_TRIVIAL(info) << "Running ConfigWizard, reason: " << p->run_reason; BOOST_LOG_TRIVIAL(info) << "Running ConfigWizard, reason: " << p->run_reason;
if (ShowModal() == wxID_OK) { if (ShowModal() == wxID_OK) {
p->apply_config(GUI::get_app_config(), preset_bundle, updater); auto *app_config = GUI::get_app_config();
p->apply_config(app_config, preset_bundle, updater);
app_config->set_legacy_datadir(false);
BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied"; BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied";
return true; return true;
} else { } else {