]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Fix for bug PAL12449: No warning is displayed when the graph view is closed.
authormkr <mkr@opencascade.com>
Mon, 29 May 2006 08:06:22 +0000 (08:06 +0000)
committermkr <mkr@opencascade.com>
Mon, 29 May 2006 08:06:22 +0000 (08:06 +0000)
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERV_msg_en.po

index b1cf1a54e098667ade0a36fe1fa7f43c4583b495..743e9c167c8fdcdc433b8d5887f6c894ce716363 100644 (file)
@@ -375,43 +375,55 @@ void SUPERVGUI::onGraphClosed(SUIT_ViewWindow* theViewWindow) {
     SUPERVGraph_View* view = supervFrame->getViewWidget();
     SUPERVGUI_Main* aGraph = dynamic_cast<SUPERVGUI_Main*>(view);
     if ( aGraph ) {
+      // mkr: PAL12449 --->
+      if ( !aGraph->isDataflowInStudy() ) {
+       const int aWarnResult = QMessageBox::information(application()->desktop(), tr("MSG_INFO"),
+                                                        tr("MSG_GRAPH_UNSAVED"),
+                                                        QMessageBox::Yes, QMessageBox::No);
+       if ( aWarnResult == QMessageBox::Yes ) {
+         aGraph->addDataflowToStudy();
+         updateObjBrowser();
+       }
+      }
+      // mkr: PAL12449 <---
+      
       unregisterGraph(aGraph);
       SUPERV_Graph aDataFlow = aGraph->getDataflow();
       if ( !SUPERV_isNull( aDataFlow ) ) {
-        if ( aDataFlow->IsExecuting() ) {
-          const int aMsgResult = QMessageBox::warning(application()->desktop(),
-                                                      tr("WARNING"),
-                                                      tr("MSG_DF_RUNNING"),
-                                                      tr("MSG_DF_EXECUTION"),
-                                                      tr("MSG_DF_KILL"));
-          if ( aMsgResult == 1 ) {
-            // KILL EXECUTION
-            if ( aDataFlow->Kill() ) {
-              // Kill() sends KillEvent and KillState to SUPERVGUI_Thread
-              // while sets myIsActive flag to false when it receives such event/state
-              // after myIsActive is false it calls QThread::exit() to terminate.
-
-              // why while() { qApp->processEvents() } ?
-              // because: SUPERVGUI_Thread::run() receives events, and calls myMain->execute()
-              // method using SALOME_Event paradigm, ProcessVoidEvent() function -
-              // it puts this event to the main application event loop, in which we are being now.
-              // So if we block main GUI application thread (by calling aGraph->getMyThread()->wait() here)
-              // then we will have a deadlock of 2 threads waiting for one another
-              while (aGraph->getMyThread()->running())
-                qApp->processEvents();
-            }
-          }
-          else { // BACKGROUND EXECUTION
-            emit KillMainThread(true); // set SUPERVGUI_Thread::myIsActive to false
-            while ( aGraph->getMyThread()->running() )
-              qApp->processEvents();
-          }
-        }
-        else { // EXECUTION IS FINISHED, JUST DESTROY THE SUPERVGUI_Thread object and return.
-          emit KillMainThread(true);
-          while ( aGraph->getMyThread()->running() )
-            qApp->processEvents();
-        }
+       if ( aDataFlow->IsExecuting() ) {
+         const int aMsgResult = QMessageBox::warning(application()->desktop(),
+                                                     tr("WARNING"),
+                                                     tr("MSG_DF_RUNNING"),
+                                                     tr("MSG_DF_EXECUTION"),
+                                                     tr("MSG_DF_KILL"));
+         if ( aMsgResult == 1 ) {
+           // KILL EXECUTION
+           if ( aDataFlow->Kill() ) {
+             // Kill() sends KillEvent and KillState to SUPERVGUI_Thread
+             // while sets myIsActive flag to false when it receives such event/state
+             // after myIsActive is false it calls QThread::exit() to terminate.
+             
+             // why while() { qApp->processEvents() } ?
+             // because: SUPERVGUI_Thread::run() receives events, and calls myMain->execute()
+             // method using SALOME_Event paradigm, ProcessVoidEvent() function -
+             // it puts this event to the main application event loop, in which we are being now.
+             // So if we block main GUI application thread (by calling aGraph->getMyThread()->wait() here)
+             // then we will have a deadlock of 2 threads waiting for one another
+             while (aGraph->getMyThread()->running())
+               qApp->processEvents();
+           }
+         }
+         else { // BACKGROUND EXECUTION
+           emit KillMainThread(true); // set SUPERVGUI_Thread::myIsActive to false
+           while ( aGraph->getMyThread()->running() )
+             qApp->processEvents();
+         }
+       }
+       else { // EXECUTION IS FINISHED, JUST DESTROY THE SUPERVGUI_Thread object and return.
+         emit KillMainThread(true);
+         while ( aGraph->getMyThread()->running() )
+           qApp->processEvents();
+       }
       }
     }
   }
index 785d577da80332d3f7de13aacf55726de7dcc0bb..bc5980294dadfaa50f8459d4c194fc2ee4cdf3ff 100644 (file)
@@ -244,6 +244,9 @@ msgstr "Choose a Data in Study"
 msgid "MSG_GRAPH_DISPLAYED"
 msgstr "The DataFlow %1 \nis already displayed. Open again?"
 
+msgid "MSG_GRAPH_UNSAVED"
+msgstr "This dataflow has not been saved in study. Do you want to add it in study before close?"
+
 #:SUPERVGUI_Main.cxx:288
 msgid "MSG_CRL_NOTCOMPLETE"
 msgstr "Link Creation Is Not Complete"