diff --git a/src/slic3r/GUI/ButtonsDescription.cpp b/src/slic3r/GUI/ButtonsDescription.cpp index 8460a9411..e225c7db7 100644 --- a/src/slic3r/GUI/ButtonsDescription.cpp +++ b/src/slic3r/GUI/ButtonsDescription.cpp @@ -83,8 +83,9 @@ wxBitmapBundle * ModePaletteComboBox::get_bmp(const std::vector &pa return bmp_bndl; } +namespace GUI_Descriptions { -void ButtonsDescription::FillSizerWithTextColorDescriptions(wxSizer* sizer, wxWindow* parent, wxColourPickerCtrl** sys_colour, wxColourPickerCtrl** mod_colour) +void FillSizerWithTextColorDescriptions(wxSizer* sizer, wxWindow* parent, wxColourPickerCtrl** sys_colour, wxColourPickerCtrl** mod_colour) { wxFlexGridSizer* grid_sizer = new wxFlexGridSizer(3, 5, 5); sizer->Add(grid_sizer, 0, wxEXPAND); @@ -127,7 +128,7 @@ void ButtonsDescription::FillSizerWithTextColorDescriptions(wxSizer* sizer, wxWi add_color(mod_colour, wxGetApp().get_label_clr_modified(),wxGetApp().get_label_default_clr_modified(), _L("Value was changed and is not equal to the system value or the last saved preset")); } -void ButtonsDescription::FillSizerWithModeColorDescriptions( +void FillSizerWithModeColorDescriptions( wxSizer* sizer, wxWindow* parent, std::vector clr_pickers, std::vector& mode_palette) @@ -195,7 +196,7 @@ void ButtonsDescription::FillSizerWithModeColorDescriptions( } } -ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vector &entries) : +Dialog::Dialog(wxWindow* parent, const std::vector &entries) : wxDialog(parent, wxID_ANY, _(L("Buttons And Text Colors Description")), wxDefaultPosition, wxDefaultSize), m_entries(entries) { @@ -207,7 +208,7 @@ ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vectorAdd(grid_sizer, 0, wxEXPAND | wxALL, 20); // Icon description - for (const Entry &entry : m_entries) + for (const ButtonEntry &entry : m_entries) { auto icon = new wxStaticBitmap(this, wxID_ANY, entry.bitmap->bmp()); grid_sizer->Add(icon, -1, wxALIGN_CENTRE_VERTICAL); @@ -219,14 +220,14 @@ ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vectorAdd(sizer, 0, wxEXPAND | wxALL, 20); // Mode color markers description mode_palette = wxGetApp().get_mode_palette(); wxSizer* mode_sizer = new wxBoxSizer(wxVERTICAL); - FillSizerWithModeColorDescriptions(mode_sizer, this, { &simple, &advanced, &expert }, mode_palette); + GUI_Descriptions::FillSizerWithModeColorDescriptions(mode_sizer, this, { &simple, &advanced, &expert }, mode_palette); main_sizer->Add(mode_sizer, 0, wxEXPAND | wxALL, 20); auto buttons = CreateStdDialogButtonSizer(wxOK|wxCANCEL); @@ -248,6 +249,7 @@ ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vectorSetSizeHints(this); } +} // GUI_Descriptions } // GUI } // Slic3r diff --git a/src/slic3r/GUI/ButtonsDescription.hpp b/src/slic3r/GUI/ButtonsDescription.hpp index d1315d3d0..13aa909ab 100644 --- a/src/slic3r/GUI/ButtonsDescription.hpp +++ b/src/slic3r/GUI/ButtonsDescription.hpp @@ -35,9 +35,20 @@ protected: wxBitmapBundle* get_bmp( const std::vector& palette); }; +namespace GUI_Descriptions { -class ButtonsDescription : public wxDialog +struct ButtonEntry { + ButtonEntry(ScalableBitmap *bitmap, const std::string &symbol, const std::string &explanation) : bitmap(bitmap), symbol(symbol), explanation(explanation) {} + + ScalableBitmap *bitmap; + std::string symbol; + std::string explanation; +}; + +class Dialog : public wxDialog { + std::vector m_entries; + wxColourPickerCtrl* sys_colour{ nullptr }; wxColourPickerCtrl* mod_colour{ nullptr }; @@ -47,26 +58,17 @@ class ButtonsDescription : public wxDialog std::vector mode_palette; public: - struct Entry { - Entry(ScalableBitmap *bitmap, const std::string &symbol, const std::string &explanation) : bitmap(bitmap), symbol(symbol), explanation(explanation) {} - ScalableBitmap *bitmap; - std::string symbol; - std::string explanation; - }; - - ButtonsDescription(wxWindow* parent, const std::vector &entries); - ~ButtonsDescription() {} - - static void FillSizerWithTextColorDescriptions(wxSizer* sizer, wxWindow* parent, wxColourPickerCtrl** sys_colour, wxColourPickerCtrl** mod_colour); - static void FillSizerWithModeColorDescriptions(wxSizer* sizer, wxWindow* parent, - std::vector clr_pickers, - std::vector& mode_palette); - -private: - std::vector m_entries; + Dialog(wxWindow* parent, const std::vector &entries); + ~Dialog() {} }; +extern void FillSizerWithTextColorDescriptions(wxSizer* sizer, wxWindow* parent, wxColourPickerCtrl** sys_colour, wxColourPickerCtrl** mod_colour); +extern void FillSizerWithModeColorDescriptions(wxSizer* sizer, wxWindow* parent, + std::vector clr_pickers, + std::vector& mode_palette); +} // GUI_Descriptions + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/DownloaderFileGet.cpp b/src/slic3r/GUI/DownloaderFileGet.cpp index b30c1a237..0a1e7ce25 100644 --- a/src/slic3r/GUI/DownloaderFileGet.cpp +++ b/src/slic3r/GUI/DownloaderFileGet.cpp @@ -253,7 +253,10 @@ void FileGet::priv::get_perform() if (file != NULL) fclose(file); wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_ERROR); - evt->SetString(GUI::from_u8(error)); + if (!error.empty()) + evt->SetString(GUI::from_u8(error)); + else + evt->SetString(GUI::from_u8(body)); evt->SetInt(m_id); m_evt_handler->QueueEvent(evt); }) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index c1490342c..7312297b7 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3403,7 +3403,7 @@ void GUI_App::app_updater(bool from_user) } app_data.target_path =dwnld_dlg.get_download_path(); // start download - this->plater_->get_notification_manager()->push_download_progress_notification(_utf8("Download"), std::bind(&AppUpdater::cancel_callback, this->m_app_updater.get())); + this->plater_->get_notification_manager()->push_download_progress_notification(GUI::format(_utf8("Downloading %1%"), app_data.target_path.filename().string()), std::bind(&AppUpdater::cancel_callback, this->m_app_updater.get())); app_data.start_after = dwnld_dlg.run_after_download(); m_app_updater->set_app_data(std::move(app_data)); m_app_updater->sync_download(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index d369c9505..21a1f9ba5 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -170,12 +170,12 @@ void GLGizmosManager::reset_all_states() if (! m_enabled || m_serializing) return; - EType current = get_current_type(); + const EType current = get_current_type(); if (current != Undefined) // close any open gizmo open_gizmo(current); - else - activate_gizmo(Undefined); + + activate_gizmo(Undefined); m_hover = Undefined; } diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 1b2c68bdd..6727b7553 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1041,7 +1041,7 @@ void PreferencesDialog::create_settings_text_color_widget() m_blinkers[opt_key] = new BlinkingBitmap(parent); wxSizer* stb_sizer = new wxStaticBoxSizer(stb, wxVERTICAL); - ButtonsDescription::FillSizerWithTextColorDescriptions(stb_sizer, parent, &m_sys_colour, &m_mod_colour); + GUI_Descriptions::FillSizerWithTextColorDescriptions(stb_sizer, parent, &m_sys_colour, &m_mod_colour); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(m_blinkers[opt_key], 0, wxRIGHT, 2); @@ -1068,7 +1068,7 @@ void PreferencesDialog::create_settings_mode_color_widget() // Mode color markers description m_mode_palette = wxGetApp().get_mode_palette(); - ButtonsDescription::FillSizerWithModeColorDescriptions(stb_sizer, parent, { &m_mode_simple, &m_mode_advanced, &m_mode_expert }, m_mode_palette); + GUI_Descriptions::FillSizerWithModeColorDescriptions(stb_sizer, parent, { &m_mode_simple, &m_mode_advanced, &m_mode_expert }, m_mode_palette); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(m_blinkers[opt_key], 0, wxRIGHT, 2); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 43eaa1a22..434d6d1e7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -194,7 +194,7 @@ void Tab::create_preset_tab() m_undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(); })); m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); })); m_question_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { - ButtonsDescription dlg(this, m_icon_descriptions); + GUI_Descriptions::Dialog dlg(this, m_icon_descriptions); if (dlg.ShowModal() == wxID_OK) wxGetApp().update_label_colours(); }); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index b131761e6..1a2edfe05 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -254,7 +254,7 @@ protected: std::map m_options_list; int m_opt_status_value = 0; - std::vector m_icon_descriptions = {}; + std::vector m_icon_descriptions = {}; bool m_is_modified_values{ false }; bool m_is_nonsys_values{ true }; diff --git a/src/slic3r/Utils/AppUpdater.cpp b/src/slic3r/Utils/AppUpdater.cpp index d054db4b5..9eb012827 100644 --- a/src/slic3r/Utils/AppUpdater.cpp +++ b/src/slic3r/Utils/AppUpdater.cpp @@ -2,18 +2,20 @@ #include #include +#include #include #include #include #include -#include +#include #include #include "slic3r/GUI/format.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/I18N.hpp" +#include "slic3r/GUI/GLCanvas3D.hpp" #include "slic3r/Utils/Http.hpp" #include "libslic3r/Utils.hpp" @@ -214,7 +216,7 @@ boost::filesystem::path AppUpdater::priv::download_file(const DownloadAppData& d } boost::filesystem::path tmp_path = dest_path; - tmp_path += format(".%1%%2%", get_current_pid(), ".download"); + tmp_path += format(".%1%%2%", std::to_string(GUI::GLCanvas3D::timestamp_now()), ".download"); FILE* file; wxString temp_path_wstring(tmp_path.wstring()); file = fopen(temp_path_wstring.c_str(), "wb");