ActionSet Class Reference

#include <actionset.h>

List of all members.


Detailed Description

Maintains consistancy between actions and keybindings.

This class handles adding a removing bindings to keys.

Definition at line 37 of file actionset.h.


Public Member Functions

 ActionSet ()
 Create a new, empty set of action bindings.
bool AddAction (const ActionID &id, const QString &description, const QString &keys)
 Add an action.
bool Add (const ActionID &id, const QString &key)
 Add a binding.
bool Remove (const ActionID &id, const QString &key)
 Remove a key from an action identifier.
bool Replace (const ActionID &id, const QString &newkey, const QString &oldkey)
 Replace a specific key in a specific action.
bool SetModifiedFlag (const ActionID &id, bool modified)
 Mark an action as modified or unmodified by its identifier.
QStringList GetContextStrings (void) const
 Returns a list of all contexts in the action set.
QStringList GetActionStrings (const QString &context_name) const
 Returns a list of all action in the action set.
QString GetKeyString (const ActionID &id) const
 Returns a string containing all the keys in bound to an action by its identifier.
QStringList GetKeys (const ActionID &id) const
 Get the keys bound to an action by its identifier.
QStringList GetContextKeys (const QString &context_name) const
QStringList GetAllKeys (void) const
 Get all keys (from every context) to which an action is bound.
QString GetDescription (const ActionID &id) const
 Returns the description of an action by its identifier.
const ActionListGetActions (const QString &key) const
 Returns the actions bound to the specified key.
const ActionListGetModified (void) const
 Returns the appropriate container of modified actions based on current context.
bool HasModified (void) const
 Returns true iff changes have been made.
bool IsModified (const ActionID &id) const
 Returns true iff the action is modified.

Static Public Attributes

static const QString kJumpContext = "JumpPoints"
 The statically assigned context for jump point actions.
static const QString kGlobalContext = "Global"
 The name of global actions.

Protected Member Functions

ActionGetAction (const ActionID &id) const
 Returns a pointer to an action by its identifier.
ContextGetContext (const QString &name) const
 Returns a pointer to a context by its identifier.

Private Attributes

QMap< QString, ActionListm_keyToActionMap
QDict< Contextm_contexts
ActionList m_modified

Constructor & Destructor Documentation

ActionSet::ActionSet (  )  [inline]

Create a new, empty set of action bindings.

Definition at line 41 of file actionset.h.


Member Function Documentation

bool ActionSet::AddAction ( const ActionID id,
const QString &  description,
const QString &  keys 
)

Add an action.

(note: result not thread-safe)

If the action has already been added, it will not be added again. There are no duplicate actions in the action set.

Parameters:
id The action identifier.
description The action description.
keys The keys for this action.
Returns:
true if the action on success, false otherwise.

Definition at line 195 of file actionset.cpp.

Referenced by KeyBindings::LoadContexts(), and KeyBindings::LoadJumppoints().

bool ActionSet::Add ( const ActionID id,
const QString &  key 
)

Add a binding.

If the key is added, we mark this action as modified, and update the key map.

Parameters:
id The action identifier.
key The symbolic name of the key.
Returns:
true if the key was added otherwise, false.

Definition at line 50 of file actionset.cpp.

Referenced by KeyBindings::AddActionKey().

bool ActionSet::Remove ( const ActionID id,
const QString &  key 
)

Remove a key from an action identifier.

If the key is removed from the action, then we remove it from the key list, and mark the action id as modified.

Parameters:
id The action identifier to remove from.
key The key to remove.
Todo:
Remove the actionlist from the m_keyToActionMap if the key is no longer bound to any actions.

Definition at line 82 of file actionset.cpp.

Referenced by KeyBindings::RemoveActionKey().

bool ActionSet::Replace ( const ActionID id,
const QString &  newkey,
const QString &  oldkey 
)

Replace a specific key in a specific action.

If the key is replaced, then we remove the old key from the key list and add the new key and mark the action as modified.

Parameters:
id The action identifier.
newkey The new key.
oldkey The key to be replaced.

Definition at line 113 of file actionset.cpp.

Referenced by KeyBindings::ReplaceActionKey().

bool ActionSet::SetModifiedFlag ( const ActionID id,
bool  modified 
)

Mark an action as modified or unmodified by its identifier.

Returns:
true if the action was modified, and is set to unmodified.

Definition at line 136 of file actionset.cpp.

