]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Move isEventLoopStarted() staff from GUI to MED module.
authorvsr <vsr@opencascade.com>
Thu, 21 Apr 2016 13:43:58 +0000 (16:43 +0300)
committervsr <vsr@opencascade.com>
Thu, 21 Apr 2016 13:43:58 +0000 (16:43 +0300)
src/MEDCalc/gui/TestController.cxx
src/MEDCalc/gui/TestController.hxx

index 78bb46dd2c3f1d7134c33daa12ec1a1dccdcbe32..c9d71efd190e10448cb1bc0e380295814f587503 100644 (file)
@@ -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;
+}
index 9f5acfd6f9f0a67d8620527a947fe75f08c37219..ed8295c1caef5e21a5ccec0808c5b6ba3e952e69 100644 (file)
@@ -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_ */