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