23 , CoreProxy_ {
proxy }
40 for (
auto& list : Actions_)
44 if (HasActionInfo (
id))
46 const auto&
info = ActionInfo_ [
id];
47 if (
act->text ().isEmpty ())
48 act->setText (
info.UserVisibleText_);
49 if (
act->icon ().isNull () &&
50 act->property (
"ActionIcon").isNull ())
55 const auto&
icon =
act->icon ().isNull () ?
85 for (
auto& list : Shortcuts_)
100 if (!HasActionInfo (
id))
121 for (
const auto&
entity : Globals_)
127 for (
auto act : Actions_ [
id])
130 for (
auto sc : Shortcuts_ [
id])
132 sc->setKey (
seqs.value (0));
139 subsc->setContext (
sc->context ());
142 &QShortcut::activated,
144 &QShortcut::activated);
149 if (Globals_.contains (
id))
151 auto&
e = Globals_ [
id];
154 &QVariant::fromValue<QKeySequence>);
170 bool ShortcutManager::HasActionInfo (
const QString&
id)
const
172 return ActionInfo_.contains (
id) &&
173 !ActionInfo_ [
id].UserVisibleText_.isEmpty ();
virtual IEntityManager * GetEntityManager() const =0
Returns the entity manager object.
virtual IShortcutProxy * GetShortcutProxy() const =0
Returns the shortcut proxy used to communicate with the shortcut manager.
virtual IIconThemeManager * GetIconThemeManager() const =0
Returns the icon theme manager.
virtual bool HandleEntity(LC::Entity entity, QObject *desired=nullptr)=0
Handles the given entity.
virtual QIcon GetIcon(const QString &on, const QString &off=QString())=0
Returns the current theme's icon for the given on and off states.
virtual QList< QKeySequence > GetShortcuts(QObject *object, const QString &id)=0
Returns a QKeySequence for the given action.
virtual bool HasObject(QObject *object) const =0
Checks whether a given object has been registered already.
Aids in providing configurable shortcuts.
void AnnounceGlobalShorcuts()
Announces the global shortcuts.
void RegisterActionInfo(const QString &id, const ActionInfo &info)
Registers the given action info with the given id.
void RegisterAction(const QString &id, QAction *action)
Registers the given QAction by the given id.
QMap< QString, ActionInfo > GetActionInfo() const
Returns the map with information about actions.
void SetObject(QObject *pluginObj)
Sets the plugin instance object of this manager.
void RegisterGlobalShortcut(const QString &id, QObject *target, const QByteArray &method, const ActionInfo &info)
Registers the given global shortcut with the given id.
ShortcutManager(const ICoreProxy_ptr &proxy, QObject *parent=nullptr)
Creates the shortcut manager.
void SetShortcut(const QString &id, const QKeySequences_t &sequences)
Sets the key sequence for the given action.
void RegisterShortcut(const QString &id, const ActionInfo &info, QShortcut *shortcut)
Registers the given QShortcut with the given id.
void RegisterActions(const std::initializer_list< IDPair_t > &actions)
ShortcutManager & operator<<(const QPair< QString, QAction * > &pair)
Utility function equivalent to RegisterAction().
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Container< T > Filter(const Container< T > &c, F f)
auto Map(Container &&c, F f)
Entity MakeEntity(const QVariant &entity, const QString &location, TaskParameters tp, const QString &mime)
Describes an action exposed in shortcut manager.
A message used for inter-plugin communication.
QMap< QString, QVariant > Additional_
Additional parameters.