Skip to content

Commit

Permalink
Fixed localization issue of the "Removable media unmounted" message.
Browse files Browse the repository at this point in the history
Generalized the Slic3r::show_info() function to std::strings and
const char*
  • Loading branch information
bubnikv committed Feb 29, 2020
1 parent 192bdff commit c9a75bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/slic3r/GUI/GUI.cpp
Expand Up @@ -231,6 +231,7 @@ void show_error(wxWindow* parent, const wxString& message)

void show_error(wxWindow* parent, const char* message)
{
assert(message);
show_error(parent, wxString::FromUTF8(message));
}

Expand All @@ -242,10 +243,16 @@ void show_error_id(int id, const std::string& message)

void show_info(wxWindow* parent, const wxString& message, const wxString& title)
{
wxMessageDialog msg_wingow(parent, message, title.empty() ? _(L("Notice")) : title, wxOK | wxICON_INFORMATION);
wxMessageDialog msg_wingow(parent, message, wxString(SLIC3R_APP_NAME " - ") + (title.empty() ? _(L("Notice")) : title), wxOK | wxICON_INFORMATION);
msg_wingow.ShowModal();
}

void show_info(wxWindow* parent, const char* message, const char* title)
{
assert(message);
show_info(parent, wxString::FromUTF8(message), title ? wxString::FromUTF8(title) : wxString());
}

void warning_catcher(wxWindow* parent, const wxString& message)
{
wxMessageDialog msg(parent, message, _(L("Warning")), wxOK | wxICON_WARNING);
Expand Down
4 changes: 3 additions & 1 deletion src/slic3r/GUI/GUI.hpp
Expand Up @@ -42,7 +42,9 @@ void show_error(wxWindow* parent, const wxString& message);
void show_error(wxWindow* parent, const char* message);
inline void show_error(wxWindow* parent, const std::string& message) { show_error(parent, message.c_str()); }
void show_error_id(int id, const std::string& message); // For Perl
void show_info(wxWindow* parent, const wxString& message, const wxString& title);

This comment has been minimized.

Copy link
@jarl-dk

jarl-dk Mar 1, 2020

Contributor

This line makes the build fail:

PrusaSlicer/src/slic3r/GUI/MainFrame.cpp:1031:49: error: call of overloaded ‘show_info(Slic3r::GUI::MainFrame*, const wxString&, const char [5])’ is ambiguous
void show_info(wxWindow* parent, const wxString& message, const wxString& title = wxString());
void show_info(wxWindow* parent, const char* message, const char* title = nullptr);
inline void show_info(wxWindow* parent, const std::string& message,const std::string& title = std::string()) { show_info(parent, message.c_str(), title.c_str()); }
void warning_catcher(wxWindow* parent, const wxString& message);

// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
Expand Down
9 changes: 4 additions & 5 deletions src/slic3r/GUI/Plater.cpp
Expand Up @@ -5199,11 +5199,10 @@ void Plater::drive_ejected_callback()
if (RemovableDriveManager::get_instance().get_did_eject())
{
RemovableDriveManager::get_instance().set_did_eject(false);
wxString message = wxString::Format(
_(L("Unmounting successful. The device %s(%s) can now be safely removed from the computer.")),
RemovableDriveManager::get_instance().get_ejected_name(),
RemovableDriveManager::get_instance().get_ejected_path());
wxMessageBox(message);
show_info(this,
(boost::format(_utf8(L("Unmounting successful. The device %s(%s) can now be safely removed from the computer.")))
% RemovableDriveManager::get_instance().get_ejected_name()
% RemovableDriveManager::get_instance().get_ejected_path()).str());
}
p->show_action_buttons(false);
}
Expand Down

0 comments on commit c9a75bb

Please sign in to comment.