MythTV  master
lcdprocclient.h
Go to the documentation of this file.
1 #ifndef LCDPROCCLIENT_H_
2 #define LCDPROCCLIENT_H_
3 
4 #include <QStringList>
5 #include <QObject>
6 #include <QList>
7 #include <QTcpSocket>
8 
9 #include "tvremoteutil.h"
10 
11 class LCDServer;
12 class LCDTextItem;
13 class LCDMenuItem;
14 class QEvent;
15 class QTimer;
16 
17 
18 class LCDProcClient : public QObject
19 {
20  Q_OBJECT
21 
22  public:
23 
24  explicit LCDProcClient(LCDServer *lparent);
25 
26  void customEvent(QEvent *e) override; // QObject
27 
29 
30  bool SetupLCD(void);
31  void reset(void);
32 
33  void setStartupMessage(QString msg, uint messagetime);
34 
35  // Used to actually connect to an LCD device
36  bool connectToHost(const QString &hostname, unsigned int port);
37 
38  void switchToTime();
39  void switchToMusic(const QString &artist, const QString &album, const QString &track);
40  void setMusicProgress(QString time, float value);
41  void setMusicRepeat(int repeat);
42  void setMusicShuffle(int shuffle);
43  void switchToChannel(const QString& channum = "", const QString& title = "",
44  const QString& subtitle = "");
45  void setChannelProgress(const QString &time, float value);
46  void switchToMenu(QList<LCDMenuItem> *menuItems, const QString& app_name = "",
47  bool popMenu = true);
48  void switchToGeneric(QList<LCDTextItem> *textItems);
49  void setGenericProgress(bool busy, float value);
50 
51  void switchToVolume(const QString& app_name);
52  void setVolumeLevel(float value);
53 
54  void switchToNothing();
55 
56  void shutdown();
57  void removeWidgets();
58  void updateLEDs(int mask);
59  void stopAll(void);
60 
61  int getLCDWidth(void) { return m_lcdWidth; }
62  int getLCDHeight(void) { return m_lcdHeight; }
63 
64  private slots:
65  void veryBadThings(QAbstractSocket::SocketError error); // Communication Errors
66  void serverSendingData(); // Data coming back from LCDd
67 
68  void checkConnections(); // check connections to LCDd and mythbackend
69  // every 10 seconds
70 
71  void dobigclock(void); // Large display
72  void dostdclock(); // Small display
73  void outputTime(); // Fire from a timer
74  void outputMusic(); // Short timer (equalizer)
75  void outputChannel(); // Longer timer (progress bar)
76  void outputGeneric(); // Longer timer (progress bar)
77  void outputVolume();
78  void outputRecStatus();
79  void scrollMenuText(); // Scroll the menu items if need be
80  void beginScrollingMenuText(); // But only after a bit of time has gone by
81  void unPopMenu(); // Remove the Pop Menu display
82  void scrollList(); // display a list line by line
83  void updateRecordingList(void);
84  void removeStartupMessage(void);
85  void beginScrollingWidgets(void);
86  void scrollWidgets(void);
87 
88  private:
89  void outputCenteredText(const QString& theScreen, QString theText,
90  const QString& widget = "topWidget", int row = 1);
91 
92  void outputLeftText(const QString& theScreen, QString theText,
93  const QString& widget = "topWidget", int row = 1);
94  void outputRightText(const QString& theScreen, QString theText,
95  const QString& widget = "topWidget", int row = 1);
96 
97  void outputScrollerText(const QString& theScreen, const QString& theText,
98  const QString& widget = "scroller", int top = 1, int bottom = 1);
99 
100  QStringList formatScrollerText(const QString &text);
101  void outputText(QList<LCDTextItem> *textItems);
102 
103  void sendToServer(const QString &someText);
104 
106  void setPriority(const QString &screen, PRIORITY priority);
107 
108  void setHeartbeat (const QString &screen, bool onoff);
109  QString expandString(const QString &aString);
110 
111  void init();
112  void loadSettings(); //reload the settings from the db
113 
114  void assignScrollingList(QStringList theList, QString theScreen,
115  QString theWidget = "topWidget", int theRow = 1);
116 
117  // Scroll 1 or more widgets on a screen
118  void assignScrollingWidgets(const QString& theText, const QString& theScreen,
119  const QString& theWidget = "topWidget", int theRow = 1);
120  void formatScrollingWidgets(void);
121 
122  void startTime();
123  void startMusic(QString artist, const QString& album, const QString& track);
124  void startChannel(const QString& channum, const QString& title, const QString& subtitle);
125  void startGeneric(QList<LCDTextItem> * textItems);
126  void startMenu(QList<LCDMenuItem> *menuItems, QString app_name,
127  bool popMenu);
128  void startVolume(const QString& app_name);
129  void showStartupMessage(void);
130 
131  void setWidth(unsigned int);
132  void setHeight(unsigned int);
133  void setCellWidth(unsigned int);
134  void setCellHeight(unsigned int);
135  void setVersion(const QString &, const QString &);
136  void describeServer();
137 
138  QString m_activeScreen;
139 
140  QTcpSocket *m_socket {nullptr};
141  QTimer *m_timeTimer {nullptr};
142  QTimer *m_scrollWTimer {nullptr};
143  QTimer *m_preScrollWTimer {nullptr};
144  QTimer *m_menuScrollTimer {nullptr};
145  QTimer *m_menuPreScrollTimer {nullptr};
146  QTimer *m_popMenuTimer {nullptr};
147  QTimer *m_checkConnectionsTimer {nullptr};
148  QTimer *m_recStatusTimer {nullptr};
149  QTimer *m_scrollListTimer {nullptr};
150  QTimer *m_showMessageTimer {nullptr};
151  QTimer *m_updateRecInfoTimer {nullptr};
152 
153  QString m_prioTop;
154  QString m_prioUrgent;
155  QString m_prioHigh;
156  QString m_prioMedium;
157  QString m_prioLow;
158  QString m_prioOff;
159 
160  unsigned int m_lcdWidth {5};
161  unsigned int m_lcdHeight {1};
162  unsigned int m_cellWidth {1};
163  unsigned int m_cellHeight {1};
164 
167  int m_pVersion {0};
168 
169  float m_progress {0.0};
170  QString m_channelTime;
173  bool m_busyProgress {false};
176  int m_busyPos {0};
179  float m_busyIndicatorSize {0.0};
183  float m_genericProgress {0.0};
184  float m_volumeLevel {0.0};
185 
186  float m_musicProgress {0.0};
187  QString m_musicTime;
188  int m_musicRepeat {0};
189  int m_musicShuffle {0};
190 
191  QList<LCDTextItem> *m_lcdTextItems {nullptr};
192  //QString m_scrollingText;
193  QString m_scrollScreen;
194  unsigned int m_scrollPosition {0};
195  QString m_timeFormat;
196  QString m_dateFormat;
197 
198  QStringList m_scrollListItems;
202  unsigned int m_scrollListItem {0};
203 
204  unsigned int m_menuScrollPosition {0};
205  QList<LCDMenuItem> *m_lcdMenuItems {nullptr};
206 
207  bool m_connected {false};
208  bool m_timeFlash {false};
209 
210  QString m_sendBuffer;
211  QString m_lastCommand;
212  QString m_hostname;
213  unsigned int m_port {13666};
214 
215  bool m_lcdReady {false};
216 
217  bool m_lcdShowTime {true};
218  bool m_lcdShowMenu {true};
219  bool m_lcdShowGeneric {true};
220  bool m_lcdShowMusic {true};
221  bool m_lcdShowChannel {true};
222  bool m_lcdShowVolume {true};
223  bool m_lcdShowRecstatus {true};
224  bool m_lcdBacklightOn {true};
225  bool m_lcdHeartbeatOn {true};
226  bool m_lcdBigClock {true};
227  int m_lcdPopupTime {0};
229  QString m_lcdKeyString;
233 
234  bool m_isRecording {false};
235  bool m_isTimeVisible {false};
236  int m_lcdTunerNo {0};
237 
238  vector<TunerStatus> m_tunerList;
239 };
240 
241 #endif
QString m_sendBuffer
QString expandString(const QString &aString)
QString m_lastCommand
float m_genericProgress
QString m_lcdKeyString
int m_busyDirection
Direction of the busy indicator on the, -1 or 1, used if m_busyProgress is true.
unsigned int slots[4]
Definition: element.c:38
unsigned int m_scrollPosition
QTimer * m_recStatusTimer
void setVersion(const QString &, const QString &)
QString m_channelTime
void outputLeftText(const QString &theScreen, QString theText, const QString &widget="topWidget", int row=1)
void dobigclock(void)
unsigned int m_port
void sendToServer(const QString &someText)
QTcpSocket * m_socket
QString m_timeFormat
static void error(const char *str,...)
Definition: vbi.c:42
QList< LCDMenuItem > * m_lcdMenuItems
QTimer * m_menuPreScrollTimer
QString m_scrollListScreen
QList< LCDTextItem > * m_lcdTextItems
void setMusicRepeat(int repeat)
QStringList formatScrollerText(const QString &text)
void setChannelProgress(const QString &time, float value)
QString m_prioLow
void startVolume(const QString &app_name)
void switchToChannel(const QString &channum="", const QString &title="", const QString &subtitle="")
bool m_lcdShowRecstatus
QTimer * m_preScrollWTimer
void setWidth(unsigned int)
QString m_protocolVersion
QTimer * m_scrollListTimer
int getLCDWidth(void)
Definition: lcdprocclient.h:61
void switchToVolume(const QString &app_name)
unsigned int m_cellWidth
vector< TunerStatus > m_tunerList
QString m_dateFormat
QTimer * m_checkConnectionsTimer
unsigned int m_cellHeight
void outputCenteredText(const QString &theScreen, QString theText, const QString &widget="topWidget", int row=1)
QString m_scrollListWidget
unsigned int m_lcdWidth
QString m_hostname
void removeStartupMessage(void)
QString m_activeScreen
void startGeneric(QList< LCDTextItem > *textItems)
QTimer * m_scrollWTimer
void outputRightText(const QString &theScreen, QString theText, const QString &widget="topWidget", int row=1)
QString m_prioHigh
void outputText(QList< LCDTextItem > *textItems)
void switchToMenu(QList< LCDMenuItem > *menuItems, const QString &app_name="", bool popMenu=true)
QString m_scrollScreen
QString m_prioMedium
QString m_prioOff
void setStartupMessage(QString msg, uint messagetime)
void beginScrollingMenuText()
void startChannel(const QString &channum, const QString &title, const QString &subtitle)
QTimer * m_showMessageTimer
QString m_prioTop
void switchToGeneric(QList< LCDTextItem > *textItems)
unsigned int m_scrollListItem
void setGenericProgress(bool busy, float value)
void assignScrollingWidgets(const QString &theText, const QString &theScreen, const QString &theWidget="topWidget", int theRow=1)
void outputScrollerText(const QString &theScreen, const QString &theText, const QString &widget="scroller", int top=1, int bottom=1)
void checkConnections()
QTimer * m_popMenuTimer
QString m_prioUrgent
void setCellHeight(unsigned int)
string hostname
Definition: caa.py:17
unsigned int uint
Definition: compat.h:140
void customEvent(QEvent *e) override
void stopAll(void)
void updateRecordingList(void)
void startMenu(QList< LCDMenuItem > *menuItems, QString app_name, bool popMenu)
void setHeight(unsigned int)
void showStartupMessage(void)
LCDServer * m_parentLCDServer
int getLCDHeight(void)
Definition: lcdprocclient.h:62
void updateLEDs(int mask)
void setMusicProgress(QString time, float value)
float m_musicProgress
void scrollWidgets(void)
void serverSendingData()
QTimer * m_timeTimer
void reset(void)
QString m_musicTime
void switchToMusic(const QString &artist, const QString &album, const QString &track)
void setHeartbeat(const QString &screen, bool onoff)
int m_busyPos
Current position of the busy indicator, used if m_busyProgress is true.
QString m_startupMessage
void setVolumeLevel(float value)
void setMusicShuffle(int shuffle)
void beginScrollingWidgets(void)
unsigned int m_lcdHeight
bool SetupLCD(void)
QString m_serverVersion
QString m_lcdShowMusicItems
void setCellWidth(unsigned int)
void startMusic(QString artist, const QString &album, const QString &track)
void veryBadThings(QAbstractSocket::SocketError error)
void formatScrollingWidgets(void)
QTimer * m_updateRecInfoTimer
void setPriority(const QString &screen, PRIORITY priority)
bool m_busyProgress
true if the generic progress indicator is a busy (ie.
void assignScrollingList(QStringList theList, QString theScreen, QString theWidget="topWidget", int theRow=1)
bool connectToHost(const QString &hostname, unsigned int port)
float m_busyIndicatorSize
How many "blocks" the busy indicator must be, used if m_busyProgress is true.
uint m_startupShowTime
LCDProcClient(LCDServer *lparent)
unsigned int m_menuScrollPosition
QStringList m_scrollListItems
QTimer * m_menuScrollTimer