kwave
18.07.70
|
Manager class for access to Kwave's menu subsystem. More...
#include <MenuManager.h>
Public Slots | |
void | setItemChecked (const QString &uid, bool check) |
void | setItemEnabled (const QString &uid, bool enable) |
Signals | |
void | sigMenuCommand (const QString &command) |
Public Member Functions | |
MenuManager (QWidget *parent, QMenuBar &bar) | |
virtual | ~MenuManager () |
int | executeCommand (const QString &command) |
void | clearNumberedMenu (const QString &uid) |
void | addNumberedMenuEntry (const QString &uid, const QString &entry, const QString ¶m) |
void | selectItem (const QString &group, const QString &uid) |
void | setItemText (const QString &uid, const QString &text) |
void | setItemVisible (const QString &uid, bool show) |
Private Attributes | |
Kwave::MenuRoot * | m_menu_root |
Static Private Attributes | |
static QMap< QString, QKeySequence > | m_standard_keys |
Manager class for access to Kwave's menu subsystem.
Definition at line 46 of file MenuManager.h.
Kwave::MenuManager::MenuManager | ( | QWidget * | parent, |
QMenuBar & | bar | ||
) |
Constructor.
parent | the menu's parent widget |
bar | reference to the menu bar |
Definition at line 50 of file MenuManager.cpp.
References Kwave::connect(), INS, m_menu_root, m_standard_keys, and sigMenuCommand().
|
virtual |
void Kwave::MenuManager::addNumberedMenuEntry | ( | const QString & | uid, |
const QString & | entry, | ||
const QString & | param | ||
) |
Add an entry to a numbered menu
uid | unique id string of the numbered menu |
entry | name of the new entry (non-localized) |
param | a parameter to use when the entry is activated (optional, pass QString() when using the text of the menu entry as parameter) |
Definition at line 225 of file MenuManager.cpp.
References _, Kwave::MenuNode::command(), DBG, Kwave::Parser::escape(), Kwave::MenuNode::findUID(), Kwave::MenuNode::insertLeaf(), m_menu_root, and Kwave::MenuNode::parentNode().
Referenced by Kwave::TopWidget::updateMenu(), and Kwave::TopWidget::updateRecentFiles().
void Kwave::MenuManager::clearNumberedMenu | ( | const QString & | uid | ) |
Deletes all entries of a numbered menu
uid | unique id string of the numbered menu |
Definition at line 217 of file MenuManager.cpp.
References Kwave::MenuNode::clear(), Kwave::MenuNode::findUID(), and m_menu_root.
Referenced by Kwave::TopWidget::updateMenu(), and Kwave::TopWidget::updateRecentFiles().
int Kwave::MenuManager::executeCommand | ( | const QString & | command | ) |
Executes menu commands.
command | string with the command |
0 | if succeeded |
-EINVAL | if failed |
Definition at line 138 of file MenuManager.cpp.
References _, DBG, Kwave::Parser::firstParam(), Kwave::MenuRoot::insertNode(), m_menu_root, m_standard_keys, and Kwave::Parser::nextParam().
Referenced by Kwave::TopWidget::executeCommand().
void Kwave::MenuManager::selectItem | ( | const QString & | group, |
const QString & | uid | ||
) |
Selects an menu item within a group of menu items. All other items will be deselected and the new one will become the only selected one. (exclusive one-of-n-selection)
group | name of the menu group |
uid | unique id string specifying the new selection |
Definition at line 248 of file MenuManager.cpp.
References DBG, Kwave::MenuRoot::groupList(), m_menu_root, and Kwave::MenuGroup::selectItem().
Referenced by Kwave::TopWidget::updateMenu().
|
slot |
Checks/unchecks a menu node.
uid | unique id string of the menu node |
check | true to set a checkmark, false to remove |
Definition at line 278 of file MenuManager.cpp.
References Kwave::MenuNode::findUID(), m_menu_root, and Kwave::MenuNode::setChecked().
|
slot |
Enables/disables a menu node.
uid | unique id string of the menu node |
enable | true to enable, false to disable |
Definition at line 309 of file MenuManager.cpp.
References DBG, Kwave::MenuNode::findUID(), Kwave::MenuRoot::groupList(), m_menu_root, Kwave::MenuGroup::setEnabled(), and Kwave::MenuNode::setEnabled().
Referenced by Kwave::TopWidget::clipboardChanged(), Kwave::TopWidget::selectionChanged(), Kwave::TopWidget::setUndoRedoInfo(), Kwave::TopWidget::updateMenu(), Kwave::TopWidget::updateRecentFiles(), and Kwave::PlayerToolBar::updateState().
void Kwave::MenuManager::setItemText | ( | const QString & | uid, |
const QString & | text | ||
) |
Sets the text of a menu entry to a new value.
uid | unique id string of the menu node |
text | the new text of the item |
Definition at line 286 of file MenuManager.cpp.
References Kwave::MenuNode::findUID(), m_menu_root, and Kwave::MenuNode::setText().
Referenced by Kwave::TopWidget::setUndoRedoInfo().
void Kwave::MenuManager::setItemVisible | ( | const QString & | uid, |
bool | show | ||
) |
Shows/hides a menu entry identified by an ID. Groups are not supported.
uid | unique id string of the menu node |
show | true to show, false to hide |
Definition at line 294 of file MenuManager.cpp.
References DBG, Kwave::MenuNode::findUID(), m_menu_root, and Kwave::MenuNode::setVisible().
Referenced by Kwave::TopWidget::updateMenu().
|
signal |
Will be emitted if the command of a menu node should be executed.
Referenced by MenuManager().
|
private |
root node of the menu structure
Definition at line 137 of file MenuManager.h.
Referenced by addNumberedMenuEntry(), clearNumberedMenu(), executeCommand(), MenuManager(), selectItem(), setItemChecked(), setItemEnabled(), setItemText(), setItemVisible(), and ~MenuManager().
|
staticprivate |
map of standard key names / key sequences
static map with standard keys
Definition at line 140 of file MenuManager.h.
Referenced by executeCommand(), and MenuManager().