mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-03 09:28:44 +03:00
Update MsgDialog.cpp
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "slic3r/GUI/MainFrame.hpp"
|
#include "slic3r/GUI/MainFrame.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
|
#include "libslic3r/AppConfig.cpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@@ -116,7 +117,7 @@ void MsgDialog::finalize()
|
|||||||
// Text shown as HTML, so that mouse selection and Ctrl-V to copy will work.
|
// Text shown as HTML, so that mouse selection and Ctrl-V to copy will work.
|
||||||
static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxString msg, bool monospaced_font = false, bool is_marked_msg = false)
|
static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxString msg, bool monospaced_font = false, bool is_marked_msg = false)
|
||||||
{
|
{
|
||||||
wxHtmlWindow* html = new wxHtmlWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER);
|
wxHtmlWindow* html = new wxHtmlWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO);
|
||||||
|
|
||||||
// count lines in the message
|
// count lines in the message
|
||||||
int msg_lines = 0;
|
int msg_lines = 0;
|
||||||
@@ -193,7 +194,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
|
|||||||
wxClientDC dc(parent);
|
wxClientDC dc(parent);
|
||||||
wxSize msg_sz = dc.GetMultiLineTextExtent(msg);
|
wxSize msg_sz = dc.GetMultiLineTextExtent(msg);
|
||||||
page_size = wxSize(std::min(msg_sz.GetX() + 2 * em, 68 * em),
|
page_size = wxSize(std::min(msg_sz.GetX() + 2 * em, 68 * em),
|
||||||
std::min(msg_sz.GetY() + 4 * em, 68 * em));
|
std::min(msg_sz.GetY() + 8 * em, 68 * em));
|
||||||
}
|
}
|
||||||
html->SetMinSize(page_size);
|
html->SetMinSize(page_size);
|
||||||
|
|
||||||
@@ -203,8 +204,11 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
|
|||||||
if (monospaced_font)
|
if (monospaced_font)
|
||||||
// Code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
|
// Code formatting will be preserved. This is useful for reporting errors from the placeholder parser.
|
||||||
msg_escaped = std::string("<pre><code>") + msg_escaped + "</code></pre>";
|
msg_escaped = std::string("<pre><code>") + msg_escaped + "</code></pre>";
|
||||||
std::string is_that_msg;
|
bool is_that_msg = false;
|
||||||
is_that_msg = msg_escaped.substr(msg_escaped.length() - 3, msg_escaped.length());
|
std::string that_msg;
|
||||||
|
that_msg = msg_escaped.substr(0, 46);
|
||||||
|
if (that_msg == "Downloading QIDISlicer version file has failed")
|
||||||
|
is_that_msg = true;
|
||||||
bool is_errort = false;//priv::http_get_file();
|
bool is_errort = false;//priv::http_get_file();
|
||||||
html->SetPage(format_wxstr("<html>"
|
html->SetPage(format_wxstr("<html>"
|
||||||
"<body bgcolor=%1% link=%2%>"
|
"<body bgcolor=%1% link=%2%>"
|
||||||
@@ -214,7 +218,7 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
|
|||||||
"</font>"
|
"</font>"
|
||||||
"</body>"
|
"</body>"
|
||||||
"</html>",
|
"</html>",
|
||||||
bgr_clr_str, text_clr_str, from_u8(msg_escaped), (is_that_msg == "28]") ? "<br />You can get the latest version of the software through the link below:\n<a href=\"https://qidi3d.com/pages/software-firmware\">https://qidi3d.com/pages/software-firmware</a>" : ""));
|
bgr_clr_str, text_clr_str, from_u8(msg_escaped), is_that_msg ? "<br />You can get the latest version of the software through the link below:\n<a href=\"https://qidi3d.com/pages/software-firmware\">https://qidi3d.com/pages/software-firmware</a>" : ""));
|
||||||
|
|
||||||
html->Bind(wxEVT_HTML_LINK_CLICKED, [parent](wxHtmlLinkEvent& event) {
|
html->Bind(wxEVT_HTML_LINK_CLICKED, [parent](wxHtmlLinkEvent& event) {
|
||||||
wxGetApp().open_browser_with_warning_dialog(event.GetLinkInfo().GetHref(), parent, false);
|
wxGetApp().open_browser_with_warning_dialog(event.GetLinkInfo().GetHref(), parent, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user