diff options
Diffstat (limited to 'src/slic3r/GUI/UpdateDialogs.cpp')
-rw-r--r-- | src/slic3r/GUI/UpdateDialogs.cpp | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp index d5c69be0b..b152ed135 100644 --- a/src/slic3r/GUI/UpdateDialogs.cpp +++ b/src/slic3r/GUI/UpdateDialogs.cpp @@ -142,6 +142,71 @@ MsgUpdateConfig::MsgUpdateConfig(const std::vector<Update> &updates) : MsgUpdateConfig::~MsgUpdateConfig() {} +//MsgUpdateForced + +MsgUpdateForced::MsgUpdateForced(const std::vector<Update>& updates) : + MsgDialog(nullptr, wxString::Format(_(L("%s incompatibility")), SLIC3R_APP_NAME), _(L("Configuration update is necessary to install")), wxID_NONE) +{ + auto* text = new wxStaticText(this, wxID_ANY, wxString::Format(_(L( + "%s will now start updates. Otherwise it won't be able to start.\n\n" + "Note that a full configuration snapshot will be created first. It can then be restored at any time " + "should there be a problem with the new version.\n\n" + "Updated configuration bundles:" + )), SLIC3R_APP_NAME)); + + logo->SetBitmap(create_scaled_bitmap("PrusaSlicer_192px_grayscale.png", this, 192)); + + text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit()); + content_sizer->Add(text); + content_sizer->AddSpacer(VERT_SPACING); + + const auto lang_code = wxGetApp().current_language_code_safe().ToStdString(); + + auto* versions = new wxBoxSizer(wxVERTICAL); + for (const auto& update : updates) { + auto* flex = new wxFlexGridSizer(2, 0, VERT_SPACING); + + auto* text_vendor = new wxStaticText(this, wxID_ANY, update.vendor); + text_vendor->SetFont(boldfont); + flex->Add(text_vendor); + flex->Add(new wxStaticText(this, wxID_ANY, update.version.to_string())); + + if (!update.comment.empty()) { + flex->Add(new wxStaticText(this, wxID_ANY, _(L("Comment:"))), 0, wxALIGN_RIGHT); + auto* update_comment = new wxStaticText(this, wxID_ANY, from_u8(update.comment)); + update_comment->Wrap(CONTENT_WIDTH * wxGetApp().em_unit()); + flex->Add(update_comment); + } + + versions->Add(flex); + + if (!update.changelog_url.empty() && update.version.prerelease() == nullptr) { + auto* line = new wxBoxSizer(wxHORIZONTAL); + auto changelog_url = (boost::format(update.changelog_url) % lang_code).str(); + line->AddSpacer(3 * VERT_SPACING); + line->Add(new wxHyperlinkCtrl(this, wxID_ANY, _(L("Open changelog page")), changelog_url)); + versions->Add(line); + } + } + + content_sizer->Add(versions); + content_sizer->AddSpacer(2 * VERT_SPACING); + + auto* btn_exit = new wxButton(this, wxID_EXIT, wxString::Format(_(L("Exit %s")), SLIC3R_APP_NAME)); + btn_sizer->Add(btn_exit); + btn_sizer->AddSpacer(HORIZ_SPACING); + auto* btn_ok = new wxButton(this, wxID_OK); + btn_sizer->Add(btn_ok); + btn_ok->SetFocus(); + + auto exiter = [this](const wxCommandEvent& evt) { this->EndModal(evt.GetId()); }; + btn_exit->Bind(wxEVT_BUTTON, exiter); + btn_ok->Bind(wxEVT_BUTTON, exiter); + + Fit(); +} + +MsgUpdateForced::~MsgUpdateForced() {} // MsgDataIncompatible @@ -157,7 +222,7 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w "You may either exit %s and try again with a newer version, or you may re-run the initial configuration. " "Doing so will create a backup snapshot of the existing configuration before installing files compatible with this %s.")) + "\n", - SLIC3R_APP_NAME, SLIC3R_APP_NAME, SLIC3R_APP_NAME, SLIC3R_APP_NAME)); + SLIC3R_APP_NAME, SLIC3R_APP_NAME, SLIC3R_APP_NAME, SLIC3R_APP_NAME)); text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit()); content_sizer->Add(text); @@ -236,5 +301,28 @@ MsgDataLegacy::MsgDataLegacy() : MsgDataLegacy::~MsgDataLegacy() {} +// MsgNoUpdate + +MsgNoUpdates::MsgNoUpdates() : + MsgDialog(nullptr, _(L("Configuration updates")), _(L("No updates aviable"))) +{ + + auto* text = new wxStaticText(this, wxID_ANY, wxString::Format( + _(L( + "%s has no configuration updates aviable." + )), + SLIC3R_APP_NAME, ConfigWizard::name() + )); + text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit()); + content_sizer->Add(text); + content_sizer->AddSpacer(VERT_SPACING); + + logo->SetBitmap(create_scaled_bitmap("PrusaSlicer_192px_grayscale.png", this, 192)); + + Fit(); +} + +MsgNoUpdates::~MsgNoUpdates() {} + } } |