Skip to content

Commit

Permalink
Merge pull request #671 from lioncash/non-panic
Browse files Browse the repository at this point in the history
DolphinWX: Use a regular wxMessageBox instead of a PanicAlert for non-panic errors.
  • Loading branch information
delroth committed Aug 4, 2014
2 parents 95a8c24 + 0ed29e1 commit 497de04
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 89 deletions.
3 changes: 2 additions & 1 deletion Source/Core/DolphinWX/ARCodeAddEdit.cpp
Expand Up @@ -12,6 +12,7 @@
#include <wx/event.h>
#include <wx/gbsizer.h>
#include <wx/gdicmn.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/spinbutt.h>
#include <wx/stattext.h>
Expand Down Expand Up @@ -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.
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;
}

Expand Down
11 changes: 6 additions & 5 deletions Source/Core/DolphinWX/CheatsWindow.cpp
Expand Up @@ -18,6 +18,7 @@
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/radiobut.h>
Expand Down Expand Up @@ -398,7 +399,7 @@ void CheatSearchTab::StartNewSearch(wxCommandEvent& WXUNUSED (event))
const u8* const memptr = Memory::GetPointer(0);
if (nullptr == memptr)
{
PanicAlertT("A game is not currently running.");
WxUtils::ShowErrorDialog(_("A game is not currently running."));
return;
}

Expand Down Expand Up @@ -432,7 +433,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
const u8* const memptr = Memory::GetPointer(0);
if (nullptr == memptr)
{
PanicAlertT("A game is not currently running.");
WxUtils::ShowErrorDialog(_("A game is not currently running."));
return;
}

Expand Down Expand Up @@ -479,7 +480,7 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)

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;
}

Expand Down Expand Up @@ -629,15 +630,15 @@ void CreateCodeDialog::PressOK(wxCommandEvent& ev)
const wxString code_name = textctrl_name->GetValue();
if (code_name.empty())
{
PanicAlertT("You must enter a name!");
WxUtils::ShowErrorDialog(_("You must enter a name."));
return;
}

long code_value;
int base = checkbox_use_hex->IsChecked() ? 16 : 10;
if (!textctrl_value->GetValue().ToLong(&code_value, base))
{
PanicAlertT("Invalid Value!");
WxUtils::ShowErrorDialog(_("Invalid value."));
return;
}

Expand Down
12 changes: 6 additions & 6 deletions Source/Core/DolphinWX/ConfigMain.cpp
Expand Up @@ -1070,8 +1070,8 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
GCMemcard memorycard(filename);
if (!memorycard.IsValid())
{
PanicAlertT("Cannot use that file as a memory card.\n%s\n" \
"is not a valid gamecube memory card file", filename.c_str());
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()));
return;
}
}
Expand Down Expand Up @@ -1106,8 +1106,8 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
}
else
{
PanicAlertT("Cannot use that file as a memory card.\n" \
"Are you trying to use the same file in both slots?");
WxUtils::ShowErrorDialog(_("Cannot use that file as a memory card.\n"
"Are you trying to use the same file in both slots?"));
}
}
}
Expand Down Expand Up @@ -1204,7 +1204,7 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
u8 country_code = GetSADRCountryCode(wii_system_lang);
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;
}
Expand Down Expand Up @@ -1238,7 +1238,7 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
{
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
{
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp
Expand Up @@ -8,6 +8,7 @@
#include <wx/dialog.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/string.h>
#include <wx/textctrl.h>
Expand Down Expand Up @@ -50,7 +51,7 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
}
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();
Expand Down
25 changes: 13 additions & 12 deletions Source/Core/DolphinWX/Debugger/DebuggerPanel.cpp
Expand Up @@ -23,6 +23,7 @@
#include "Common/IniFile.h"
#include "Core/ConfigManager.h"
#include "Core/CoreParameter.h"
#include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/DebuggerPanel.h"
#include "VideoCommon/Debugger.h"
#include "VideoCommon/TextureCacheBase.h"
Expand Down Expand Up @@ -288,42 +289,42 @@ void GFXDebuggerPanel::OnDumpButton(wxCommandEvent& event)

case 2: // Pixel Shader Constants
DumpPixelShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 3: // Vertex Shader Constants
DumpVertexShaderConstants(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 4: // Textures
DumpTextures(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 5: // Frame Buffer
DumpFrameBuffer(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 6: // Geometry
DumpGeometry(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 7: // Vertex Description
DumpVertexDecl(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 8: // Vertex Matrices
DumpMatrices(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;

case 9: // Statistics
DumpStats(dump_path);
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
break;
}
}
Expand All @@ -337,7 +338,7 @@ void GFXDebuggerPanel::OnContButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnClearScreenButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
}

void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
Expand All @@ -348,17 +349,17 @@ void GFXDebuggerPanel::OnClearTextureCacheButton(wxCommandEvent& event)
void GFXDebuggerPanel::OnClearVertexShaderCacheButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
}

void GFXDebuggerPanel::OnClearPixelShaderCacheButton(wxCommandEvent& event)
{
// TODO
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
}

void GFXDebuggerPanel::OnUpdateScreenButton(wxCommandEvent& event)
{
wxMessageBox(_("Not implemented"), _("Error"), wxOK);
WxUtils::ShowErrorDialog(_("Not implemented"));
GFXDebuggerUpdateScreen();
}
6 changes: 3 additions & 3 deletions Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
Expand Up @@ -162,7 +162,7 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
{
if (!Memory::IsInitialized())
{
PanicAlertT("Cannot set uninitialized memory.");
WxUtils::ShowErrorDialog(_("Cannot set uninitialized memory."));
return;
}

Expand All @@ -173,13 +173,13 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)

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;
}

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;
}

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/DolphinWX/FifoPlayerDlg.cpp
Expand Up @@ -20,6 +20,7 @@
#include <wx/filedlg.h>
#include <wx/gdicmn.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
Expand Down Expand Up @@ -418,7 +419,7 @@ void FifoPlayerDlg::OnSaveFile(wxCommandEvent& WXUNUSED(event))

// Wasn't able to save the file, shit's whack, yo.
if (!result)
PanicAlertT("Error saving file");
WxUtils::ShowErrorDialog(_("Error saving file."));
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -750,9 +750,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))

if (Movie::IsReadOnly())
{
//PanicAlertT("Cannot record movies in read-only mode.");
//return;
// the user just chose to record a movie, so that should take precedence
// The user just chose to record a movie, so that should take precedence
Movie::SetReadOnly(false);
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/DolphinWX/GameListCtrl.cpp
Expand Up @@ -1169,7 +1169,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
}

if (!all_good)
wxMessageBox(_("Dolphin was unable to complete the requested action."));
WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));

Update();
}
Expand Down Expand Up @@ -1255,7 +1255,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
}

if (!all_good)
wxMessageBox(_("Dolphin was unable to complete the requested action."));
WxUtils::ShowErrorDialog(_("Dolphin was unable to complete the requested action."));

Update();
}
Expand Down
18 changes: 5 additions & 13 deletions Source/Core/DolphinWX/GeckoCodeDiag.cpp
Expand Up @@ -13,6 +13,7 @@
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/listbox.h>
#include <wx/msgdlg.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
Expand Down Expand Up @@ -188,17 +189,8 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
// parse the codes
std::istringstream ss(resp.GetBody());

// debug
//PanicAlert("File size is %i bytes.", ss.str().size());

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
std::getline(ss, line);
std::getline(ss, line);
Expand Down Expand Up @@ -300,20 +292,20 @@ void CodeConfigPanel::DownloadCodes(wxCommandEvent&)
}
}

PanicAlertT("Downloaded %lu codes. (added %lu)",
(unsigned long)gcodes.size(), added_count);
wxMessageBox(wxString::Format(_("Downloaded %lu codes. (added %lu)"),
(unsigned long)gcodes.size(), added_count));

// refresh the list
UpdateCodeList();
}
else
{
PanicAlertT("File contained no codes.");
wxMessageBox(_("File contained no codes."));
}
}
else
{
PanicAlertT("Failed to download codes.");
WxUtils::ShowErrorDialog(_("Failed to download codes."));
}
}

Expand Down
20 changes: 12 additions & 8 deletions Source/Core/DolphinWX/ISOProperties.cpp
Expand Up @@ -642,7 +642,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
void CISOProperties::OnClose(wxCloseEvent& WXUNUSED (event))
{
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);
}
Expand Down Expand Up @@ -903,7 +903,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
}
else
{
PanicAlertT("Partition doesn't exist: %d", partitionNum);
WxUtils::ShowErrorDialog(wxString::Format(_("Partition doesn't exist: %d"), partitionNum));
return;
}
}
Expand All @@ -923,7 +923,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
}

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
Expand Down Expand Up @@ -1150,17 +1150,21 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename)
filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
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;
}
}
wxString OpenCommand;
OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename));

wxString OpenCommand = filetype->GetOpenCommand(StrToWxStr(filename));
if (OpenCommand.IsEmpty())
PanicAlertT("Couldn't find open command for extension 'ini'!");
{
WxUtils::ShowErrorDialog(_("Couldn't find open command for extension 'ini'!"));
}
else
{
if (wxExecute(OpenCommand, wxEXEC_SYNC) == -1)
PanicAlertT("wxExecute returned -1 on application run!");
WxUtils::ShowErrorDialog(_("wxExecute returned -1 on application run!"));
}
#endif

bRefreshList = true; // Just in case
Expand Down

0 comments on commit 497de04

Please sign in to comment.