From 23a72cec1f2e1b4795846078dafab332ca27d778 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 14 Jun 2023 14:38:35 +0200 Subject: [PATCH] Add url to documentation for template filament warning followup 45ba32d29ad9509064e7c7501989ef7e9e305170 --- src/slic3r/GUI/NotificationManager.cpp | 4 ++-- src/slic3r/GUI/NotificationManager.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 21 +++++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index c4e95d702..26addd75f 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -2108,9 +2108,9 @@ void NotificationManager::push_slicing_error_notification(const std::string& tex push_notification_data({ NotificationType::SlicingError, NotificationLevel::ErrorNotificationLevel, 0, _u8L("ERROR:") + "\n" + text }, 0); set_slicing_progress_hidden(); } -void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step) +void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step, const std::string& hypertext, std::function callback) { - NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0, _u8L("WARNING:") + "\n" + text }; + NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0, _u8L("WARNING:") + "\n" + text , hypertext, callback}; auto notification = std::make_unique(data, m_id_provider, m_evt_handler); notification->object_id = oid; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 778f99bfa..fdf84ad00 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -172,7 +172,7 @@ public: // Creates Slicing Error notification with a custom text and no fade out. void push_slicing_error_notification(const std::string& text); // Creates Slicing Warning notification with a custom text and no fade out. - void push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step); + void push_slicing_warning_notification(const std::string& text, bool gray, ObjectID oid, int warning_step, const std::string& hypertext = "", std::function callback = std::function()); // marks slicing errors as gray void set_all_slicing_errors_gray(bool g); // marks slicing warings as gray diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e6c7a33de..a788e0614 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4099,16 +4099,21 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) } } if (templ_cnt > 0) { - const std::string message_notif = GUI::format("%1%\n%2%\n%3%" + const std::string message_notif = GUI::format("%1%\n%2%\n%3%\n\n%4% " , _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt) , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.") - , names); + , names + ,_u8L("More info at")); // warning dialog proccessing cuts text at first '/n' - pass the text without new lines (and without filament names). - const std::string message_dial = GUI::format("%1% %2%" + const std::string message_dial = GUI::format("%1% %2% %3%" , _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt) - , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.")); + , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.") + , "https://help.prusa3d.com/" + ); BOOST_LOG_TRIVIAL(warning) << message_notif; - notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0); + notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0, "https://help.prusa3d.com/", + [](wxEvtHandler* evnthndlr) { wxGetApp().open_browser_with_warning_dialog("https://help.prusa3d.com/article/template-filaments_467599"); return false; } + ); add_warning({ PrintStateBase::WarningLevel::CRITICAL, true, message_dial, 0}, 0); } } @@ -4248,9 +4253,9 @@ bool Plater::priv::warnings_dialog() else text += it.first.message; } - //text += "\n\nDo you still wish to export?"; - //wxMessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK); - MessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK); + //MessageDialog msg_wingow(this->q, from_u8(text), wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), wxOK); + // Changed ti InfoDialog so it can show hyperlinks + InfoDialog msg_wingow(this->q, wxString(SLIC3R_APP_NAME " ") + _L("generated warnings"), from_u8(text), wxOK); const auto res = msg_wingow.ShowModal(); return res == wxID_OK;