]> git.vomp.tv Git - vompclient.git/blob - control.h
Fix subs running during pause - after a jump then quick pause
[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 ImageLoader;
34 class Boxx;
35 class BoxStack;
36 class LogNT;
37 class VInfo;
38 class WJpeg;
39 class SleepTimer;
40 class Wol;
41 class Audio;
42 class Video;
43 class Osd;
44 class Timers;
45 class Led;
46
47 struct ASLPref
48 {
49   std::string langcode;
50   int audiopref;
51   int subtitlepref;
52 };
53
54 typedef std::vector<struct ASLPref> ASLPrefList;
55
56 class Control : public MessageQueue
57 {
58   public:
59     Control();
60     ~Control();
61     static Control* getInstance();
62
63     bool init(bool crashed = false);
64     void shutdown();
65     void run();
66     void stop();
67     void doReboot();
68     void connectionLost();
69
70     void setAdvMenus(bool adv) { advMenus = adv; };
71     bool isAdvMenus() { return advMenus; };
72     int getLangPref(bool subtitle,const char* langcode);
73     ASLPrefList &getASLList() { return langcodes; };
74
75   private:
76     // I own:
77     Led* led{};
78     Timers* timers{};
79     Osd* osd{};
80     Video* video{};
81     Audio* audio{};
82     VDR* vdr{};
83     ImageLoader* imageLoader{};
84     BoxStack* boxstack{};
85     SleepTimer* sleepTimer{};
86     Wol* wol{};
87     InputMan* inputMan{};
88
89
90
91     void handleCommand(int);
92     void doStandby();
93     void doPowerOn();
94     void doPowerOff();
95     void doJustConnected(VConnect* vconnect);
96     void doWallpaper();
97     void doFromTheTop(bool which);  // true - show vinfo,wait. false - del vinfo,restart
98     void buildCrashedBox();
99 //    void sig1();
100     void clearMQInputEvents();
101
102     static Control* instance;
103
104     LogNT* logger;
105
106     bool initted{};
107     bool isStandby{};
108     bool firstBoot{true};
109     Boxx* wallpaper{};
110     WJpeg* wallpaper_pict{};
111     VInfo* connLost{};
112     bool crashed{};
113
114     bool advMenus{};
115     ASLPrefList langcodes;
116         
117     void dispatchMessage(Message* m);
118 };
119
120 #endif