Referenced by Add(), KeyBindings::CommitChanges(), Remove(), and Replace().

QStringList ActionSet::GetContextStrings ( void   )  const

Returns a list of all contexts in the action set.

(note: result not thread-safe)

Definition at line 154 of file actionset.cpp.

Referenced by KeyBindings::GetContexts().

QStringList ActionSet::GetActionStrings ( const QString &  context_name  )  const

Returns a list of all action in the action set.

(note: result not thread-safe)

Definition at line 169 of file actionset.cpp.

Referenced by KeyBindings::GetActions().

QString ActionSet::GetKeyString ( const ActionID id  )  const

Returns a string containing all the keys in bound to an action by its identifier.

(note: result not thread-safe)

Definition at line 220 of file actionset.cpp.

Referenced by KeyBindings::CommitAction(), and KeyBindings::CommitJumppoint().

QStringList ActionSet::GetKeys ( const ActionID id  )  const

Get the keys bound to an action by its identifier.

(note: result not thread-safe)

Definition at line 238 of file actionset.cpp.

Referenced by KeyBindings::GetActionKeys(), KeyBindings::HasMandatoryBindings(), and KeyBindings::RemoveActionKey().

QStringList ActionSet::GetContextKeys ( const QString &  context_name  )  const

Definition at line 253 of file actionset.cpp.

Referenced by KeyBindings::GetContextKeys().

QStringList ActionSet::GetAllKeys ( void   )  const

Get all keys (from every context) to which an action is bound.

Definition at line 274 of file actionset.cpp.

Referenced by KeyBindings::GetKeys().

QString ActionSet::GetDescription ( const ActionID id  )  const

Returns the description of an action by its identifier.

(note: result not thread-safe)

Definition at line 290 of file actionset.cpp.

Referenced by KeyBindings::GetActionDescription().

const ActionList & ActionSet::GetActions ( const QString &  key  )  const

Returns the actions bound to the specified key.

(note: result not thread-safe)

Definition at line 307 of file actionset.cpp.

Referenced by KeyBindings::GetConflict(), KeyBindings::GetKeyActions(), and KeyBindings::GetKeyContexts().

const ActionList& ActionSet::GetModified ( void   )  const [inline]

Returns the appropriate container of modified actions based on current context.

(result not thread-safe)

Definition at line 67 of file actionset.h.

Referenced by KeyBindings::CommitChanges().

bool ActionSet::HasModified ( void   )  const [inline]

Returns true iff changes have been made.

Definition at line 69 of file actionset.h.

Referenced by KeyBindings::HasChanges().

bool ActionSet::IsModified ( const ActionID id  )  const [inline]

Returns true iff the action is modified.

Definition at line 71 of file actionset.h.

Referenced by SetModifiedFlag().

Action * ActionSet::GetAction ( const ActionID id  )  const [protected]

Returns a pointer to an action by its identifier.

(note: result not thread-safe)

Definition at line 316 of file actionset.cpp.

Referenced by Add(), AddAction(), Remove(), and Replace().

Context * ActionSet::GetContext ( const QString &  name  )  const [protected]

Returns a pointer to a context by its identifier.

(note: result not thread-safe)

Definition at line 343 of file actionset.cpp.

Referenced by AddAction(), and GetAction().


Member Data Documentation

const QString ActionSet::kJumpContext = "JumpPoints" [static]

The statically assigned context for jump point actions.

Definition at line 80 of file actionset.h.

Referenced by KeyBindings::CommitChanges(), KeyBindings::GetConflict(), MythControls::LoadData(), and KeyBindings::LoadJumppoints().

const QString ActionSet::kGlobalContext = "Global" [static]

The name of global actions.

Definition at line 82 of file actionset.h.

Referenced by KeyBindings::GetConflict(), MythControls::LoadData(), and KeyBindings::LoadMandatoryBindings().

QMap<QString, ActionList> ActionSet::m_keyToActionMap [private]

Definition at line 85 of file actionset.h.

Referenced by Add(), AddAction(), GetActions(), GetAllKeys(), Remove(), and Replace().

QDict<Context> ActionSet::m_contexts [private]

Definition at line 87 of file actionset.h.

Referenced by GetModified(), HasModified(), IsModified(), and SetModifiedFlag().


The documentation for this class was generated from the following files:

Generated on Sat Dec 18 05:15:59 2010 for MythTV by  doxygen 1.5.5