From e183711d749fefd480ef8091acfd1230ae8c604e Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sat, 2 Mar 2013 20:34:53 -0600 Subject: [PATCH] wxString conversion cleanup. --- .../Src/Debugger/CodeWindowFunctions.cpp | 2 +- Source/Core/DolphinWX/Src/GameListCtrl.cpp | 17 ----------------- Source/Core/DolphinWX/Src/ISOProperties.cpp | 16 ++++++++-------- Source/Core/DolphinWX/Src/MemcardManager.cpp | 10 +++++----- Source/Core/DolphinWX/Src/NetWindow.cpp | 2 +- 5 files changed, 15 insertions(+), 32 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp index fad0380eca..ef4622d14f 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeWindowFunctions.cpp @@ -209,7 +209,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) break; } wxString OpenCommand; - OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(filename.c_str())); + OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename)); if(!OpenCommand.IsEmpty()) wxExecute(OpenCommand, wxEXEC_SYNC); } diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index 6a6df49ee5..562d2234cd 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -423,23 +423,6 @@ void CGameListCtrl::InsertItemInReportView(long _Index) // company: 0x007030 int ImageIndex = -1; -#ifdef _WIN32 - wxCSConv SJISConv(*(wxCSConv*)wxConvCurrent); - static bool validCP932 = ::IsValidCodePage(932) != 0; - if (validCP932) - { - SJISConv = wxCSConv(wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS)); - } - else - { - WARN_LOG(COMMON, "Cannot Convert from Charset Windows Japanese cp 932"); - } -#else - // on linux the wrong string is returned from wxFontMapper::GetEncodingName(wxFONTENCODING_SHIFT_JIS) - // it returns CP-932, in order to use iconv we need to use CP932 - wxCSConv SJISConv(wxT("CP932")); -#endif - GameListItem& rISOFile = *m_ISOFiles[_Index]; m_gamePath.append(rISOFile.GetFileName() + '\n'); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index 5993111698..43657300cb 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -152,7 +152,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW LoadGameConfig(); else wxMessageBox(wxString::Format(_("Could not create %s"), - wxString::From8BitData(GameIniFile.c_str()).c_str()), + StrToWxStr(GameIniFile).c_str()), _("Error"), wxOK|wxICON_ERROR, this); } @@ -199,9 +199,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW m_Country->SetValue(_("UNKNOWN")); break; } - wxString temp = _T("0x") + wxString::From8BitData(OpenISO->GetMakerID().c_str()); + wxString temp = _T("0x") + StrToWxStr(OpenISO->GetMakerID()); m_MakerID->SetValue(temp); - m_Date->SetValue(wxString::From8BitData(OpenISO->GetApploaderDate().c_str())); + m_Date->SetValue(StrToWxStr(OpenISO->GetApploaderDate())); m_FST->SetValue(wxString::Format(wxT("%u"), OpenISO->GetFSTSize())); // Here we set all the info to be shown (be it SJIS or Ascii) + we set the window title @@ -266,12 +266,12 @@ size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent, // check next index if (rFileInfo->IsDirectory()) { - wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::From8BitData(itemName), 1, 1); + wxTreeItemId item = m_Treectrl->AppendItem(parent, StrToWxStr(itemName), 1, 1); CurrentIndex = CreateDirectoryTree(item, fileInfos, CurrentIndex + 1, (size_t)rFileInfo->m_FileSize); } else { - m_Treectrl->AppendItem(parent, wxString::From8BitData(itemName), 2, 2); + m_Treectrl->AppendItem(parent, StrToWxStr(itemName), 2, 2); CurrentIndex++; } } @@ -1081,7 +1081,7 @@ bool CISOProperties::SaveGameConfig() void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event)) { - if (wxFileExists(wxString::From8BitData(GameIniFile.c_str()))) + if (File::Exists(GameIniFile)) { SaveGameConfig(); @@ -1102,7 +1102,7 @@ void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event)) } } wxString OpenCommand; - OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(GameIniFile.c_str())); + OpenCommand = filetype->GetOpenCommand(StrToWxStr(GameIniFile)); if(OpenCommand.IsEmpty()) PanicAlertT("Couldn't find open command for extension 'ini'!"); else @@ -1275,7 +1275,7 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event) CARCodeAddEdit dlg(-1, this, 1, _("Add ActionReplay Code")); if (dlg.ShowModal() == wxID_OK) { - Cheats->Append(wxString::From8BitData(arCodes.back().name.c_str())); + Cheats->Append(StrToWxStr(arCodes.back().name)); Cheats->Check((unsigned int)(arCodes.size() - 1), arCodes.back().active); } } diff --git a/Source/Core/DolphinWX/Src/MemcardManager.cpp b/Source/Core/DolphinWX/Src/MemcardManager.cpp index d9fd4d3ae6..b9b26b6da8 100644 --- a/Source/Core/DolphinWX/Src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/Src/MemcardManager.cpp @@ -214,7 +214,7 @@ void CMemcardManager::CreateGUIControls() sPages->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1); m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, - wxString::From8BitData(File::GetUserPath(D_GCUSER_IDX).c_str()), _("Choose a memory card:"), + StrToWxStr(File::GetUserPath(D_GCUSER_IDX)), _("Choose a memory card:"), _("Gamecube Memory Cards (*.raw,*.gcp)") + wxString(wxT("|*.raw;*.gcp")), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400), @@ -265,7 +265,7 @@ void CMemcardManager::CreateGUIControls() m_Delete[i]->Disable(); if (DefaultMemcard[i].length()) { - m_MemcardPath[i]->SetPath(wxString::From8BitData(DefaultMemcard[i].c_str())); + m_MemcardPath[i]->SetPath(StrToWxStr(DefaultMemcard[i])); ChangePath(i); } } @@ -520,7 +520,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) _("Select a save file to import"), (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) ? StrToWxStr("") - : wxString::From8BitData(DefaultIOPath.c_str()), + : StrToWxStr(DefaultIOPath), wxEmptyString, wxEmptyString, _("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString(wxT("|*.gci;*.gcs;*.sav|")) + _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + @@ -557,8 +557,8 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event) } wxString fileName = wxFileSelector( _("Export save as..."), - wxString::From8BitData(DefaultIOPath.c_str()), - wxString::From8BitData(gciFilename.c_str()), wxT(".gci"), + StrToWxStr(DefaultIOPath), + StrToWxStr(gciFilename), wxT(".gci"), _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + _("MadCatz Gameshark files(*.gcs)") + wxString(wxT("|*.gcs|")) + _("Datel MaxDrive/Pro files(*.sav)") + wxString(wxT("|*.sav")), diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index 988ccae83e..60efcedc6f 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -51,7 +51,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* std::string nickname; netplay_section.Get("Nickname", &nickname, "Player"); - m_nickname_text = new wxTextCtrl(panel, wxID_ANY, wxString::From8BitData(nickname.c_str())); + m_nickname_text = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(nickname)); wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL); nick_szr->Add(nick_lbl, 0, wxCENTER);