Skip to content
Permalink
Browse files
[FEATURE][needs-docs] Add better crash dialog
  • Loading branch information
NathanW2 committed Apr 12, 2017
1 parent 0e1a7d9 commit 7694dd2d814ef3bcdecfa18afb7c934b08c30b8e
Showing with 690 additions and 1 deletion.
  1. +1 −0 images/images.qrc
  2. +2 −0 src/app/CMakeLists.txt
  3. +17 −1 src/app/qgisapp.cpp
  4. +32 −0 src/app/qgscrashdialog.cpp
  5. +38 −0 src/app/qgscrashdialog.h
  6. +600 −0 src/ui/qgscrashdialog.ui
@@ -557,6 +557,7 @@
<file>themes/default/mActionNewMap.svg</file>
<file>themes/default/mActionMapSettings.svg</file>
<file>themes/default/mActionLockExtent.svg</file>
<file>icons/qgis_icon.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
@@ -178,6 +178,7 @@ SET(QGIS_APP_SRCS

qgssettingstree.cpp
qgsvariantdelegate.cpp
qgscrashdialog.cpp
)

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

qgssettingstree.h
qgsvariantdelegate.h
qgscrashdialog.h
)

SET (WITH_QWTPOLAR FALSE CACHE BOOL "Determines whether QwtPolar should be built")
@@ -110,6 +110,7 @@
// QGIS Specific Includes
//

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

void QgisApp::fileNew()
{
QgsRuntimeProfiler *profile;
profile->clear();
fileNew( true ); // prompts whether to save project
} // fileNew()

@@ -12505,6 +12508,9 @@ void QgisApp::transactionGroupCommitError( const QString &error )
#ifdef Q_OS_WIN
LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
// Crash dump creation will be move to a new class in the near future.

#if 0
QString dumpName = QDir::toNativeSeparators(
QString( "%1\\qgis-%2-%3-%4-%5.dmp" )
.arg( QDir::tempPath() )
@@ -12538,8 +12544,18 @@ LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
msg = QObject::tr( "creation of minidump to %1 failed (%2)" ).arg( dumpName ).arg( GetLastError(), 0, 16 );
}
#endif

QMessageBox::critical( 0, QObject::tr( "Crash dumped" ), msg );
QgsCrashDialog dlg( QApplication::activeWindow() );
if ( dlg.exec() )
{
QStringList arguments;
arguments = QCoreApplication::arguments();
QString path = arguments.at( 0 );
arguments.removeFirst();
arguments << QgsProject::instance()->fileName();
QProcess::startDetached( path, arguments, QDir::toNativeSeparators( QCoreApplication::applicationDirPath() ) );
}

return EXCEPTION_EXECUTE_HANDLER;
}
@@ -0,0 +1,32 @@
/***************************************************************************
qgscrashdialog.cpp - QgsCrashDialog
---------------------
begin : 11.4.2017
copyright : (C) 2017 by Nathan Woodrow
email : woodrow.nathan@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/


#include "qgscrashdialog.h"

QgsCrashDialog::QgsCrashDialog( QWidget *parent )
: QDialog( parent )
{
setupUi( this );
setWindowTitle( tr( "Oh. Snap!" ) );

mCrashHeaderMessage->setText( tr( "Ouch!" ) );
mCrashMessage->setText( tr("Sorry it looks like QGIS crashed. \nSomething unexpected happened that we didn't handle correctly."));

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>" ) );
mHelpLabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
mHelpLabel->setOpenExternalLinks( true );
}
@@ -0,0 +1,38 @@
/***************************************************************************
qgscrashdialog.h - QgsCrashDialog
---------------------
begin : 11.4.2017
copyright : (C) 2017 by Nathan Woodrow
email : woodrow.nathan@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSCRASHDIALOG_H
#define QGSCRASHDIALOG_H

#include <QDialog>
#include "ui_qgscrashdialog.h"
#include "qgis_app.h"

/**
* A dialog to show a nicer crash dialog to the user.
*/
class APP_EXPORT QgsCrashDialog : public QDialog, private Ui::QgsCrashDialog
{
Q_OBJECT
public:

/**
* A dialog to show a nicer crash dialog to the user.
*/
QgsCrashDialog( QWidget *parent = nullptr );
};

#endif // QGSCRASHDIALOG_H
Loading

0 comments on commit 7694dd2

Please sign in to comment.