Go to the documentation of this file.
41 ctx.erase(ctx.begin());
66 LOG(VB_GENERAL, LOG_ERR,
"ActionSet::AddKey() failed");
121 const QString &newkey,
122 const QString &oldkey)
162 QStringList context_strings;
164 ContextMap::const_iterator it =
m_contexts.begin();
166 context_strings.append(it.key());
167 return context_strings;
175 QStringList action_strings;
177 ContextMap::const_iterator cit =
m_contexts.find(context_name);
179 return action_strings;
181 ActionContext::const_iterator it = (*cit).begin();
182 for (; it != (*cit).end(); ++it)
183 action_strings.append(it.key());
184 return action_strings;
199 const QString &description,
202 ContextMap::iterator cit =
m_contexts.find(
id.GetContext());
205 else if ((*cit).find(
id.GetAction()) != (*cit).end())
208 auto *a =
new Action(description, keys);
211 const QStringList keylist = a->GetKeys();
212 for (
const auto & key : qAsConst(keylist))
224 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
228 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
229 if (it != (*cit).end())
230 return (*it)->GetKeyString();
242 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
246 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
247 if (it != (*cit).end())
248 keys = (*it)->GetKeys();
255 ContextMap::const_iterator cit =
m_contexts.find(context_name);
259 for (
const auto *ctx : qAsConst(*cit))
260 keys += ctx->GetKeys();
271 QMap<QString, ActionList>::ConstIterator it;
274 keys.push_back(it.key());
284 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
288 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
289 if (it != (*cit).end())
290 return (*it)->GetDescription();
301 ContextMap::iterator cit =
m_contexts.find(
id.GetContext());
304 LOG(VB_GENERAL, LOG_ERR,
305 QString(
"GetAction: Did not find context '%1'")
306 .arg(
id.GetContext()));
311 ActionContext::iterator it = (*cit).find(
id.
GetAction());
313 if (it == (*cit).end())
315 LOG(VB_GENERAL, LOG_ERR,
316 QString(
"GetAction: Did not find action '%1' in context '%1'")
Main header for the action set class.
QStringList GetKeys(const ActionID &id) const
Get the keys bound to an action by its identifier.
QStringList GetActionStrings(const QString &context_name) const
Returns a list of all action in the action set.
QList< ActionID > ActionList
QStringList GetContextKeys(const QString &context_name) const
bool Replace(const ActionID &id, const QString &newkey, const QString &oldkey)
Replace a specific key in a specific action.
QMap< QString, ActionList > m_keyToActionMap
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
An action (for this plugin) consists of a description, and a set of key sequences.
Main header for the action class.
bool Remove(const ActionID &id, const QString &key)
Remove a key from an action identifier.
QStringList GetContextStrings(void) const
Returns a list of all contexts in the action set.
bool RemoveKey(const QString &key)
Remove a key from this action.
Action * GetAction(const ActionID &id)
Returns a pointer to an action by its identifier. (note: result not thread-safe)
QHash< QString, Action * > ActionContext
bool AddAction(const ActionID &id, const QString &description, const QString &keys)
Add an action.
bool AddKey(const QString &key)
Add a key sequence to this action.
static const QString kJumpContext
The statically assigned context for jump point actions.
bool ReplaceKey(const QString &newkey, const QString &oldkey)
Replace a key.
QStringList GetAllKeys(void) const
Get all keys (from every context) to which an action is bound.
bool IsModified(const ActionID &id) const
Returns true iff the action is modified.
bool SetModifiedFlag(const ActionID &id, bool modified)
Mark an action as modified or unmodified by its identifier.
static const QString kGlobalContext
The name of global actions.
A class that uniquely identifies an action.
QString GetDescription(const ActionID &id) const
Returns the description of an action by its identifier.
static bool modified(uint64_t sig)
bool Add(const ActionID &id, const QString &key)
Add a binding.
QString GetKeyString(const ActionID &id) const
Returns a string containing all the keys in bound to an action by its identifier.