From a5ee71cf7f8b598f2ab4c1d9a0d43d92daa6d3e9 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 21 Apr 2016 16:43:58 +0300 Subject: [PATCH] Move isEventLoopStarted() staff from GUI to MED module. --- src/MEDCalc/gui/TestController.cxx | 13 ++++++++++--- src/MEDCalc/gui/TestController.hxx | 7 ++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/MEDCalc/gui/TestController.cxx b/src/MEDCalc/gui/TestController.cxx index 78bb46dd2..c9d71efd1 100644 --- a/src/MEDCalc/gui/TestController.cxx +++ b/src/MEDCalc/gui/TestController.cxx @@ -60,12 +60,15 @@ TestController::TestController(MEDModule* mod): _tester(0), _lock_action(0), _quitEventType(QEvent::registerEventType()), _playEventType(QEvent::registerEventType()), - _aboutToPlayTest(false) + _aboutToPlayTest(false), + _myEventLoopStarted(false) { STDLOG("Creating a TestController"); _tester = new pqTestUtility(_desk); _tester->addEventObserver("xml", new pqXMLEventObserver(_desk)); _tester->addEventSource("xml", new pqXMLEventSource(_desk)); + + QTimer::singleShot(0, this, SLOT(onMainEventLoopStarting())); } TestController::~TestController() @@ -160,7 +163,7 @@ TestController::customEvent(QEvent * event) { if (event->type() == _quitEventType) { - if(!_salomeModule->getApp()->isMainEventLoopStarted()) + if(!isMainEventLoopStarted()) // Repost (=delay) QApplication::postEvent(this, new QEvent((QEvent::Type)_quitEventType)); else @@ -172,7 +175,7 @@ TestController::customEvent(QEvent * event) if (e) { // // Wait for main event loop to start: - if(!_salomeModule->getApp()->isMainEventLoopStarted()) + if(!isMainEventLoopStarted()) // Repost (=delay) QApplication::postEvent(this, new PlayTestEvent((QEvent::Type)_playEventType, e->_filename)); else @@ -207,3 +210,7 @@ TestController::processWorkspaceEvent(const MEDCALC::MedEvent* event) } } +void TestController::onMainEventLoopStarting() +{ + _myEventLoopStarted = true; +} diff --git a/src/MEDCalc/gui/TestController.hxx b/src/MEDCalc/gui/TestController.hxx index 9f5acfd6f..ed8295c1c 100644 --- a/src/MEDCalc/gui/TestController.hxx +++ b/src/MEDCalc/gui/TestController.hxx @@ -40,7 +40,7 @@ public: void createActions(); - + bool isMainEventLoopStarted() const { return _myEventLoopStarted; } protected: virtual void customEvent(QEvent * event); @@ -62,11 +62,16 @@ protected: pqTestUtility * _tester; QAction * _lock_action; +private slots: + void onMainEventLoopStarting(); + private: const int _playEventType; const int _quitEventType; bool _aboutToPlayTest; + + bool _myEventLoopStarted; }; #endif /* SRC_MEDCALC_GUI_TESTCONTROLLER_HXX_ */ -- 2.39.2