Fix of #10210 (crash when using mainsail print host) and some related UI fixes ('OctoPrint'->'Mainsail/Fluidd')

This commit is contained in:
Lukas Matena 2023-04-03 10:30:55 +02:00 committed by David Kocik
parent 06403eef65
commit f6da852353
3 changed files with 19 additions and 5 deletions

View File

@ -44,7 +44,7 @@ enum class MachineLimitsUsage {
}; };
enum PrintHostType { enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htMainSail htPrusaLink, htPrusaConnect, htOctoPrint, htMainSail, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS
}; };
enum AuthorizationType { enum AuthorizationType {

View File

@ -203,7 +203,7 @@ bool OctoPrint::test_with_resolved_ip(wxString &msg) const
const auto text = ptree.get_optional<std::string>("text"); const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text); res = validate_version_text(text);
if (!res) { if (!res) {
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : "OctoPrint")); msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : name));
} }
} }
catch (const std::exception&) { catch (const std::exception&) {
@ -252,7 +252,7 @@ bool OctoPrint::test(wxString& msg) const
const auto text = ptree.get_optional<std::string>("text"); const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text); res = validate_version_text(text);
if (! res) { if (! res) {
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : "OctoPrint")); msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : name));
} }
} }
catch (const std::exception &) { catch (const std::exception &) {
@ -396,7 +396,7 @@ bool OctoPrint::upload_inner_with_resolved_ip(PrintHostUpload upload_data, Progr
prorgess_fn(std::move(progress), cancel); prorgess_fn(std::move(progress), cancel);
if (cancel) { if (cancel) {
// Upload was canceled // Upload was canceled
BOOST_LOG_TRIVIAL(info) << "Octoprint: Upload canceled"; BOOST_LOG_TRIVIAL(info) << name << ": Upload canceled";
result = false; result = false;
} }
}) })
@ -473,7 +473,7 @@ bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn p
prorgess_fn(std::move(progress), cancel); prorgess_fn(std::move(progress), cancel);
if (cancel) { if (cancel) {
// Upload was canceled // Upload was canceled
BOOST_LOG_TRIVIAL(info) << "Octoprint: Upload canceled"; BOOST_LOG_TRIVIAL(info) << name << ": Upload canceled";
res = false; res = false;
} }
}) })
@ -1127,4 +1127,16 @@ wxString PrusaConnect::get_test_failed_msg(wxString& msg) const
return GUI::format_wxstr("%s: %s", _L("Could not connect to Prusa Connect"), msg); return GUI::format_wxstr("%s: %s", _L("Could not connect to Prusa Connect"), msg);
} }
wxString Mainsail::get_test_ok_msg() const
{
return _(L("Connection to Mainsail/Fluidd works correctly."));
}
wxString Mainsail::get_test_failed_msg(wxString& msg) const
{
return GUI::format_wxstr("%s: %s", _L("Could not connect to MainSail/Fluidd"), msg);
}
} }

View File

@ -125,6 +125,8 @@ public:
~Mainsail() override = default; ~Mainsail() override = default;
const char* get_name() const override { return "Mainsail/Fluidd"; } const char* get_name() const override { return "Mainsail/Fluidd"; }
wxString get_test_ok_msg() const override;
wxString get_test_failed_msg(wxString& msg) const override;
}; };
class SL1Host : public PrusaLink class SL1Host : public PrusaLink