00001 // -*- Mode: c++ -*- 00024 #ifndef MYTHCONTROLS_H 00025 #define MYTHCONTROLS_H 00026 00027 #include <mythtv/libmythui/mythscreentype.h> 00028 #include <mythtv/libmythui/mythuitext.h> 00029 #include <mythtv/libmythui/mythlistbutton.h> 00030 #include <mythtv/libmythui/mythuiimage.h> 00031 #include <mythtv/libmythui/mythdialogbox.h> 00032 00033 #include "keybindings.h" 00034 00035 00036 typedef enum { kActionsByContext, kKeysByContext, kContextsByKey, } ViewType; 00037 00041 class MythControls : public MythScreenType 00042 { 00043 Q_OBJECT 00044 00045 public: 00046 00047 MythControls(MythScreenStack *parent, const char *name); 00048 ~MythControls(); 00049 00050 virtual bool Create(void); 00051 virtual bool keyPressEvent(QKeyEvent *); 00052 virtual void customEvent(QCustomEvent*); 00053 00054 typedef enum 00055 { 00056 kContextList, 00057 kKeyList, 00058 kActionList 00059 } ListType; 00060 00061 // Gets 00062 QString GetCurrentContext(void); 00063 QString GetCurrentAction(void); 00064 QString GetCurrentKey(void); 00065 00066 protected: 00067 void Teardown(void); 00068 00069 // Commands 00070 bool LoadUI(void); 00071 void LoadData(const QString &hostname); 00072 void ChangeButtonFocus(int direction); 00073 void ChangeView(void); 00074 void SetListContents(MythListButton *uilist, 00075 const QStringList & contents, 00076 bool arrows = false); 00077 void UpdateRightList(void); 00078 00079 // Gets 00080 uint GetCurrentButton(void); 00081 00082 // Functions 00083 static bool ResolveConflict(ActionID *conflict, int error_level); 00084 QString GetTypeDesc(ListType type) const; 00085 00086 private slots: 00087 void AddKeyToAction(void); 00088 void DeleteKey(void); 00089 void LeftSelected(MythListButtonItem*); 00090 void RightSelected(MythListButtonItem*); 00091 bool JumpTo(QKeyEvent *event) { return false; } 00093 void Save(void) { m_bindings->CommitChanges(); } 00094 void RefreshKeyInformation(void); 00095 00096 private: 00097 ViewType m_currentView; 00098 MythUIType *m_focusedUIElement; 00099 MythListButton *m_leftList; 00100 MythListButton *m_rightList; 00101 MythUIText *m_description; 00102 MythUIText *m_leftDescription; 00103 MythUIText *m_rightDescription; 00104 QPtrList<MythUIButton> m_actionButtons; 00105 MythDialogBox *m_menuPopup; 00106 00107 KeyBindings *m_bindings; 00108 QStringList m_sortedContexts; 00109 QDict<QStringList> m_contexts; 00110 ListType m_leftListType; 00111 ListType m_rightListType; 00112 }; 00113 00114 00115 #endif /* MYTHCONTROLS_H */
1.5.5