mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
Fixing wxString::Format encoding mismatches (part 3)
This commit is contained in:
parent
bcd3842183
commit
f2b98bddee
10 changed files with 55 additions and 38 deletions
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "Http.hpp"
|
||||
|
||||
|
||||
|
@ -65,7 +66,7 @@ bool AstroBox::test(wxString &msg) const
|
|||
const auto text = ptree.get_optional<std::string>("text");
|
||||
res = validate_version_text(text);
|
||||
if (! res) {
|
||||
msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "AstroBox");
|
||||
msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "AstroBox")).str());
|
||||
}
|
||||
}
|
||||
catch (const std::exception &) {
|
||||
|
@ -85,8 +86,10 @@ wxString AstroBox::get_test_ok_msg () const
|
|||
|
||||
wxString AstroBox::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return wxString::Format("%s: %s\n\n%s",
|
||||
_(L("Could not connect to AstroBox")), msg, _(L("Note: AstroBox version at least 1.1.0 is required.")));
|
||||
return GUI::from_u8((boost::format("%s: %s\n\n%s")
|
||||
% _utf8(L("Could not connect to AstroBox"))
|
||||
% std::string(msg.ToUTF8())
|
||||
% _utf8(L("Note: AstroBox version at least 1.1.0 is required."))).str());
|
||||
}
|
||||
|
||||
bool AstroBox::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||
|
|
|
@ -51,7 +51,9 @@ wxString Duet::get_test_ok_msg () const
|
|||
|
||||
wxString Duet::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return wxString::Format("%s: %s", _(L("Could not connect to Duet")), msg);
|
||||
return GUI::from_u8((boost::format("%s: %s")
|
||||
% _utf8(L("Could not connect to Duet"))
|
||||
% std::string(msg.ToUTF8())).str());
|
||||
}
|
||||
|
||||
bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||
|
|
|
@ -70,7 +70,10 @@ wxString FlashAir::get_test_ok_msg () const
|
|||
|
||||
wxString FlashAir::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return wxString::Format("%s: %s", _(L("Could not connect to FlashAir")), msg, _(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required.")));
|
||||
return wxString::FromUTF8((boost::format("%s: %s")
|
||||
% _utf8(L("Could not connect to FlashAir"))
|
||||
% std::string(msg.ToUTF8())
|
||||
% _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());
|
||||
}
|
||||
|
||||
bool FlashAir::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "Http.hpp"
|
||||
|
||||
|
||||
|
@ -65,7 +66,7 @@ bool OctoPrint::test(wxString &msg) const
|
|||
const auto text = ptree.get_optional<std::string>("text");
|
||||
res = validate_version_text(text);
|
||||
if (! res) {
|
||||
msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "OctoPrint");
|
||||
msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "OctoPrint")).str());
|
||||
}
|
||||
}
|
||||
catch (const std::exception &) {
|
||||
|
@ -85,8 +86,10 @@ wxString OctoPrint::get_test_ok_msg () const
|
|||
|
||||
wxString OctoPrint::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return wxString::Format("%s: %s\n\n%s",
|
||||
_(L("Could not connect to OctoPrint")), msg, _(L("Note: OctoPrint version at least 1.1.0 is required.")));
|
||||
return GUI::from_u8((boost::format("%s: %s\n\n%s")
|
||||
% _utf8(L("Could not connect to OctoPrint"))
|
||||
% std::string(msg.ToUTF8())
|
||||
% _utf8(L("Note: OctoPrint version at least 1.1.0 is required."))).str());
|
||||
}
|
||||
|
||||
bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||
|
@ -178,7 +181,9 @@ wxString SL1Host::get_test_ok_msg () const
|
|||
|
||||
wxString SL1Host::get_test_failed_msg (wxString &msg) const
|
||||
{
|
||||
return wxString::Format("%s: %s", _(L("Could not connect to Prusa SLA")), msg);
|
||||
return GUI::from_u8((boost::format("%s: %s")
|
||||
% _utf8(L("Could not connect to Prusa SLA"))
|
||||
% std::string(msg.ToUTF8())).str());
|
||||
}
|
||||
|
||||
bool SL1Host::validate_version_text(const boost::optional<std::string> &version_text) const
|
||||
|
|
|
@ -702,15 +702,15 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver &old_slic3
|
|||
const auto max_slic3r = incompat.version.max_slic3r_version;
|
||||
wxString restrictions;
|
||||
if (min_slic3r != Semver::zero() && max_slic3r != Semver::inf()) {
|
||||
restrictions = wxString::Format(_(L("requires min. %s and max. %s")),
|
||||
min_slic3r.to_string(),
|
||||
max_slic3r.to_string()
|
||||
restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s and max. %s")))
|
||||
% min_slic3r.to_string()
|
||||
% max_slic3r.to_string()).str()
|
||||
);
|
||||
} else if (min_slic3r != Semver::zero()) {
|
||||
restrictions = wxString::Format(_(L("requires min. %s")), min_slic3r.to_string());
|
||||
restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s"))) % min_slic3r.to_string()).str());
|
||||
BOOST_LOG_TRIVIAL(debug) << "Bundle is not downgrade, user will now have to do whole wizard. This should not happen.";
|
||||
} else {
|
||||
restrictions = wxString::Format(_(L("requires max. %s")), max_slic3r.to_string());
|
||||
restrictions = GUI::from_u8((boost::format(_utf8(L("requires max. %s"))) % max_slic3r.to_string()).str());
|
||||
}
|
||||
|
||||
incompats_map.emplace(std::make_pair(incompat.vendor, std::move(restrictions)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue