00001 #ifndef MYTHEVENT_H_
00002 #define MYTHEVENT_H_
00003
00004 #include <QStringList>
00005 #include <QEvent>
00006 #include <QHash>
00007
00008 #include "mythbaseexp.h"
00009
00016 class MBASE_PUBLIC MythEvent : public QEvent
00017 {
00018 public:
00019 MythEvent(int t) : QEvent((QEvent::Type)t)
00020 { }
00021
00022
00023 MythEvent(int t, const QString lmessage) : QEvent((QEvent::Type)t)
00024 {
00025 message = lmessage;
00026 extradata.append( "empty" );
00027 }
00028
00029
00030 MythEvent(int t, const QString lmessage, const QStringList &lextradata)
00031 : QEvent((QEvent::Type)t)
00032 {
00033 message = lmessage;
00034 extradata = lextradata;
00035 }
00036
00037
00038 MythEvent(const QString lmessage) : QEvent(MythEventMessage)
00039 {
00040 message = lmessage;
00041 extradata.append( "empty" );
00042 }
00043
00044
00045 MythEvent(const QString lmessage, const QStringList &lextradata)
00046 : QEvent((QEvent::Type)MythEventMessage)
00047 {
00048 message = lmessage;
00049 extradata = lextradata;
00050 }
00051
00052
00053 MythEvent(const QString lmessage, const QString lextradata)
00054 : QEvent((QEvent::Type)MythEventMessage)
00055 {
00056 message = lmessage;
00057 extradata.append( lextradata );
00058 }
00059
00060
00061 virtual ~MythEvent() {}
00062
00063 const QString& Message() const { return message; }
00064 const QString& ExtraData(int idx = 0) const { return extradata[idx]; }
00065 const QStringList& ExtraDataList() const { return extradata; }
00066 int ExtraDataCount() const { return extradata.size(); }
00067
00068 virtual MythEvent *clone() const
00069 { return new MythEvent(message, extradata); }
00070
00071 static Type MythEventMessage;
00072 static Type MythUserMessage;
00073 static Type kUpdateTvProgressEventType;
00074 static Type kExitToMainMenuEventType;
00075 static Type kMythPostShowEventType;
00076 static Type kEnableDrawingEventType;
00077 static Type kDisableDrawingEventType;
00078 static Type kPushDisableDrawingEventType;
00079 static Type kPopDisableDrawingEventType;
00080 static Type kLockInputDevicesEventType;
00081 static Type kUnlockInputDevicesEventType;
00082 static Type kUpdateBrowseInfoEventType;
00083
00084 private:
00085 QString message;
00086 QStringList extradata;
00087 };
00088
00089 class MBASE_PUBLIC ExternalKeycodeEvent : public QEvent
00090 {
00091 public:
00092 ExternalKeycodeEvent(const int key) :
00093 QEvent(kEventType), keycode(key) {}
00094
00095 int getKeycode() { return keycode; }
00096
00097 static Type kEventType;
00098
00099 private:
00100 int keycode;
00101 };
00102
00103 class MBASE_PUBLIC UpdateBrowseInfoEvent : public QEvent
00104 {
00105 public:
00106 UpdateBrowseInfoEvent(const QHash<QString,QString> &infoMap) :
00107 QEvent(MythEvent::kUpdateBrowseInfoEventType), im(infoMap) {}
00108 QHash<QString,QString> im;
00109 };
00110
00111
00112 class MBASE_PUBLIC MythInfoMapEvent : public MythEvent
00113 {
00114 public:
00115 MythInfoMapEvent(const QString &lmessage,
00116 const QHash<QString,QString> &linfoMap)
00117 : MythEvent(lmessage), infoMap(linfoMap) { }
00118
00119 virtual MythInfoMapEvent *clone() const
00120 { return new MythInfoMapEvent(Message(), infoMap); }
00121 const QHash<QString,QString>* InfoMap(void) { return &infoMap; }
00122
00123 private:
00124 QHash<QString,QString> infoMap;
00125 };
00126
00127 #endif