Merge pull request #671 from lioncash/non-panic

DolphinWX: Use a regular wxMessageBox instead of a PanicAlert for non-panic errors.
This commit is contained in:
Pierre Bourdon 2014-08-03 21:27:27 -07:00
commit 497de04c52
18 changed files with 106 additions and 89 deletions

View File

@ -12,6 +12,7 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/spinbutt.h> #include <wx/spinbutt.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -148,7 +149,7 @@ void CARCodeAddEdit::SaveCheatData(wxCommandEvent& WXUNUSED (event))
// Codes with no lines appear to be deleted/hidden from the list. Let's prevent that. // Codes with no lines appear to be deleted/hidden from the list. Let's prevent that.
if (!decryptedLines.size()) if (!decryptedLines.size())
{ {
PanicAlertT("The resulting decrypted AR code doesn't contain any lines."); WxUtils::ShowErrorDialog(_("The resulting decrypted AR code doesn't contain any lines."));
return; return;
} }

View File

@ -18,6 +18,7 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/radiobut.h> #include <wx/radiobut.h>
@ -398,7 +399,7 @@ void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED (event))
const u8* const memptr = Memory::GetPointer(0); const u8* const memptr = Memory::GetPointer(0);
if (nullptr == memptr) if (nullptr == memptr)
{ {
PanicAlertT("A game is not currently running."); WxUtils::ShowErrorDialog(_("A game is not currently running."));
return; return;
} }
@ -432,7 +433,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
const u8* const memptr = Memory::GetPointer(0); const u8* const memptr = Memory::GetPointer(0);
if (nullptr == memptr) if (nullptr == memptr)
{ {
PanicAlertT("A game is not currently running."); WxUtils::ShowErrorDialog(_("A game is not currently running."));
return; return;
} }
@ -479,7 +480,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
if (!x_val.ToULong(&parsed_x_val, 0)) if (!x_val.ToULong(&parsed_x_val, 0))
{ {
PanicAlertT("You must enter a valid decimal, hexadecimal or octal value."); WxUtils::ShowErrorDialog(_("You must enter a valid decimal, hexadecimal or octal value."));
return; return;
} }
@ -629,7 +630,7 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
const wxString code_name = textctrl_name->GetValue(); const wxString code_name = textctrl_name->GetValue();
if (code_name.empty()) if (code_name.empty())
{ {
PanicAlertT("You must enter a name!"); WxUtils::ShowErrorDialog(_("You must enter a name."));
return; return;
} }
@ -637,7 +638,7 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
int base = checkbox_use_hex->IsChecked() ? 16 : 10; int base = checkbox_use_hex->IsChecked() ? 16 : 10;
if (!textctrl_value->GetValue().ToLong(&code_value, base)) if (!textctrl_value->GetValue().ToLong(&code_value, base))
{ {
PanicAlertT("Invalid Value!"); WxUtils::ShowErrorDialog(_("Invalid value."));
return; return;
} }

View File

@ -1070,8 +1070,8 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
GCMemcard memorycard(filename); GCMemcard memorycard(filename);
if (!memorycard.IsValid()) if (!memorycard.IsValid())
{ {
PanicAlertT("Cannot use that file as a memory card.\n%s\n" \ WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n" \
"is not a valid gamecube memory card file", filename.c_str()); "is not a valid gamecube memory card file"), filename.c_str()));
return; return;
} }
} }
@ -1106,8 +1106,8 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
} }
else else
{ {
PanicAlertT("Cannot use that file as a memory card.\n" \ WxUtils::ShowErrorDialog(_("Cannot use that file as a memory card.\n"
"Are you trying to use the same file in both slots?"); "Are you trying to use the same file in both slots?"));
} }
} }
} }
@ -1204,7 +1204,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
u8 country_code = GetSADRCountryCode(wii_system_lang); u8 country_code = GetSADRCountryCode(wii_system_lang);
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1)) if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1))
{ {
PanicAlertT("Failed to update country code in SYSCONF"); WxUtils::ShowErrorDialog(_("Failed to update country code in SYSCONF"));
} }
break; break;
} }
@ -1238,7 +1238,7 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
{ {
if (ISOPaths->FindString(dialog.GetPath()) != -1) if (ISOPaths->FindString(dialog.GetPath()) != -1)
{ {
wxMessageBox(_("The chosen directory is already in the list"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("The chosen directory is already in the list."));
} }
else else
{ {

View File

@ -8,6 +8,7 @@
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
@ -50,7 +51,7 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
} }
else else
{ {
PanicAlertT("The address %s is invalid.", WxStrToStr(AddressString).c_str()); WxUtils::ShowErrorDialog(wxString::Format(_("The address %s is invalid."), WxStrToStr(AddressString).c_str()));
} }
event.Skip(); event.Skip();

View File

@ -23,6 +23,7 @@
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/CoreParameter.h" #include "Core/CoreParameter.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/DebuggerPanel.h" #include "DolphinWX/Debugger/DebuggerPanel.h"
#include "VideoCommon/Debugger.h" #include "VideoCommon/Debugger.h"
#include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureCacheBase.h"
@ -288,42 +289,42 @@ void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)
case 2: // Pixel Shader Constants case 2: // Pixel Shader Constants
DumpPixelShaderConstants(dump_path); DumpPixelShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 3: // Vertex Shader Constants case 3: // Vertex Shader Constants
DumpVertexShaderConstants(dump_path); DumpVertexShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 4: // Textures case 4: // Textures
DumpTextures(dump_path); DumpTextures(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 5: // Frame Buffer case 5: // Frame Buffer
DumpFrameBuffer(dump_path); DumpFrameBuffer(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 6: // Geometry case 6: // Geometry
DumpGeometry(dump_path); DumpGeometry(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 7: // Vertex Description case 7: // Vertex Description
DumpVertexDecl(dump_path); DumpVertexDecl(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 8: // Vertex Matrices case 8: // Vertex Matrices
DumpMatrices(dump_path); DumpMatrices(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
case 9: // Statistics case 9: // Statistics
DumpStats(dump_path); DumpStats(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
break; break;
} }
} }
@ -337,7 +338,7 @@ void GFXDebuggerPanel::OnContButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnClearScreenButton(wxCommandEvent& event) void GFXDebuggerPanel::OnClearScreenButton(wxCommandEvent& event)
{ {
// TODO // TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
} }
void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event) void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
@ -348,17 +349,17 @@ void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnClearVertexShaderCacheButton(wxCommandEvent& event) void GFXDebuggerPanel::OnClearVertexShaderCacheButton(wxCommandEvent& event)
{ {
// TODO // TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
} }
void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event) void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event)
{ {
// TODO // TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
} }
void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event) void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event)
{ {
wxMessageBox(_("Not implemented"), _("Error"), wxOK); WxUtils::ShowErrorDialog(_("Not implemented"));
GFXDebuggerUpdateScreen(); GFXDebuggerUpdateScreen();
} }

View File

@ -162,7 +162,7 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
{ {
if (!Memory::IsInitialized()) if (!Memory::IsInitialized())
{ {
PanicAlertT("Cannot set uninitialized memory."); WxUtils::ShowErrorDialog(_("Cannot set uninitialized memory."));
return; return;
} }
@ -173,13 +173,13 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
if (!TryParse(std::string("0x") + str_addr, &addr)) if (!TryParse(std::string("0x") + str_addr, &addr))
{ {
PanicAlertT("Invalid Address: %s", str_addr.c_str()); WxUtils::ShowErrorDialog(wxString::Format(_("Invalid address: %s"), str_addr.c_str()));
return; return;
} }
if (!TryParse(std::string("0x") + str_val, &val)) if (!TryParse(std::string("0x") + str_val, &val))
{ {
PanicAlertT("Invalid Value: %s", str_val.c_str()); WxUtils::ShowErrorDialog(wxString::Format(_("Invalid value: %s"), str_val.c_str()));
return; return;
} }

View File

@ -20,6 +20,7 @@
#include <wx/filedlg.h> #include <wx/filedlg.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/sizer.h> #include <wx/sizer.h>
@ -418,7 +419,7 @@ void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event))
// Wasn't able to save the file, shit's whack, yo. // Wasn't able to save the file, shit's whack, yo.
if (!result) if (!result)
PanicAlertT("Error saving file"); WxUtils::ShowErrorDialog(_("Error saving file."));
} }
} }
} }

