FIX:fixed error msg cannot be displayed in the bind dialog

Change-Id: Id64a755c91eed08dc5c9beeea17959b16ea4f4f0
This commit is contained in:
tao wang 2023-07-10 16:02:20 +08:00 committed by Lane.Wei
parent 8ebe2fb4d3
commit 69f69b8eb3
3 changed files with 13 additions and 13 deletions

View file

@ -477,7 +477,7 @@ wxString get_fail_reason(int code)
{
wxString extra;
try {
json j = json::parse(str.ToStdString());
json j = json::parse(str.utf8_string());
if (j.contains("err_code")) {
int error_code = j["err_code"].get<int>();
extra = wxGetApp().get_hms_query()->query_print_error_msg(error_code);
@ -498,7 +498,7 @@ wxString get_fail_reason(int code)
if (show) {
if (!m_sw_bind_failed_info->IsShown()) {
m_sw_bind_failed_info->Show(true);
extra = get_print_error(extra.ToStdString());
m_result_extra = get_print_error(m_result_extra);
m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_result_code));
m_st_txt_error_desc->SetLabelText( wxGetApp().filter_string(m_result_info));
m_st_txt_extra_info->SetLabelText( wxGetApp().filter_string(m_result_extra));
@ -555,8 +555,8 @@ wxString get_fail_reason(int code)
m_static_bitmap_show_error->Show(true);
m_result_code = event.GetInt();
m_result_info = get_fail_reason(event.GetInt()).ToStdString();
m_result_extra = event.GetString().ToStdString();
m_result_info = get_fail_reason(event.GetInt());
m_result_extra = event.GetString();
show_bind_failed_info(true, event.GetInt(), get_fail_reason(event.GetInt()), event.GetString());
}
@ -577,8 +577,8 @@ wxString get_fail_reason(int code)
void BindMachineDialog::on_bind_printer(wxCommandEvent &event)
{
m_result_code = 0;
m_result_extra = "";
m_result_info = "";
m_result_extra = wxEmptyString;
m_result_info = wxEmptyString;
m_link_show_error->Hide();
m_static_bitmap_show_error->Hide();
show_bind_failed_info(false);
@ -634,8 +634,8 @@ void BindMachineDialog::on_show(wxShowEvent &event)
m_allow_privacy = false;
m_allow_notice = false;
m_result_code = 0;
m_result_extra = "";
m_result_info = "";
m_result_extra = wxEmptyString;
m_result_info = wxEmptyString;
if (event.IsShown()) {
auto img = m_machine_info->get_printer_thumbnail_img_str();

View file

@ -68,8 +68,8 @@ private:
Label* m_st_txt_error_desc{ nullptr };
Label* m_st_txt_extra_info{ nullptr };
Label* m_link_network_state{ nullptr };
std::string m_result_info;
std::string m_result_extra;
wxString m_result_info;
wxString m_result_extra;
bool m_show_error_info_state = true;
bool m_allow_privacy{false};
bool m_allow_notice{false};

View file

@ -5724,8 +5724,8 @@ void GUI_App::preset_deleted_from_cloud(std::string setting_id)
wxString GUI_App::filter_string(wxString str)
{
std::string result = str.ToStdString();
std::string input = str.ToStdString();
std::string result = str.utf8_string();
std::string input = str.utf8_string();
std::regex domainRegex(R"(([a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,})?))");
@ -5739,7 +5739,7 @@ wxString GUI_App::filter_string(wxString str)
++it;
}
return result;
return wxString::FromUTF8(result);
}
bool GUI_App::OnExceptionInMainLoop()