]> git.vomp.tv Git - vompclient.git/blob - control.h
Fix text corruption in live TV OSD clock
[vompclient.git] / control.h
1 /*
2     Copyright 2004-2020 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef COMMAND_H
21 #define COMMAND_H
22
23 #include <string>
24 #include <vector>
25
26 #include "defines.h"
27 #include "messagequeue.h"
28
29 class VDR;
30 class VConnect;
31 class Message;
32 class InputMan;
33 class Boxx;
34 class BoxStack;
35 class LogNT;
36 class VInfo;
37 class WJpeg;
38 class SleepTimer;
39 class Wol;
40 class Audio;
41 class Video;
42 class Osd;
43 class Timers;
44 class Led;
45
46 struct ASLPref
47 {
48   std::string langcode;
49   int audiopref;
50   int subtitlepref;
51 };
52
53 typedef std::vector<struct ASLPref> ASLPrefList;
54
55 class Control : public MessageQueue
56 {
57   public:
58     Control();
59     ~Control();
60     static Control* getInstance();
61
62     bool init(bool crashed = false);
63     void shutdown();
64     void run();
65     void stop();
66     void doReboot();
67     void connectionLost();
68
69     void setAdvMenus(bool adv) { advMenus = adv; };
70     bool isAdvMenus() { return advMenus; };
71     int getLangPref(bool subtitle,const char* langcode);
72     ASLPrefList &getASLList() { return langcodes; };
73
74   private:
75     // I own:
76     Led* led{};
77     Timers* timers{};
78     Osd* osd{};
79     Video* video{};
80     Audio* audio{};
81     VDR* vdr{};
82     BoxStack* boxstack{};
83     SleepTimer* sleepTimer{};
84     Wol* wol{};
85     InputMan* inputMan{};
86
87
88
89     void handleCommand(int);
90     void doStandby();
91     void doPowerOn();
92     void doPowerOff();
93     void doJustConnected(VConnect* vconnect);
94     void doWallpaper();
95     void doFromTheTop(bool which);  // true - show vinfo,wait. false - del vinfo,restart
96     void buildCrashedBox();
97 //    void sig1();
98     void clearMQInputEvents();
99
100     static Control* instance;
101
102     LogNT* logger;
103
104     bool initted{};
105     bool isStandby{};
106     bool firstBoot{true};
107     Boxx* wallpaper{};
108     WJpeg* wallpaper_pict{};
109     VInfo* connLost{};
110     bool crashed{};
111
112     bool advMenus{};
113     ASLPrefList langcodes;
114         
115     void dispatchMessage(Message* m);
116 };
117
118 #endif