Commit f4a0f3fa authored by Langella Olivier's avatar Langella Olivier
Browse files

no more need to use notify for cross thread exception communication

parent 05e50e70
......@@ -5,37 +5,6 @@
#include "masschroq_cli.h"
#include <pappsomspp/pappsoexception.h>
// using namespace std;
class MyAppMcq : public QCoreApplication
{
public:
MyAppMcq(int &argc, char **argv) : QCoreApplication(argc, argv){};
private:
bool
notify(QObject *receiver_, QEvent *event_)
{
try
{
return QCoreApplication::notify(receiver_, event_);
}
catch(pappso::PappsoException &ex)
{
std::cerr << "pappso::PappsoException was caught:\n"
<< ex.qwhat().toStdString() << std::endl;
throw ex;
}
catch(std::exception &ex)
{
std::cerr << "std::exception was caught:\n" << ex.what() << std::endl;
throw ex;
}
return false;
};
};
int
main(int argc, char **argv)
{
......@@ -45,7 +14,7 @@ main(int argc, char **argv)
ConsoleOut::setCout(new QTextStream(stdout, QIODevice::WriteOnly));
ConsoleOut::setCerr(new QTextStream(stderr, QIODevice::WriteOnly));
MyAppMcq app(argc, argv);
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("MassChroQ");
QCoreApplication::setApplicationVersion(MASSCHROQ_VERSION);
QLocale::setDefault(QLocale::system());
......@@ -53,18 +22,11 @@ main(int argc, char **argv)
// create the main class
masschroqCli myMain;
// connect up the signals
#if QT_VERSION >= 0x050000
// Qt5 code
QObject::connect(&myMain, &masschroqCli::finished, &app, &MyAppMcq::quit);
QObject::connect(
&app, &MyAppMcq::aboutToQuit, &myMain, &masschroqCli::aboutToQuitApp);
#else
// Qt4 code
QObject::connect(&myMain, SIGNAL(finished()), &app, SLOT(quit()));
QObject::connect(&myMain, &masschroqCli::finished, &app, &QCoreApplication::quit);
QObject::connect(
&app, SIGNAL(aboutToQuit()), &myMain, SLOT(aboutToQuitApp()));
#endif
&app, &QCoreApplication::aboutToQuit, &myMain, &masschroqCli::aboutToQuitApp);
// This code will start the messaging engine in QT and in
// 10ms it will start the execution in the MainClass.run routine;
......
Supports Markdown
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