defuze.me
Client
|
00001 /************************************************************************** 00002 ** defuze.me Epitech Innovative Project 00003 ** 00004 ** Copyright 2010-2011 00005 ** Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard 00006 ** Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier 00007 ** 00008 ** All rights reserved. 00009 **************************************************************************/ 00010 00011 #include "defuzemeapplication.hpp" 00012 #include "logger.hpp" 00013 #include <QDebug> 00014 #include <QMessageBox> 00015 #include <QTimer> 00016 00017 DefuzemeApplication::DefuzemeApplication(int &argc, char **argv) : 00018 QApplication(argc, argv) 00019 { 00020 qRegisterMetaType<Exception>("Exception"); 00021 connect(this, SIGNAL(forwardException(Exception)), SLOT(displayException(Exception))); 00022 } 00023 00024 DefuzemeApplication::~DefuzemeApplication() 00025 { 00026 } 00027 00028 bool DefuzemeApplication::notify(QObject *receiver, QEvent *event) 00029 { 00030 try 00031 { 00032 return QApplication::notify(receiver, event); 00033 } 00034 catch (Exception &e) 00035 { 00036 qDebug() << "APP: " << e.description(); 00037 emit forwardException(e); 00038 } 00039 return false; 00040 } 00041 00042 void DefuzemeApplication::displayException(const Exception& e) throw() 00043 { 00044 if (!speedControl.isActive()) 00045 { 00046 speedControl.setSingleShot(true); 00047 speedControl.start(5000); 00048 QMessageBox::critical(NULL, "defuze.me", "An fatal error occurred while running defuze.me.<br><i>" + 00049 e.msg() + " (error " + e.hexCode() + 00050 ")</i><br><br>Get online support about this error <a href='http://defuze.me/support/errors/" + 00051 e.hexCode() + "'>here</a>."); 00052 } 00053 }