Preferences: Changed tooltip for the "Suppress to open hyperlink in browser"

+ Show "PrusaSlicer: Don't ask me again" dialog when "Remember my choice" is checked in "PrusaSlicer: Open hyperlink" dialog
+ Ignore suppress of hyperlink for menu items
+ Code refactoring for OptionsGroup::launch_browser() => use common wxGetApp().open_browser_with_warning_dialog().
This commit is contained in:
YuSanka 2022-01-06 13:55:16 +01:00
parent e031001f0a
commit 2b66a81ee1
5 changed files with 39 additions and 45 deletions

View file

@ -977,36 +977,7 @@ wxString OptionsGroup::get_url(const std::string& path_end)
bool OptionsGroup::launch_browser(const std::string& path_end)
{
bool launch = true;
if (get_app_config()->get("suppress_hyperlinks").empty()) {
wxWindow* parent = wxGetApp().mainframe->m_tabpanel;
RichMessageDialog dialog(parent, _L("Open hyperlink in default browser?"), _L("PrusaSlicer: Open hyperlink"), wxYES_NO);
dialog.ShowCheckBox(_L("Remember my choice"));
int answer = dialog.ShowModal();
if (answer == wxID_CANCEL)
return false;
if (dialog.IsCheckBoxChecked()) {
wxString preferences_item = _L("Suppress to open hyperlink in browser");
wxString msg =
_L("PrusaSlicer will remember your choice.") + "\n\n" +
_L("You will not be asked about it again on label hovering.") + "\n\n" +
format_wxstr(_L("Visit \"Preferences\" and check \"%1%\"\nto changes your choice."), preferences_item);
MessageDialog msg_dlg(parent, msg, _L("PrusaSlicer: Don't ask me again"), wxOK | wxCANCEL | wxICON_INFORMATION);
if (msg_dlg.ShowModal() == wxID_CANCEL)
return false;
get_app_config()->set("suppress_hyperlinks", dialog.IsCheckBoxChecked() ? (answer == wxID_NO ? "1" : "0") : "");
}
launch = answer == wxID_YES;
}
if (launch)
launch = get_app_config()->get("suppress_hyperlinks") != "1";
return launch && wxLaunchDefaultBrowser(OptionsGroup::get_url(path_end));
return wxGetApp().open_browser_with_warning_dialog(OptionsGroup::get_url(path_end), wxGetApp().mainframe->m_tabpanel);
}