Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2021-11-11 12:30:47 +0300
committerYuSanka <yusanka@gmail.com>2021-11-11 12:31:12 +0300
commita0e6c7a076c2b63eb5027757a8d398a8715152b4 (patch)
tree139801038895ec7b6f36fda021cd5da3fda47c1c /src/slic3r/GUI/UpdateDialogs.cpp
parent117302ba22aa540cc020e1e5eb77422801627c29 (diff)
Follow up https://github.com/prusa3d/PrusaSlicer/commit/a3f6ce1ac6a37c10e078672215c93bc0d705cab0
Diffstat (limited to 'src/slic3r/GUI/UpdateDialogs.cpp')
-rw-r--r--src/slic3r/GUI/UpdateDialogs.cpp52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp
index 552ca43be..5f09ffe30 100644
--- a/src/slic3r/GUI/UpdateDialogs.cpp
+++ b/src/slic3r/GUI/UpdateDialogs.cpp
@@ -89,7 +89,7 @@ MsgUpdateConfig::MsgUpdateConfig(const std::vector<Update> &updates, bool force_
MsgDialog(nullptr, force_before_wizard ? _L("Opening Configuration Wizard") : _L("Configuration update"),
force_before_wizard ? _L("PrusaSlicer is not using the newest configuration available.\n"
"Configuration Wizard may not offer the latest printers, filaments and SLA materials to be installed. ") :
- _L("Configuration update is available"), wxID_NONE)
+ _L("Configuration update is available"), wxOK)
{
auto *text = new wxStaticText(this, wxID_ANY, _(L(
"Would you like to install it?\n\n"
@@ -133,22 +133,14 @@ MsgUpdateConfig::MsgUpdateConfig(const std::vector<Update> &updates, bool force_
content_sizer->Add(versions);
content_sizer->AddSpacer(2*VERT_SPACING);
- auto* btn_ok = new wxButton(this, wxID_OK, force_before_wizard ? _L("Install") : "OK");
- btn_sizer->Add(btn_ok);
- btn_sizer->AddSpacer(HORIZ_SPACING);
+ add_btn(wxID_OK, true, force_before_wizard ? _L("Install") : "OK");
if (force_before_wizard) {
- auto* btn_no_install = new wxButton(this, wxID_ANY, "Don't install");
- btn_no_install->Bind(wxEVT_BUTTON, [this](wxEvent&) { this->EndModal(wxID_CLOSE); });
- btn_sizer->Add(btn_no_install);
- btn_sizer->AddSpacer(HORIZ_SPACING);
+ add_btn(wxID_CLOSE, false, _L("Don't install"));
+ static_cast<wxButton*>(FindWindowById(wxID_CLOSE, this))->Bind(wxEVT_BUTTON, [this](const wxCommandEvent&) { this->EndModal(wxID_CLOSE); });
}
- auto* btn_cancel = new wxButton(this, wxID_CANCEL);
- btn_sizer->Add(btn_cancel);
- btn_ok->SetFocus();
+ add_btn(wxID_CANCEL);
- wxGetApp().UpdateDlgDarkUI(this);
-
- Fit();
+ finalize();
}
MsgUpdateConfig::~MsgUpdateConfig() {}
@@ -156,7 +148,7 @@ MsgUpdateConfig::~MsgUpdateConfig() {}
//MsgUpdateForced
MsgUpdateForced::MsgUpdateForced(const std::vector<Update>& updates) :
- MsgDialog(nullptr, wxString::Format(_(L("%s incompatibility")), SLIC3R_APP_NAME), _(L("You must install a configuration update.")) + " ", wxICON_ERROR)
+ MsgDialog(nullptr, wxString::Format(_(L("%s incompatibility")), SLIC3R_APP_NAME), _(L("You must install a configuration update.")) + " ", wxOK | wxICON_ERROR)
{
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"
@@ -197,17 +189,10 @@ MsgUpdateForced::MsgUpdateForced(const std::vector<Update>& updates) :
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);
+ add_btn(wxID_EXIT, false, wxString::Format(_L("Exit %s"), SLIC3R_APP_NAME));
+ for (auto ID : { wxID_EXIT, wxID_OK })
+ static_cast<wxButton*>(FindWindowById(ID, this))->Bind(wxEVT_BUTTON, [this](const wxCommandEvent& evt) { this->EndModal(evt.GetId()); });
finalize();
}
@@ -218,7 +203,7 @@ MsgUpdateForced::~MsgUpdateForced() {}
MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, wxString> &incompats) :
MsgDialog(nullptr, wxString::Format(_(L("%s incompatibility")), SLIC3R_APP_NAME),
- wxString::Format(_(L("%s configuration is incompatible")), SLIC3R_APP_NAME), /*wxID_NONE | */wxICON_ERROR)
+ wxString::Format(_(L("%s configuration is incompatible")), SLIC3R_APP_NAME), wxICON_ERROR)
{
auto *text = new wxStaticText(this, wxID_ANY, wxString::Format(_(L(
"This version of %s is not compatible with currently installed configuration bundles.\n"
@@ -251,16 +236,11 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w
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_reconf = new wxButton(this, wxID_REPLACE, _(L("Re-configure")));
- btn_sizer->Add(btn_reconf);
- btn_exit->SetFocus();
+ add_btn(wxID_REPLACE, true, _L("Re-configure"));
+ add_btn(wxID_EXIT, false, wxString::Format(_L("Exit %s"), SLIC3R_APP_NAME));
- auto exiter = [this](const wxCommandEvent& evt) { this->EndModal(evt.GetId()); };
- btn_exit->Bind(wxEVT_BUTTON, exiter);
- btn_reconf->Bind(wxEVT_BUTTON, exiter);
+ for (auto ID : {wxID_EXIT, wxID_REPLACE})
+ static_cast<wxButton*>(FindWindowById(ID, this))->Bind(wxEVT_BUTTON, [this](const wxCommandEvent& evt) { this->EndModal(evt.GetId()); });
finalize();
}
@@ -309,7 +289,7 @@ MsgDataLegacy::~MsgDataLegacy() {}
// MsgNoUpdate
MsgNoUpdates::MsgNoUpdates() :
- MsgDialog(nullptr, _(L("Configuration updates")), _(L("No updates available")), wxICON_ERROR)
+ MsgDialog(nullptr, _(L("Configuration updates")), _(L("No updates available")), wxICON_ERROR | wxOK)
{
auto* text = new wxStaticText(this, wxID_ANY, wxString::Format(