]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2830: Make Red/Green button accessible in OpenParts application
authorvsv <vsv@opencascade.com>
Thu, 10 Jan 2019 10:45:02 +0000 (13:45 +0300)
committervsv <vsv@opencascade.com>
Thu, 10 Jan 2019 10:45:02 +0000 (13:45 +0300)
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_WorkshopListener.cpp

index 553a0d05f92507e4cd36173b4084d509d3bee149..10aab94b060a96a869996563f2318c73c760b4b8 100755 (executable)
@@ -505,11 +505,11 @@ void XGUI_Workshop::initMenu()
   aCommand->connectTo(this, SLOT(onOpen()));
 
 
-  //aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
-  //                              tr("Blocks immediate apply of modifications"),
-  //                              QIcon(":pictures/autoapply_start.png"), QKeySequence());
-  //aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
-  //aCommand->connectTo(this, SLOT(onAutoApply()));
+  aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
+                                tr("Blocks immediate apply of modifications"),
+                                QIcon(":pictures/autoapply_start.png"), QKeySequence());
+  aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
+  aCommand->connectTo(this, SLOT(onAutoApply()));
 
   aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
                                 QIcon(":pictures/preferences.png"), QKeySequence::Preferences);
@@ -1331,11 +1331,11 @@ void XGUI_Workshop::updateCommandStatus()
         else
           aCmd->setEnabled(myModule->canRedo());
       }
-      //else if (aId == "AUTOCOMPUTE_CMD") {
-      //  aCmd->setIcon(aMgr->isAutoUpdateBlocked() ?
-      //    QIcon(":pictures/autoapply_stop.png") :
-      //    QIcon(":pictures/autoapply_start.png"));
-      //}
+      else if (aId == "AUTOCOMPUTE_CMD") {
+        aCmd->setIcon(aMgr->isAutoUpdateBlocked() ?
+          QIcon(":pictures/autoapply_stop.png") :
+          QIcon(":pictures/autoapply_start.png"));
+      }
       else
         // Enable all commands
         aCmd->setEnabled(true);
@@ -2843,10 +2843,10 @@ void XGUI_Workshop::onAutoApply()
   aMgr->blockAutoUpdate(!isBlocked);
 }
 
-//void XGUI_Workshop::updateAutoComputeState()
-//{
-//  SessionPtr aMgr = ModelAPI_Session::get();
-//  bool isComputeBlocked = aMgr->isAutoUpdateBlocked();
+void XGUI_Workshop::updateAutoComputeState()
+{
+  SessionPtr aMgr = ModelAPI_Session::get();
+  bool isComputeBlocked = aMgr->isAutoUpdateBlocked();
 //#ifdef HAVE_SALOME
 //  QAction* aUpdateCmd;
 //  QList<QAction*> aCommands = mySalomeConnector->commandList();
@@ -2859,12 +2859,12 @@ void XGUI_Workshop::onAutoApply()
 //  aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
 //    QIcon(":pictures/autoapply_start.png"));
 //#else
-//  AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
-//  AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD");
-//  aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
-//    QIcon(":pictures/autoapply_start.png"));
+  AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
+  AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD");
+  aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
+    QIcon(":pictures/autoapply_start.png"));
 //#endif
-//}
+}
 
 
 void XGUI_Workshop::clearTemporaryDir()
index 5c5a47d9a49a4ee3d19f24ee85202c0a94b1be5f..2955efab2dd7d3508166edb3b76fb3755e548dc0 100755 (executable)
@@ -321,7 +321,7 @@ Q_OBJECT
   /// \param theDirectory a path to directory
   void openFile(const QString& theDirectory);
 
-  //void updateAutoComputeState();
+  void updateAutoComputeState();
 
 signals:
   /// Emitted when selection happens in Salome viewer
index 33c2cd199650529312bdf2d7e9fd45777301c3f1..7701c221b70b1375a1764282380bbd044b4063f3 100755 (executable)
@@ -113,8 +113,8 @@ void XGUI_WorkshopListener::initializeEventListening()
 
   aLoop->registerListener(this, Events_Loop::eventByName("FinishOperation"));
   aLoop->registerListener(this, Events_Loop::eventByName("AbortOperation"));
-  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE));
-  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE));
 }
 
 //******************************************************
@@ -186,11 +186,11 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr<Events_Message>&
     // the viewer's update context is unblocked, the viewer's update works
     XGUI_Displayer* aDisplayer = workshop()->displayer();
     aDisplayer->enableUpdateViewer(true);
-  //} else if ((theMessage->eventID() ==
-  //  Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)) ||
-  //  (theMessage->eventID() ==
-  //    Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE))) {
-  //  myWorkshop->updateAutoComputeState();
+  } else if ((theMessage->eventID() ==
+    Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)) ||
+    (theMessage->eventID() ==
+      Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE))) {
+    myWorkshop->updateAutoComputeState();
   } else {
     //Show error dialog if error message received.
     std::shared_ptr<Events_InfoMessage> anIngfoMsg =