1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 16:37:12 +01:00

Move AudacityApp::GenerateCrashReport to its own files

This commit is contained in:
Paul Licameli
2019-05-17 16:29:31 -04:00
parent 8da6529329
commit b04387a21d
11 changed files with 175 additions and 90 deletions

View File

@@ -71,6 +71,7 @@ It handles initialization and termination by subclassing wxApp.
#include "AudioIO.h"
#include "Benchmark.h"
#include "Clipboard.h"
#include "CrashReport.h"
#include "DirManager.h"
#include "commands/CommandHandler.h"
#include "commands/AppCommandEvent.h"
@@ -97,7 +98,6 @@ It handles initialization and termination by subclassing wxApp.
#include "ondemand/ODManager.h"
#include "widgets/ErrorDialog.h"
#include "prefs/DirectoriesPrefs.h"
#include "prefs/GUIPrefs.h"
#include "tracks/ui/Scrubbing.h"
#include "widgets/FileHistory.h"
@@ -850,7 +850,7 @@ wxLanguageInfo userLangs[] =
void AudacityApp::OnFatalException()
{
#if defined(EXPERIMENTAL_CRASH_REPORT)
GenerateCrashReport(wxDebugReport::Context_Exception);
CrashReport::Generate(wxDebugReport::Context_Exception);
#endif
exit(-1);
@@ -914,59 +914,6 @@ bool AudacityApp::OnExceptionInMainLoop()
#pragma warning( pop )
#endif //_MSC_VER
#if defined(EXPERIMENTAL_CRASH_REPORT)
void AudacityApp::GenerateCrashReport(wxDebugReport::Context ctx)
{
wxDebugReportCompress rpt;
rpt.AddAll(ctx);
wxFileName fn(FileNames::DataDir(), wxT("audacity.cfg"));
rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration"));
rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry"));
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings"));
if (ctx == wxDebugReport::Context_Current)
{
auto saveLang = GUIPrefs::GetLang();
GUIPrefs::InitLang( wxT("en") );
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
#ifdef EXPERIMENTAL_MIDI_OUT
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
#endif
}
auto logger = AudacityLogger::Get();
if (logger)
{
rpt.AddText(wxT("log.txt"), logger->GetLog(), _TS("Audacity Log"));
}
bool ok = wxDebugReportPreviewStd().Show(rpt);
#if defined(__WXMSW__)
wxEventLoop::SetCriticalWindow(NULL);
#endif
if (ok && rpt.Process())
{
AudacityTextEntryDialog dlg(NULL,
_("Report generated to:"),
_("Audacity Support Data"),
rpt.GetCompressedFileName(),
wxOK | wxCENTER);
dlg.SetName(dlg.GetTitle());
dlg.ShowModal();
wxLogMessage(wxT("Report generated to: %s"),
rpt.GetCompressedFileName());
rpt.Reset();
}
}
#endif
int AudacityApp::FilterEvent(wxEvent & event)
{
(void)event;// compiler food (stops unused parameter warning)