Skip to content

Commit

Permalink
Replace wxHelper::MakeUTF8 with wxString.utf8_string
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs00 committed Sep 6, 2023
1 parent 380fe76 commit 0579446
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/gui/GraphicPacksWindow2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ void GraphicPacksWindow2::OnActivePresetChanged(wxCommandEvent& event)
wxASSERT(obj);
const auto string_data = dynamic_cast<wxStringClientData*>(obj->GetClientObject());
wxASSERT(string_data);
const auto preset = wxHelper::MakeUTF8(obj->GetStringSelection());
if(m_shown_graphic_pack->SetActivePreset(wxHelper::MakeUTF8(string_data->GetData()), preset))
const auto preset = obj->GetStringSelection().utf8_string();
if(m_shown_graphic_pack->SetActivePreset(string_data->GetData().utf8_string(), preset))
{
wxWindowUpdateLocker lock(this);
ClearPresets();
Expand Down Expand Up @@ -668,7 +668,7 @@ void GraphicPacksWindow2::SashPositionChanged(wxEvent& event)

void GraphicPacksWindow2::OnFilterUpdate(wxEvent& event)
{
m_filter = wxHelper::MakeUTF8(m_filter_text->GetValue());
m_filter = m_filter_text->GetValue().utf8_string();
FillGraphicPackList();
event.Skip();
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/components/wxGameList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
if(dialog.ShowModal() == wxID_OK)
{
const auto custom_name = dialog.GetValue();
GetConfig().SetGameListCustomName(title_id, wxHelper::MakeUTF8(custom_name));
GetConfig().SetGameListCustomName(title_id, custom_name.utf8_string());
m_name_cache.clear();
g_config.Save();
// update list entry
Expand Down
7 changes: 0 additions & 7 deletions src/gui/wxHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@

namespace wxHelper
{
// wxString to utf8 std::string
inline std::string MakeUTF8(const wxString& str)
{
auto tmpUtf8 = str.ToUTF8();
return std::string(tmpUtf8.data(), tmpUtf8.length());
}

inline fs::path MakeFSPath(const wxString& str)
{
auto tmpUtf8 = str.ToUTF8();
Expand Down

0 comments on commit 0579446

Please sign in to comment.