mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-27 00:24:00 -06:00
FIX: use current_language_code_safe() for valid language
Change-Id: I480730055588aa76bd40f35e6c4bcbe9833c330d
This commit is contained in:
parent
74a1bb8c0f
commit
c5bba1fa85
6 changed files with 9 additions and 24 deletions
|
@ -37,37 +37,24 @@ BEGIN_EVENT_TABLE(ZUserLogin, wxDialog)
|
|||
EVT_TIMER(NETWORK_OFFLINE_TIMER_ID, ZUserLogin::OnTimer)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
string &replace_str(string &str, const string &to_replaced, const string &newchars)
|
||||
{
|
||||
for (string::size_type pos(0); pos != string::npos; pos += newchars.length()) {
|
||||
pos = str.find(to_replaced, pos);
|
||||
if (pos != string::npos)
|
||||
str.replace(pos, to_replaced.length(), newchars);
|
||||
else
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int ZUserLogin::web_sequence_id = 20000;
|
||||
|
||||
ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_ANY, "BambuStudio")
|
||||
{
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
// Url
|
||||
AppConfig * config = wxGetApp().app_config;
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
if (!agent) return;
|
||||
std::string host_url = agent->get_bambulab_host();
|
||||
TargetUrl = host_url + "/sign-in";
|
||||
m_networkOk = false;
|
||||
|
||||
std::string strlang = config->get("language");
|
||||
wxString strlang = wxGetApp().current_language_code_safe();
|
||||
if (strlang != "") {
|
||||
replace_str(strlang, "_", "-");
|
||||
strlang.Replace("_", "-");
|
||||
TargetUrl = host_url + "/" + strlang + "/sign-in";
|
||||
}
|
||||
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "login url = " << TargetUrl.ToStdString();
|
||||
|
||||
m_bbl_user_agent = wxString::Format("BBL-Slicer/v%s", SLIC3R_VERSION);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue