diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 9d36e6e04..77526cae4 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2345,6 +2345,8 @@ void GUI_App::init_app_config() std::string error = app_config->load(); if (!error.empty()) { // Error while parsing config file. We'll customize the error message and rethrow to be displayed. + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ + << "Configuration file may be corrupted and is not able to be parsed.Please delete the file and try again."; throw Slic3r::RuntimeError( _u8L("BambuStudio configuration file may be corrupted and is not able to be parsed." "Please delete the file and try again.") + diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 0e093e412..103a57523 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -93,7 +93,7 @@ void MsgDialog::show_dsa_button(wxString const &title) Fit(); } -bool MsgDialog::get_checkbox_state() +bool MsgDialog::get_checkbox_state() { if (m_checkbox_dsa) { return m_checkbox_dsa->GetValue(); @@ -101,7 +101,7 @@ bool MsgDialog::get_checkbox_state() return false; } -void MsgDialog::on_dpi_changed(const wxRect &suggested_rect) +void MsgDialog::on_dpi_changed(const wxRect &suggested_rect) { if (m_buttons.size() > 0) { MsgButtonsHash::iterator i = m_buttons.begin(); @@ -124,7 +124,7 @@ void MsgDialog::on_dpi_changed(const wxRect &suggested_rect) } } -void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus/* = false*/) +void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool set_focus/* = false*/) { if (Button* btn = get_button(btn_id)) { btn->SetLabel(label); @@ -148,7 +148,7 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con type = ButtonSizeLong; btn->SetMinSize(MSG_DIALOG_LONG_BUTTON_SIZE); } - + btn->SetCornerRadius(FromDIP(12)); StateColor btn_bg_green( std::pair(wxColour(27, 136, 68), StateColor::Pressed), @@ -271,7 +271,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin wxSize page_size; int em = wxGetApp().em_unit(); if (!wxGetApp().mainframe) { - // If mainframe is nullptr, it means that GUI_App::on_init_inner() isn't completed + // If mainframe is nullptr, it means that GUI_App::on_init_inner() isn't completed // (We just show information dialog about configuration version now) // And as a result the em_unit value wasn't created yet // So, calculate it from the scale factor of Dialog @@ -297,10 +297,12 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin page_size = wxSize(68 * em, page_height); } else { +#ifdef __WINDOWS__ Label* wrapped_text = new Label(html, msg); wrapped_text->Wrap(68 * em); msg = wrapped_text->GetLabel(); wrapped_text->Destroy(); +#endif //__WINDOWS__ wxClientDC dc(parent); wxSize msg_sz = dc.GetMultiLineTextExtent(msg); @@ -323,7 +325,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin // ErrorDialog ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg, bool monospaced_font) - : MsgDialog(parent, wxString::Format(_(L("%s error")), SLIC3R_APP_FULL_NAME), + : MsgDialog(parent, wxString::Format(_(L("%s error")), SLIC3R_APP_FULL_NAME), wxString::Format(_(L("%s has encountered an error")), SLIC3R_APP_FULL_NAME), wxOK) , msg(msg) { @@ -343,7 +345,7 @@ WarningDialog::WarningDialog(wxWindow *parent, const wxString& message, const wxString& caption/* = wxEmptyString*/, long style/* = wxOK*/) - : MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s warning"), SLIC3R_APP_FULL_NAME) : caption, + : MsgDialog(parent, caption.IsEmpty() ? wxString::Format(_L("%s warning"), SLIC3R_APP_FULL_NAME) : caption, wxString::Format(_L("%s has a warning")+":", SLIC3R_APP_FULL_NAME), style) { add_msg_content(this, content_sizer, message); @@ -375,25 +377,28 @@ RichMessageDialog::RichMessageDialog(wxWindow* parent, { add_msg_content(this, content_sizer, message); - m_checkBox = new wxCheckBox(this, wxID_ANY, m_checkBoxText); - wxGetApp().UpdateDarkUI(m_checkBox); - m_checkBox->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent&) { m_checkBoxValue = m_checkBox->GetValue(); }); - - btn_sizer->Insert(0, m_checkBox, wxALIGN_CENTER_VERTICAL); finalize(); } int RichMessageDialog::ShowModal() { - if (m_checkBoxText.IsEmpty()) - m_checkBox->Hide(); - else - m_checkBox->SetLabelText(m_checkBoxText); + if (!m_checkBoxText.IsEmpty()) { + show_dsa_button(m_checkBoxText); + m_checkbox_dsa->SetValue(m_checkBoxValue); + } Layout(); return wxDialog::ShowModal(); } + +bool RichMessageDialog::IsCheckBoxChecked() const +{ + if (m_checkbox_dsa) + return m_checkbox_dsa->GetValue(); + + return m_checkBoxValue; +} #endif // InfoDialog @@ -411,12 +416,12 @@ DownloadDialog::DownloadDialog(wxWindow *parent, const wxString &msg, const wxSt { add_button(wxID_YES, true, _L("Download")); add_button(wxID_CANCEL, true, _L("Skip")); - + finalize(); } -void DownloadDialog::SetExtendedMessage(const wxString &extendedMessage) +void DownloadDialog::SetExtendedMessage(const wxString &extendedMessage) { add_msg_content(this, content_sizer, msg + "\n" + extendedMessage, false, false); Layout(); @@ -520,13 +525,13 @@ wxBoxSizer *Newer3mfVersionDialog::get_msg_sizer() wxStaticText *text1; wxBoxSizer * horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); wxString msg_str; - if (file_version_newer) { + if (file_version_newer) { text1 = new wxStaticText(this, wxID_ANY, _L("The 3mf file version is in Beta and it is newer than the current Bambu Studio version.")); wxStaticText * text2 = new wxStaticText(this, wxID_ANY, _L("If you would like to try Bambu Studio Beta, you may click to")); wxHyperlinkCtrl *github_link = new wxHyperlinkCtrl(this, wxID_ANY, _L("Download Beta Version"), "https://github.com/bambulab/BambuStudio/releases"); horizontal_sizer->Add(text2, 0, wxEXPAND, 0); horizontal_sizer->Add(github_link, 0, wxEXPAND | wxLEFT, 5); - + } else { text1 = new wxStaticText(this, wxID_ANY, _L("The 3mf file version is newer than the current Bambu Studio version.")); wxStaticText *text2 = new wxStaticText(this, wxID_ANY, _L("Update your Bambu Studio could enable all functionality in the 3mf file.")); @@ -580,7 +585,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() } }); } - + if (!file_version_newer) { m_later_btn = new Button(this, _L("Not for now")); m_later_btn->SetBackgroundColor(btn_bg_white); @@ -613,7 +618,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); - + wxBoxSizer* sizer_bacis_text = new wxBoxSizer(wxVERTICAL); m_text_basic = new Label(this, _L("The server is unable to respond. Please click the link below to check the server status.")); @@ -644,7 +649,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) m_text_proposal->Wrap(FromDIP(470)); m_text_proposal->SetFont(::Label::Body_14); m_text_proposal->SetForegroundColour(0x323A3C); - + m_text_wiki = new wxHyperlinkCtrl(this, wxID_ANY, _L("How to use LAN only mode"), ""); m_text_wiki->SetFont(::Label::Body_13); m_text_wiki->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_lan_only_wiki(); }); diff --git a/src/slic3r/GUI/MsgDialog.hpp b/src/slic3r/GUI/MsgDialog.hpp index 2ce84ac97..9a09469bd 100644 --- a/src/slic3r/GUI/MsgDialog.hpp +++ b/src/slic3r/GUI/MsgDialog.hpp @@ -190,7 +190,7 @@ public: } wxString GetCheckBoxText() const { return m_checkBoxText; } - bool IsCheckBoxChecked() const { return m_checkBoxValue; } + bool IsCheckBoxChecked() const; // This part o fcode isported from the "wx\msgdlg.h" using wxMD = wxMessageDialogBase; diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 0e1428be3..67c6ec8fa 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -68,8 +68,8 @@ struct CurlGlobalInit else message = (boost::format("use system SSL certificate: %1%") % bundle).str(); - message += "\n" + (boost::format("To manually specify the system certificate store, " - "set the %1% environment variable to the correct CA and restart the application") % SSL_CA_FILE).str(); + message += "\n" + (boost::format("To manually specify the system certificate store, " + "set the %1% environment variable to the correct CA and restart the application.") % SSL_CA_FILE).str(); } #endif // OPENSSL_CERT_OVERRIDE