From 6d38943222d45415316e102c14119c837bef499c Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 27 Apr 2018 12:29:18 +0200 Subject: [PATCH] Fix & refactor legacy datadir dialog --- xs/src/slic3r/GUI/GUI.cpp | 21 +++---------------- xs/src/slic3r/GUI/UpdateDialogs.cpp | 32 +++++++++++++++++++++++++++++ xs/src/slic3r/GUI/UpdateDialogs.hpp | 12 +++++++++++ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp index 42a931033..6bac39bd7 100644 --- a/xs/src/slic3r/GUI/GUI.cpp +++ b/xs/src/slic3r/GUI/GUI.cpp @@ -53,6 +53,7 @@ #include "ConfigWizard.hpp" #include "Preferences.hpp" #include "PresetBundle.hpp" +#include "UpdateDialogs.hpp" #include "../Utils/PresetUpdater.hpp" #include "../Config/Snapshot.hpp" @@ -480,24 +481,8 @@ bool config_wizard_startup(bool app_config_exists) // Looks like user has legacy pre-vendorbundle data directory, // explain what this is and run the wizard - const auto msg = _(L("Configuration update")); - const auto ext_msg = wxString::Format( - _(L( - "Slic3r PE now uses an updated configuration structure.\n\n" - - "So called 'System presets' have been introduced, which hold the built-in default settings for various " - "printers. These System presets cannot be modified, instead, users now may create their" - "own presets inheriting settings from one of the System presets.\n" - "An inheriting preset may either inherit a particular value from its parent or override it with a customized value.\n\n" - - "Please proceed with the %s that follows to set up the new presets " - "and to choose whether to enable automatic preset updates." - )), - ConfigWizard::name() - ); - wxMessageDialog dlg(NULL, msg, _(L("Configuration update")), wxOK|wxCENTRE); - dlg.SetExtendedMessage(ext_msg); - const auto res = dlg.ShowModal(); + MsgDataLegacy dlg; + dlg.ShowModal(); config_wizard(ConfigWizard::RR_DATA_LEGACY); return true; diff --git a/xs/src/slic3r/GUI/UpdateDialogs.cpp b/xs/src/slic3r/GUI/UpdateDialogs.cpp index e11ecdf5e..62534e598 100644 --- a/xs/src/slic3r/GUI/UpdateDialogs.cpp +++ b/xs/src/slic3r/GUI/UpdateDialogs.cpp @@ -12,6 +12,7 @@ #include "libslic3r/libslic3r.h" #include "libslic3r/Utils.hpp" #include "GUI.hpp" +#include "ConfigWizard.hpp" namespace Slic3r { namespace GUI { @@ -201,5 +202,36 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_mapWrap(CONTENT_WIDTH); + content_sizer->Add(text); + content_sizer->AddSpacer(VERT_SPACING); + + // TODO: Add link to wiki? + + Fit(); +} + +MsgDataLegacy::~MsgDataLegacy() {} + + } } diff --git a/xs/src/slic3r/GUI/UpdateDialogs.hpp b/xs/src/slic3r/GUI/UpdateDialogs.hpp index f12fd3333..e339fbe0d 100644 --- a/xs/src/slic3r/GUI/UpdateDialogs.hpp +++ b/xs/src/slic3r/GUI/UpdateDialogs.hpp @@ -85,6 +85,18 @@ public: ~MsgDataIncompatible(); }; +// Informs about a legacy data directory - an update from Slic3r PE < 1.40 +class MsgDataLegacy : public MsgDialog +{ +public: + MsgDataLegacy(); + MsgDataLegacy(MsgDataLegacy &&) = delete; + MsgDataLegacy(const MsgDataLegacy &) = delete; + MsgDataLegacy &operator=(MsgDataLegacy &&) = delete; + MsgDataLegacy &operator=(const MsgDataLegacy &) = delete; + ~MsgDataLegacy(); +}; + } }