View File

@ -750,9 +750,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
if (Movie::IsReadOnly()) if (Movie::IsReadOnly())
{ {
//PanicAlertT("Cannot record movies in read-only mode."); // The user just chose to record a movie, so that should take precedence
//return;
// the user just chose to record a movie, so that should take precedence
Movie::SetReadOnly(false); Movie::SetReadOnly(false);
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false); GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false);
} }

View File

@ -1169,7 +1169,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
} }
if (!all_good) if (!all_good)
wxMessageBox(_("Dolphin was unable to complete the requested action.")); WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));
Update(); Update();
} }
@ -1255,7 +1255,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
} }
if (!all_good) if (!all_good)
wxMessageBox(_("Dolphin was unable to complete the requested action.")); WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));
Update(); Update();
} }

View File

@ -13,6 +13,7 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -188,17 +189,8 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
// parse the codes // parse the codes
std::istringstream ss(resp.GetBody()); std::istringstream ss(resp.GetBody());
// debug
//PanicAlert("File size is %i bytes.", ss.str().size());
std::string line; std::string line;
// make sure the txt file is for this game
// eh w/e
//std::getline(ss, line);
//if (line != m_gameid)
// PanicAlert("Bad code file.");
// seek past the header, get to the first code // seek past the header, get to the first code
std::getline(ss, line); std::getline(ss, line);
std::getline(ss, line); std::getline(ss, line);
@ -300,20 +292,20 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
} }
} }
PanicAlertT("Downloaded %lu codes. (added %lu)", wxMessageBox(wxString::Format(_("Downloaded %lu codes. (added %lu)"),
(unsigned long)gcodes.size(), added_count); (unsigned long)gcodes.size(), added_count));
// refresh the list // refresh the list
UpdateCodeList(); UpdateCodeList();
} }
else else
{ {
PanicAlertT("File contained no codes."); wxMessageBox(_("File contained no codes."));
} }
} }
else else
{ {
PanicAlertT("Failed to download codes."); WxUtils::ShowErrorDialog(_("Failed to download codes."));
} }
} }

View File

@ -642,7 +642,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event)) void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
if (!SaveGameConfig()) if (!SaveGameConfig())
PanicAlertT("Could not save %s", GameIniFileLocal.c_str()); WxUtils::ShowErrorDialog(wxString::Format(_("Could not save %s."), GameIniFileLocal.c_str()));
EndModal(bRefreshList ? wxID_OK : wxID_CANCEL); EndModal(bRefreshList ? wxID_OK : wxID_CANCEL);
} }
@ -903,7 +903,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
} }
else else
{ {
PanicAlertT("Partition doesn't exist: %d", partitionNum); WxUtils::ShowErrorDialog(wxString::Format(_("Partition doesn't exist: %d"), partitionNum));
return; return;
} }
} }
@ -923,7 +923,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
} }
if (!ret) if (!ret)
PanicAlertT("Failed to extract to %s!", WxStrToStr(Path).c_str()); WxUtils::ShowErrorDialog(wxString::Format(_("Failed to extract to %s!"), WxStrToStr(Path).c_str()));
} }
class IntegrityCheckThread : public wxThread class IntegrityCheckThread : public wxThread
@ -1150,17 +1150,21 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename)
filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain"); filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
if (filetype == nullptr) // MIME type failed, aborting mission if (filetype == nullptr) // MIME type failed, aborting mission
{ {
PanicAlertT("Filetype 'ini' is unknown! Will not open!"); WxUtils::ShowErrorDialog(_("Filetype 'ini' is unknown! Will not open!"));
return; return;
} }
} }
wxString OpenCommand;
OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename)); wxString OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename));
if (OpenCommand.IsEmpty()) if (OpenCommand.IsEmpty())
PanicAlertT("Couldn't find open command for extension 'ini'!"); {
WxUtils::ShowErrorDialog(_("Couldn't find open command for extension 'ini'!"));
}
else else
{
if (wxExecute(OpenCommand, wxEXEC_SYNC) == -1) if (wxExecute(OpenCommand, wxEXEC_SYNC) == -1)
PanicAlertT("wxExecute returned -1 on application run!"); WxUtils::ShowErrorDialog(_("wxExecute returned -1 on application run!"));
}
#endif #endif
bRefreshList = true; // Just in case bRefreshList = true; // Just in case

