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