Skip to content

Commit 7694dd2

Browse files
committedApr 12, 2017
[FEATURE][needs-docs] Add better crash dialog
1 parent 0e1a7d9 commit 7694dd2

File tree

6 files changed

+690
-1
lines changed

6 files changed

+690
-1
lines changed
 

‎images/images.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@
557557
<file>themes/default/mActionNewMap.svg</file>
558558
<file>themes/default/mActionMapSettings.svg</file>
559559
<file>themes/default/mActionLockExtent.svg</file>
560+
<file>icons/qgis_icon.svg</file>
560561
</qresource>
561562
<qresource prefix="/images/tips">
562563
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>

‎src/app/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ SET(QGIS_APP_SRCS
178178

179179
qgssettingstree.cpp
180180
qgsvariantdelegate.cpp
181+
qgscrashdialog.cpp
181182
)
182183

183184
SET (QGIS_APP_MOC_HDRS
@@ -348,6 +349,7 @@ SET (QGIS_APP_MOC_HDRS
348349

349350
qgssettingstree.h
350351
qgsvariantdelegate.h
352+
qgscrashdialog.h
351353
)
352354

353355
SET (WITH_QWTPOLAR FALSE CACHE BOOL "Determines whether QwtPolar should be built")

‎src/app/qgisapp.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
// QGIS Specific Includes
111111
//
112112

113+
#include "qgscrashdialog.h"
113114
#include "qgisapp.h"
114115
#include "qgisappinterface.h"
115116
#include "qgisappstylesheet.h"
@@ -4724,6 +4725,8 @@ void QgisApp::fileExit()
47244725

47254726
void QgisApp::fileNew()
47264727
{
4728+
QgsRuntimeProfiler *profile;
4729+
profile->clear();
47274730
fileNew( true ); // prompts whether to save project
47284731
} // fileNew()
47294732

@@ -12505,6 +12508,9 @@ void QgisApp::transactionGroupCommitError( const QString &error )
1250512508
#ifdef Q_OS_WIN
1250612509
LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
1250712510
{
12511+
// Crash dump creation will be move to a new class in the near future.
12512+
12513+
#if 0
1250812514
QString dumpName = QDir::toNativeSeparators(
1250912515
QString( "%1\\qgis-%2-%3-%4-%5.dmp" )
1251012516
.arg( QDir::tempPath() )
@@ -12538,8 +12544,18 @@ LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
1253812544
{
1253912545
msg = QObject::tr( "creation of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
1254012546
}
12547+
#endif
1254112548

12542-
QMessageBox::critical( 0, QObject::tr( "Crash dumped" ), msg );
12549+
QgsCrashDialog dlg( QApplication::activeWindow() );
12550+
if ( dlg.exec() )
12551+
{
12552+
QStringList arguments;
12553+
arguments = QCoreApplication::arguments();
12554+
QString path = arguments.at( 0 );
12555+
arguments.removeFirst();
12556+
arguments << QgsProject::instance()->fileName();
12557+
QProcess::startDetached( path, arguments, QDir::toNativeSeparators( QCoreApplication::applicationDirPath() ) );
12558+
}
1254312559

1254412560
return EXCEPTION_EXECUTE_HANDLER;
1254512561
}

‎src/app/qgscrashdialog.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/***************************************************************************
2+
qgscrashdialog.cpp - QgsCrashDialog
3+
4+
---------------------
5+
begin : 11.4.2017
6+
copyright : (C) 2017 by Nathan Woodrow
7+
email : woodrow.nathan@gmail.com
8+
***************************************************************************
9+
* *
10+
* This program is free software; you can redistribute it and/or modify *
11+
* it under the terms of the GNU General Public License as published by *
12+
* the Free Software Foundation; either version 2 of the License, or *
13+
* (at your option) any later version. *
14+
* *
15+
***************************************************************************/
16+
17+
18+
#include "qgscrashdialog.h"
19+
20+
QgsCrashDialog::QgsCrashDialog( QWidget *parent )
21+
: QDialog( parent )
22+
{
23+
setupUi( this );
24+
setWindowTitle( tr( "Oh. Snap!" ) );
25+
26+
mCrashHeaderMessage->setText( tr( "Ouch!" ) );
27+
mCrashMessage->setText( tr("Sorry it looks like QGIS crashed. \nSomething unexpected happened that we didn't handle correctly."));
28+
29+
mHelpLabel->setText( tr( "Keen to help us fix it? <br> <a href=\"http://qgis.org/en/site/getinvolved/development/bugreporting.html#bugs-features-and-issues\"> Follow the steps to help devs.<a>" ) );
30+
mHelpLabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
31+
mHelpLabel->setOpenExternalLinks( true );
32+
}

‎src/app/qgscrashdialog.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/***************************************************************************
2+
qgscrashdialog.h - QgsCrashDialog
3+
4+
---------------------
5+
begin : 11.4.2017
6+
copyright : (C) 2017 by Nathan Woodrow
7+
email : woodrow.nathan@gmail.com
8+
***************************************************************************
9+
* *
10+
* This program is free software; you can redistribute it and/or modify *
11+
* it under the terms of the GNU General Public License as published by *
12+
* the Free Software Foundation; either version 2 of the License, or *
13+
* (at your option) any later version. *
14+
* *
15+
***************************************************************************/
16+
17+
#ifndef QGSCRASHDIALOG_H
18+
#define QGSCRASHDIALOG_H
19+
20+
#include <QDialog>
21+
#include "ui_qgscrashdialog.h"
22+
#include "qgis_app.h"
23+
24+
/**
25+
* A dialog to show a nicer crash dialog to the user.
26+
*/
27+
class APP_EXPORT QgsCrashDialog : public QDialog, private Ui::QgsCrashDialog
28+
{
29+
Q_OBJECT
30+
public:
31+
32+
/**
33+
* A dialog to show a nicer crash dialog to the user.
34+
*/
35+
QgsCrashDialog( QWidget *parent = nullptr );
36+
};
37+
38+
#endif // QGSCRASHDIALOG_H

‎src/ui/qgscrashdialog.ui

Lines changed: 600 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.