CORE: 'Std_ToggleSkipRecompute' implemented, no icon
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <App/GroupExtension.h>
|
||||
#include <App/Part.h>
|
||||
#include "Application.h"
|
||||
#include "Action.h"
|
||||
#include "cet_lut.hpp"
|
||||
#include "CommandT.h"
|
||||
#include "DockWindowManager.h"
|
||||
@@ -298,6 +299,65 @@ void StdCmdSendToPythonConsole::activated(int iMsg)
|
||||
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_ToggleSkipRecompute
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_AC(StdCmdToggleSkipRecompute)
|
||||
|
||||
StdCmdToggleSkipRecompute::StdCmdToggleSkipRecompute()
|
||||
: Command("Std_ToggleSkipRecompute")
|
||||
{
|
||||
sGroup = "File";
|
||||
sMenuText = QT_TR_NOOP("Skip Recomputes");
|
||||
|
||||
static std::string toolTip = QT_TR_NOOP("Enables or disables the recomputations of the document");
|
||||
|
||||
sToolTipText = toolTip.c_str();
|
||||
sStatusTip = sToolTipText;
|
||||
sWhatsThis = "Std_ToggleSkipRecompute";
|
||||
//sPixmap = "Std_ToggleSkipRecomputes"; // TODO: to be added when icon is provided
|
||||
eType = AlterDoc;
|
||||
}
|
||||
|
||||
Gui::Action* StdCmdToggleSkipRecompute::createAction()
|
||||
{
|
||||
Action* pcAction = Command::createAction();
|
||||
pcAction->setCheckable(true);
|
||||
pcAction->setIcon(QIcon()); // TODO: to be deleted, when icon is provided
|
||||
_pcAction = pcAction;
|
||||
isActive();
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
void StdCmdToggleSkipRecompute::activated(int iMsg)
|
||||
{
|
||||
const auto doc = this->getDocument();
|
||||
if (doc == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
Command::openCommand(QT_TRANSLATE_NOOP("Command", "Skip recomputes"));
|
||||
doc->setStatus(App::Document::SkipRecompute, (bool) iMsg);
|
||||
if (_pcAction) {
|
||||
_pcAction->setChecked((bool) iMsg);
|
||||
}
|
||||
Command::commitCommand();
|
||||
}
|
||||
|
||||
bool StdCmdToggleSkipRecompute::isActive()
|
||||
{
|
||||
const auto doc = this->getDocument();
|
||||
if (doc == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool skipRecomputeStatus = doc->testStatus(App::Document::SkipRecompute);
|
||||
if (_pcAction && _pcAction->isChecked() != skipRecomputeStatus) {
|
||||
_pcAction->setChecked(skipRecomputeStatus);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace Gui {
|
||||
|
||||
@@ -309,6 +369,7 @@ void CreateFeatCommands()
|
||||
rcCmdMgr.addCommand(new StdCmdToggleFreeze());
|
||||
rcCmdMgr.addCommand(new StdCmdRandomColor());
|
||||
rcCmdMgr.addCommand(new StdCmdSendToPythonConsole());
|
||||
rcCmdMgr.addCommand(new StdCmdToggleSkipRecompute());
|
||||
}
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
Reference in New Issue
Block a user