mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
ENH: support to skip current version in upgrading dialog
Change-Id: Iedcf595b146017fa26827900b446fd8782938341 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
4e1caa428d
commit
fbd6af069d
5 changed files with 87 additions and 42 deletions
|
@ -90,6 +90,10 @@ void ReleaseNoteDialog::update_release_note(wxString release_note, std::string v
|
|||
m_scrollwindw_release_note->Layout();
|
||||
}
|
||||
|
||||
void UpdateVersionDialog::alter_choice(wxCommandEvent& event)
|
||||
{
|
||||
wxGetApp().set_skip_version(m_remind_choice->GetValue());
|
||||
}
|
||||
|
||||
UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
: DPIDialog(parent, wxID_ANY, _L("New version of Bambu Studio"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
|
@ -130,30 +134,33 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
|||
m_scrollwindw_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||
m_scrollwindw_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
||||
|
||||
m_remind_choice = new wxCheckBox( this, wxID_ANY, _L("Don't remind me of this version again"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_remind_choice->SetValue(false);
|
||||
m_remind_choice->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &UpdateVersionDialog::alter_choice,this);
|
||||
|
||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
|
||||
|
||||
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
|
||||
auto m_butto_ok = new Button(this, _L("OK"));
|
||||
m_butto_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_butto_ok->SetBorderColor(*wxWHITE);
|
||||
m_butto_ok->SetTextColor(*wxWHITE);
|
||||
m_butto_ok->SetFont(Label::Body_12);
|
||||
m_butto_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_butto_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_butto_ok->SetCornerRadius(FromDIP(12));
|
||||
m_button_ok = new Button(this, _L("OK"));
|
||||
m_button_ok->SetBackgroundColor(btn_bg_green);
|
||||
m_button_ok->SetBorderColor(*wxWHITE);
|
||||
m_button_ok->SetTextColor(*wxWHITE);
|
||||
m_button_ok->SetFont(Label::Body_12);
|
||||
m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_ok->SetCornerRadius(FromDIP(12));
|
||||
|
||||
m_butto_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_YES);
|
||||
});
|
||||
|
||||
auto m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(*wxWHITE);
|
||||
m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
|
||||
m_button_cancel->SetFont(Label::Body_12);
|
||||
|
@ -164,15 +171,18 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
|||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_NO);
|
||||
});
|
||||
|
||||
sizer_button->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sizer_button->Add(m_butto_ok, 0, wxALL, 5);
|
||||
sizer_button->Add(m_button_cancel, 0, wxALL, 5);
|
||||
|
||||
sizer_button->Add(m_remind_choice, 0, wxALL | wxEXPAND, FromDIP(5));
|
||||
sizer_button->AddStretchSpacer();
|
||||
sizer_button->Add(m_button_ok, 0, wxALL, FromDIP(5));
|
||||
sizer_button->Add(m_button_cancel, 0, wxALL, FromDIP(5));
|
||||
|
||||
|
||||
m_sizer_right->Add(m_scrollwindw_release_note, 0, wxEXPAND | wxRIGHT, FromDIP(20));
|
||||
m_sizer_right->Add(sizer_button, 0, wxEXPAND | wxRIGHT, FromDIP(20));
|
||||
|
||||
m_sizer_body->Add(m_sizer_right, 1, wxBOTTOM | wxEXPAND, FromDIP(8));
|
||||
m_sizer_main->Add(m_sizer_body, 0, wxEXPAND, 0);
|
||||
m_sizer_main->Add(sizer_button, 0, wxEXPAND, 0);
|
||||
m_sizer_main->Add(0, 0, 0, wxBOTTOM, 10);
|
||||
|
||||
SetSizer(m_sizer_main);
|
||||
|
@ -186,6 +196,8 @@ UpdateVersionDialog::~UpdateVersionDialog() {}
|
|||
|
||||
|
||||
void UpdateVersionDialog::on_dpi_changed(const wxRect &suggested_rect) {
|
||||
m_button_ok->Rescale();
|
||||
m_button_cancel->Rescale();
|
||||
}
|
||||
|
||||
void UpdateVersionDialog::update_version_info(wxString release_note, wxString version)
|
||||
|
@ -199,5 +211,4 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
|
|||
m_scrollwindw_release_note->Layout();
|
||||
}
|
||||
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue