mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Created a class MainApplication to handle notify()
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* MainApplication.cpp
|
||||
*
|
||||
* (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com
|
||||
* (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net
|
||||
*
|
||||
* 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MainApplication.h"
|
||||
|
||||
MainApplication::MainApplication(int &argc, char *argv[])
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MainApplication::~MainApplication()
|
||||
{
|
||||
}
|
||||
|
||||
bool MainApplication::notify(QObject *receiver, QEvent *event)
|
||||
{
|
||||
try
|
||||
{
|
||||
return QApplication::notify(receiver, event);
|
||||
}
|
||||
catch (std::exception &ex)
|
||||
{
|
||||
qDebug() << "std::exception was caught: " << ex.what() << endl;
|
||||
qDebug() << "event type: " << event->type() << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* MainApplication.h
|
||||
*
|
||||
* (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com
|
||||
* (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net
|
||||
*
|
||||
* 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MAINAPPLICATION_H_
|
||||
#define MAINAPPLICATION_H_
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
class MainApplication : public QApplication
|
||||
{
|
||||
public:
|
||||
MainApplication(int &argc, char *argv[]);
|
||||
virtual ~MainApplication();
|
||||
|
||||
bool notify(QObject *receiver, QEvent *event);
|
||||
};
|
||||
|
||||
#endif /* MAINAPPLICATION_H_ */
|
||||
@@ -3,6 +3,7 @@ TEMPLATE = app
|
||||
HEADERS = \
|
||||
DestinationGLCanvas.h \
|
||||
# Facade.h \
|
||||
MainApplication.h \
|
||||
MainWindow.h \
|
||||
Mapper.h \
|
||||
MapperGLCanvas.h \
|
||||
@@ -22,6 +23,7 @@ SOURCES = \
|
||||
DestinationGLCanvas.cpp \
|
||||
# Facade.cpp \
|
||||
MainWindow.cpp \
|
||||
MainApplication.cpp \
|
||||
Mapper.cpp \
|
||||
MapperGLCanvas.cpp \
|
||||
Mapping.cpp \
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
// NOTE: To run, it is recommended not to be in Compiz or Beryl, they have shown some instability.
|
||||
|
||||
#include <iostream>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QTranslator>
|
||||
#include <QtGui>
|
||||
#include "Common.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MainApplication.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// TODO: avoid segfaults when OSC port is busy
|
||||
QApplication app(argc, argv);
|
||||
MainApplication app(argc, argv);
|
||||
|
||||
if (! QGLFormat::hasOpenGL())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user