-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathApp.cpp
78 lines (63 loc) · 1.56 KB
/
App.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
** RLReplayManager
**
** Copyright (C) 2015 Tobias Taschner <[email protected]>
**
** Licensed under GPL v3 or later
*/
#include <wx/wx.h>
#include <wx/intl.h>
#include <wx/debugrpt.h>
#include <wx/msgdlg.h>
#include <wx/filename.h>
#include "ManagerFrame.h"
class ReplayManagerApp : public wxApp
{
public:
virtual bool OnInit()
{
wxHandleFatalExceptions();
wxImage::AddHandler(new wxPNGHandler());
wxImage::AddHandler(new wxJPEGHandler());
wxImage::AddHandler(new wxGIFHandler());
m_locale.Init();
SetAppName("RLReplayManager");
SetAppDisplayName("RL Replay Manager");
ManagerFrame* frame = new ManagerFrame(NULL);
frame->Show();
return true;
}
void ShowCrashReport(wxDebugReport::Context context)
{
wxDebugReportCompress report;
wxDebugReportPreviewStd preview;
report.AddAll(context);
if (preview.Show(report))
{
if (report.Process())
{
wxMessageDialog msgDlg(NULL, wxString::Format(
_("A debug report has been saved to:\n%s"),
report.GetCompressedFileName()),
_("Information"), wxOK | wxCANCEL | wxICON_INFORMATION |wxCENTER);
msgDlg.SetOKCancelLabels(_("Open Folder"), wxID_CLOSE);
if (msgDlg.ShowModal() == wxID_OK)
{
wxFileName fn(report.GetCompressedFileName());
wxLaunchDefaultApplication(fn.GetPath());
}
}
}
}
virtual void OnFatalException() override
{
ShowCrashReport(wxDebugReport::Context_Exception);
}
virtual void OnUnhandledException() override
{
ShowCrashReport(wxDebugReport::Context_Current);
}
private:
wxLocale m_locale;
};
wxIMPLEMENT_APP(ReplayManagerApp);