The CommandManager class This class manage all available commands in FreeCAD. More...
#include <Command.h>
Public Member Functions | |
void | addCommand (Command *pCom) |
Insert a new command into the manager. More... | |
void | addCommandMode (const char *sContext, const char *sName) |
bool | addTo (const char *Name, QWidget *pcWidget) |
Adds the given command to a given widget. More... | |
const Command * | checkAcceleratorForConflicts (const char *accel, const Command *ignore=nullptr) const |
Returns a pointer to a conflicting command, or nullptr if there is no conflict. More... | |
CommandManager () | |
Construction. More... | |
std::vector< Command * > | getAllCommands (void) const |
Returns all commands registered in the manager delivers a vector of all commands. More... | |
Command * | getCommandByName (const char *sName) const |
Returns the command registered in the manager with the name sName If nothing is found it returns a null pointer. More... | |
const std::map< std::string, Command * > & | getCommands () const |
method is OBSOLETE use GetModuleCommands() or GetAllCommands() More... | |
std::vector< Command * > | getGroupCommands (const char *sGrpName) const |
Returns all commands of a group delivers a vector of all commands in the given group. More... | |
std::vector< Command * > | getModuleCommands (const char *sModName) const |
Returns all commands of a special App Module delivers a vector of all commands in the given application module. More... | |
std::string | newMacroName () const |
Returns the first available command name for a new macro (e.g. More... | |
void | removeCommand (Command *pCom) |
Remove a command from the manager. More... | |
void | runCommandByName (const char *sName) const |
Runs the command. More... | |
void | testActive (void) |
get frequently called by the AppWnd to check the commands are active. More... | |
void | updateCommands (const char *sContext, int mode) |
~CommandManager () | |
Destruction. More... | |
The CommandManager class This class manage all available commands in FreeCAD.
All Commands will registered here, also commands from Application modules. Also activation / deactivation, Icons Tooltips and so on are handles here. Further the Building of Toolbars and (Context) menus (connecting to a QAction) is done here.
CommandManager::CommandManager | ( | ) |
Construction.
CommandManager::~CommandManager | ( | ) |
Destruction.
void CommandManager::addCommand | ( | Command * | pCom | ) |
Insert a new command into the manager.
References Gui::Command::getName().
Referenced by Gui::GroupCommand::addCommand(), Gui::CreateDocCommands(), Gui::CreateFeatCommands(), Gui::CreateLinkCommands(), Gui::CreateMacroCommands(), Gui::CreateStdCommands(), Gui::CreateStructureCommands(), Gui::CreateTestCommands(), Gui::CreateViewStdCommands(), Gui::CreateWindowStdCommands(), Gui::MacroCommand::load(), Gui::Dialog::DlgCustomActionsImp::on_buttonAddAction_clicked(), Gui::Application::sAddCommand(), and StdViewDockUndockFullscreen::StdViewDockUndockFullscreen().
void CommandManager::addCommandMode | ( | const char * | sContext, |
const char * | sName | ||
) |
Adds the given command to a given widget.
References Gui::Command::addTo(), Base::Console(), Base::ConsoleSingleton::Error(), and Base::ConsoleSingleton::Warning().
Referenced by Gui::Dialog::DlgCustomToolbarsImp::addCustomCommand(), Mod.PartDesign.WizardShaft.Shaft.Shaft::equilibrium(), Gui::ToolBoxManager::setup(), Gui::ToolBarManager::setup(), and SandboxGui::TaskPanelView::TaskPanelView().
const Command * Gui::CommandManager::checkAcceleratorForConflicts | ( | const char * | accel, |
const Command * | ignore = nullptr |
||
) | const |
Returns a pointer to a conflicting command, or nullptr if there is no conflict.
In the case of multiple conflicts, only the first is returned.
accel | The accelerator to check |
ignore | (optional) A command to ignore matches with |
References Gui::Application::commandManager(), getAllCommands(), and Gui::Application::Instance.
Referenced by Gui::Command::printConflictingAccelerators().
std::vector< Command * > CommandManager::getAllCommands | ( | void | ) | const |
Returns all commands registered in the manager delivers a vector of all commands.
If you intereted in commands of of a special app module use GetModuleCommands()
Referenced by Gui::MainWindow::changeEvent(), checkAcceleratorForConflicts(), Gui::Dialog::DlgCustomKeyboardImp::on_buttonResetAll_clicked(), and Gui::Dialog::DlgCustomKeyboardImp::on_editShortcut_textChanged().
Command * CommandManager::getCommandByName | ( | const char * | sName | ) | const |
Returns the command registered in the manager with the name sName If nothing is found it returns a null pointer.
Referenced by Gui::PythonGroupCommand::activated(), Gui::GroupCommand::addCommand(), Gui::MDITabbar::contextMenuEvent(), Gui::PythonGroupCommand::createAction(), StdViewDockUndockFullscreen::createAction(), NaviCubeImplementation::createContextMenu(), Gui::Workbench::createLinkMenu(), Gui::MainWindow::createPopupMenu(), Gui::MainWindow::event(), Gui::Dialog::CommandModel::goAddMacro(), Gui::PythonGroupCommand::languageChange(), Gui::Dialog::DlgCustomActionsImp::on_actionListWidget_itemActivated(), Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_buttonReset_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_commandTreeWidget_currentItemChanged(), Gui::Dialog::DlgCustomKeyboardImp::on_editShortcut_textChanged(), Gui::Dialog::DemoMode::on_fullscreen_toggled(), Gui::Dialog::DlgCustomCommandsImp::onAddMacroAction(), Gui::Dialog::DlgCustomKeyboardImp::onAddMacroAction(), Gui::Dialog::DlgCustomToolbars::onAddMacroAction(), Gui::Dialog::DlgCustomCommandsImp::onModifyMacroAction(), Gui::Dialog::DlgCustomKeyboardImp::onModifyMacroAction(), Gui::Dialog::DlgCustomToolbars::onModifyMacroAction(), WebGui::BrowserView::onUpdateBrowserActions(), Gui::TaskCSysDragger::open(), runCommandByName(), Gui::Dialog::DlgCustomKeyboardImp::setShortcutOfCurrentAction(), MeshGui::Workbench::setupMenuBar(), Gui::Application::sRunCommand(), FemGui::TaskPostClip::TaskPostClip(), FemGui::TaskPostCut::TaskPostCut(), Gui::TaskView::TaskWatcherCommands::TaskWatcherCommands(), Gui::TaskView::TaskWatcherPython::TaskWatcherPython(), Gui::Command::testActive(), updateCommands(), Gui::MainWindow::updateEditorActions(), and Gui::TaskCSysDragger::~TaskCSysDragger().
const std::map< std::string, Command * > & Gui::CommandManager::getCommands | ( | ) | const |
method is OBSOLETE use GetModuleCommands() or GetAllCommands()
Referenced by Gui::Dialog::DlgCustomCommandsImp::DlgCustomCommandsImp(), Gui::Dialog::DlgCustomKeyboardImp::DlgCustomKeyboardImp(), and Gui::Dialog::DlgCustomToolbars::DlgCustomToolbars().
std::vector< Command * > CommandManager::getGroupCommands | ( | const char * | sGrpName | ) | const |
Returns all commands of a group delivers a vector of all commands in the given group.
Referenced by Gui::Dialog::DlgCustomCommandsImp::changeEvent(), Gui::Dialog::DlgCustomKeyboardImp::changeEvent(), Gui::Dialog::DlgCustomToolbars::changeEvent(), newMacroName(), Gui::Dialog::DlgCustomActionsImp::on_buttonRemoveAction_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_categoryBox_activated(), Gui::Dialog::DlgCustomToolbars::on_categoryBox_activated(), Gui::Dialog::DlgMacroExecuteImp::on_toolbarButton_clicked(), Gui::Dialog::DlgCustomCommandsImp::onGroupActivated(), and Gui::MacroCommand::save().
std::vector< Command * > CommandManager::getModuleCommands | ( | const char * | sModName | ) | const |
std::string CommandManager::newMacroName | ( | ) | const |
Returns the first available command name for a new macro (e.g.
starting from 1, examines the existing user preferences for Std_Macro_%1 and returns the lowest available numbered string).
References Gui::Application::commandManager(), getGroupCommands(), and Gui::Application::Instance.
Referenced by Gui::Dialog::DlgCustomActionsImp::on_buttonAddAction_clicked().
void CommandManager::removeCommand | ( | Command * | pCom | ) |
Remove a command from the manager.
References Gui::Command::getName().
Referenced by Gui::Dialog::DlgCustomActionsImp::on_buttonRemoveAction_clicked().
void CommandManager::runCommandByName | ( | const char * | sName | ) | const |
Runs the command.
References getCommandByName(), and Gui::Command::invoke().
Referenced by PartDesignGui::assertActivePart(), PartDesignGui::WorkflowManager::determineWorkflow(), Gui::MainWindow::event(), SpreadsheetGui::SheetTableView::mergeCells(), Gui::Dialog::DlgMacroExecuteImp::on_addonsButton_clicked(), SketcherGui::TaskSketcherConstraints::on_listWidgetConstraints_updateActiveStatus(), SketcherGui::TaskSketcherConstraints::on_listWidgetConstraints_updateDrivingStatus(), Gui::Dialog::DlgPreferencePackManagementImp::showAddonManager(), and SpreadsheetGui::SheetTableView::splitCell().
void CommandManager::testActive | ( | void | ) |
get frequently called by the AppWnd to check the commands are active.
void CommandManager::updateCommands | ( | const char * | sContext, |
int | mode | ||
) |
References getCommandByName(), and Gui::Command::updateAction().