00001 /* -*- myth -*- */ 00024 #ifndef ACTION_H 00025 #define ACTION_H 00026 00027 // Qt headers 00028 #include <qstringlist.h> 00029 #include <qdict.h> 00030 00038 class Action 00039 { 00040 public: 00042 Action(const QString &description) : m_description(description) {} 00043 Action(const QString &description, const QString &keys); 00044 00045 // Commands 00046 bool AddKey(const QString &key); 00047 bool ReplaceKey(const QString &newkey, const QString &oldkey); 00050 bool RemoveKey(const QString &key) { return m_keys.remove(key)>0; } 00051 00052 // Gets 00054 QString GetDescription(void) const { return m_description; } 00057 QStringList GetKeys(void) const { return m_keys; } 00059 QString GetKeyString(void) const { return m_keys.join(","); } 00061 bool IsEmpty(void) const { return m_keys.empty(); } 00062 bool HasKey(const QString &key) const; 00063 00064 public: 00066 static const unsigned int kMaximumNumberOfBindings = 4; 00067 00068 private: 00069 QString m_description; 00070 QStringList m_keys; 00071 }; 00072 typedef QDict<Action> Context; 00073 00074 #endif /* ACTION_H */
1.5.5