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