Provides means to keep and edit shortcuts in compliance with the application logics. See SUIT_ShortcutMgr for details. More...
#include <SUIT_ShortcutMgr.h>
Public Member Functions | |
| SUIT_ShortcutContainer () | |
| Uncomment this to enable DevTools. More... | |
| std::set< QString > | getIDsOfInterferingModules (const QString &theModuleID) const |
| std::set< QString > | getIDsOfAllModules () const |
| bool | isEmpty () const |
| std::set< std::pair< QString, QString > > | setShortcut (QString theModuleID, const QString &theInModuleActionID, const QKeySequence &theKeySequence, bool theOverride) |
| Checks for conflicts. If theOverride, modifies incoming and disables all conflicting shortcuts. Redefining a key sequence for the action, if theKeySequence does not conflict with other shortcuts, is not considered as a conflict. More... | |
| std::set< std::pair< QString, QString > > | getConflicts (QString theModuleID, const QString &theInModuleActionID, const QKeySequence &theKeySequence) const |
| Checks for conflicts. Existence of a shortcut with another key sequence for the action, if theKeySequence does not conflict with other shortcuts, is not considered as a conflict. More... | |
| const QKeySequence & | getKeySequence (QString theModuleID, const QString &theInModuleActionID) const |
| bool | hasShortcut (QString theModuleID, const QString &theInModuleActionID) const |
| const std::map< QString, QKeySequence > & | getModuleShortcutsInversed (const QString &theModuleID) const |
| const std::map< QString, QKeySequence > | getModuleShortcutsInversed (const QString &theModuleID, const QString &theInModuleActionIDPrefix) const |
| Seeks for shortcuts in the module with in-module action IDs, which start with theInModuleActionIDPrefix. More... | |
| std::map< QString, std::map< QString, std::pair< QKeySequence, QKeySequence > > > | merge (const SUIT_ShortcutContainer &theOther, bool theOverride, bool theTreatAbsentIncomingAsDisabled=false) |
| Merges shortcuts of theOther into this. More... | |
| bool | hasKeySequence (const QString &theModuleID, const QKeySequence &theKeySequence) const |
| QString | toString () const |
| Generates human-readable text representation of content. More... | |
Private Attributes | |
| std::map< QString, std::map< QKeySequence, QString > > | myShortcuts |
| { moduleID, { keySequence, inModuleActionID }[] }[]. More... | |
| std::map< QString, std::map< QString, QKeySequence > > | myShortcutsInversed |
| { moduleID, { inModuleActionID, keySequence }[] }[]. More... | |
Provides means to keep and edit shortcuts in compliance with the application logics. See SUIT_ShortcutMgr for details.
| SUIT_ShortcutContainer::SUIT_ShortcutContainer | ( | ) |
Uncomment this to enable DevTools.
References myShortcuts, myShortcutsInversed, and SUIT_ShortcutMgr::ROOT_MODULE_ID.
| std::set< std::pair< QString, QString > > SUIT_ShortcutContainer::getConflicts | ( | QString | theModuleID, |
| const QString & | theInModuleActionID, | ||
| const QKeySequence & | theKeySequence | ||
| ) | const |
Checks for conflicts. Existence of a shortcut with another key sequence for the action, if theKeySequence does not conflict with other shortcuts, is not considered as a conflict.
| theInModuleActionID | If theInModuleActionID is meta-action ID, the shortcut is looked for in root module, and theModuleID is ignored. |
| theKeySequence | Empty theKeySequence does not have conflicts. |
References getIDsOfInterferingModules(), SUIT_ShortcutMgr::isInModuleMetaActionID(), myShortcuts, and SUIT_ShortcutMgr::ROOT_MODULE_ID.
| std::set< QString > SUIT_ShortcutContainer::getIDsOfAllModules | ( | ) | const |
References myShortcutsInversed.
| std::set< QString > SUIT_ShortcutContainer::getIDsOfInterferingModules | ( | const QString & | theModuleID | ) | const |
References myShortcuts, and SUIT_ShortcutMgr::ROOT_MODULE_ID.
| const QKeySequence & SUIT_ShortcutContainer::getKeySequence | ( | QString | theModuleID, |
| const QString & | theInModuleActionID | ||
| ) | const |
| theInModuleActionID | If theInModuleActionID is meta-action ID, seeks in root module, and theModuleID is ignored. |
References SUIT_ShortcutMgr::isInModuleMetaActionID(), myShortcutsInversed, NO_KEYSEQUENCE, and SUIT_ShortcutMgr::ROOT_MODULE_ID.
| const std::map< QString, QKeySequence > & SUIT_ShortcutContainer::getModuleShortcutsInversed | ( | const QString & | theModuleID | ) | const |
References myShortcutsInversed.
| const std::map< QString, QKeySequence > SUIT_ShortcutContainer::getModuleShortcutsInversed | ( | const QString & | theModuleID, |
| const QString & | theInModuleActionIDPrefix | ||
| ) | const |
Seeks for shortcuts in the module with in-module action IDs, which start with theInModuleActionIDPrefix.
References myShortcutsInversed.
| bool SUIT_ShortcutContainer::hasKeySequence | ( | const QString & | theModuleID, |
| const QKeySequence & | theKeySequence | ||
| ) | const |
References myShortcuts.
| bool SUIT_ShortcutContainer::hasShortcut | ( | QString | theModuleID, |
| const QString & | theInModuleActionID | ||
| ) | const |
| theInModuleActionID | If theInModuleActionID is meta-action ID, seeks in root module, and theModuleID is ignored. |
References SUIT_ShortcutMgr::isInModuleMetaActionID(), myShortcutsInversed, and SUIT_ShortcutMgr::ROOT_MODULE_ID.
| bool SUIT_ShortcutContainer::isEmpty | ( | ) | const |
References myShortcutsInversed.
| std::map< QString, std::map< QString, std::pair< QKeySequence, QKeySequence > > > SUIT_ShortcutContainer::merge | ( | const SUIT_ShortcutContainer & | theOther, |
| bool | theOverride, | ||
| bool | theTreatAbsentIncomingAsDisabled = false |
||
| ) |
Merges shortcuts of theOther into this.
| theOverride | if true, overrides conflicting shortcuts. If false, and this has no shortcut for an incoming action, and the incoming shortcut conflicts with an existing shortcut, disabled shortcut for the incoming action is set. |
| theTreatAbsentIncomingAsDisabled | If theOverride == false, theTreatAbsentIncomingAsDisabled is ignored. If theOverride and theTreatAbsentIncomingAsDisabled, and theOther has no shortcut for an action, which exists in this, the existing shortcut in this is set disabled. |
References getKeySequence(), hasShortcut(), myShortcuts, myShortcutsInversed, NO_KEYSEQUENCE, and setShortcut().
| std::set< std::pair< QString, QString > > SUIT_ShortcutContainer::setShortcut | ( | QString | theModuleID, |
| const QString & | theInModuleActionID, | ||
| const QKeySequence & | theKeySequence, | ||
| bool | theOverride | ||
| ) |
Checks for conflicts. If theOverride, modifies incoming and disables all conflicting shortcuts. Redefining a key sequence for the action, if theKeySequence does not conflict with other shortcuts, is not considered as a conflict.
| theModuleID | The method has no effect if theModuleID is invalid. See SUIT_ShortcutMgr::isModuleIDValid(const QString&) for details. |
| theInModuleActionID | The method has no effect if theInModuleActionID is invalid. See SUIT_ShortcutMgr::isInModuleActionIDValid(const QString&). If theInModuleActionID is meta-action ID, the shortcut is set to root module, and theModuleID is ignored. |
| theKeySequence | Empty theKeySequence does not cause conflicts, in this case a shortcut for the action is disabled: theInModuleActionID is added/retained in the container but mapped to empty key sequence. |
| theOverride | If true, conflicting shortcuts are disabled. |
References getIDsOfInterferingModules(), SUIT_ShortcutMgr::isInModuleActionIDValid(), SUIT_ShortcutMgr::isInModuleMetaActionID(), SUIT_ShortcutMgr::isModuleIDValid(), myShortcuts, myShortcutsInversed, NO_KEYSEQUENCE, SUIT_ShortcutMgr::ROOT_MODULE_ID, and ShCutDbg().
| QString SUIT_ShortcutContainer::toString | ( | ) | const |
Generates human-readable text representation of content.
References myShortcuts, and myShortcutsInversed.
|
private |
{ moduleID, { keySequence, inModuleActionID }[] }[].
keySequence can not be empty. Can not contain entries like { <non-root module ID>, { keySequence, <meta-action ID> } }.
|
private |
{ moduleID, { inModuleActionID, keySequence }[] }[].
keySequence can be empty. Can not contain entries like { <non-root module ID>, { <meta-action ID>, keySequence } }.