Go to the documentation of this file.
96 const QString &action_name)
const
118 QStringList contexts;
120 for (
const auto &
action : qAsConst(actions))
122 QString context =
action.GetContext();
123 if (!contexts.contains(context))
124 contexts.push_back(context);
137 const QString &action_name)
const
139 ActionID id(context_name, action_name);
153 const QString &action_name,
180 const QString &context_name,
const QString &key,
int &level)
const
189 for (
int i = 0; i < ids.count(); i++)
197 if (ids[i].GetContext() == context_name)
223 const QString &action_name,
224 const QString &newkey,
225 const QString &oldkey)
243 const QString &action_name,
246 ActionID id(context_name, action_name);
266 "UPDATE keybindings "
267 "SET keylist = :KEYLIST "
268 "WHERE hostname = :HOSTNAME AND "
269 " action = :ACTION AND "
270 " context = :CONTEXT");
275 query.
bindValue(
":CONTEXT",
id.GetContext());
276 query.
bindValue(
":ACTION",
id.GetAction());
298 "SET keylist = :KEYLIST "
299 "WHERE hostname = :HOSTNAME AND"
300 " destination = :DESTINATION");
305 query.
bindValue(
":DESTINATION",
id.GetAction());
357 "SELECT destination, description, keylist "
359 "WHERE hostname = :HOSTNAME "
360 "ORDER BY destination");
373 if (query.
value(1).toString().isEmpty())
376 query.
value(2).toString());
381 query.
value(2).toString());
396 "SELECT context, action, description, keylist "
398 "WHERE hostname = :HOSTNAME "
399 "ORDER BY context, action");
408 static QStringList kModifierContexts = {
"Long Press" };
411 QString context = query.
value(0).toString();
412 bool modifier = kModifierContexts.contains(context);
422 query.
value(3).toString());
460 for (
int i = 0; i < manlist.count(); i++)
void BindJump(const QString &Destination, const QString &Key)
bool isActive(void) const
QStringList GetKeys(void) const
Returns a list of all keys bound to an action.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
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.
void LoadJumppoints(void)
Load the jumppoints from the database.
QVariant value(int i) const
QStringList m_defaultKeys
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
KeyBindings(QString hostname, Filter Filters=AllBindings)
Create a new KeyBindings instance.
Main header for keybinding classes.
ActionList m_mandatoryBindings
void ClearJump(const QString &Destination)
ActionList GetModified(void) const
Returns the appropriate container of modified actions.
QStringList GetActions(const QString &context) const
Get a list of the actions in a context.
ActionList GetActions(const QString &key) const
Returns the actions bound to the specified key.
void ClearKey(const QString &Context, const QString &Action)
bool HasMandatoryBindings(void) const
Returns true iff all mandatory bindings are satisfied.
void CommitAction(const ActionID &id)
Commit an action to the database, and reload its keybindings.
void ReplaceActionKey(const QString &context_name, const QString &action_name, const QString &newkey, const QString &oldkey)
Replace a key in an action.
void CommitChanges(void)
Commit all changes made to the keybindings.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
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.
void LoadContexts(void)
Load the keybindings from the database.
void GetKeyActions(const QString &key, ActionList &list) const
Get a list of the actions in a context.
void LoadMandatoryBindings(void)
Load the mandatory bindings.
bool AddAction(const ActionID &id, const QString &description, const QString &keys)
Add an action.
QStringList GetKeyContexts(const QString &key) const
Get the context names in which a key is bound.
static const QString kJumpContext
The statically assigned context for jump point actions.
bool RemoveActionKey(const QString &context_name, const QString &action_name, const QString &key)
Unbind a key from an action.
QStringList GetAllKeys(void) const
Get all keys (from every context) to which an action is bound.
QStringList GetActionKeys(const QString &context_name, const QString &action_name) const
Get an action's keys.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
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.
MythMainWindow * GetMythMainWindow(void)
void CommitJumppoint(const ActionID &id)
Commit a jumppoint to the database.
QStringList GetContexts(void) const
Returns a list of the context names.
QStringList GetContextKeys(const QString &context) const
Get the keys within a context.
A class that uniquely identifies an action.
QString GetActionDescription(const QString &context_name, const QString &action_name) const
Get an action's description.
bool AddActionKey(const QString &context_name, const QString &action_name, const QString &key)
Add a key to 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.
ActionID * GetConflict(const QString &context_name, const QString &key, int &level) const
Determine if adding a key would cause a conflict.
void BindKey(const QString &Context, const QString &Action, const QString &Key)
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.