24 , CoreProxy_ {
proxy }
25 , ContextObj_ { parent }
37 for (
auto& list : Actions_)
41 if (HasActionInfo (
id))
43 const auto&
info = ActionInfo_ [
id];
44 if (
act->text ().isEmpty ())
46 if (
act->icon ().isNull ())
52 act->setProperty (
"ActionIcon",
name);
58 const auto&
icon =
act->icon ().isNull () ?
90 for (
auto& list : Shortcuts_)
105 if (!HasActionInfo (
id))
113 using namespace EF::GlobalAction;
115 e.Additional_ [ActionID] =
id;
116 e.Additional_ [Method] =
method;
117 e.Additional_ [Shortcut] = QVariant::fromValue (
info.Seq_);
118 e.Additional_ [AltShortcuts] =
Util::Map (
info.AdditionalSeqs_, &QVariant::fromValue<QKeySequence>);
137 sc->setKey (
seqs.value (0));
144 subsc->setContext (
sc->context ());
147 &QShortcut::activated,
149 &QShortcut::activated);
154 if (Globals_.contains (
id))
156 auto&
e = Globals_ [
id];
159 &QVariant::fromValue<QKeySequence>);
175 bool ShortcutManager::HasActionInfo (
const QByteArray&
id)
const
177 return ActionInfo_.contains (
id) &&
178 !ActionInfo_ [
id].Text_.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 QByteArray &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.
ShortcutManager(const ICoreProxy_ptr &proxy, QObject *parent)
Creates the shortcut manager.
ShortcutManager & operator<<(const QPair< QByteArray, QAction * > &pair)
Utility function equivalent to RegisterAction().
void RegisterAction(const QByteArray &id, QAction *action)
Registers the given QAction by the given id.
void SetShortcut(const QByteArray &id, const QKeySequences_t &sequences)
Sets the key sequence for the given action.
void RegisterGlobalShortcut(const QByteArray &id, QObject *target, const QByteArray &method, const ActionInfo &info)
Registers the given global shortcut with the given id.
void RegisterActionInfo(const QByteArray &id, const ActionInfo &info)
Registers the given action info with the given id.
QMap< QByteArray, ActionInfo > GetActionInfo() const
Returns the map with information about actions.
void RegisterActions(const std::initializer_list< IDPair_t > &actions)
void RegisterShortcut(const QByteArray &id, const ActionInfo &info, QShortcut *shortcut)
Registers the given QShortcut with the given id.
std::shared_ptr< ICoreProxy > ICoreProxy_ptr
Q_DECL_IMPORT const QString GlobalActionRegister
Registration of a global system-wide action.
Container< T > Filter(const Container< T > &c, F f)
auto Visit(const Either< Left, Right > &either, Args &&... args)
auto Map(Container &&c, F &&f) noexcept(noexcept(std::is_nothrow_invocable_v< F, decltype(*c.begin())>))
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.
A proper void type, akin to unit (or ()) type in functional languages.