MythTV  0.26-pre
actionset.h
Go to the documentation of this file.
00001 /* -*- myth -*- */
00024 #ifndef ACTIONSET_H
00025 #define ACTIONSET_H
00026 
00027 // Qt headers
00028 #include <QStringList>
00029 #include <QHash>
00030 #include <QMap>
00031 
00037 class ActionSet
00038 {
00039   public:
00041     ActionSet() {}
00042     ~ActionSet();
00043 
00044     // Commands
00045     bool AddAction(const ActionID &id,
00046                    const QString  &description,
00047                    const QString  &keys);
00048     bool Add(const ActionID &id, const QString &key);
00049     bool Remove(const ActionID &id, const QString &key);
00050     bool Replace(const ActionID &id,
00051                  const QString  &newkey,
00052                  const QString  &oldkey);
00053 
00054     // Sets
00055     bool        SetModifiedFlag(const ActionID &id, bool modified);
00056 
00057     // Gets
00058     QStringList GetContextStrings(void) const;
00059     QStringList GetActionStrings(const QString &context_name) const;
00060     QString     GetKeyString(const ActionID &id) const;
00061     QStringList GetKeys(const ActionID &id) const;
00062     QStringList GetContextKeys(const QString &context_name) const;
00063     QStringList GetAllKeys(void) const;
00064     QString     GetDescription(const ActionID &id) const;
00065     ActionList  GetActions(const QString &key) const;
00066     ActionList  GetModified(void) const;
00068     bool HasModified(void) const { return !m_modified.isEmpty(); }
00070     bool IsModified(const ActionID &id) const
00071         { return m_modified.contains(id); }
00072 
00073   protected:
00074     Action *GetAction(const ActionID &id);
00075 
00076   public:
00078     static const QString kJumpContext;
00080     static const QString kGlobalContext;
00081 
00082   private:
00083     QMap<QString, ActionList> m_keyToActionMap;
00084     typedef QHash<QString, Context> ContextMap;
00085     ContextMap                m_contexts;
00086     ActionList                m_modified;
00087 };
00088 
00089 #endif /* ACTIONSET_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends