mirror of https://github.com/odrling/Aegisub
Get wxMessageBox out of AssFile
This commit is contained in:
parent
33dd0abc7f
commit
a53432736c
|
@ -82,10 +82,7 @@ void AssFile::Load(const wxString &_filename, wxString charset, bool addToRecent
|
||||||
try {
|
try {
|
||||||
// Get proper format reader
|
// Get proper format reader
|
||||||
const SubtitleFormat *reader = SubtitleFormat::GetReader(_filename);
|
const SubtitleFormat *reader = SubtitleFormat::GetReader(_filename);
|
||||||
if (!reader) {
|
if (!reader) throw "Unknown file type";
|
||||||
wxMessageBox("Unknown file type","Error loading file",wxOK | wxICON_ERROR | wxCENTER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssFile temp;
|
AssFile temp;
|
||||||
reader->ReadFile(&temp, _filename, charset);
|
reader->ReadFile(&temp, _filename, charset);
|
||||||
|
@ -112,16 +109,6 @@ void AssFile::Load(const wxString &_filename, wxString charset, bool addToRecent
|
||||||
catch (agi::UserCancelException const&) {
|
catch (agi::UserCancelException const&) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Real exception
|
|
||||||
catch (agi::Exception &e) {
|
|
||||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Other error
|
|
||||||
catch (...) {
|
|
||||||
wxMessageBox("Unknown error","Error loading file",wxOK | wxICON_ERROR | wxCENTER);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set general data
|
// Set general data
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
|
@ -48,13 +48,9 @@
|
||||||
|
|
||||||
#include <libaegisub/signal.h>
|
#include <libaegisub/signal.h>
|
||||||
|
|
||||||
class FrameRate;
|
|
||||||
class AssDialogue;
|
class AssDialogue;
|
||||||
class AssStyle;
|
class AssStyle;
|
||||||
class AssAttachment;
|
class AssAttachment;
|
||||||
class AssDialogueBlock;
|
|
||||||
class AssDialogueBlockOverride;
|
|
||||||
class AssDialogueBlockPlain;
|
|
||||||
class AssEntry;
|
class AssEntry;
|
||||||
|
|
||||||
typedef std::list<AssEntry*>::iterator entryIter;
|
typedef std::list<AssEntry*>::iterator entryIter;
|
||||||
|
|
|
@ -600,7 +600,19 @@ void DialogStyleManager::OnCurrentImport() {
|
||||||
try {
|
try {
|
||||||
temp.Load(filename, "", false);
|
temp.Load(filename, "", false);
|
||||||
}
|
}
|
||||||
|
catch (const char *err) {
|
||||||
|
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (wxString const& err) {
|
||||||
|
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (agi::Exception const& err) {
|
||||||
|
wxMessageBox(lagi_wxString(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
wxMessageBox("Unknown error", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,13 +436,16 @@ void FrameMain::LoadSubtitles(wxString filename,wxString charset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (const char *err) {
|
catch (const char *err) {
|
||||||
wxMessageBox(wxString(err), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (wxString const& err) {
|
catch (wxString const& err) {
|
||||||
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch (agi::Exception const& err) {
|
||||||
|
wxMessageBox(lagi_wxString(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
wxMessageBox("Unknown error", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
wxMessageBox("Unknown error", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue