Commit 6504d775 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Improved crash window.

You can test it by using Tools -> crash :D
parent d48dc31e
......@@ -487,3 +487,8 @@ void MainWindow::keyboardShortcutChanged( const QString& name, const QString&
else
qWarning() << "Unknown shortcut:" << name;
}
void MainWindow::on_actionCrash_triggered()
{
int test = 1 / 0;
}
......@@ -95,6 +95,7 @@ private slots:
void on_actionHelp_triggered();
void on_actionProject_Preferences_triggered();
void on_actionClose_Project_triggered();
void on_actionCrash_triggered();
void toolButtonClicked( int id );
void projectUpdated( const QString& projectName, bool savedStatus );
void keyboardShortcutChanged( const QString&, const QString& );
......
......@@ -146,7 +146,6 @@ void PreviewWidget::endReached()
void PreviewWidget::on_pushButtonNextFrame_clicked()
{
int test = 1 / 0;
if ( m_previewStopped == false )
m_renderer->nextFrame();
}
......
......@@ -73,6 +73,7 @@
<string>Tools</string>
</property>
<addaction name="actionTranscode"/>
<addaction name="actionCrash"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
......@@ -212,6 +213,11 @@
<string>Close Project</string>
</property>
</action>
<action name="actionCrash">
<property name="text">
<string>Crash</string>
</property>
</action>
</widget>
<resources>
<include location="../../../ressources.qrc"/>
......
......@@ -25,10 +25,10 @@
#include "ui_CrashHandler.h"
#include <execinfo.h>
#include <signal.h>
CrashHandler::CrashHandler( QWidget *parent ) :
CrashHandler::CrashHandler( int sig, QWidget *parent ) :
QDialog( parent ),
ui( new Ui::CrashHandler )
{
......@@ -37,9 +37,18 @@ CrashHandler::CrashHandler( QWidget *parent ) :
void *buff[CrashHandler::backtraceSize];
int nbSymb = backtrace( buff, CrashHandler::backtraceSize );
char** backtraceStr = backtrace_symbols( buff, nbSymb );
for ( unsigned int i = 0; i < nbSymb; ++i )
for ( int i = 0; i < nbSymb; ++i )
ui->backtraceDisplay->insertPlainText( QString( backtraceStr[i]) + "\n" );
free(backtraceStr);
QString sigName = tr( "Unknown signal" );
if ( sig == SIGSEGV )
sigName = "SIGSEGV (Segmentation Fault)";
if ( sig == SIGFPE )
sigName = "SIGFPE (Floating Exception)";
else
sigName = "Unknown";
ui->crashDescriptionLabel->setText( tr("A crash occured. Signal received: ") + sigName );
}
CrashHandler::~CrashHandler()
......
......@@ -35,7 +35,7 @@ class CrashHandler : public QDialog
{
Q_OBJECT
public:
CrashHandler(QWidget *parent = 0);
CrashHandler( int sig, QWidget *parent = 0 );
~CrashHandler();
protected:
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>512</width>
<height>370</height>
</rect>
</property>
<property name="windowTitle">
......@@ -99,39 +99,6 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>VLMC Crash handler</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="3">
<widget class="QLabel" name="logoLabel">
<property name="sizePolicy">
......@@ -148,10 +115,27 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>VLMC Crash handler</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>An error occured. We're sorry for the inconvenient, though we saved your project. It will be reopened next time you open VLMC.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
......@@ -175,26 +159,26 @@
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="2" column="0">
<widget class="QTextEdit" name="backtraceDisplay">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="backtraceDisplay"/>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="crashDescriptionLabel">
<property name="text">
<string>TextLabel</string>
<string>Crash_Description</string>
</property>
</widget>
</item>
......
......@@ -24,6 +24,7 @@
#include <QtDebug>
#include <QSettings>
#include <QMessageBox>
#include <QApplication>
#include <signal.h>
......@@ -39,9 +40,9 @@ void ProjectManager::signalHandler( int sig )
ProjectManager::getInstance()->emergencyBackup();
CrashHandler* ch = new CrashHandler();
CrashHandler* ch = new CrashHandler( sig );
ch->exec();
raise( sig );
QApplication::exit(1);
}
const QString ProjectManager::unNamedProject = tr( "<Unnamed project>" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment