From: vsr Date: Thu, 21 Apr 2016 13:43:58 +0000 (+0300) Subject: Move isEventLoopStarted() staff from GUI to MED module. X-Git-Tag: V8_1_0b1~25^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a5ee71cf7f8b598f2ab4c1d9a0d43d92daa6d3e9;p=modules%2Fmed.git Move isEventLoopStarted() staff from GUI to MED module. --- 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_ */