55 SIGNAL (destroyed ()),
57 SLOT (handleActionDestroyed ()));
59 const QIcon& icon = act->icon ().isNull () ?
60 CoreProxy_->GetIcon (act->property (
"ActionIcon").toString ()) :
63 { act->text (), act->shortcuts (), icon });
67 CoreProxy_->GetShortcutProxy ()->GetShortcuts (ContextObj_,
id));
72 Shortcuts_ [id] << shortcut;
74 SIGNAL (destroyed ()),
76 SLOT (handleShortcutDestroyed ()));
82 CoreProxy_->GetShortcutProxy ()->GetShortcuts (ContextObj_,
id));
87 if (!ActionInfo_.contains (
id))
88 ActionInfo_ [
id] = info;
93 for (
auto act : Actions_ [
id])
94 act->setShortcuts (seqs);
96 for (
auto sc : Shortcuts_ [
id])
97 sc->setKey (seqs.value (0));
107 RegisterAction (pair.first, pair.second);
111 void ShortcutManager::handleActionDestroyed ()
113 auto act =
static_cast<QAction*
> (sender ());
114 for (
const auto&
id : Actions_.keys ())
115 Actions_ [
id].removeAll (act);
118 void ShortcutManager::handleShortcutDestroyed()
120 auto sc =
static_cast<QShortcut*
> (sender ());
121 for (
const auto&
id : Shortcuts_.keys ())
122 Shortcuts_ [
id].removeAll (sc);
UTIL_API QMap< QString, ActionInfo > GetActionInfo() const
Returns the map with information about actions.
UTIL_API ShortcutManager(ICoreProxy_ptr proxy, QObject *parent=0)
Creates the shortcut manager.
UTIL_API void SetObject(QObject *pluginObj)
Sets the plugin instance object of this manager.
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
QList< QKeySequence > QKeySequences_t
UTIL_API void SetShortcut(const QString &id, const QKeySequences_t &sequences) const
Sets the key sequence for the given action.
UTIL_API void RegisterAction(const QString &id, QAction *action, bool update=false)
Registers the given QAction by the given id.
Describes an action exposed in shortcut manager.
Aids in providing configurable shortcuts.
UTIL_API void RegisterShortcut(const QString &id, const ActionInfo &info, QShortcut *shortcut, bool update=false)
Registers the given QShortcut with the given id.
UTIL_API void RegisterActionInfo(const QString &id, const ActionInfo &info)
Registers the given action info with the given id.