fix(modulo): fix icon loading when path includes unicode chars. Fix #554

This commit is contained in:
Federico Terzi 2021-10-12 21:19:05 +02:00
parent 48bd591bd6
commit 45b20fd067
5 changed files with 12 additions and 12 deletions

View File

@ -102,8 +102,8 @@ enum
bool FormApp::OnInit() bool FormApp::OnInit()
{ {
FormFrame *frame = new FormFrame(formMetadata->windowTitle, wxPoint(50, 50), wxSize(450, 340) ); FormFrame *frame = new FormFrame(wxString::FromUTF8(formMetadata->windowTitle), wxPoint(50, 50), wxSize(450, 340) );
setFrameIcon(formMetadata->iconPath, frame); setFrameIcon(wxString::FromUTF8(formMetadata->iconPath), frame);
frame->Show( true ); frame->Show( true );
Activate(frame); Activate(frame);

View File

@ -166,7 +166,7 @@ private:
bool SearchApp::OnInit() bool SearchApp::OnInit()
{ {
SearchFrame *frame = new SearchFrame(searchMetadata->windowTitle, wxPoint(50, 50), wxSize(450, 340)); SearchFrame *frame = new SearchFrame(wxString::FromUTF8(searchMetadata->windowTitle), wxPoint(50, 50), wxSize(450, 340));
frame->Show(true); frame->Show(true);
SetupWindowStyle(frame); SetupWindowStyle(frame);
Activate(frame); Activate(frame);
@ -198,7 +198,7 @@ SearchFrame::SearchFrame(const wxString &title, const wxPoint &pos, const wxSize
iconPanel = nullptr; iconPanel = nullptr;
if (searchMetadata->iconPath) if (searchMetadata->iconPath)
{ {
wxString iconPath = wxString(searchMetadata->iconPath); wxString iconPath = wxString::FromUTF8(searchMetadata->iconPath);
if (wxFileExists(iconPath)) if (wxFileExists(iconPath))
{ {
wxBitmap bitmap = wxBitmap(iconPath, wxBITMAP_TYPE_PNG); wxBitmap bitmap = wxBitmap(iconPath, wxBITMAP_TYPE_PNG);

View File

@ -81,7 +81,7 @@ public:
if (error_set_metadata->errors[i].level == ERROR_METADATA_LEVEL_WARNING) { if (error_set_metadata->errors[i].level == ERROR_METADATA_LEVEL_WARNING) {
level = wxT("WARNING"); level = wxT("WARNING");
} }
wxString error_text = wxString::Format(wxT("[%s] %s\n"), level, error_set_metadata->errors[i].message); wxString error_text = wxString::Format(wxT("[%s] %s\n"), level, wxString::FromUTF8(error_set_metadata->errors[i].message));
errors_text.Append(error_text); errors_text.Append(error_text);
} }
@ -171,7 +171,7 @@ bool TroubleshootingApp::OnInit()
if (troubleshooting_metadata->window_icon_path) if (troubleshooting_metadata->window_icon_path)
{ {
setFrameIcon(troubleshooting_metadata->window_icon_path, frame); setFrameIcon(wxString::FromUTF8(troubleshooting_metadata->window_icon_path), frame);
} }
frame->Show(true); frame->Show(true);

View File

@ -54,7 +54,7 @@ DerivedWelcomeFrame::DerivedWelcomeFrame(wxWindow *parent)
if (welcome_metadata->tray_image_path) if (welcome_metadata->tray_image_path)
{ {
wxBitmap trayBitmap = wxBitmap(welcome_metadata->tray_image_path, wxBITMAP_TYPE_PNG); wxBitmap trayBitmap = wxBitmap(wxString::FromUTF8(welcome_metadata->tray_image_path), wxBITMAP_TYPE_PNG);
this->tray_bitmap->SetBitmap(trayBitmap); this->tray_bitmap->SetBitmap(trayBitmap);
#ifdef __WXOSX__ #ifdef __WXOSX__
this->tray_info_label->SetLabel("You should see the espanso icon on the status bar:"); this->tray_info_label->SetLabel("You should see the espanso icon on the status bar:");
@ -91,7 +91,7 @@ bool WelcomeApp::OnInit()
if (welcome_metadata->window_icon_path) if (welcome_metadata->window_icon_path)
{ {
setFrameIcon(welcome_metadata->window_icon_path, frame); setFrameIcon(wxString::FromUTF8(welcome_metadata->window_icon_path), frame);
} }
frame->Show(true); frame->Show(true);

View File

@ -130,7 +130,7 @@ DerivedFrame::DerivedFrame(wxWindow *parent)
if (wizard_metadata->welcome_image_path) if (wizard_metadata->welcome_image_path)
{ {
wxBitmap welcomeBitmap = wxBitmap(wizard_metadata->welcome_image_path, wxBITMAP_TYPE_PNG); wxBitmap welcomeBitmap = wxBitmap(wxString::FromUTF8(wizard_metadata->welcome_image_path), wxBITMAP_TYPE_PNG);
this->welcome_image->SetBitmap(welcomeBitmap); this->welcome_image->SetBitmap(welcomeBitmap);
} }
@ -140,12 +140,12 @@ DerivedFrame::DerivedFrame(wxWindow *parent)
if (wizard_metadata->accessibility_image_1_path) if (wizard_metadata->accessibility_image_1_path)
{ {
wxBitmap accessiblityImage1 = wxBitmap(wizard_metadata->accessibility_image_1_path, wxBITMAP_TYPE_PNG); wxBitmap accessiblityImage1 = wxBitmap(wxString::FromUTF8(wizard_metadata->accessibility_image_1_path), wxBITMAP_TYPE_PNG);
this->accessibility_image1->SetBitmap(accessiblityImage1); this->accessibility_image1->SetBitmap(accessiblityImage1);
} }
if (wizard_metadata->accessibility_image_2_path) if (wizard_metadata->accessibility_image_2_path)
{ {
wxBitmap accessiblityImage2 = wxBitmap(wizard_metadata->accessibility_image_2_path, wxBITMAP_TYPE_PNG); wxBitmap accessiblityImage2 = wxBitmap(wxString::FromUTF8(wizard_metadata->accessibility_image_2_path), wxBITMAP_TYPE_PNG);
this->accessibility_image2->SetBitmap(accessiblityImage2); this->accessibility_image2->SetBitmap(accessiblityImage2);
} }
@ -380,7 +380,7 @@ bool WizardApp::OnInit()
if (wizard_metadata->window_icon_path) if (wizard_metadata->window_icon_path)
{ {
setFrameIcon(wizard_metadata->window_icon_path, frame); setFrameIcon(wxString::FromUTF8(wizard_metadata->window_icon_path), frame);
} }
frame->Show(true); frame->Show(true);