00001 #ifndef LCDPROCCLIENT_H_
00002 #define LCDPROCCLIENT_H_
00003
00004 #include <QStringList>
00005 #include <QObject>
00006 #include <QList>
00007 #include <QTcpSocket>
00008
00009 #include "tvremoteutil.h"
00010
00011 class LCDServer;
00012 class LCDTextItem;
00013 class LCDMenuItem;
00014 class QEvent;
00015 class QTimer;
00016
00017
00018 class LCDProcClient : public QObject
00019 {
00020 Q_OBJECT
00021
00022 public:
00023
00024 LCDProcClient(LCDServer *lparent);
00025
00026 void customEvent(QEvent *e);
00027
00028 ~LCDProcClient();
00029
00030 bool SetupLCD(void);
00031 void reset(void);
00032
00033 void setStartupMessage(QString msq, uint messagetime);
00034
00035
00036 bool connectToHost(const QString &hostname, unsigned int port);
00037
00038 void switchToTime();
00039 void switchToMusic(const QString &artist, const QString &album, const QString &track);
00040 void setMusicProgress(QString time, float generic_progress);
00041 void setMusicRepeat(int repeat);
00042 void setMusicShuffle(int shuffle);
00043 void switchToChannel(QString channum = "", QString title = "",
00044 QString subtitle = "");
00045 void setChannelProgress(const QString &time, float percentViewed);
00046 void switchToMenu(QList<LCDMenuItem> *menuItems, QString app_name = "",
00047 bool popMenu = true);
00048 void switchToGeneric(QList<LCDTextItem> *textItems);
00049 void setGenericProgress(bool busy, float generic_progress);
00050
00051 void switchToVolume(QString app_name);
00052 void setVolumeLevel(float volume_level);
00053
00054 void switchToNothing();
00055
00056 void shutdown();
00057 void removeWidgets();
00058 void updateLEDs(int mask);
00059 void stopAll(void);
00060
00061 int getLCDWidth(void) { return lcdWidth; }
00062 int getLCDHeight(void) { return lcdHeight; }
00063
00064 private slots:
00065 void veryBadThings(QAbstractSocket::SocketError error);
00066 void serverSendingData();
00067
00068 void checkConnections();
00069
00070
00071 void dobigclock(bool);
00072 void dostdclock();
00073 void outputTime();
00074 void outputMusic();
00075 void outputChannel();
00076 void outputGeneric();
00077 void outputVolume();
00078 void outputRecStatus();
00079 void scrollMenuText();
00080 void beginScrollingMenuText();
00081 void unPopMenu();
00082 void scrollList();
00083 void updateRecordingList(void);
00084 void removeStartupMessage(void);
00085 void beginScrollingWidgets(void);
00086 void scrollWidgets(void);
00087
00088 private:
00089 void outputCenteredText(QString theScreen, QString theText,
00090 QString widget = "topWidget", int row = 1);
00091
00092 void outputLeftText(QString theScreen, QString theText,
00093 QString widget = "topWidget", int row = 1);
00094 void outputRightText(QString theScreen, QString theText,
00095 QString widget = "topWidget", int row = 1);
00096
00097 void outputScrollerText(QString theScreen, QString theText,
00098 QString widget = "scroller", int top = 1, int bottom = 1);
00099
00100 QStringList formatScrollerText(const QString &text);
00101 void outputText(QList<LCDTextItem> *textItems);
00102
00103 void sendToServer(const QString &someText);
00104
00105 enum PRIORITY {TOP, URGENT, HIGH, MEDIUM, LOW, OFF};
00106 void setPriority(const QString &screen, PRIORITY priority);
00107
00108 void setHeartbeat (const QString &screen, bool onoff);
00109 QString expandString(const QString &aString);
00110
00111 void init();
00112 void loadSettings();
00113
00114 void assignScrollingList(QStringList theList, QString theScreen,
00115 QString theWidget = "topWidget", int theRow = 1);
00116
00117
00118 void assignScrollingWidgets(QString theText, QString theScreen,
00119 QString theWidget = "topWidget", int theRow = 1);
00120 void formatScrollingWidgets(void);
00121
00122 void startTime();
00123 void startMusic(QString artist, QString album, QString track);
00124 void startChannel(QString channum, QString title, QString subtitle);
00125 void startGeneric(QList<LCDTextItem> * textItems);
00126 void startMenu(QList<LCDMenuItem> *menuItems, QString app_name,
00127 bool popMenu);
00128 void startVolume(QString app_name);
00129 void showStartupMessage(void);
00130
00131 QString activeScreen;
00132
00133 QTcpSocket *socket;
00134 QTimer *timeTimer;
00135 QTimer *scrollWTimer;
00136 QTimer *preScrollWTimer;
00137 QTimer *menuScrollTimer;
00138 QTimer *menuPreScrollTimer;
00139 QTimer *popMenuTimer;
00140 QTimer *checkConnectionsTimer;
00141 QTimer *recStatusTimer;
00142 QTimer *scrollListTimer;
00143 QTimer *showMessageTimer;
00144 QTimer *updateRecInfoTimer;
00145
00146 void setWidth(unsigned int);
00147 void setHeight(unsigned int);
00148 void setCellWidth(unsigned int);
00149 void setCellHeight(unsigned int);
00150 void setVersion(const QString &, const QString &);
00151 void describeServer();
00152
00153 QString prioTop;
00154 QString prioUrgent;
00155 QString prioHigh;
00156 QString prioMedium;
00157 QString prioLow;
00158 QString prioOff;
00159
00160 unsigned int lcdWidth;
00161 unsigned int lcdHeight;
00162 unsigned int cellWidth;
00163 unsigned int cellHeight;
00164
00165 QString serverVersion;
00166 QString protocolVersion;
00167 int pVersion;
00168
00169 float EQlevels[10];
00170 float progress;
00171 QString channel_time;
00174 bool busy_progress;
00177 int busy_pos;
00180 float busy_indicator_size;
00183 int busy_direction;
00184 float generic_progress;
00185 float volume_level;
00186
00187 float music_progress;
00188 QString music_time;
00189 int music_repeat;
00190 int music_shuffle;
00191
00192 QList<LCDTextItem> *lcdTextItems;
00193 QString scrollingText;
00194 QString scrollScreen;
00195 unsigned int scrollPosition;
00196 QString timeformat;
00197 QString dateformat;
00198
00199 QStringList scrollListItems;
00200 QString scrollListScreen, scrollListWidget;
00201 int scrollListRow;
00202 unsigned int scrollListItem;
00203
00204 unsigned int menuScrollPosition;
00205 QList<LCDMenuItem> *lcdMenuItems;
00206
00207 bool connected;
00208 bool timeFlash;
00209
00210 QString send_buffer;
00211 QString last_command;
00212 QString hostname;
00213 unsigned int port;
00214
00215 bool lcd_ready;
00216
00217 bool lcd_showtime;
00218 bool lcd_showmenu;
00219 bool lcd_showgeneric;
00220 bool lcd_showmusic;
00221 bool lcd_showchannel;
00222 bool lcd_showvolume;
00223 bool lcd_showrecstatus;
00224 bool lcd_backlighton;
00225 bool lcd_heartbeaton;
00226 bool lcd_bigclock;
00227 int lcd_popuptime;
00228 QString lcd_showmusic_items;
00229 QString lcd_keystring;
00230 LCDServer *m_parent;
00231 QString startup_message;
00232 uint startup_showtime;
00233
00234 bool isRecording;
00235 bool isTimeVisible;
00236 int lcdTunerNo;
00237
00238 vector<TunerStatus> tunerList;
00239 };
00240
00241 #endif