From cc3070fb2875ae411eb5e1b6286ca966605caea3 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 10 Jan 2019 13:05:24 +0300 Subject: [PATCH] Issue #2830: Remove Green/Red button --- src/XGUI/XGUI_Workshop.cpp | 75 +++++++++++++++--------------- src/XGUI/XGUI_Workshop.h | 2 +- src/XGUI/XGUI_WorkshopListener.cpp | 14 +++--- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 95901d380..553a0d05f 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -442,13 +442,13 @@ void XGUI_Workshop::initMenu() salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT"); - aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Auto rebuild"), - tr("Blocks immediate apply of modifications"), - QIcon(":pictures/autoapply.png"), QKeySequence(), - false, "MEN_DESK_EDIT"); - salomeConnector()->addActionInToolbar( aAction, aToolBarTitle ); + //aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Auto rebuild"), + // tr("Blocks immediate apply of modifications"), + // QIcon(":pictures/autoapply.png"), QKeySequence(), + // false, "MEN_DESK_EDIT"); + //salomeConnector()->addActionInToolbar( aAction, aToolBarTitle ); - connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onAutoApply())); + //connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onAutoApply())); salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT"); @@ -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 = 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->connectTo(this, SLOT(onAutoApply())); aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"), QIcon(":pictures/preferences.png"), QKeySequence::Preferences); @@ -1331,12 +1331,11 @@ void XGUI_Workshop::updateCommandStatus() else aCmd->setEnabled(myModule->canRedo()); } - else if (aId == "AUTOCOMPUTE_CMD") { - //aCmd->setChecked(aMgr->isAutoUpdateBlocked()); - 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); @@ -2844,28 +2843,28 @@ void XGUI_Workshop::onAutoApply() aMgr->blockAutoUpdate(!isBlocked); } -void XGUI_Workshop::updateAutoComputeState() -{ - SessionPtr aMgr = ModelAPI_Session::get(); - bool isComputeBlocked = aMgr->isAutoUpdateBlocked(); -#ifdef HAVE_SALOME - QAction* aUpdateCmd; - QList aCommands = mySalomeConnector->commandList(); - foreach(QAction* aCmd, aCommands) { - if (aCmd->data().toString() == "AUTOCOMPUTE_CMD") { - aUpdateCmd = aCmd; - break; - } - } - 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")); -#endif -} +//void XGUI_Workshop::updateAutoComputeState() +//{ +// SessionPtr aMgr = ModelAPI_Session::get(); +// bool isComputeBlocked = aMgr->isAutoUpdateBlocked(); +//#ifdef HAVE_SALOME +// QAction* aUpdateCmd; +// QList aCommands = mySalomeConnector->commandList(); +// foreach(QAction* aCmd, aCommands) { +// if (aCmd->data().toString() == "AUTOCOMPUTE_CMD") { +// aUpdateCmd = aCmd; +// break; +// } +// } +// 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")); +//#endif +//} void XGUI_Workshop::clearTemporaryDir() diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 2955efab2..5c5a47d9a 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 7701c221b..33c2cd199 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 = -- 2.39.2