View File

@ -25,6 +25,7 @@
#include <wx/font.h> #include <wx/font.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/sizer.h> #include <wx/sizer.h>
@ -676,7 +677,7 @@ void GamepadPage::SaveProfile(wxCommandEvent&)
} }
else else
{ {
PanicAlertT("You must enter a valid profile name."); WxUtils::ShowErrorDialog(_("You must enter a valid profile name."));
} }
} }

View File

@ -430,14 +430,14 @@ void DolphinApp::InitLanguageSupport()
if (!m_locale->IsOk()) if (!m_locale->IsOk())
{ {
PanicAlertT("Error loading selected language. Falling back to system default."); wxMessageBox(_("Error loading selected language. Falling back to system default."), _("Error"));
delete m_locale; delete m_locale;
m_locale = new wxLocale(wxLANGUAGE_DEFAULT); m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
} }
} }
else else
{ {
PanicAlertT("The selected language is not supported by your system. Falling back to system default."); wxMessageBox(_("The selected language is not supported by your system. Falling back to system default."), _("Error"));
m_locale = new wxLocale(wxLANGUAGE_DEFAULT); m_locale = new wxLocale(wxLANGUAGE_DEFAULT);
} }
} }

View File

@ -18,6 +18,7 @@
#include <wx/listbase.h> #include <wx/listbase.h>
#include <wx/menu.h> #include <wx/menu.h>
#include <wx/menuitem.h> #include <wx/menuitem.h>
#include <wx/msgdlg.h>
#include <wx/mstream.h> #include <wx/mstream.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -301,7 +302,7 @@ void CMemcardManager::ChangePath(int slot)
if (!m_MemcardPath[SLOT_A]->GetPath().CmpNoCase(m_MemcardPath[SLOT_B]->GetPath())) if (!m_MemcardPath[SLOT_A]->GetPath().CmpNoCase(m_MemcardPath[SLOT_B]->GetPath()))
{ {
if (m_MemcardPath[slot]->GetPath().length()) if (m_MemcardPath[slot]->GetPath().length())
PanicAlertT("Memcard already opened"); wxMessageBox(_("Memcard already opened"));
} }
else else
{ {
@ -423,7 +424,7 @@ bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
switch (error) switch (error)
{ {
case GCS: case GCS:
SuccessAlertT("File converted to .gci"); wxMessageBox(_("File converted to .gci"));
break; break;
case SUCCESS: case SUCCESS:
if (slot != -1) if (slot != -1)
@ -435,54 +436,54 @@ bool CMemcardManager::CopyDeleteSwitch(u32 error, int slot)
} }
break; break;
case NOMEMCARD: case NOMEMCARD:
PanicAlertT("File is not recognized as a memcard"); WxUtils::ShowErrorDialog(_("File is not recognized as a memcard"));
break; break;
case OPENFAIL: case OPENFAIL:
PanicAlertT("File could not be opened\nor does not have a valid extension"); WxUtils::ShowErrorDialog(_("File could not be opened\nor does not have a valid extension"));
break; break;
case OUTOFBLOCKS: case OUTOFBLOCKS:
if (slot == -1) if (slot == -1)
{ {
PanicAlertT(E_UNK); WxUtils::ShowErrorDialog(_(E_UNK));
break; break;
} }
PanicAlertT("Only %d blocks available", memoryCard[slot]->GetFreeBlocks()); wxMessageBox(wxString::Format(_("Only %d blocks available"), memoryCard[slot]->GetFreeBlocks()));
break; break;
case OUTOFDIRENTRIES: case OUTOFDIRENTRIES:
PanicAlertT("No free dir index entries"); WxUtils::ShowErrorDialog(_("No free directory index entries."));
break; break;
case LENGTHFAIL: case LENGTHFAIL:
PanicAlertT("Imported file has invalid length"); WxUtils::ShowErrorDialog(_("Imported file has invalid length."));
break; break;
case INVALIDFILESIZE: case INVALIDFILESIZE:
PanicAlertT("The save you are trying to copy has an invalid file size"); WxUtils::ShowErrorDialog(_("The save you are trying to copy has an invalid file size."));
break; break;
case TITLEPRESENT: case TITLEPRESENT:
PanicAlertT("Memcard already has a save for this title"); WxUtils::ShowErrorDialog(_("Memcard already has a save for this title."));
break; break;
case SAVFAIL: case SAVFAIL:
PanicAlertT("Imported file has sav extension\nbut does not have a correct header"); WxUtils::ShowErrorDialog(_("Imported file has sav extension\nbut does not have a correct header."));
break; break;
case GCSFAIL: case GCSFAIL:
PanicAlertT("Imported file has gsc extension\nbut does not have a correct header"); WxUtils::ShowErrorDialog(_("Imported file has gsc extension\nbut does not have a correct header."));
break; break;
case FAIL: case FAIL:
if (slot == -1) if (slot == -1)
{ {
PanicAlertT("Export Failed"); WxUtils::ShowErrorDialog(_("Export failed"));
return false; return false;
} }
PanicAlertT("Invalid bat.map or dir entry"); WxUtils::ShowErrorDialog(_("Invalid bat.map or dir entry."));
break; break;
case WRITEFAIL: case WRITEFAIL:
PanicAlertT(E_SAVEFAILED); WxUtils::ShowErrorDialog(_(E_SAVEFAILED));
break; break;
case DELETE_FAIL: case DELETE_FAIL:
PanicAlertT("Order of files in the File Directory do not match the block order\n" WxUtils::ShowErrorDialog(_("Order of files in the File Directory do not match the block order\n"
"Right click and export all of the saves,\nand import the saves to a new memcard\n"); "Right click and export all of the saves,\nand import the saves to a new memcard\n"));
break; break;
default: default:
PanicAlertT(E_UNK); WxUtils::ShowErrorDialog(_(E_UNK));
break; break;
} }
SetFocus(); SetFocus();
@ -519,11 +520,11 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
case ID_FIXCHECKSUM_B: case ID_FIXCHECKSUM_B:
if (memoryCard[slot]->FixChecksums() && memoryCard[slot]->Save()) if (memoryCard[slot]->FixChecksums() && memoryCard[slot]->Save())
{ {
SuccessAlertT("The checksum was successfully fixed"); wxMessageBox(_("The checksum was successfully fixed."));
} }
else else
{ {
PanicAlertT(E_SAVEFAILED); WxUtils::ShowErrorDialog(_(E_SAVEFAILED));
} }
break; break;
case ID_CONVERTTOGCI: case ID_CONVERTTOGCI:
@ -571,7 +572,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
std::string gciFilename; std::string gciFilename;
if (!memoryCard[slot]->GCI_FileName(index, gciFilename)) if (!memoryCard[slot]->GCI_FileName(index, gciFilename))
{ {
PanicAlertT("Invalid index"); wxMessageBox(_("Invalid index"), _("Error"));
return; return;
} }
wxString fileName = wxFileSelector( wxString fileName = wxFileSelector(
@ -601,12 +602,17 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
SplitPath(mpath, &path1, &path2, nullptr); SplitPath(mpath, &path1, &path2, nullptr);
path1 += path2; path1 += path2;
File::CreateDir(path1); File::CreateDir(path1);
if (PanicYesNoT("Warning: This will overwrite any existing saves that are in the folder:\n"
"%s\nand have the same name as a file on your memcard\nContinue?", path1.c_str())) int answer = wxMessageBox(wxString::Format(_("Warning: This will overwrite any existing saves that are in the folder:\n"
for (int i = 0; i < DIRLEN; i++) "%s\nand have the same name as a file on your memcard\nContinue?"), path1.c_str()), _("Warning"), wxYES_NO);
if (answer == wxYES)
{ {
CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, "", path1), -1); for (int i = 0; i < DIRLEN; i++)
{
CopyDeleteSwitch(memoryCard[slot]->ExportGci(i, "", path1), -1);
}
} }
break; break;
} }
case ID_DELETE_A: case ID_DELETE_A:

View File

@ -18,6 +18,7 @@
#include <wx/frame.h> #include <wx/frame.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/sizer.h> #include <wx/sizer.h>
@ -256,13 +257,13 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
NetPlayDiag *&npd = NetPlayDiag::GetInstance(); NetPlayDiag *&npd = NetPlayDiag::GetInstance();
if (npd) if (npd)
{ {
PanicAlertT("A NetPlay window is already open!!"); WxUtils::ShowErrorDialog(_("A NetPlay window is already open!"));
return; return;
} }
if (-1 == m_game_lbox->GetSelection()) if (-1 == m_game_lbox->GetSelection())
{ {
PanicAlertT("You must choose a game!!"); WxUtils::ShowErrorDialog(_("You must choose a game!"));
return; return;
} }
@ -283,7 +284,7 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
} }
else else
{ {
PanicAlertT("Failed to listen. Is another instance of the NetPlay server running?"); WxUtils::ShowErrorDialog(_("Failed to listen. Is another instance of the NetPlay server running?"));
} }
} }
@ -292,7 +293,7 @@ void NetPlaySetupDiag::OnJoin(wxCommandEvent&)
NetPlayDiag *&npd = NetPlayDiag::GetInstance(); NetPlayDiag *&npd = NetPlayDiag::GetInstance();
if (npd) if (npd)
{ {
PanicAlertT("A NetPlay window is already open!!"); WxUtils::ShowErrorDialog(_("A NetPlay window is already open!"));
return; return;
} }
@ -459,7 +460,7 @@ std::string NetPlayDiag::FindGame()
if (m_selected_game == BuildGameName(*game)) if (m_selected_game == BuildGameName(*game))
return game->GetFileName(); return game->GetFileName();
PanicAlertT("Game not found!"); WxUtils::ShowErrorDialog(_("Game not found!"));
return ""; return "";
} }

