1 | #ifndef KEYACTIONS_H |
---|
2 | #define KEYACTIONS_H |
---|
3 | |
---|
4 | //key 0: blue |
---|
5 | //key 1: red |
---|
6 | //key 2: plugin |
---|
7 | //flag 0: without menulist |
---|
8 | //flag 1: with menulist |
---|
9 | void screenkeyactions(int key, int flag) |
---|
10 | { |
---|
11 | char* keyconf = NULL; |
---|
12 | struct skin* pluginnode = NULL; |
---|
13 | void (*startplugin)(void); |
---|
14 | char* tmpstr = NULL; |
---|
15 | struct skin* plugin = getscreen("plugin"); |
---|
16 | struct skin* child = plugin->child; |
---|
17 | struct menulist* mlist = NULL, *mbox = NULL; |
---|
18 | |
---|
19 | // needed for translation |
---|
20 | char* tmptxt = NULL; |
---|
21 | tmptxt = ostrcat(tmptxt, _("Extensions List"), 1, 0); |
---|
22 | tmptxt = ostrcat(tmptxt, _("Auto Resolution"), 1, 0); |
---|
23 | tmptxt = ostrcat(tmptxt, _("TV / Radio Switch"), 1, 0); |
---|
24 | tmptxt = ostrcat(tmptxt, _("Softcam Panel"), 1, 0); |
---|
25 | tmptxt = ostrcat(tmptxt, _("Multi EPG"), 1, 0); |
---|
26 | tmptxt = ostrcat(tmptxt, _("Graphic Multi EPG"), 1, 0); |
---|
27 | tmptxt = ostrcat(tmptxt, _("Sleep Timer"), 1, 0); |
---|
28 | tmptxt = ostrcat(tmptxt, _("Child Protection"), 1, 0); |
---|
29 | tmptxt = ostrcat(tmptxt, _("Subchannel"), 1, 0); |
---|
30 | tmptxt = ostrcat(tmptxt, _("Downloads"), 1, 0); |
---|
31 | tmptxt = ostrcat(tmptxt, _("MediaDB Scan Info"), 1, 0); |
---|
32 | free(tmptxt), tmptxt = NULL; |
---|
33 | |
---|
34 | if(flag == 1) |
---|
35 | { |
---|
36 | char* skintitle = _("Key Action - Plugins"); |
---|
37 | |
---|
38 | if(status.mediadbfiles > 0) |
---|
39 | addmenulist(&mlist, "MediaDB Scan Info", NULL, NULL, 0, 0); |
---|
40 | |
---|
41 | if(key == 1) |
---|
42 | { |
---|
43 | while(child != NULL) |
---|
44 | { |
---|
45 | if(child->del == PLUGINDELMARK && (status.security == 1 || (status.security == 0 && checkpluginskip(child->name) == 0))) |
---|
46 | { |
---|
47 | if(!ostrncmp("TMDb", child->name, 4)) |
---|
48 | { |
---|
49 | debug(60, "skip key: %s", child->name); |
---|
50 | } |
---|
51 | else if(!ostrncmp("Reader Config", child->name, 13)) |
---|
52 | { |
---|
53 | debug(60, "skip key: %s", child->name); |
---|
54 | } |
---|
55 | else |
---|
56 | { |
---|
57 | addmenulist(&mlist, child->name, NULL, child->pic, 0, 0); |
---|
58 | debug(60, "key: %s", child->name); |
---|
59 | } |
---|
60 | } |
---|
61 | child = child->next; |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | //addmenulist(&mlist, "Extensions List", NULL, NULL, 0, 0); |
---|
66 | addmenulist(&mlist, "Auto Resolution", NULL, "resolution.png", 0, 0); |
---|
67 | if(checkemu() == 1) |
---|
68 | addmenulist(&mlist, "Softcam Panel", NULL, NULL, 0, 0); |
---|
69 | //addmenulist(&mlist, "TV / Radio Switch", NULL, NULL, 0, 0); |
---|
70 | addmenulist(&mlist, "Multi EPG", NULL, NULL, 0, 0); |
---|
71 | addmenulist(&mlist, "Graphic Multi EPG", NULL, NULL, 0, 0); |
---|
72 | addmenulist(&mlist, "Sleep Timer", NULL, NULL, 0, 0); |
---|
73 | addmenulist(&mlist, "Child Protection", NULL, NULL, 0, 0); |
---|
74 | addmenulist(&mlist, "Subchannel", NULL, NULL, 0, 0); |
---|
75 | addmenulist(&mlist, "Downloads", NULL, NULL, 0, 0); |
---|
76 | |
---|
77 | mbox = menulistbox(mlist, NULL, skintitle, NULL, NULL, NULL, 1, 0); |
---|
78 | if(mbox != NULL) keyconf = mbox->name; |
---|
79 | free(tmpstr); tmpstr = NULL; |
---|
80 | } |
---|
81 | else |
---|
82 | { |
---|
83 | if(key == 0) keyconf = getconfig("bluekey", NULL); |
---|
84 | if(key == 1) keyconf = getconfig("redkey", NULL); |
---|
85 | if(key == 2) keyconf = getconfig("pluginkey", NULL); |
---|
86 | } |
---|
87 | |
---|
88 | if(flag == 0 && keyconf == NULL) |
---|
89 | { |
---|
90 | if(key == 1) screenkeyactions(1, 1); |
---|
91 | if(key == 2) screenkeyactions(2, 1); |
---|
92 | freemenulist(mlist, 1); mlist = NULL; |
---|
93 | return; |
---|
94 | } |
---|
95 | |
---|
96 | if(status.security == 0 && checkpluginskip(keyconf) == 1) return; |
---|
97 | |
---|
98 | debug(60, "key=%s", keyconf); |
---|
99 | if(ostrcmp(keyconf, "Softcam Panel") == 0) |
---|
100 | { |
---|
101 | screensoftcam(); |
---|
102 | freemenulist(mlist, 1); mlist = NULL; |
---|
103 | resettvpic(); |
---|
104 | return; |
---|
105 | } |
---|
106 | else if(ostrcmp(keyconf, "Subchannel") == 0) |
---|
107 | { |
---|
108 | screenlinkedchannel(); |
---|
109 | freemenulist(mlist, 1); mlist = NULL; |
---|
110 | resettvpic(); |
---|
111 | return; |
---|
112 | } |
---|
113 | else if(ostrcmp(keyconf, "Auto Resolution") == 0) |
---|
114 | { |
---|
115 | keyactions_setres(); |
---|
116 | freemenulist(mlist, 1); mlist = NULL; |
---|
117 | resettvpic(); |
---|
118 | return; |
---|
119 | } |
---|
120 | else if(ostrcmp(keyconf, "Extensions List") == 0) |
---|
121 | { |
---|
122 | screenkeyactions(1, 1); |
---|
123 | freemenulist(mlist, 1); mlist = NULL; |
---|
124 | resettvpic(); |
---|
125 | return; |
---|
126 | } |
---|
127 | else if(ostrcmp(keyconf, "Multi EPG") == 0) |
---|
128 | { |
---|
129 | screenmultiepg(NULL, NULL, 0); |
---|
130 | freemenulist(mlist, 1); mlist = NULL; |
---|
131 | resettvpic(); |
---|
132 | return; |
---|
133 | } |
---|
134 | else if(ostrcmp(keyconf, "Graphic Multi EPG") == 0) |
---|
135 | { |
---|
136 | screengmultiepg(NULL, NULL, 0); |
---|
137 | freemenulist(mlist, 1); mlist = NULL; |
---|
138 | resettvpic(); |
---|
139 | return; |
---|
140 | } |
---|
141 | else if(ostrcmp(keyconf, "Sleep Timer") == 0) |
---|
142 | { |
---|
143 | screenpowerofftimer(); |
---|
144 | freemenulist(mlist, 1); mlist = NULL; |
---|
145 | resettvpic(); |
---|
146 | return; |
---|
147 | } |
---|
148 | else if(ostrcmp(keyconf, "Child Protection") == 0) |
---|
149 | { |
---|
150 | screenpin(); |
---|
151 | freemenulist(mlist, 1); mlist = NULL; |
---|
152 | resettvpic(); |
---|
153 | return; |
---|
154 | } |
---|
155 | else if(ostrcmp(keyconf, "Downloads") == 0) |
---|
156 | { |
---|
157 | screenbgdownload(0); |
---|
158 | freemenulist(mlist, 1); mlist = NULL; |
---|
159 | resettvpic(); |
---|
160 | return; |
---|
161 | } |
---|
162 | else if(ostrcmp(keyconf, "MediaDB Scan Info") == 0) |
---|
163 | { |
---|
164 | get_mediadb_scan_info(); |
---|
165 | freemenulist(mlist, 1); mlist = NULL; |
---|
166 | resettvpic(); |
---|
167 | return; |
---|
168 | } |
---|
169 | |
---|
170 | pluginnode = getplugin(keyconf); |
---|
171 | |
---|
172 | if(pluginnode != NULL) |
---|
173 | { |
---|
174 | startplugin = dlsym(pluginnode->pluginhandle, "start"); |
---|
175 | if(startplugin != NULL) |
---|
176 | { |
---|
177 | resettvpic(); |
---|
178 | startplugin(); |
---|
179 | } |
---|
180 | } |
---|
181 | else if(keyconf != NULL) |
---|
182 | { |
---|
183 | screenkeyactions(1, 1); |
---|
184 | freemenulist(mlist, 1); mlist = NULL; |
---|
185 | resettvpic(); |
---|
186 | return; |
---|
187 | } |
---|
188 | |
---|
189 | resettvpic(); |
---|
190 | freemenulist(mlist, 1); mlist = NULL; |
---|
191 | return; |
---|
192 | } |
---|
193 | |
---|
194 | void keyactions_setres() |
---|
195 | { |
---|
196 | int m_width; |
---|
197 | char* res = NULL; |
---|
198 | char* res_act = NULL; |
---|
199 | char* res_def = NULL; |
---|
200 | char* res_sd = NULL; |
---|
201 | |
---|
202 | if(getaktvideosize() == 0) |
---|
203 | { |
---|
204 | m_width = status.videosize.w; |
---|
205 | if(m_width == 720) |
---|
206 | { |
---|
207 | res_sd = getconfig("av_videomode_autores_sd", NULL); |
---|
208 | if(res_sd == NULL) |
---|
209 | res = ostrcat(res, "576i50", 1, 0); |
---|
210 | else |
---|
211 | res = ostrcat(res, res_sd, 1, 0); |
---|
212 | } |
---|
213 | else if(m_width == 1280) |
---|
214 | res = ostrcat(res, "720p50", 1, 0); |
---|
215 | else if(m_width == 1920) |
---|
216 | res = ostrcat(res, "1080i50", 1, 0); |
---|
217 | else |
---|
218 | m_width = 0; |
---|
219 | |
---|
220 | if(m_width > 0) |
---|
221 | { |
---|
222 | res_act = getvideomode(); |
---|
223 | if(ostrcmp(res_act, res) == 0) |
---|
224 | { |
---|
225 | res_def = getconfig("av_videomode", NULL); |
---|
226 | if(res_def == NULL) |
---|
227 | res_def = res_act; |
---|
228 | setvideomode(res_def, 1); |
---|
229 | changefbresolution(res_def, 0); |
---|
230 | screenautores(res_def, 5, 0); |
---|
231 | } |
---|
232 | else |
---|
233 | { |
---|
234 | setvideomode(res, 1); |
---|
235 | changefbresolution(res, 0); |
---|
236 | screenautores(res, 5, 0); |
---|
237 | } |
---|
238 | } |
---|
239 | } |
---|
240 | else |
---|
241 | { |
---|
242 | textbox(_("Message"), _("ERROR cant read res"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
243 | } |
---|
244 | free(res); |
---|
245 | res = NULL; |
---|
246 | |
---|
247 | return; |
---|
248 | } |
---|
249 | |
---|
250 | #endif |
---|