mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-07-11 01:25:15 +02:00
UI: Replace to_wxString and wxHelper::FromUtf8 with wxString::FromUTF8 (#1752)
This commit is contained in:
+1
-2
@@ -56,7 +56,6 @@ fs::path _utf8ToPath(std::string_view input);
|
|||||||
|
|
||||||
// wxString <-> std::string
|
// wxString <-> std::string
|
||||||
wxString wxString::FromUTF8(const std::string& s)
|
wxString wxString::FromUTF8(const std::string& s)
|
||||||
wxString to_wxString(std::string_view str); // in gui/helpers.h
|
|
||||||
std::string wxString::utf8_string();
|
std::string wxString::utf8_string();
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -96,4 +95,4 @@ namespace coreinit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
You may also see some code which uses `osLib_addFunction` directly. This is a deprecated way of registering functions.
|
You may also see some code which uses `osLib_addFunction` directly. This is a deprecated way of registering functions.
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ void CemuApp::InitializeExistingMLCOrFail(fs::path mlc)
|
|||||||
|
|
||||||
std::string TranslationCallback(std::string_view msgId)
|
std::string TranslationCallback(std::string_view msgId)
|
||||||
{
|
{
|
||||||
return wxGetTranslation(to_wxString(msgId)).utf8_string();
|
return wxGetTranslation(wxString::FromUTF8(msgId)).utf8_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CemuApp::OnInit()
|
bool CemuApp::OnInit()
|
||||||
@@ -304,7 +304,7 @@ bool CemuApp::OnInit()
|
|||||||
|
|
||||||
for (auto&& path : failedWriteAccess)
|
for (auto&& path : failedWriteAccess)
|
||||||
{
|
{
|
||||||
wxMessageBox(formatWxString(_("Cemu can't write to {}!"), wxString::FromUTF8(_pathToUtf8(path))),
|
wxMessageBox(formatWxString(_("Cemu can't write to {}!"), wxHelper::FromPath(path)),
|
||||||
_("Warning"), wxOK | wxCENTRE | wxICON_EXCLAMATION, nullptr);
|
_("Warning"), wxOK | wxCENTRE | wxICON_EXCLAMATION, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ void ChecksumTool::VerifyJsonEntry(const rapidjson::Document& doc)
|
|||||||
if (dialog.ShowModal() != wxID_OK || dialog.GetPath().IsEmpty())
|
if (dialog.ShowModal() != wxID_OK || dialog.GetPath().IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::string path = dialog.GetPath().ToUTF8().data();
|
const std::string path = dialog.GetPath().utf8_string();
|
||||||
std::ofstream file(path);
|
std::ofstream file(path);
|
||||||
if (file.is_open())
|
if (file.is_open())
|
||||||
{
|
{
|
||||||
@@ -519,7 +519,7 @@ void ChecksumTool::VerifyJsonEntry(const rapidjson::Document& doc)
|
|||||||
file.flush();
|
file.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", path)));
|
wxLaunchDefaultBrowser(formatWxString("file:{}", path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxMessageBox(_("Can't open file to write!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
wxMessageBox(_("Can't open file to write!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ void GameProfileWindow::OnControllerProfileDropdown(wxCommandEvent& event)
|
|||||||
auto profiles = InputManager::get_profiles();
|
auto profiles = InputManager::get_profiles();
|
||||||
for (const auto& profile : profiles)
|
for (const auto& profile : profiles)
|
||||||
{
|
{
|
||||||
cb->Append(to_wxString(profile));
|
cb->Append(wxString::FromUTF8(profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
cb->SetStringSelection(selected_value);
|
cb->SetStringSelection(selected_value);
|
||||||
@@ -309,7 +309,7 @@ void GameProfileWindow::ApplyProfile()
|
|||||||
cb->Clear();
|
cb->Clear();
|
||||||
for (const auto& profile : profiles)
|
for (const auto& profile : profiles)
|
||||||
{
|
{
|
||||||
cb->Append(to_wxString(profile));
|
cb->Append(wxString::FromUTF8(profile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1797,7 +1797,7 @@ void GeneralSettings2::ApplyConfig()
|
|||||||
if (LaunchSettings::GetMLCPath().has_value())
|
if (LaunchSettings::GetMLCPath().has_value())
|
||||||
m_mlc_path->SetValue(wxHelper::FromPath(LaunchSettings::GetMLCPath().value()));
|
m_mlc_path->SetValue(wxHelper::FromPath(LaunchSettings::GetMLCPath().value()));
|
||||||
else
|
else
|
||||||
m_mlc_path->SetValue(wxHelper::FromUtf8(config.mlc_path.GetValue()));
|
m_mlc_path->SetValue(wxString::FromUTF8(config.mlc_path.GetValue()));
|
||||||
|
|
||||||
m_save_window_position_size->SetValue(wxGUIconfig.window_position != Vector2i{-1,-1});
|
m_save_window_position_size->SetValue(wxGUIconfig.window_position != Vector2i{-1,-1});
|
||||||
m_save_padwindow_position_size->SetValue(wxGUIconfig.pad_position != Vector2i{-1,-1});
|
m_save_padwindow_position_size->SetValue(wxGUIconfig.pad_position != Vector2i{-1,-1});
|
||||||
@@ -1825,7 +1825,7 @@ void GeneralSettings2::ApplyConfig()
|
|||||||
m_game_paths->Clear();
|
m_game_paths->Clear();
|
||||||
for (auto& path : config.game_paths)
|
for (auto& path : config.game_paths)
|
||||||
{
|
{
|
||||||
m_game_paths->Append(to_wxString(path));
|
m_game_paths->Append(wxString::FromUTF8(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto app = (CemuApp*)wxTheApp;
|
const auto app = (CemuApp*)wxTheApp;
|
||||||
@@ -1989,7 +1989,7 @@ void GeneralSettings2::ApplyConfig()
|
|||||||
// debug
|
// debug
|
||||||
m_crash_dump->SetSelection((int)config.crash_dump.GetValue());
|
m_crash_dump->SetSelection((int)config.crash_dump.GetValue());
|
||||||
m_gdb_port->SetValue(config.gdb_port.GetValue());
|
m_gdb_port->SetValue(config.gdb_port.GetValue());
|
||||||
m_gpu_capture_dir->SetValue(wxHelper::FromUtf8(config.gpu_capture_dir.GetValue()));
|
m_gpu_capture_dir->SetValue(wxString::FromUTF8(config.gpu_capture_dir.GetValue()));
|
||||||
m_framebuffer_fetch->SetValue(config.framebuffer_fetch);
|
m_framebuffer_fetch->SetValue(config.framebuffer_fetch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "helpers/wxHelpers.h"
|
||||||
#include "wxgui/wxgui.h"
|
#include "wxgui/wxgui.h"
|
||||||
#include "wxgui/GraphicPacksWindow2.h"
|
#include "wxgui/GraphicPacksWindow2.h"
|
||||||
#include "wxgui/DownloadGraphicPacksWindow.h"
|
#include "wxgui/DownloadGraphicPacksWindow.h"
|
||||||
@@ -91,10 +92,10 @@ void GraphicPacksWindow2::FillGraphicPackList() const
|
|||||||
const auto parent_node = node;
|
const auto parent_node = node;
|
||||||
if (i < (tokens.size() - 1))
|
if (i < (tokens.size() - 1))
|
||||||
{
|
{
|
||||||
node = FindTreeItem(parent_node, wxHelper::FromUtf8(token));
|
node = FindTreeItem(parent_node, wxString::FromUTF8(token));
|
||||||
if (!node.IsOk())
|
if (!node.IsOk())
|
||||||
{
|
{
|
||||||
node = m_graphic_pack_tree->AppendItem(parent_node, wxHelper::FromUtf8(token));
|
node = m_graphic_pack_tree->AppendItem(parent_node, wxString::FromUTF8(token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -103,10 +104,10 @@ void GraphicPacksWindow2::FillGraphicPackList() const
|
|||||||
// if a node with same name already exists, add a number suffix
|
// if a node with same name already exists, add a number suffix
|
||||||
for (sint32 s = 0; s < 999; s++)
|
for (sint32 s = 0; s < 999; s++)
|
||||||
{
|
{
|
||||||
wxString nodeName = wxHelper::FromUtf8(token);
|
wxString nodeName = wxString::FromUTF8(token);
|
||||||
if (s > 0)
|
if (s > 0)
|
||||||
nodeName.append(wxHelper::FromUtf8(fmt::format(" #{}", s + 1)));
|
nodeName.append(formatWxString(" #{}", s + 1));
|
||||||
|
|
||||||
node = FindTreeItem(parent_node, nodeName);
|
node = FindTreeItem(parent_node, nodeName);
|
||||||
if (!node.IsOk())
|
if (!node.IsOk())
|
||||||
{
|
{
|
||||||
@@ -220,7 +221,7 @@ GraphicPacksWindow2::GraphicPacksWindow2(wxWindow* parent, uint64_t title_id_fil
|
|||||||
text->Wrap(-1);
|
text->Wrap(-1);
|
||||||
filter_row->Add(text, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
filter_row->Add(text, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
|
|
||||||
m_filter_text = new wxTextCtrl(left_panel, wxID_ANY, wxHelper::FromUtf8(m_filter), wxDefaultPosition, wxDefaultSize, 0);
|
m_filter_text = new wxTextCtrl(left_panel, wxID_ANY, wxString::FromUTF8(m_filter), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
filter_row->Add(m_filter_text, 0, wxALL | wxEXPAND, 5);
|
filter_row->Add(m_filter_text, 0, wxALL | wxEXPAND, 5);
|
||||||
m_filter_text->Bind(wxEVT_COMMAND_TEXT_UPDATED, &GraphicPacksWindow2::OnFilterUpdate, this);
|
m_filter_text->Bind(wxEVT_COMMAND_TEXT_UPDATED, &GraphicPacksWindow2::OnFilterUpdate, this);
|
||||||
|
|
||||||
@@ -390,7 +391,7 @@ void GraphicPacksWindow2::LoadPresetSelections(const GraphicPackPtr& gp)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString categoryWxStr = wxHelper::FromUtf8(category);
|
wxString categoryWxStr = wxString::FromUTF8(category);
|
||||||
wxString label(category.empty() ? _("Active preset") : categoryWxStr);
|
wxString label(category.empty() ? _("Active preset") : categoryWxStr);
|
||||||
auto* box = new wxStaticBox(m_preset_sizer->GetContainingWindow(), wxID_ANY, label);
|
auto* box = new wxStaticBox(m_preset_sizer->GetContainingWindow(), wxID_ANY, label);
|
||||||
auto* box_sizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
auto* box_sizer = new wxStaticBoxSizer(box, wxVERTICAL);
|
||||||
@@ -405,13 +406,13 @@ void GraphicPacksWindow2::LoadPresetSelections(const GraphicPackPtr& gp)
|
|||||||
if (!pentry->visible)
|
if (!pentry->visible)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
preset->AppendString(wxHelper::FromUtf8(pentry->name));
|
preset->AppendString(wxString::FromUTF8(pentry->name));
|
||||||
if (pentry->active)
|
if (pentry->active)
|
||||||
active_preset = pentry->name;
|
active_preset = pentry->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_preset)
|
if (active_preset)
|
||||||
preset->SetStringSelection(wxHelper::FromUtf8(active_preset.value()));
|
preset->SetStringSelection(wxString::FromUTF8(active_preset.value()));
|
||||||
else if (preset->GetCount() > 0)
|
else if (preset->GetCount() > 0)
|
||||||
preset->SetSelection(0);
|
preset->SetSelection(0);
|
||||||
|
|
||||||
@@ -443,14 +444,14 @@ void GraphicPacksWindow2::OnTreeSelectionChanged(wxTreeEvent& event)
|
|||||||
{
|
{
|
||||||
m_preset_sizer->Clear(true);
|
m_preset_sizer->Clear(true);
|
||||||
m_gp_name = gp->GetName();
|
m_gp_name = gp->GetName();
|
||||||
m_graphic_pack_name->SetLabel(wxHelper::FromUtf8(m_gp_name));
|
m_graphic_pack_name->SetLabel(wxString::FromUTF8(m_gp_name));
|
||||||
|
|
||||||
if (gp->GetDescription().empty())
|
if (gp->GetDescription().empty())
|
||||||
m_gp_description = _("This graphic pack has no description").utf8_string();
|
m_gp_description = _("This graphic pack has no description").utf8_string();
|
||||||
else
|
else
|
||||||
m_gp_description = gp->GetDescription();
|
m_gp_description = gp->GetDescription();
|
||||||
|
|
||||||
m_graphic_pack_description->SetLabel(wxHelper::FromUtf8(m_gp_description));
|
m_graphic_pack_description->SetLabel(wxString::FromUTF8(m_gp_description));
|
||||||
|
|
||||||
LoadPresetSelections(gp);
|
LoadPresetSelections(gp);
|
||||||
|
|
||||||
@@ -503,7 +504,7 @@ void GraphicPacksWindow2::OnTreeChoiceChanged(wxTreeEvent& event)
|
|||||||
bool isRunning = CafeSystem::IsTitleRunning() && graphic_pack->ContainsTitleId(CafeSystem::GetForegroundTitleId());
|
bool isRunning = CafeSystem::IsTitleRunning() && graphic_pack->ContainsTitleId(CafeSystem::GetForegroundTitleId());
|
||||||
if (isRunning)
|
if (isRunning)
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
GraphicPack2::ActivateGraphicPack(graphic_pack);
|
GraphicPack2::ActivateGraphicPack(graphic_pack);
|
||||||
if (!requiresRestart)
|
if (!requiresRestart)
|
||||||
@@ -642,10 +643,10 @@ void GraphicPacksWindow2::OnSizeChanged(wxSizeEvent& event)
|
|||||||
obj->SetSashPosition((sint32)(m_ratio * width));
|
obj->SetSashPosition((sint32)(m_ratio * width));
|
||||||
|
|
||||||
if (!m_gp_name.empty())
|
if (!m_gp_name.empty())
|
||||||
m_graphic_pack_name->SetLabel(wxHelper::FromUtf8(m_gp_name));
|
m_graphic_pack_name->SetLabel(wxString::FromUTF8(m_gp_name));
|
||||||
|
|
||||||
if (!m_gp_description.empty())
|
if (!m_gp_description.empty())
|
||||||
m_graphic_pack_description->SetLabel(wxHelper::FromUtf8(m_gp_description));
|
m_graphic_pack_description->SetLabel(wxString::FromUTF8(m_gp_description));
|
||||||
|
|
||||||
m_graphic_pack_name->Wrap(m_graphic_pack_name->GetParent()->GetClientSize().GetWidth() - 10);
|
m_graphic_pack_name->Wrap(m_graphic_pack_name->GetParent()->GetClientSize().GetWidth() - 10);
|
||||||
m_graphic_pack_description->Wrap(m_graphic_pack_description->GetParent()->GetClientSize().GetWidth() - 10);
|
m_graphic_pack_description->Wrap(m_graphic_pack_description->GetParent()->GetClientSize().GetWidth() - 10);
|
||||||
|
|||||||
@@ -1593,7 +1593,7 @@ void MainWindow::OnGameLoaded()
|
|||||||
void MainWindow::AsyncSetTitle(std::string_view windowTitle)
|
void MainWindow::AsyncSetTitle(std::string_view windowTitle)
|
||||||
{
|
{
|
||||||
wxCommandEvent set_title_event(wxEVT_SET_WINDOW_TITLE);
|
wxCommandEvent set_title_event(wxEVT_SET_WINDOW_TITLE);
|
||||||
set_title_event.SetString(wxHelper::FromUtf8(windowTitle));
|
set_title_event.SetString(wxString::FromUTF8(windowTitle));
|
||||||
g_mainFrame->QueueEvent(set_title_event.Clone());
|
g_mainFrame->QueueEvent(set_title_event.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1805,7 +1805,7 @@ void MainWindow::UpdateNFCMenu()
|
|||||||
if (recentFileIndex == 0)
|
if (recentFileIndex == 0)
|
||||||
m_nfcMenuSeparator0 = m_nfcMenu->AppendSeparator();
|
m_nfcMenuSeparator0 = m_nfcMenu->AppendSeparator();
|
||||||
|
|
||||||
m_nfcMenu->Append(MAINFRAME_MENU_ID_NFC_RECENT_0 + i, to_wxString(fmt::format("{}. {}", recentFileIndex, entry)));
|
m_nfcMenu->Append(MAINFRAME_MENU_ID_NFC_RECENT_0 + i, formatWxString("{}. {}", recentFileIndex, entry));
|
||||||
|
|
||||||
recentFileIndex++;
|
recentFileIndex++;
|
||||||
if (recentFileIndex >= 12)
|
if (recentFileIndex >= 12)
|
||||||
@@ -2045,7 +2045,7 @@ public:
|
|||||||
"/*****************************************************************************/\r\n"
|
"/*****************************************************************************/\r\n"
|
||||||
);
|
);
|
||||||
delete fs;
|
delete fs;
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", _pathToUtf8(tempPath))));
|
wxLaunchDefaultBrowser(formatWxString("file:{}", _pathToUtf8(tempPath)));
|
||||||
});
|
});
|
||||||
lineSizer->Add(noticeLink, 0);
|
lineSizer->Add(noticeLink, 0);
|
||||||
lineSizer->Add(new wxStaticText(parent, wxID_ANY, ")"), 0);
|
lineSizer->Add(new wxStaticText(parent, wxID_ANY, ")"), 0);
|
||||||
@@ -2142,7 +2142,7 @@ void MainWindow::RecreateMenu()
|
|||||||
const std::string& pathStr = guiConfig.recent_launch_files[i];
|
const std::string& pathStr = guiConfig.recent_launch_files[i];
|
||||||
if (pathStr.empty())
|
if (pathStr.empty())
|
||||||
continue;
|
continue;
|
||||||
recentMenu->Append(MAINFRAME_MENU_ID_FILE_RECENT_0 + i, to_wxString(fmt::format("{}. {}", recentFileIndex, pathStr)));
|
recentMenu->Append(MAINFRAME_MENU_ID_FILE_RECENT_0 + i, formatWxString("{}. {}", recentFileIndex, pathStr));
|
||||||
recentFileIndex++;
|
recentFileIndex++;
|
||||||
|
|
||||||
if (recentFileIndex >= 10)
|
if (recentFileIndex >= 10)
|
||||||
|
|||||||
@@ -226,6 +226,6 @@ void PadViewFrame::OnSetWindowTitle(wxCommandEvent& event)
|
|||||||
void PadViewFrame::AsyncSetTitle(std::string_view windowTitle)
|
void PadViewFrame::AsyncSetTitle(std::string_view windowTitle)
|
||||||
{
|
{
|
||||||
wxCommandEvent set_title_event(wxEVT_SET_WINDOW_TITLE);
|
wxCommandEvent set_title_event(wxEVT_SET_WINDOW_TITLE);
|
||||||
set_title_event.SetString(wxHelper::FromUtf8(windowTitle));
|
set_title_event.SetString(wxString::FromUTF8(windowTitle));
|
||||||
QueueEvent(set_title_event.Clone());
|
QueueEvent(set_title_event.Clone());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -719,7 +719,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
std::string customName = "";
|
std::string customName = "";
|
||||||
if (!GetConfig().GetGameListCustomName(title_id, customName))
|
if (!GetConfig().GetGameListCustomName(title_id, customName))
|
||||||
customName.clear();
|
customName.clear();
|
||||||
wxTextEntryDialog dialog(this, wxEmptyString, _("Enter a custom game title"), wxHelper::FromUtf8(customName));
|
wxTextEntryDialog dialog(this, wxEmptyString, _("Enter a custom game title"), wxString::FromUTF8(customName));
|
||||||
if(dialog.ShowModal() == wxID_OK)
|
if(dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
const auto custom_name = dialog.GetValue();
|
const auto custom_name = dialog.GetValue();
|
||||||
@@ -733,7 +733,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
if (id == title_id)
|
if (id == title_id)
|
||||||
{
|
{
|
||||||
if (m_style == Style::kList)
|
if (m_style == Style::kList)
|
||||||
SetItem(i, ColumnName, wxHelper::FromUtf8(GetNameByTitleId(title_id)));
|
SetItem(i, ColumnName, wxString::FromUTF8(GetNameByTitleId(title_id)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -760,7 +760,7 @@ void wxGameList::OnContextMenuSelected(wxCommandEvent& event)
|
|||||||
wxASSERT(!tokens.empty());
|
wxASSERT(!tokens.empty());
|
||||||
const std::string company_code = gameInfo.GetBase().GetMetaInfo()->GetCompanyCode();
|
const std::string company_code = gameInfo.GetBase().GetMetaInfo()->GetCompanyCode();
|
||||||
wxASSERT(company_code.size() >= 2);
|
wxASSERT(company_code.size() >= 2);
|
||||||
wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2).c_str())));
|
wxLaunchDefaultBrowser(formatWxString("https://wiki.cemu.info/wiki/{}{}", *tokens.rbegin(), company_code.substr(company_code.size() - 2)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1116,7 +1116,7 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
|
|||||||
if(index == wxNOT_FOUND)
|
if(index == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
// entry doesn't exist
|
// entry doesn't exist
|
||||||
index = InsertItem(FindInsertPosition(baseTitleId), wxHelper::FromUtf8(GetNameByTitleId(baseTitleId)));
|
index = InsertItem(FindInsertPosition(baseTitleId), wxString::FromUTF8(GetNameByTitleId(baseTitleId)));
|
||||||
SetItemPtrData(index, baseTitleId);
|
SetItemPtrData(index, baseTitleId);
|
||||||
isNewEntry = true;
|
isNewEntry = true;
|
||||||
}
|
}
|
||||||
@@ -1125,7 +1125,7 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
|
|||||||
{
|
{
|
||||||
SetItemColumnImage(index, ColumnIcon, icon_small);
|
SetItemColumnImage(index, ColumnIcon, icon_small);
|
||||||
|
|
||||||
SetItem(index, ColumnName, wxHelper::FromUtf8(GetNameByTitleId(baseTitleId)));
|
SetItem(index, ColumnName, wxString::FromUTF8(GetNameByTitleId(baseTitleId)));
|
||||||
|
|
||||||
SetItem(index, ColumnVersion, fmt::format("{}", gameInfo.GetVersion()));
|
SetItem(index, ColumnVersion, fmt::format("{}", gameInfo.GetVersion()));
|
||||||
|
|
||||||
|
|||||||
@@ -384,8 +384,8 @@ void wxTitleManagerList::OnConvertToCompressedFormat(uint64 titleId, uint64 righ
|
|||||||
defaultFileName.append(".wua");
|
defaultFileName.append(".wua");
|
||||||
|
|
||||||
// ask the user to provide a path for the output file
|
// ask the user to provide a path for the output file
|
||||||
wxFileDialog saveFileDialog(this, _("Save Wii U game archive file"), defaultDir, wxHelper::FromUtf8(defaultFileName),
|
wxFileDialog saveFileDialog(this, _("Save Wii U game archive file"), defaultDir, wxString::FromUTF8(defaultFileName),
|
||||||
"WUA files (*.wua)|*.wua", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
"WUA files (*.wua)|*.wua", wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
if (saveFileDialog.ShowModal() == wxID_CANCEL || saveFileDialog.GetPath().IsEmpty())
|
if (saveFileDialog.ShowModal() == wxID_CANCEL || saveFileDialog.GetPath().IsEmpty())
|
||||||
return;
|
return;
|
||||||
fs::path outputPath(wxHelper::MakeFSPath(saveFileDialog.GetPath()));
|
fs::path outputPath(wxHelper::MakeFSPath(saveFileDialog.GetPath()));
|
||||||
|
|||||||
@@ -74,12 +74,6 @@ private:
|
|||||||
void wxAutosizeColumn(wxListCtrlBase* ctrl, int col);
|
void wxAutosizeColumn(wxListCtrlBase* ctrl, int col);
|
||||||
void wxAutosizeColumns(wxListCtrlBase* ctrl, int col_start, int col_end);
|
void wxAutosizeColumns(wxListCtrlBase* ctrl, int col_start, int col_end);
|
||||||
|
|
||||||
// creates wxString from utf8 string
|
|
||||||
inline wxString to_wxString(std::string_view str)
|
|
||||||
{
|
|
||||||
return wxString::FromUTF8(str.data(), str.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T get_next_sibling(const T element)
|
T get_next_sibling(const T element)
|
||||||
{
|
{
|
||||||
@@ -111,4 +105,4 @@ void update_slider_text(wxCommandEvent& event, const wxFormatString& format = "%
|
|||||||
|
|
||||||
uint32 fix_raw_keycode(uint32 keycode, uint32 raw_flags);
|
uint32 fix_raw_keycode(uint32 keycode, uint32 raw_flags);
|
||||||
|
|
||||||
WindowSystem::WindowHandleInfo initHandleContextFromWxWidgetsWindow(wxWindow* wxw);
|
WindowSystem::WindowHandleInfo initHandleContextFromWxWidgetsWindow(wxWindow* wxw);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ InputAPIAddWindow::InputAPIAddWindow(wxWindow* parent, const wxPoint& position,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto provider = *p.begin();
|
const auto provider = *p.begin();
|
||||||
m_input_api->Append(to_wxString(provider->api_name()), new wxTypeData(provider->api()));
|
m_input_api->Append(wxString::FromUTF8(provider->api_name()), new wxTypeData(provider->api()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_input_api->Bind(wxEVT_CHOICE, &InputAPIAddWindow::on_api_selected, this);
|
m_input_api->Bind(wxEVT_CHOICE, &InputAPIAddWindow::on_api_selected, this);
|
||||||
@@ -150,7 +150,7 @@ void InputAPIAddWindow::on_close_button(wxCommandEvent& event)
|
|||||||
bool InputAPIAddWindow::has_custom_settings() const
|
bool InputAPIAddWindow::has_custom_settings() const
|
||||||
{
|
{
|
||||||
const auto selection = m_input_api->GetStringSelection();
|
const auto selection = m_input_api->GetStringSelection();
|
||||||
return selection == to_wxString(to_string(InputAPI::DSUClient));
|
return selection == wxString::FromUTF8(to_string(InputAPI::DSUClient));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ControllerProviderSettings> InputAPIAddWindow::get_settings() const
|
std::unique_ptr<ControllerProviderSettings> InputAPIAddWindow::get_settings() const
|
||||||
@@ -174,7 +174,7 @@ void InputAPIAddWindow::on_api_selected(wxCommandEvent& event)
|
|||||||
|
|
||||||
const auto selection = m_input_api->GetStringSelection();
|
const auto selection = m_input_api->GetStringSelection();
|
||||||
// keyboard is a special case, as theres only one device supported atm
|
// keyboard is a special case, as theres only one device supported atm
|
||||||
if (selection == to_wxString(to_string(InputAPI::Keyboard)))
|
if (selection == wxString::FromUTF8(to_string(InputAPI::Keyboard)))
|
||||||
{
|
{
|
||||||
const auto controllers = InputManager::instance().get_api_provider(InputAPI::Keyboard)->get_controllers();
|
const auto controllers = InputManager::instance().get_api_provider(InputAPI::Keyboard)->get_controllers();
|
||||||
if (!controllers.empty())
|
if (!controllers.empty())
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ void InputSettings2::update_state()
|
|||||||
has_controllers = !emulated_controller->get_controllers().empty();
|
has_controllers = !emulated_controller->get_controllers().empty();
|
||||||
|
|
||||||
const auto emulated_type = emulated_controller->type();
|
const auto emulated_type = emulated_controller->type();
|
||||||
int index = page_data.m_emulated_controller->Append(to_wxString(emulated_controller->type_to_string(emulated_type)));
|
int index = page_data.m_emulated_controller->Append(wxString::FromUTF8(emulated_controller->type_to_string(emulated_type)));
|
||||||
page_data.m_emulated_controller->SetSelection(index);
|
page_data.m_emulated_controller->SetSelection(index);
|
||||||
|
|
||||||
const auto controller_selection = page_data.m_controllers->GetStringSelection();
|
const auto controller_selection = page_data.m_controllers->GetStringSelection();
|
||||||
@@ -764,7 +764,7 @@ void InputSettings2::on_emulated_controller_dropdown(wxCommandEvent& event)
|
|||||||
const auto selected_value = emulated_controllers->GetStringSelection();
|
const auto selected_value = emulated_controllers->GetStringSelection();
|
||||||
if(selected != wxNOT_FOUND)
|
if(selected != wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
is_gamepad_selected = selected_value == to_wxString(EmulatedController::type_to_string(EmulatedController::Type::VPAD));
|
is_gamepad_selected = selected_value == wxString::FromUTF8(EmulatedController::type_to_string(EmulatedController::Type::VPAD));
|
||||||
is_wpad_selected = !is_gamepad_selected && selected != 0;
|
is_wpad_selected = !is_gamepad_selected && selected != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,13 +774,13 @@ void InputSettings2::on_emulated_controller_dropdown(wxCommandEvent& event)
|
|||||||
emulated_controllers->AppendString(_("Disabled"));
|
emulated_controllers->AppendString(_("Disabled"));
|
||||||
|
|
||||||
if (vpad_count < InputManager::kMaxVPADControllers || is_gamepad_selected)
|
if (vpad_count < InputManager::kMaxVPADControllers || is_gamepad_selected)
|
||||||
emulated_controllers->Append(to_wxString(EmulatedController::type_to_string(EmulatedController::Type::VPAD)));
|
emulated_controllers->Append(wxString::FromUTF8(EmulatedController::type_to_string(EmulatedController::Type::VPAD)));
|
||||||
|
|
||||||
if (wpad_count < InputManager::kMaxWPADControllers || is_wpad_selected)
|
if (wpad_count < InputManager::kMaxWPADControllers || is_wpad_selected)
|
||||||
{
|
{
|
||||||
emulated_controllers->AppendString(to_wxString(EmulatedController::type_to_string(EmulatedController::Type::Pro)));
|
emulated_controllers->AppendString(wxString::FromUTF8(EmulatedController::type_to_string(EmulatedController::Type::Pro)));
|
||||||
emulated_controllers->AppendString(to_wxString(EmulatedController::type_to_string(EmulatedController::Type::Classic)));
|
emulated_controllers->AppendString(wxString::FromUTF8(EmulatedController::type_to_string(EmulatedController::Type::Classic)));
|
||||||
emulated_controllers->AppendString(to_wxString(EmulatedController::type_to_string(EmulatedController::Type::Wiimote)));
|
emulated_controllers->AppendString(wxString::FromUTF8(EmulatedController::type_to_string(EmulatedController::Type::Wiimote)));
|
||||||
}
|
}
|
||||||
|
|
||||||
emulated_controllers->SetStringSelection(selected_value);
|
emulated_controllers->SetStringSelection(selected_value);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ ClassicControllerInputPanel::ClassicControllerInputPanel(wxWindow* parent)
|
|||||||
|
|
||||||
void ClassicControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id) {
|
void ClassicControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ClassicController::ButtonId &button_id) {
|
||||||
sizer->Add(
|
sizer->Add(
|
||||||
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ClassicController::get_button_name(button_id)))),
|
new wxStaticText(this, wxID_ANY, wxGetTranslation(wxString::FromUTF8(ClassicController::get_button_name(button_id)))),
|
||||||
wxGBPosition(row, column),
|
wxGBPosition(row, column),
|
||||||
wxDefaultSpan,
|
wxDefaultSpan,
|
||||||
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ ProControllerInputPanel::ProControllerInputPanel(wxWindow* parent)
|
|||||||
|
|
||||||
void ProControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
|
void ProControllerInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const ProController::ButtonId &button_id) {
|
||||||
sizer->Add(
|
sizer->Add(
|
||||||
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(ProController::get_button_name(button_id)))),
|
new wxStaticText(this, wxID_ANY, wxGetTranslation(wxString::FromUTF8(ProController::get_button_name(button_id)))),
|
||||||
wxGBPosition(row, column),
|
wxGBPosition(row, column),
|
||||||
wxDefaultSpan,
|
wxDefaultSpan,
|
||||||
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ VPADInputPanel::VPADInputPanel(wxWindow* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const VPADController::ButtonId &button_id) {
|
void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column, const VPADController::ButtonId &button_id) {
|
||||||
add_button_row(sizer, row, column, button_id, wxGetTranslation(to_wxString(VPADController::get_button_name(button_id))));
|
add_button_row(sizer, row, column, button_id, wxGetTranslation(wxString::FromUTF8(VPADController::get_button_name(button_id))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column,
|
void VPADInputPanel::add_button_row(wxGridBagSizer *sizer, sint32 row, sint32 column,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
m_item_sizer->Add(
|
m_item_sizer->Add(
|
||||||
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(WiimoteController::get_button_name(id)))),
|
new wxStaticText(this, wxID_ANY, wxGetTranslation(wxString::FromUTF8(WiimoteController::get_button_name(id)))),
|
||||||
wxGBPosition(row, column),
|
wxGBPosition(row, column),
|
||||||
wxDefaultSpan,
|
wxDefaultSpan,
|
||||||
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||||
@@ -158,7 +158,7 @@ WiimoteInputPanel::WiimoteInputPanel(wxWindow* parent)
|
|||||||
|
|
||||||
void WiimoteInputPanel::add_button_row(sint32 row, sint32 column, const WiimoteController::ButtonId &button_id) {
|
void WiimoteInputPanel::add_button_row(sint32 row, sint32 column, const WiimoteController::ButtonId &button_id) {
|
||||||
m_item_sizer->Add(
|
m_item_sizer->Add(
|
||||||
new wxStaticText(this, wxID_ANY, wxGetTranslation(to_wxString(WiimoteController::get_button_name(button_id)))),
|
new wxStaticText(this, wxID_ANY, wxGetTranslation(wxString::FromUTF8(WiimoteController::get_button_name(button_id)))),
|
||||||
wxGBPosition(row, column),
|
wxGBPosition(row, column),
|
||||||
wxDefaultSpan,
|
wxDefaultSpan,
|
||||||
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||||
|
|||||||
@@ -12,15 +12,10 @@ namespace wxHelper
|
|||||||
return fs::path(sv);
|
return fs::path(sv);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline wxString FromUtf8(std::string_view str)
|
|
||||||
{
|
|
||||||
return wxString::FromUTF8(str.data(), str.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline wxString FromPath(const fs::path& path)
|
inline wxString FromPath(const fs::path& path)
|
||||||
{
|
{
|
||||||
std::string str = _pathToUtf8(path);
|
std::string str = _pathToUtf8(path);
|
||||||
return wxString::FromUTF8(str.data(), str.size());
|
return wxString::FromUTF8(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline wxColour CalculateAccentColour(const wxColour& bgColour)
|
inline wxColour CalculateAccentColour(const wxColour& bgColour)
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ void WindowSystem::ShowErrorDialog(std::string_view message, std::string_view ti
|
|||||||
if (title.empty())
|
if (title.empty())
|
||||||
caption = wxASCII_STR(wxMessageBoxCaptionStr);
|
caption = wxASCII_STR(wxMessageBoxCaptionStr);
|
||||||
else
|
else
|
||||||
caption = to_wxString(title);
|
caption = wxString::FromUTF8(title);
|
||||||
wxMessageBox(to_wxString(message), caption, wxOK | wxCENTRE | wxICON_ERROR);
|
wxMessageBox(wxString::FromUTF8(message), caption, wxOK | wxCENTRE | wxICON_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowSystem::WindowInfo& WindowSystem::GetWindowInfo()
|
WindowSystem::WindowInfo& WindowSystem::GetWindowInfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user