Go to the documentation of this file.
40 for (
auto iter2 = ctx.begin();
42 iter2 = ctx.erase(iter2))
68 LOG(VB_GENERAL, LOG_ERR,
"ActionSet::AddKey() failed");
123 const QString &newkey,
124 const QString &oldkey)
164 QStringList context_strings;
166 ContextMap::const_iterator it =
m_contexts.begin();
168 context_strings.append(it.key());
169 return context_strings;
177 QStringList action_strings;
179 ContextMap::const_iterator cit =
m_contexts.find(context_name);
181 return action_strings;
183 ActionContext::const_iterator it = (*cit).begin();
184 for (; it != (*cit).end(); ++it)
185 action_strings.append(it.key());
186 return action_strings;
201 const QString &description,
204 ContextMap::iterator cit =
m_contexts.find(
id.GetContext());
207 else if ((*cit).find(
id.GetAction()) != (*cit).end())
210 auto *a =
new Action(description, keys);
213 const QStringList keylist = a->GetKeys();
214 for (
const auto & key : std::as_const(keylist))
226 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
230 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
231 if (it != (*cit).end())
232 return (*it)->GetKeyString();
244 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
248 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
249 if (it != (*cit).end())
250 keys = (*it)->GetKeys();
257 ContextMap::const_iterator cit =
m_contexts.find(context_name);
261 for (
const auto *ctx : std::as_const(*cit))
262 keys += ctx->GetKeys();
273 QMap<QString, ActionList>::ConstIterator it;
276 keys.push_back(it.key());
286 ContextMap::const_iterator cit =
m_contexts.find(
id.GetContext());
290 ActionContext::const_iterator it = (*cit).find(
id.
GetAction());
291 if (it != (*cit).end())
292 return (*it)->GetDescription();
303 ContextMap::iterator cit =
m_contexts.find(
id.GetContext());
306 LOG(VB_GENERAL, LOG_ERR,
307 QString(
"GetAction: Did not find context '%1'")
308 .arg(
id.GetContext()));
313 ActionContext::iterator it = (*cit).find(
id.
GetAction());
315 if (it == (*cit).end())
317 LOG(VB_GENERAL, LOG_ERR,
318 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.