From: vsv Date: Thu, 10 Jan 2019 10:45:02 +0000 (+0300) Subject: Issue #2830: Make Red/Green button accessible in OpenParts application X-Git-Tag: Jan2019~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6fc9747c897b04aac85b3b5abbeb05abde1045fc;p=modules%2Fshaper.git Issue #2830: Make Red/Green button accessible in OpenParts application --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 553a0d05f..10aab94b0 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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 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() diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 5c5a47d9a..2955efab2 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -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 diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 33c2cd199..7701c221b 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -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& // 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 anIngfoMsg =