View File

@ -12,6 +12,7 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/msgdlg.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/spinbutt.h> #include <wx/spinbutt.h>
@ -233,7 +234,7 @@ bool CPatchAddEdit::UpdateTempEntryData(std::vector<PatchEngine::PatchEntry>::it
if (!parsed_ok) if (!parsed_ok)
{ {
PanicAlertT("Unable to create patch from given values.\nEntry not modified."); wxMessageBox(_("Unable to create patch from given values.\nEntry not modified."), _("Error"));
} }
return parsed_ok; return parsed_ok;

View File

@ -7,6 +7,7 @@
#include <wx/chartype.h> #include <wx/chartype.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/msgdlg.h>
#include <wx/mstream.h> #include <wx/mstream.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/utils.h> #include <wx/utils.h>
@ -51,6 +52,11 @@ void Explore(const std::string& path)
} }
} }
void ShowErrorDialog(const wxString& error_msg)
{
wxMessageBox(error_msg, _("Error"), wxOK | wxICON_ERROR);
}
double GetCurrentBitmapLogicalScale() double GetCurrentBitmapLogicalScale()
{ {
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -21,6 +21,9 @@ void Launch(const std::string& filename);
// Launch an file explorer window on a certain path // Launch an file explorer window on a certain path
void Explore(const std::string& path); void Explore(const std::string& path);
// Displays a wxMessageBox geared for errors
void ShowErrorDialog(const wxString& error_msg);
double GetCurrentBitmapLogicalScale(); double GetCurrentBitmapLogicalScale();
wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length); wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length);