Skip to content

Commit

Permalink
Improve 'Create GitHub Issue' button functionality on crash dialog
Browse files Browse the repository at this point in the history
Now it will open a new crash report issue type directly, and automatically fill the version and crash info (stack trace) sections
  • Loading branch information
sirjuddington committed Jan 3, 2024
1 parent e17e2f2 commit ff6013a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Application/SLADEWxApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
#include "UI/WxUtils.h"
#include "Utility/Parser.h"
#include "Utility/StringUtils.h"
#include <wx/statbmp.h>
#include <wx/filefn.h>
#include <wx/statbmp.h>
#include <wx/url.h>
#undef BOOL
#ifdef UPDATEREVISION
#include "gitinfo.h"
Expand Down Expand Up @@ -195,9 +196,7 @@ class SLADECrashDialog : public wxDialog
// Add general crash message
string message =
"SLADE has crashed unexpectedly. To help fix the problem that caused this crash, "
"please click 'Create GitHub Issue' below and copy+paste the stack trace into the "
"issue details, along with a description of what you were doing at the time of the "
"crash.";
"please click 'Create GitHub Issue' below and complete the issue details on GitHub.";
auto label = new wxStaticText(this, -1, message);
hbox->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 10);
label->Wrap(480 - 20 - picture->GetSize().x);
Expand Down Expand Up @@ -304,7 +303,13 @@ class SLADECrashDialog : public wxDialog

void onBtnPostReport(wxCommandEvent& e)
{
wxLaunchDefaultBrowser("https://github.com/sirjuddington/SLADE/issues/new");
auto url_base = "https://github.com/sirjuddington/SLADE/issues/new?labels=crash+bug&template=crash.yml";
auto version = global::sc_rev.empty() ? app::version().toString() :
app::version().toString() + " " + global::sc_rev;

wxURL url(wxString::Format("%s&version=%s&crashinfo=%s", url_base, version, trace_));

wxLaunchDefaultBrowser(url.BuildURI());
}

void onBtnExit(wxCommandEvent& e) { EndModal(wxID_OK); }
Expand Down

0 comments on commit ff6013a

Please # to comment.