mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
replace all instances of wxString with std::string in all cases not
directly involved in either the GUI or other wxWidget classes like wxFile
This commit is contained in:
parent
b1894ac6cb
commit
8ac226ae69
124 changed files with 1716 additions and 1502 deletions
|
|
@ -49,7 +49,7 @@ enum
|
|||
id_add_hdd
|
||||
};
|
||||
|
||||
VHDDExplorer::VHDDExplorer(wxWindow* parent, const wxString& hdd_path) : wxDialog(parent, wxID_ANY, "Virtual HDD Explorer", wxDefaultPosition)
|
||||
VHDDExplorer::VHDDExplorer(wxWindow* parent, const std::string& hdd_path) : wxDialog(parent, wxID_ANY, "Virtual HDD Explorer", wxDefaultPosition)
|
||||
{
|
||||
m_list = new wxListView(this);
|
||||
m_drop_target = new VHDDListDropTarget(m_list);
|
||||
|
|
@ -88,21 +88,21 @@ void VHDDExplorer::UpdateList()
|
|||
m_list->Freeze();
|
||||
m_list->DeleteAllItems();
|
||||
m_entries.clear();
|
||||
m_names.Clear();
|
||||
m_names.clear();
|
||||
|
||||
u64 block;
|
||||
vfsHDD_Entry entry;
|
||||
wxString name;
|
||||
std::string name;
|
||||
|
||||
for(bool is_ok = m_hdd->GetFirstEntry(block, entry, name); is_ok; is_ok = m_hdd->GetNextEntry(block, entry, name))
|
||||
{
|
||||
int item = m_list->GetItemCount();
|
||||
m_list->InsertItem(item, name);
|
||||
m_list->InsertItem(item, fmt::FromUTF8(name));
|
||||
m_list->SetItem(item, 1, entry.type == vfsHDD_Entry_Dir ? "Dir" : "File");
|
||||
m_list->SetItem(item, 2, wxString::Format("%lld", entry.size));
|
||||
m_list->SetItem(item, 3, wxDateTime().Set(time_t(entry.ctime)).Format());
|
||||
m_entries.push_back(entry);
|
||||
m_names.Add(name);
|
||||
m_names.push_back(name);
|
||||
}
|
||||
|
||||
m_list->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
|
||||
|
|
@ -112,7 +112,7 @@ void VHDDExplorer::UpdateList()
|
|||
m_list->Thaw();
|
||||
}
|
||||
|
||||
void VHDDExplorer::Import(const wxString& path, const wxString& to)
|
||||
void VHDDExplorer::Import(const std::string& path, const std::string& to)
|
||||
{
|
||||
if(!m_hdd->Create(vfsHDD_Entry_File, to))
|
||||
{
|
||||
|
|
@ -126,7 +126,7 @@ void VHDDExplorer::Import(const wxString& path, const wxString& to)
|
|||
return;
|
||||
}
|
||||
|
||||
wxFile f(path);
|
||||
wxFile f(fmt::FromUTF8(path));
|
||||
char buf[256];
|
||||
|
||||
while(!f.Eof())
|
||||
|
|
@ -137,15 +137,15 @@ void VHDDExplorer::Import(const wxString& path, const wxString& to)
|
|||
m_hdd->Close();
|
||||
}
|
||||
|
||||
void VHDDExplorer::Export(const wxString& path, const wxString& to)
|
||||
void VHDDExplorer::Export(const std::string& path, const std::string& to)
|
||||
{
|
||||
if(!m_hdd->Open(path))
|
||||
{
|
||||
wxMessageBox(wxString::Format("EXPORT ERROR: file open error. (%s)", path.wx_str()));
|
||||
wxMessageBox(wxString::Format("EXPORT ERROR: file open error. (%s)", path.c_str()));
|
||||
return;
|
||||
}
|
||||
|
||||
wxFile f(to, wxFile::write);
|
||||
wxFile f(fmt::FromUTF8(to), wxFile::write);
|
||||
char buf[256];
|
||||
|
||||
while(u64 size = m_hdd->Read(buf, 256))
|
||||
|
|
@ -189,7 +189,7 @@ void VHDDExplorer::OnDropFiles(wxDropFilesEvent& event)
|
|||
for(int i=0; i<count; ++i)
|
||||
{
|
||||
ConLog.Write("Importing '%s'", dropped[i].wx_str());
|
||||
Import(dropped[i], wxFileName(dropped[i]).GetFullName());
|
||||
Import(fmt::ToUTF8(dropped[i]), fmt::ToUTF8(wxFileName(dropped[i]).GetFullName()));
|
||||
}
|
||||
|
||||
UpdateList();
|
||||
|
|
@ -248,20 +248,20 @@ void VHDDExplorer::OnRemove(wxCommandEvent& event)
|
|||
void VHDDExplorer::OnCreateDir(wxCommandEvent& event)
|
||||
{
|
||||
int i = 1;
|
||||
static const wxString& fmt = "New Dir (%d)";
|
||||
while(m_hdd->HasEntry(wxString::Format(fmt, i))) i++;
|
||||
static const std::string& fmt = "New Dir (%d)";
|
||||
while(m_hdd->HasEntry(fmt::Format(fmt, i))) i++;
|
||||
|
||||
m_hdd->Create(vfsHDD_Entry_Dir, wxString::Format(fmt, i));
|
||||
m_hdd->Create(vfsHDD_Entry_Dir, fmt::Format(fmt, i));
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
void VHDDExplorer::OnCreateFile(wxCommandEvent& event)
|
||||
{
|
||||
int i = 1;
|
||||
static const wxString& fmt = "New File (%d)";
|
||||
while(m_hdd->HasEntry(wxString::Format(fmt, i))) i++;
|
||||
static const std::string& fmt = "New File (%d)";
|
||||
while (m_hdd->HasEntry(fmt::Format(fmt, i))) i++;
|
||||
|
||||
m_hdd->Create(vfsHDD_Entry_File, wxString::Format(fmt, i));
|
||||
m_hdd->Create(vfsHDD_Entry_File, fmt::Format(fmt, i));
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ void VHDDExplorer::OnImport(wxCommandEvent& event)
|
|||
{
|
||||
if(wxFileExists(paths[i]))
|
||||
{
|
||||
Import(paths[i], wxFileName(paths[i]).GetFullName());
|
||||
Import(fmt::ToUTF8(paths[i]), fmt::ToUTF8(wxFileName(paths[i]).GetFullName()));
|
||||
}
|
||||
}
|
||||
UpdateList();
|
||||
|
|
@ -300,20 +300,20 @@ void VHDDExplorer::OnExport(wxCommandEvent& event)
|
|||
|
||||
for(int sel = m_list->GetNextSelected(-1); sel != wxNOT_FOUND; sel = m_list->GetNextSelected(sel))
|
||||
{
|
||||
Export(m_names[sel], ctrl.GetPath() + '\\' + m_names[sel]);
|
||||
Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath()) + '\\' + m_names[sel]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int sel = m_list->GetFirstSelected();
|
||||
wxFileDialog ctrl(this, "Select export file", wxEmptyString, m_names[sel], wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
wxFileDialog ctrl(this, "Select export file", wxEmptyString, fmt::FromUTF8(m_names[sel]), wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
|
||||
if(ctrl.ShowModal() == wxID_CANCEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Export(m_names[sel], ctrl.GetPath());
|
||||
Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath()));
|
||||
}
|
||||
|
||||
UpdateList();
|
||||
|
|
@ -446,7 +446,7 @@ void VHDDManagerDialog::AddHDD(wxCommandEvent& event)
|
|||
bool skip = false;
|
||||
for(size_t j=0; j<m_paths.size(); ++j)
|
||||
{
|
||||
if(m_paths[j].CmpNoCase(paths[i]) == 0)
|
||||
if(fmt::FromUTF8(m_paths[j]).CmpNoCase(paths[i]) == 0)
|
||||
{
|
||||
skip = true;
|
||||
break;
|
||||
|
|
@ -455,7 +455,7 @@ void VHDDManagerDialog::AddHDD(wxCommandEvent& event)
|
|||
|
||||
if(!skip)
|
||||
{
|
||||
m_paths.emplace_back(paths[i]);
|
||||
m_paths.emplace_back(fmt::ToUTF8(paths[i]));
|
||||
}
|
||||
}
|
||||
UpdateList();
|
||||
|
|
@ -505,8 +505,8 @@ void VHDDManagerDialog::OnCreateHDD(wxCommandEvent& event)
|
|||
{
|
||||
u64 size, bsize;
|
||||
dial.GetResult(size, bsize);
|
||||
vfsHDDManager::CreateHDD(ctrl.GetPath(), size, bsize);
|
||||
m_paths.push_back(ctrl.GetPath());
|
||||
vfsHDDManager::CreateHDD(fmt::ToUTF8(ctrl.GetPath()), size, bsize);
|
||||
m_paths.push_back(fmt::ToUTF8(ctrl.GetPath()));
|
||||
UpdateList();
|
||||
}
|
||||
}
|
||||
|
|
@ -526,9 +526,9 @@ void VHDDManagerDialog::LoadPaths()
|
|||
|
||||
for(size_t i=0; i<count; ++i)
|
||||
{
|
||||
IniEntry<wxString> path_entry;
|
||||
path_entry.Init(wxString::Format("path[%d]", i), "HDDManager");
|
||||
m_paths.emplace_back(path_entry.LoadValue(wxEmptyString));
|
||||
IniEntry<std::string> path_entry;
|
||||
path_entry.Init(fmt::Format("path[%d]", i), "HDDManager");
|
||||
m_paths.emplace_back(path_entry.LoadValue(""));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -540,8 +540,8 @@ void VHDDManagerDialog::SavePaths()
|
|||
|
||||
for(size_t i=0; i<m_paths.size(); ++i)
|
||||
{
|
||||
IniEntry<wxString> path_entry;
|
||||
path_entry.Init(wxString::Format("path[%d]", i), "HDDManager");
|
||||
IniEntry<std::string> path_entry;
|
||||
path_entry.Init(fmt::Format("path[%d]", i), "HDDManager");
|
||||
path_entry.SaveValue(m_paths[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue