00001 #ifndef LCDPROCCLIENT_H_
00002 #define LCDPROCCLIENT_H_
00003
00004 #include <qobject.h>
00005 #include <qstringlist.h>
00006 #include <qvaluevector.h>
00007 #include <qsocket.h>
00008 #include <qtimer.h>
00009 #include <qdatetime.h>
00010
00011 #include "remoteutil.h"
00012
00013 class LCDServer;
00014 class LCDTextItem;
00015 class LCDMenuItem;
00016
00017 class LCDProcClient : public QObject
00018 {
00019 Q_OBJECT
00020
00021 public:
00022
00023 LCDProcClient(LCDServer *lparent);
00024
00025 void customEvent(QCustomEvent *e);
00026
00027 ~LCDProcClient();
00028
00029 bool SetupLCD(void);
00030 void reset(void);
00031
00032 void setStartupMessage(QString msq, uint messagetime);
00033
00034
00035 bool connectToHost(const QString &hostname, unsigned int port);
00036
00037 void switchToTime();
00038 void switchToMusic(const QString &artist, const QString &album, const QString &track);
00039 void setMusicProgress(QString time, float generic_progress);
00040 void setMusicRepeat(int repeat);
00041 void setMusicShuffle(int shuffle);
00042 void setLevels(int numbLevels, float *values);
00043 void switchToChannel(QString channum = "", QString title = "",
00044 QString subtitle = "");
00045 void setChannelProgress(float percentViewed);
00046 void switchToMenu(QPtrList<LCDMenuItem> *menuItems, QString app_name = "",
00047 bool popMenu = true);
00048 void switchToGeneric(QPtrList<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(int);
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(QPtrList<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(QPtrList<LCDTextItem> * textItems);
00126 void startMenu(QPtrList<LCDMenuItem> *menuItems, QString app_name,
00127 bool popMenu);
00128 void startVolume(QString app_name);
00129 void showStartupMessage(void);
00130
00131 QString activeScreen;
00132
00133 QSocket *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;
00173 bool busy_progress;
00176 int busy_pos;
00179 float busy_indicator_size;
00182 int busy_direction;
00183 float generic_progress;
00184 float volume_level;
00185
00186 float music_progress;
00187 QString music_time;
00188 int music_repeat;
00189 int music_shuffle;
00190
00191 QPtrList<LCDTextItem> *lcdTextItems;
00192 QString scrollingText;
00193 QString scrollScreen;
00194 unsigned int scrollPosition;
00195 QString timeformat;
00196
00197 QStringList scrollListItems;
00198 QString scrollListScreen, scrollListWidget;
00199 int scrollListRow;
00200 unsigned int scrollListItem;
00201
00202 unsigned int menuScrollPosition;
00203 QPtrList<LCDMenuItem> *lcdMenuItems;
00204
00205 bool connected;
00206 bool timeFlash;
00207
00208 QString send_buffer;
00209 QString last_command;
00210 QString hostname;
00211 unsigned int port;
00212
00213 bool lcd_ready;
00214
00215 bool lcd_showtime;
00216 bool lcd_showmenu;
00217 bool lcd_showgeneric;
00218 bool lcd_showmusic;
00219 bool lcd_showchannel;
00220 bool lcd_showvolume;
00221 bool lcd_showrecstatus;
00222 bool lcd_backlighton;
00223 bool lcd_heartbeaton;
00224 bool lcd_bigclock;
00225 int lcd_popuptime;
00226 QString lcd_showmusic_items;
00227 QString lcd_keystring;
00228 LCDServer *m_parent;
00229 QString startup_message;
00230 uint startup_showtime;
00231
00232 bool isRecording;
00233 bool isTimeVisible;
00234 int lcdTunerNo;
00235
00236 QPtrList<TunerStatus> tunerList;
00237 };
00238
00239 #endif