]> git.vomp.tv Git - vompclient.git/blob - control.h
Clean up screenShot() - all params, return types, function names
[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 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     void setSubDefault(int subon) { subdefault = subon; };
73     int getSubDefault() { return subdefault; };
74     ASLPrefList &getASLList() { return langcodes; };
75
76   private:
77     // I own:
78     Led* led{};
79     Timers* timers{};
80     Osd* osd{};
81     Video* video{};
82     Audio* audio{};
83     VDR* vdr{};
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     Log* logger;
105
106     bool initted{};
107     bool irun{};
108     bool isStandby{};
109     bool firstBoot{true};
110     Boxx* wallpaper{};
111     WJpeg* wallpaper_pict{};
112     VInfo* connLost{};
113     bool crashed{};
114
115     bool advMenus{};
116     ASLPrefList langcodes;
117     int subdefault;
118         
119     void processMessage(Message* m);
120 };
121
122 #endif