itom 1.4.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef MAIN_H 00024 #define MAIN_H 00025 00026 #include <qapplication.h> 00027 #include <qdebug.h> 00028 #include "opencv/cv.h" 00029 00030 class QItomApplication : public QApplication 00031 { 00032 Q_OBJECT 00033 public: 00034 00035 QItomApplication ( int & argc, char ** argv ) : QApplication(argc,argv) {} 00036 00037 bool notify ( QObject * receiver, QEvent * event ) 00038 { 00039 try 00040 { 00041 return QApplication::notify(receiver,event); 00042 } 00043 catch (cv::Exception &exc) 00044 { 00045 qWarning("Itom-Application has caught a cv::exception"); 00046 qWarning() << (exc.err).c_str() << " from" << receiver->objectName(); 00047 //qDebug() << "Itom-Application caught an exception from" << receiver->objectName() << "from event type" << event->type(); 00048 qFatal("Exiting due to exception caught. OpenCV-Exception: %s", (exc.err).c_str()); 00049 } 00050 catch(std::exception &exc) 00051 { 00052 qWarning("Itom-Application has caught an exception"); 00053 qWarning() << "Message:" << exc.what() << " from" << receiver->objectName(); 00054 qFatal("Exiting due to exception caught. Exception: %s", exc.what()); 00055 } 00056 catch (...) 00057 { 00058 qWarning("Itom-Application has caught an exception"); 00059 qDebug() << "Itom-Application caught an exception from" << receiver->objectName() << "from event type" << event->type(); 00060 qFatal("Exiting due to exception caught"); 00061 00062 } 00063 return false; 00064 } 00065 }; 00066 00067 #endif