17#include "phosphorshortcuts_export.h"
34class PHOSPHORSHORTCUTS_EXPORT
Registry :
public QObject
78 void bind(
const QString&
id,
const QKeySequence& defaultSeq,
const QString& description = {},
79 std::function<void()> callback = {},
bool persistent =
true);
88 void rebind(
const QString&
id,
const QKeySequence& seq);
100 const QList<QKeySequence>& sequences);
101 std::optional<QList<QKeySequence>>
foreignShortcuts(
const QString& componentName,
const QString& actionName)
const;
210 QVector<Binding>
bindings(
bool persistentOnly =
false)
const;
240 void onBackendActivated(QString
id);
241 void onBackendReady();
247 std::function<void()> callback;
251 QKeySequence lastSentDefault;
252 QKeySequence lastSentCurrent;
253 bool registered =
false;
259 bool lastSentPersistent =
true;
260 bool persistent =
true;
269 bool settled =
false;
274 bool storePending =
false;
277 QPointer<IBackend> m_backend;
278 QHash<QString, Entry> m_entries;
Pluggable global shortcut backend.
Definition IBackend.h:32
void ready()
Forwarded from IBackend::ready().
std::optional< QStringList > storedShortcutIds() const
Every id the platform keeps a record for under this process's component (IBackend::storedShortcutIds)...
QVector< Binding > bindings(bool persistentOnly=false) const
Enumerate registered bindings, sorted by id for deterministic output.
void rebind(const QString &id, const QKeySequence &seq)
Change the active binding for an already-registered id.
void setActive(const QString &id, bool active)
Park or revive a binding without forgetting it and without destroying what the platform persists abou...
void flush()
Forward queued bind/rebind ops to the backend.
bool setForeignShortcuts(const QString &componentName, const QString &actionName, const QList< QKeySequence > &sequences)
Rebind / read another component's global shortcut (IBackend foreign pass-throughs; only the KGlobalAc...
void purge(const QString &id)
Like unbind() for an id this registry holds.
QKeySequence shortcut(const QString &id) const
void unbind(const QString &id)
Drop a binding entirely.
void bind(const QString &id, const QKeySequence &defaultSeq, const QString &description={}, std::function< void()> callback={}, bool persistent=true)
Register a shortcut.
void triggered(QString id)
Emitted on every activation, regardless of whether the binding has a callback.
Registry(IBackend *backend, QObject *parent=nullptr)
bool isActive(const QString &id) const
Whether the id is currently active. Unknown ids report false.
void triggersChanged(QString id)
Forwarded from IBackend::triggersChanged for ids this registry owns — the effective binding changed o...
QStringList effectiveTriggers(const QString &id) const
Display strings for the key(s) the user EFFECTIVELY has to press for an id right now.
std::optional< QList< QKeySequence > > foreignShortcuts(const QString &componentName, const QString &actionName) const
QString description
Definition Registry.h:43
QKeySequence defaultSeq
Definition Registry.h:41
QKeySequence currentSeq
Definition Registry.h:42
QString id
Definition Registry.h:40