From 8d6497297a76e63e749ceed4ecbf1c82083ed446 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 18 Dec 2023 14:33:11 +0100 Subject: [PATCH] Replaced all occurrences of boost::nowide::narrow for wxStrings with into_u8 --- src/libslic3r/GCode/PostProcessor.cpp | 4 ++-- src/libslic3r/Thread.cpp | 4 ++-- src/slic3r/GUI/ConfigWizard.cpp | 2 +- src/slic3r/GUI/DesktopIntegrationDialog.cpp | 6 +++--- src/slic3r/GUI/Downloader.cpp | 4 ++-- src/slic3r/GUI/FileArchiveDialog.cpp | 4 ++-- src/slic3r/GUI/GUI.cpp | 4 ++-- src/slic3r/GUI/GUI_App.cpp | 14 +++++++------- src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/Mouse3DController.cpp | 4 ++-- src/slic3r/GUI/NotificationManager.cpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/PrintHostDialogs.cpp | 10 +++++----- src/slic3r/GUI/RemovableDriveManager.cpp | 4 ++-- src/slic3r/GUI/Search.cpp | 2 +- src/slic3r/GUI/SendSystemInfoDialog.cpp | 2 +- src/slic3r/GUI/Sidebar.cpp | 2 +- src/slic3r/GUI/WifiConfigDialog.cpp | 4 ++-- src/slic3r/Utils/AppUpdater.cpp | 4 ++-- src/slic3r/Utils/Duet.cpp | 2 +- src/slic3r/Utils/Serial.cpp | 12 ++++++------ src/slic3r/Utils/WifiScanner.cpp | 7 +++---- 22 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp index 092a4be058..c660c63416 100644 --- a/src/libslic3r/GCode/PostProcessor.cpp +++ b/src/libslic3r/GCode/PostProcessor.cpp @@ -92,7 +92,7 @@ static DWORD execute_process_winapi(const std::wstring &command_line) if (! ::CreateProcessW( nullptr /* lpApplicationName */, (LPWSTR)command_line.c_str(), nullptr /* lpProcessAttributes */, nullptr /* lpThreadAttributes */, false /* bInheritHandles */, CREATE_UNICODE_ENVIRONMENT /* | CREATE_NEW_CONSOLE */ /* dwCreationFlags */, (LPVOID)envstr.c_str(), nullptr /* lpCurrentDirectory */, &startup_info, &process_info)) - throw Slic3r::RuntimeError(std::string("Failed starting the script ") + boost::nowide::narrow(command_line) + ", Win32 error: " + std::to_string(int(::GetLastError()))); + throw Slic3r::RuntimeError(std::string("Failed starting the script ") + boost::nowide::narrow(command_line) + ", Win32 error: " + std::to_string(int(::GetLastError()))); ::WaitForSingleObject(process_info.hProcess, INFINITE); ULONG rc = 0; ::GetExitCodeProcess(process_info.hProcess, &rc); @@ -117,7 +117,7 @@ static int run_script(const std::string &script, const std::string &gcode, std:: std::wstring command_line; std::wstring command = szArglist[0]; if (! boost::filesystem::exists(boost::filesystem::path(command))) - throw Slic3r::RuntimeError(std::string("The configured post-processing script does not exist: ") + boost::nowide::narrow(command)); + throw Slic3r::RuntimeError(std::string("The configured post-processing script does not exist: ") + boost::nowide::narrow(command)); if (boost::iends_with(command, L".pl")) { // This is a perl script. Run it through the perl interpreter. // The current process may be slic3r.exe or slic3r-console.exe. diff --git a/src/libslic3r/Thread.cpp b/src/libslic3r/Thread.cpp index 338182e026..193b942cea 100644 --- a/src/libslic3r/Thread.cpp +++ b/src/libslic3r/Thread.cpp @@ -127,8 +127,8 @@ std::optional get_current_thread_name() return std::nullopt; wchar_t *ptr = nullptr; - s_fnGetThreadDescription(::GetCurrentThread(), &ptr); - return (ptr == nullptr) ? std::string() : boost::nowide::narrow(ptr); + s_fnGetThreadDescription(::GetCurrentThread(), &ptr); + return (ptr == nullptr) ? std::string() : boost::nowide::narrow(ptr); } #else // _WIN32 diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 1329fdbef3..2ac0e7b72b 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1426,7 +1426,7 @@ Worker::Worker(wxWindow* parent) wxGetApp().SetWindowVariantForButton(button_path); this->Add(button_path, 0, wxEXPAND | wxTOP | wxLEFT, 5); button_path->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { - boost::filesystem::path chosen_dest(boost::nowide::narrow(m_input_path->GetValue())); + boost::filesystem::path chosen_dest(into_u8(m_input_path->GetValue())); wxDirDialog dialog(m_parent, _L("Choose folder") + ":", chosen_dest.string() ); if (dialog.ShowModal() == wxID_OK) diff --git a/src/slic3r/GUI/DesktopIntegrationDialog.cpp b/src/slic3r/GUI/DesktopIntegrationDialog.cpp index 2fae9f0881..19ce09c569 100644 --- a/src/slic3r/GUI/DesktopIntegrationDialog.cpp +++ b/src/slic3r/GUI/DesktopIntegrationDialog.cpp @@ -308,7 +308,7 @@ void DesktopIntegrationDialog::perform_desktop_integration() // if all failed - try creating default home folder if (i == target_candidates.size() - 1) { // create $HOME/.local/share - create_path(boost::nowide::narrow(wxFileName::GetHomeDir()), ".local/share/icons" + icon_theme_dirs); + create_path(into_u8(wxFileName::GetHomeDir()), ".local/share/icons" + icon_theme_dirs); // copy icon target_dir_icons = GUI::format("%1%/.local/share",wxFileName::GetHomeDir()); std::string icon_path = GUI::format("%1%/icons/PrusaSlicer.png",resources_dir()); @@ -364,7 +364,7 @@ void DesktopIntegrationDialog::perform_desktop_integration() // if all failed - try creating default home folder if (!candidate_found) { // create $HOME/.local/share - create_path(boost::nowide::narrow(wxFileName::GetHomeDir()), ".local/share/applications"); + create_path(into_u8(wxFileName::GetHomeDir()), ".local/share/applications"); // create desktop file target_dir_desktop = GUI::format("%1%/.local/share", wxFileName::GetHomeDir()); std::string path = GUI::format("%1%/applications/PrusaSlicer%2%.desktop", target_dir_desktop, version_suffix); @@ -582,7 +582,7 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() // if all failed - try creating default home folder if (!candidate_found) { // create $HOME/.local/share - create_path(boost::nowide::narrow(wxFileName::GetHomeDir()), ".local/share/applications"); + create_path(into_u8(wxFileName::GetHomeDir()), ".local/share/applications"); // create desktop file target_dir_desktop = GUI::format("%1%/.local/share", wxFileName::GetHomeDir()); std::string path = GUI::format("%1%/applications/PrusaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); diff --git a/src/slic3r/GUI/Downloader.cpp b/src/slic3r/GUI/Downloader.cpp index 529230df5b..129079d806 100644 --- a/src/slic3r/GUI/Downloader.cpp +++ b/src/slic3r/GUI/Downloader.cpp @@ -169,7 +169,7 @@ void Downloader::start_download(const std::string& full_url) void Downloader::on_progress(wxCommandEvent& event) { size_t id = event.GetInt(); - float percent = (float)std::stoi(boost::nowide::narrow(event.GetString())) / 100.f; + float percent = (float)std::stoi(into_u8(event.GetString())) / 100.f; //BOOST_LOG_TRIVIAL(error) << "progress " << id << ": " << percent; NotificationManager* ntf_mngr = wxGetApp().notification_manager(); BOOST_LOG_TRIVIAL(trace) << "Download "<< id << ": " << percent; @@ -181,7 +181,7 @@ void Downloader::on_error(wxCommandEvent& event) set_download_state(event.GetInt(), DownloadState::DownloadError); BOOST_LOG_TRIVIAL(error) << "Download error: " << event.GetString(); NotificationManager* ntf_mngr = wxGetApp().notification_manager(); - ntf_mngr->set_download_URL_error(id, boost::nowide::narrow(event.GetString())); + ntf_mngr->set_download_URL_error(id, into_u8(event.GetString())); show_error(nullptr, format_wxstr(L"%1%\n%2%", _L("The download has failed") + ":", event.GetString())); } void Downloader::on_complete(wxCommandEvent& event) diff --git a/src/slic3r/GUI/FileArchiveDialog.cpp b/src/slic3r/GUI/FileArchiveDialog.cpp index 266e10be8e..f33743e3d1 100644 --- a/src/slic3r/GUI/FileArchiveDialog.cpp +++ b/src/slic3r/GUI/FileArchiveDialog.cpp @@ -227,7 +227,7 @@ FileArchiveDialog::FileArchiveDialog(wxWindow* parent_window, mz_zip_archive* ar path = boost::filesystem::path(extra.substr(0, extra_size)); } else { wxString wname = boost::nowide::widen(stat.m_filename); - std::string name = boost::nowide::narrow(wname); + std::string name = into_u8(wname); path = boost::filesystem::path(name); } assert(!path.empty()); @@ -388,4 +388,4 @@ void FileArchiveDialog::on_none_button() } } // namespace GUI -} // namespace Slic3r \ No newline at end of file +} // namespace Slic3r diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 9263e0505a..28e24dd8d4 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -473,10 +473,10 @@ bool create_process(const boost::filesystem::path& path, const std::wstring& cmd return true; } else - error_msg = "CreateProcessW failed to create process " + boost::nowide::narrow(path.wstring()); + error_msg = "CreateProcessW failed to create process " + into_u8(path.wstring()); } else - error_msg = "Executable doesn't exists. Path: " + boost::nowide::narrow(path.wstring()); + error_msg = "Executable doesn't exists. Path: " + into_u8(path.wstring()); return false; } #endif //_WIN32 diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index c959b06c0a..0137da2a68 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -638,7 +638,7 @@ static void register_win32_device_notification_event() // if (lpdbi->dbcc_classguid == GUID_DEVINTERFACE_VOLUME) { // printf("DBT_DEVICEARRIVAL %d - Media has arrived: %ws\n", msg_count, lpdbi->dbcc_name); if (lpdbi->dbcc_classguid == GUID_DEVINTERFACE_HID) - plater->GetEventHandler()->AddPendingEvent(HIDDeviceAttachedEvent(EVT_HID_DEVICE_ATTACHED, boost::nowide::narrow(lpdbi->dbcc_name))); + plater->GetEventHandler()->AddPendingEvent(HIDDeviceAttachedEvent(EVT_HID_DEVICE_ATTACHED, into_u8(lpdbi->dbcc_name))); } break; case DBT_DEVICEREMOVECOMPLETE: @@ -649,7 +649,7 @@ static void register_win32_device_notification_event() // if (lpdbi->dbcc_classguid == GUID_DEVINTERFACE_VOLUME) // printf("DBT_DEVICEARRIVAL %d - Media was removed: %ws\n", msg_count, lpdbi->dbcc_name); if (lpdbi->dbcc_classguid == GUID_DEVINTERFACE_HID) - plater->GetEventHandler()->AddPendingEvent(HIDDeviceDetachedEvent(EVT_HID_DEVICE_DETACHED, boost::nowide::narrow(lpdbi->dbcc_name))); + plater->GetEventHandler()->AddPendingEvent(HIDDeviceDetachedEvent(EVT_HID_DEVICE_DETACHED, into_u8(lpdbi->dbcc_name))); } break; default: @@ -712,7 +712,7 @@ static void register_win32_device_notification_event() copy_data_structure = (COPYDATASTRUCT*)lParam; if (copy_data_structure->dwData == 1) { LPCWSTR arguments = (LPCWSTR)copy_data_structure->lpData; - Slic3r::GUI::wxGetApp().other_instance_message_handler()->handle_message(boost::nowide::narrow(arguments)); + Slic3r::GUI::wxGetApp().other_instance_message_handler()->handle_message(into_u8(arguments)); } return true; }); @@ -1115,9 +1115,9 @@ void GUI_App::jump_to_option(size_t selected) { const Search::Option& opt = m_searcher.get_option(selected); if (opt.type == Preset::TYPE_PREFERENCES) - open_preferences(opt.opt_key(), boost::nowide::narrow(opt.group)); + open_preferences(opt.opt_key(), into_u8(opt.group)); else - get_tab(opt.type)->activate_option(opt.opt_key(), boost::nowide::narrow(opt.category)); + get_tab(opt.type)->activate_option(opt.opt_key(), into_u8(opt.category)); } void GUI_App::jump_to_option(const std::string& composite_key) @@ -1134,7 +1134,7 @@ void GUI_App::jump_to_option(const std::string& composite_key) // so resort searcher before get an option m_searcher.sort_options_by_key(); const Search::Option& opt = m_searcher.get_option(opt_key, tab->type()); - tab->activate_option(opt_key, boost::nowide::narrow(opt.category)); + tab->activate_option(opt_key, into_u8(opt.category)); // Revert sort of searcher back m_searcher.sort_options_by_label(); @@ -3052,7 +3052,7 @@ void GUI_App::MacOpenURL(const wxString& url) BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url; return; } - start_download(boost::nowide::narrow(url)); + start_download(into_u8(url)); } #endif /* __APPLE */ diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 3950ed56ff..0db7f65aa6 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -4671,7 +4671,7 @@ void ObjectList::fix_through_winsdk() // Show info notification wxString msg = MenuFactory::get_repaire_result_message(succes_models, failed_models); - plater->get_notification_manager()->push_notification(NotificationType::RepairFinished, NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel, boost::nowide::narrow(msg)); + plater->get_notification_manager()->push_notification(NotificationType::RepairFinished, NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel, into_u8(msg)); } void ObjectList::simplify() diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index ae44f77933..facb72d3d5 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -976,12 +976,12 @@ bool Mouse3DController::connect_device() if (m_device != nullptr) { wchar_t buffer[1024]; hid_get_manufacturer_string(m_device, buffer, 1024); - m_device_str = boost::nowide::narrow(buffer); + m_device_str = into_u8(buffer); // #3479 seems to show that sometimes an extra whitespace is added, so we remove it boost::algorithm::trim(m_device_str); hid_get_product_string(m_device, buffer, 1024); - m_device_str += "/" + boost::nowide::narrow(buffer); + m_device_str += "/" + into_u8(buffer); // #3479 seems to show that sometimes an extra whitespace is added, so we remove it boost::algorithm::trim(m_device_str); diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index c3142b08ab..9f76ddbe2c 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -1143,7 +1143,7 @@ void NotificationManager::URLDownloadNotification::render_pause_button_inner(ImG button_text = (m_download_paused ? ImGui::PlayHoverButton : ImGui::PauseHoverButton); } - ImVec2 button_pic_size = ImGui::CalcTextSize(boost::nowide::narrow(button_text).c_str()); + ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str()); ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f); ImGui::SetCursorPosX(win_size.x - m_line_height * 5.0f); ImGui::SetCursorPosY(win_size.y / 2 - button_size.y); @@ -1182,7 +1182,7 @@ void NotificationManager::URLDownloadNotification::render_open_button_inner(ImGu button_text = ImGui::OpenHoverButton; } - ImVec2 button_pic_size = ImGui::CalcTextSize(boost::nowide::narrow(button_text).c_str()); + ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str()); ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f); ImGui::SetCursorPosX(win_size.x - m_line_height * 5.0f); ImGui::SetCursorPosY(win_size.y / 2 - button_size.y); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f014196af5..5956cde4b7 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4324,7 +4324,7 @@ bool Plater::preview_zip_archive(const boost::filesystem::path& archive_path) if (size != stat.m_uncomp_size) // size must fit continue; wxString wname = boost::nowide::widen(stat.m_filename); - std::string name = boost::nowide::narrow(wname); + std::string name = into_u8(wname); fs::path archive_path(name); std::string extra(1024, 0); diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index 8c25915a0d..6a2eb078ba 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -203,7 +203,7 @@ std::string PrintHostSendDialog::storage() const return GUI::format("%1%", m_preselected_storage); if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= int(m_paths.size())) return {}; - return boost::nowide::narrow(m_paths[combo_storage->GetSelection()]); + return into_u8(m_paths[combo_storage->GetSelection()]); } void PrintHostSendDialog::EndModal(int ret) @@ -469,7 +469,7 @@ void PrintHostQueueDialog::on_progress(Event &evt) job_list->GetValue(hst, evt.job_id, COL_HOST); const wchar_t * nm_str = nm.GetString(); const wchar_t * hst_str = hst.GetString(); - wxGetApp().notification_manager()->set_upload_job_notification_percentage(evt.job_id + 1, boost::nowide::narrow(nm_str), boost::nowide::narrow(hst_str), evt.progress / 100.f); + wxGetApp().notification_manager()->set_upload_job_notification_percentage(evt.job_id + 1, into_u8(nm_str), into_u8(hst_str), evt.progress / 100.f); } } @@ -515,17 +515,17 @@ void PrintHostQueueDialog::on_info(Event& evt) if (evt.tag == L"resolve") { wxVariant hst(evt.status); job_list->SetValue(hst, evt.job_id, COL_HOST); - wxGetApp().notification_manager()->set_upload_job_notification_host(evt.job_id + 1, boost::nowide::narrow(evt.status)); + wxGetApp().notification_manager()->set_upload_job_notification_host(evt.job_id + 1, into_u8(evt.status)); } else if (evt.tag == L"complete") { wxVariant hst(evt.status); job_list->SetValue(hst, evt.job_id, COL_ERRORMSG); wxGetApp().notification_manager()->set_upload_job_notification_completed(evt.job_id + 1); - wxGetApp().notification_manager()->set_upload_job_notification_status(evt.job_id + 1, boost::nowide::narrow(evt.status)); + wxGetApp().notification_manager()->set_upload_job_notification_status(evt.job_id + 1, into_u8(evt.status)); } else if(evt.tag == L"complete_with_warning"){ wxVariant hst(evt.status); job_list->SetValue(hst, evt.job_id, COL_ERRORMSG); wxGetApp().notification_manager()->set_upload_job_notification_completed_with_warning(evt.job_id + 1); - wxGetApp().notification_manager()->set_upload_job_notification_status(evt.job_id + 1, boost::nowide::narrow(evt.status)); + wxGetApp().notification_manager()->set_upload_job_notification_status(evt.job_id + 1, into_u8(evt.status)); } else if (evt.tag == L"set_complete_off") { wxGetApp().notification_manager()->set_upload_job_notification_comp_on_100(evt.job_id + 1, false); } diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 52ae1dad8b..679fcc836c 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -77,8 +77,8 @@ std::vector RemovableDriveManager::search_for_removable_drives() cons ULARGE_INTEGER free_space; ::GetDiskFreeSpaceExW(wpath.c_str(), &free_space, nullptr, nullptr); if (free_space.QuadPart > 0) { - path += "\\"; - current_drives.emplace_back(DriveData{ boost::nowide::narrow(volume_name), path }); + path += "\\"; + current_drives.emplace_back(DriveData{ boost::nowide::narrow(volume_name), path }); } } } diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 09c46bf97a..ff2798abd5 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -57,7 +57,7 @@ static char marker_by_type(Preset::Type type, PrinterTechnology pt) std::string Option::opt_key() const { - return boost::nowide::narrow(key).substr(2); + return into_u8(key).substr(2); } void FoundOption::get_marked_label_and_tooltip(const char** label_, const char** tooltip_) const diff --git a/src/slic3r/GUI/SendSystemInfoDialog.cpp b/src/slic3r/GUI/SendSystemInfoDialog.cpp index 2a367f36c5..7d11042e9b 100644 --- a/src/slic3r/GUI/SendSystemInfoDialog.cpp +++ b/src/slic3r/GUI/SendSystemInfoDialog.cpp @@ -493,7 +493,7 @@ static std::string generate_system_info_json() std::vector blacklisted_libraries; BlacklistedLibraryCheck::get_instance().get_blacklisted(blacklisted_libraries); for (const std::wstring& wstr : blacklisted_libraries) { - std::string utf8 = boost::nowide::narrow(wstr); + std::string utf8 = into_u8(wstr); if (size_t last_bs_pos = utf8.find_last_of("\\"); last_bs_pos < utf8.size() - 1) { // Remove anything before last backslash so we don't send the path to the DLL. utf8.erase(0, last_bs_pos + 1); diff --git a/src/slic3r/GUI/Sidebar.cpp b/src/slic3r/GUI/Sidebar.cpp index 39867712a0..4f6be2b61f 100644 --- a/src/slic3r/GUI/Sidebar.cpp +++ b/src/slic3r/GUI/Sidebar.cpp @@ -920,7 +920,7 @@ void Sidebar::update_sliced_info_sizer() wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : from_u8(short_time_ui(get_time_dhms(float(ps.estimated_print_time)))); m_sliced_info->SetTextAndShow(siEstimatedTime, t_est, _L("Estimated printing time") + ":"); - m_plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + boost::nowide::narrow(t_est), m_plater->is_sidebar_collapsed()); + m_plater->get_notification_manager()->set_slicing_complete_print_time(_u8L("Estimated printing time") + ": " + into_u8(t_est), m_plater->is_sidebar_collapsed()); // Hide non-SLA sliced info parameters m_sliced_info->SetTextAndShow(siFilament_m, "N/A"); diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index 6b088d8ad5..03cab91509 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -149,7 +149,7 @@ void WifiConfigDialog::on_retrieve_password(wxCommandEvent& e) return; } - std::string psk = m_wifi_scanner->get_psk(boost::nowide::narrow(m_ssid_combo->GetValue())); + std::string psk = m_wifi_scanner->get_psk(into_u8(m_ssid_combo->GetValue())); if (psk.empty()) { // TRN Alert message when retrieving password for wifi from keychain. Probably will display only on Apple so keychain is MacOS term. wxString msg = _L("No password in the keychain for given SSID."); @@ -214,7 +214,7 @@ void WifiConfigDialog::on_ok(wxCommandEvent& e) return; } - std::string selected_path = boost::nowide::narrow(m_drive_combo->GetValue()); + std::string selected_path = into_u8(m_drive_combo->GetValue()); if (selected_path.empty()) { // TRN Alert message when writing WiFi configuration file to usb drive. diff --git a/src/slic3r/Utils/AppUpdater.cpp b/src/slic3r/Utils/AppUpdater.cpp index eb407f4276..f8ad97905f 100644 --- a/src/slic3r/Utils/AppUpdater.cpp +++ b/src/slic3r/Utils/AppUpdater.cpp @@ -58,8 +58,8 @@ namespace { std::string ret; PWSTR path = NULL; HRESULT hr = SHGetKnownFolderPath(FOLDERID_Downloads, 0, NULL, &path); - if (SUCCEEDED(hr)) { - ret = boost::nowide::narrow(path); + if (SUCCEEDED(hr)) { + ret = boost::nowide::narrow(path); } CoTaskMemFree(path); return ret; diff --git a/src/slic3r/Utils/Duet.cpp b/src/slic3r/Utils/Duet.cpp index aeaee69b4c..0cc114d171 100644 --- a/src/slic3r/Utils/Duet.cpp +++ b/src/slic3r/Utils/Duet.cpp @@ -101,7 +101,7 @@ bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn e if (dsf) { http.set_put_body(upload_data.source_path); if (connect_msg.empty()) - http.header("X-Session-Key", boost::nowide::narrow(connect_msg)); + http.header("X-Session-Key", GUI::into_u8(connect_msg)); } else { http.set_post_body(upload_data.source_path); } diff --git a/src/slic3r/Utils/Serial.cpp b/src/slic3r/Utils/Serial.cpp index d355fff973..2fe8e299af 100644 --- a/src/slic3r/Utils/Serial.cpp +++ b/src/slic3r/Utils/Serial.cpp @@ -128,8 +128,8 @@ std::vector scan_serial_ports_extended() wchar_t pszPortName[4096]; DWORD dwSize = sizeof(pszPortName); DWORD dwType = 0; - if (RegQueryValueEx(hDeviceKey, L"PortName", NULL, &dwType, (LPBYTE)pszPortName, &dwSize) == ERROR_SUCCESS) - port_info.port = boost::nowide::narrow(pszPortName); + if (RegQueryValueEx(hDeviceKey, L"PortName", NULL, &dwType, (LPBYTE)pszPortName, &dwSize) == ERROR_SUCCESS) + port_info.port = boost::nowide::narrow(pszPortName); RegCloseKey(hDeviceKey); if (port_info.port.empty()) continue; @@ -142,8 +142,8 @@ std::vector scan_serial_ports_extended() std::vector hardware_id(reqSize > 1 ? reqSize : 1); // Now store it in a buffer. if (! SetupDiGetDeviceRegistryProperty(hDeviceInfo, &devInfoData, SPDRP_HARDWAREID, ®DataType, (BYTE*)hardware_id.data(), reqSize, nullptr)) - continue; - parse_hardware_id(boost::nowide::narrow(hardware_id.data()), port_info); + continue; + parse_hardware_id(boost::nowide::narrow(hardware_id.data()), port_info); // Find the size required to hold the friendly name. reqSize = 0; @@ -153,8 +153,8 @@ std::vector scan_serial_ports_extended() // Now store it in a buffer. if (! SetupDiGetDeviceRegistryProperty(hDeviceInfo, &devInfoData, SPDRP_FRIENDLYNAME, nullptr, (BYTE*)friendly_name.data(), reqSize, nullptr)) { port_info.friendly_name = port_info.port; - } else { - port_info.friendly_name = boost::nowide::narrow(friendly_name.data()); + } else { + port_info.friendly_name = boost::nowide::narrow(friendly_name.data()); port_info.is_printer = looks_like_printer(port_info.friendly_name); } output.emplace_back(std::move(port_info)); diff --git a/src/slic3r/Utils/WifiScanner.cpp b/src/slic3r/Utils/WifiScanner.cpp index 260583516d..e7ac0844d7 100644 --- a/src/slic3r/Utils/WifiScanner.cpp +++ b/src/slic3r/Utils/WifiScanner.cpp @@ -1,8 +1,7 @@ #include "WifiScanner.hpp" - +#include "slic3r/GUI/GUI.hpp" #include -#include #include #include @@ -143,7 +142,7 @@ void fill_wifi_map(Slic3r::WifiSsidPskMap& wifi_map, std::string& connected_ssid { wxString xml(xmlstr); boost::property_tree::ptree pt; - std::stringstream ss(boost::nowide::narrow(xml)); + std::stringstream ss(Slic3r::GUI::into_u8(xml)); boost::property_tree::read_xml(ss, pt); std::string password; std::string psk_protected; @@ -457,4 +456,4 @@ std::string WifiScanner::get_psk(const std::string& ssid) } return {}; } -} // Slic3r \ No newline at end of file +} // Slic3r