]> git.vomp.tv Git - vompclient.git/blob - control.h
Fixes for Windows
[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 Log;
36 class VInfo;
37 class WJpeg;
38 class Sleeptimer;
39 class Wol;
40
41 struct ASLPref
42 {
43   std::string langcode;
44   int audiopref;
45   int subtitlepref;
46 };
47
48 typedef std::vector<struct ASLPref> ASLPrefList;
49
50 class Control : public MessageQueue
51 {
52   public:
53     Control();
54     ~Control();
55     static Control* getInstance();
56
57     bool init(bool crashed = false);
58     void shutdown();
59     void run();
60     void stop();
61     void doReboot();
62     void connectionLost();
63
64     void setAdvMenus(bool adv) { advMenus = adv; };
65     bool isAdvMenus() { return advMenus; };
66     int getLangPref(bool subtitle,const char* langcode);
67     void setSubDefault(int subon) { subdefault = subon; };
68     int getSubDefault() { return subdefault; };
69     ASLPrefList &getASLList() { return langcodes; };
70
71   private:
72     // I own:
73     VDR* vdr{};
74     BoxStack* boxstack{};
75     Sleeptimer* sleeptimer{};
76     Wol* wol{};
77
78
79
80     void handleCommand(int);
81     void doStandby();
82     void doPowerOn();
83     void doPowerOff();
84     void doJustConnected(VConnect* vconnect);
85     void doWallpaper();
86     void doFromTheTop(bool which);  // true - show vinfo,wait. false - del vinfo,restart
87     void buildCrashedBox();
88 //    void sig1();
89     void clearMQInputEvents();
90
91     static Control* instance;
92
93     Log* logger;
94     InputMan* inputMan;
95
96     bool initted{};
97     bool irun{};
98     bool isStandby{};
99     bool firstBoot{true};
100     Boxx* wallpaper{};
101     WJpeg* wallpaper_pict{};
102     VInfo* connLost{};
103     bool crashed{};
104
105     bool advMenus{};
106     ASLPrefList langcodes;
107     int subdefault;
108         
109     void processMessage(Message* m);
110 };
111
112 #endif