wxString conversion cleanup.

This commit is contained in:
Jordan Woyak 2013-03-02 20:34:53 -06:00
parent 6c8adf6130
commit e183711d74
5 changed files with 15 additions and 32 deletions

View File

@ -209,7 +209,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
break; break;
} }
wxString OpenCommand; wxString OpenCommand;
OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(filename.c_str())); OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename));
if(!OpenCommand.IsEmpty()) if(!OpenCommand.IsEmpty())
wxExecute(OpenCommand, wxEXEC_SYNC); wxExecute(OpenCommand, wxEXEC_SYNC);
} }

View File

@ -423,23 +423,6 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// company: 0x007030 // company: 0x007030
int ImageIndex = -1; 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]; GameListItem& rISOFile = *m_ISOFiles[_Index];
m_gamePath.append(rISOFile.GetFileName() + '\n'); m_gamePath.append(rISOFile.GetFileName() + '\n');

View File

@ -152,7 +152,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
LoadGameConfig(); LoadGameConfig();
else else
wxMessageBox(wxString::Format(_("Could not create %s"), wxMessageBox(wxString::Format(_("Could not create %s"),
wxString::From8BitData(GameIniFile.c_str()).c_str()), StrToWxStr(GameIniFile).c_str()),
_("Error"), wxOK|wxICON_ERROR, this); _("Error"), wxOK|wxICON_ERROR, this);
} }
@ -199,9 +199,9 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
m_Country->SetValue(_("UNKNOWN")); m_Country->SetValue(_("UNKNOWN"));
break; break;
} }
wxString temp = _T("0x") + wxString::From8BitData(OpenISO->GetMakerID().c_str()); wxString temp = _T("0x") + StrToWxStr(OpenISO->GetMakerID());
m_MakerID->SetValue(temp); 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())); 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 // 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 // check next index
if (rFileInfo->IsDirectory()) 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); CurrentIndex = CreateDirectoryTree(item, fileInfos, CurrentIndex + 1, (size_t)rFileInfo->m_FileSize);
} }
else else
{ {
m_Treectrl->AppendItem(parent, wxString::From8BitData(itemName), 2, 2); m_Treectrl->AppendItem(parent, StrToWxStr(itemName), 2, 2);
CurrentIndex++; CurrentIndex++;
} }
} }
@ -1081,7 +1081,7 @@ bool CISOProperties::SaveGameConfig()
void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event)) void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
{ {
if (wxFileExists(wxString::From8BitData(GameIniFile.c_str()))) if (File::Exists(GameIniFile))
{ {
SaveGameConfig(); SaveGameConfig();
@ -1102,7 +1102,7 @@ void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
} }
} }
wxString OpenCommand; wxString OpenCommand;
OpenCommand = filetype->GetOpenCommand(wxString::From8BitData(GameIniFile.c_str())); OpenCommand = filetype->GetOpenCommand(StrToWxStr(GameIniFile));
if(OpenCommand.IsEmpty()) if(OpenCommand.IsEmpty())
PanicAlertT("Couldn't find open command for extension 'ini'!"); PanicAlertT("Couldn't find open command for extension 'ini'!");
else else
@ -1275,7 +1275,7 @@ void CISOProperties::ActionReplayButtonClicked(wxCommandEvent& event)
CARCodeAddEdit dlg(-1, this, 1, _("Add ActionReplay Code")); CARCodeAddEdit dlg(-1, this, 1, _("Add ActionReplay Code"));
if (dlg.ShowModal() == wxID_OK) 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); Cheats->Check((unsigned int)(arCodes.size() - 1), arCodes.back().active);
} }
} }

View File

@ -214,7 +214,7 @@ void CMemcardManager::CreateGUIControls()
sPages->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1); sPages->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1);
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, 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); _("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), 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(); m_Delete[i]->Disable();
if (DefaultMemcard[i].length()) if (DefaultMemcard[i].length())
{ {
m_MemcardPath[i]->SetPath(wxString::From8BitData(DefaultMemcard[i].c_str())); m_MemcardPath[i]->SetPath(StrToWxStr(DefaultMemcard[i]));
ChangePath(i); ChangePath(i);
} }
} }
@ -520,7 +520,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
_("Select a save file to import"), _("Select a save file to import"),
(strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0) (strcmp(DefaultIOPath.c_str(), "/Users/GC") == 0)
? StrToWxStr("") ? StrToWxStr("")
: wxString::From8BitData(DefaultIOPath.c_str()), : StrToWxStr(DefaultIOPath),
wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString,
_("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString(wxT("|*.gci;*.gcs;*.sav|")) + _("GameCube Savegame files(*.gci;*.gcs;*.sav)") + wxString(wxT("|*.gci;*.gcs;*.sav|")) +
_("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) +
@ -557,8 +557,8 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
} }
wxString fileName = wxFileSelector( wxString fileName = wxFileSelector(
_("Export save as..."), _("Export save as..."),
wxString::From8BitData(DefaultIOPath.c_str()), StrToWxStr(DefaultIOPath),
wxString::From8BitData(gciFilename.c_str()), wxT(".gci"), StrToWxStr(gciFilename), wxT(".gci"),
_("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) + _("Native GCI files(*.gci)") + wxString(wxT("|*.gci|")) +
_("MadCatz Gameshark files(*.gcs)") + wxString(wxT("|*.gcs|")) + _("MadCatz Gameshark files(*.gcs)") + wxString(wxT("|*.gcs|")) +
_("Datel MaxDrive/Pro files(*.sav)") + wxString(wxT("|*.sav")), _("Datel MaxDrive/Pro files(*.sav)") + wxString(wxT("|*.sav")),

View File

@ -51,7 +51,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
std::string nickname; std::string nickname;
netplay_section.Get("Nickname", &nickname, "Player"); 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); wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL);
nick_szr->Add(nick_lbl, 0, wxCENTER); nick_szr->Add(nick_lbl, 0, wxCENTER);