00001
00002 #ifndef GUIDEGRID_H_
00003 #define GUIDEGRID_H_
00004
00005 #include <qstring.h>
00006 #include <qdatetime.h>
00007 #include <qptrlist.h>
00008 #include <qlayout.h>
00009 #include <vector>
00010
00011 #include "libmyth/mythwidgets.h"
00012 #include <qdom.h>
00013 #include "uitypes.h"
00014 #include "xmlparse.h"
00015 #include "libmythtv/programinfo.h"
00016 #include "channelutil.h"
00017
00018 using namespace std;
00019
00020 class ProgramInfo;
00021 class TimeInfo;
00022 class TV;
00023 class QTimer;
00024 class QWidget;
00025
00026 #define MAX_DISPLAY_CHANS 12
00027 #define MAX_DISPLAY_TIMES 30
00028
00029 typedef vector<PixmapChannel> pix_chan_list_t;
00030 typedef vector<pix_chan_list_t> pix_chan_list_list_t;
00031
00032 class MPUBLIC GuideGrid : public MythDialog
00033 {
00034 Q_OBJECT
00035
00036 public:
00037
00038 static DBChanList Run(uint startChanId,
00039 const QString &startChanNum,
00040 bool thread = false,
00041 TV *player = NULL,
00042 bool allowsecondaryepg = true);
00043
00044 DBChanList GetSelection(void) const;
00045
00046 protected slots:
00047 void cursorLeft();
00048 void cursorRight();
00049 void cursorDown();
00050 void cursorUp();
00051
00052 void scrollLeft();
00053 void scrollRight();
00054 void scrollDown();
00055 void scrollUp();
00056
00057 void dayLeft();
00058 void dayRight();
00059 void pageLeft();
00060 void pageRight();
00061 void pageDown();
00062 void pageUp();
00063 void toggleGuideListing();
00064 void toggleChannelFavorite();
00065 void generateListings();
00066
00067 void enter();
00068 void escape();
00069
00070 void showProgFinder();
00071 void channelUpdate();
00072 void volumeUpdate(bool);
00073 void toggleMute();
00074
00075 void quickRecord();
00076 void editRecording();
00077 void editScheduled();
00078 void customEdit();
00079 void remove();
00080 void upcoming();
00081 void details();
00082
00083 void customEvent(QCustomEvent *e);
00084
00085 protected:
00086 GuideGrid(MythMainWindow *parent,
00087 uint chanid = 0, QString channum = "",
00088 TV *player = NULL, bool allowsecondaryepg = true,
00089 const char *name = "GuideGrid");
00090 ~GuideGrid();
00091
00092 void paintEvent(QPaintEvent *);
00093
00094 private slots:
00095 void timeCheckTimeout(void);
00096 void repaintVideoTimeout(void);
00097 void jumpToChannelTimeout(void);
00098
00099 private:
00100 void keyPressEvent(QKeyEvent *e);
00101 void keyReleaseEvent(QKeyEvent *e);
00102
00103 void updateBackground(void);
00104 void paintDate(QPainter *);
00105 void paintJumpToChannel(QPainter *);
00106 bool paintChannels(QPainter *);
00107 void paintTimes(QPainter *);
00108 void paintPrograms(QPainter *);
00109 void paintCurrentInfo(QPainter *);
00110 void paintInfo(QPainter *);
00111
00112 void resizeImage(QPixmap *, QString);
00113 void LoadWindow(QDomElement &);
00114 void parseContainer(QDomElement &);
00115 XMLParse *theme;
00116 QDomElement xmldata;
00117
00118 int m_context;
00119
00120 bool selectChangesChannel;
00121 int selectRecThreshold;
00122
00123 int gridfilltype;
00124 int scrolltype;
00125
00126 QRect fullRect;
00127 QRect dateRect;
00128 QRect jumpToChannelRect;
00129 QRect channelRect;
00130 QRect timeRect;
00131 QRect programRect;
00132 QRect infoRect;
00133 QRect curInfoRect;
00134 QRect videoRect;
00135
00136 void fillChannelInfos(bool gotostartchannel = true);
00137
00138 void fillTimeInfos();
00139
00140 void fillProgramInfos(void);
00141 void fillProgramRowInfos(unsigned int row);
00142
00143 void setStartChannel(int newStartChannel);
00144
00145 void createProgramLabel(int, int);
00146
00147 PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1);
00148 const PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1) const;
00149 uint GetChannelCount(void) const;
00150 int GetStartChannelOffset(int row = -1) const;
00151
00152 ProgramList GetProgramList(uint chanid) const;
00153 uint GetAlternateChannelIndex(uint chan_idx, bool with_same_channum) const;
00154
00155 private:
00156 pix_chan_list_list_t m_channelInfos;
00157 QMap<uint,uint> m_channelInfoIdx;
00158
00159 TimeInfo *m_timeInfos[MAX_DISPLAY_TIMES];
00160 ProgramList *m_programs[MAX_DISPLAY_CHANS];
00161 ProgramInfo *m_programInfos[MAX_DISPLAY_CHANS][MAX_DISPLAY_TIMES];
00162 ProgramList m_recList;
00163
00164 QDateTime m_originalStartTime;
00165 QDateTime m_currentStartTime;
00166 QDateTime m_currentEndTime;
00167 uint m_currentStartChannel;
00168 uint startChanID;
00169 QString startChanNum;
00170
00171 int m_currentRow;
00172 int m_currentCol;
00173
00174 bool selectState;
00175 bool showFavorites;
00176 bool sortReverse;
00177 QString channelFormat;
00178
00179 int desiredDisplayChans;
00180 int DISPLAY_CHANS;
00181 int DISPLAY_TIMES;
00182
00183 QDateTime firstTime;
00184 QDateTime lastTime;
00185
00186 TV *m_player;
00187
00188 QString channelOrdering;
00189 QString dateformat;
00190 QString timeformat;
00191 QString unknownTitle;
00192 QString unknownCategory;
00193
00194 QTimer *timeCheck;
00195 QTimer *videoRepaintTimer;
00196
00197 bool keyDown;
00198
00199 void jumpToChannelResetAndHide();
00200 void jumpToChannelCancel();
00201 void jumpToChannelCommit();
00202 void jumpToChannelShowSelection();
00203 void jumpToChannelDeleteLastDigit();
00204 void jumpToChannelDigitPress(int);
00205 bool jumpToChannelGetInputDigit(QStringList & actions, int & digit);
00206 int jumpToChannel;
00207 int jumpToChannelPreviousStartChannel;
00208 int jumpToChannelPreviousRow;
00209 bool jumpToChannelEnabled;
00210 bool jumpToChannelActive;
00211 bool jumpToChannelHasRect;
00212 QTimer *jumpToChannelTimer;
00213 };
00214
00215 #endif