source: titan/titan/keyactions.h @ 28000

Last change on this file since 28000 was 28000, checked in by obi, 10 years ago

fix

File size: 7.7 KB
Line 
1#ifndef KEYACTIONS_H
2#define KEYACTIONS_H
3
4//key 0: blue
5//key 1: red
6//key 2: plugin
7//key 3: media
8//flag 0: without menulist
9//flag 1: with menulist
10void screenkeyactions(int key, int flag)
11{
12        char* keyconf = NULL;
13        struct skin* pluginnode = NULL;
14        void (*startplugin)(void);
15        char* tmpstr = NULL;
16        struct skin* plugin = getscreen("plugin");
17        struct skin* child = plugin->child;
18        struct menulist* mlist = NULL, *mbox = NULL;
19
20// needed for translation
21        char* tmptxt = NULL;
22        tmptxt = ostrcat(tmptxt, _("Extensions List"), 1, 0);
23        tmptxt = ostrcat(tmptxt, _("Auto Resolution"), 1, 0);
24        tmptxt = ostrcat(tmptxt, _("TV / Radio Switch"), 1, 0);
25        tmptxt = ostrcat(tmptxt, _("Softcam Panel"), 1, 0);
26        tmptxt = ostrcat(tmptxt, _("Multi EPG"), 1, 0);
27        tmptxt = ostrcat(tmptxt, _("Graphic Multi EPG"), 1, 0);
28        tmptxt = ostrcat(tmptxt, _("Sleep Timer"), 1, 0);
29        tmptxt = ostrcat(tmptxt, _("Child Protection"), 1, 0);
30        tmptxt = ostrcat(tmptxt, _("Subchannel"), 1, 0);
31        tmptxt = ostrcat(tmptxt, _("Downloads"), 1, 0);
32        tmptxt = ostrcat(tmptxt, _("MediaDB Scan Info"), 1, 0);
33        free(tmptxt), tmptxt = NULL;
34               
35        if(flag == 1)
36        {
37                char* skintitle = _("Key Action - Plugins");
38
39                if(status.mediadbfiles > 0)
40                        addmenulist(&mlist, "MediaDB Scan Info", NULL, NULL, 0, 0);
41                       
42                if(key == 1)
43                {
44                        while(child != NULL)
45                        {
46                                if(child->del == PLUGINDELMARK && (status.security == 1 || (status.security == 0 && checkpluginskip(child->name) == 0)))
47                                {
48                                        if(!ostrncmp("TMDb", child->name, 4))
49                                        {
50                                                debug(60, "skip key: %s", child->name);                 
51                                        }
52                                        else if(!ostrncmp("Reader Config", child->name, 13))
53                                        {
54                                                debug(60, "skip key: %s", child->name);                 
55                                        }
56                                        else
57                                        {
58                                                addmenulist(&mlist, child->name, NULL, child->pic, 0, 0);
59                                                debug(60, "key: %s", child->name);
60                                        }
61                                }
62                                child = child->next;
63                        }
64                }
65       
66                if(key == 3)
67                {
68                        addmenulist(&mlist, "MediaCenter", NULL, NULL, 0, 0);
69                //      addmenulist(&mlist, "VideoPlayer", NULL, NULL, 0, 0);
70                //      addmenulist(&mlist, "AudioPlayer", NULL, NULL, 0, 0);
71                //      addmenulist(&mlist, "PicturePlayer", NULL, NULL, 0, 0);
72                        addmenulist(&mlist, "MediaThek", NULL, NULL, 0, 0);
73                        addmenulist(&mlist, "MiniPlayer", NULL, NULL, 0, 0);
74                        addmenulist(&mlist, "RecordPlayer", NULL, NULL, 0, 0);
75                }
76                else
77                {
78                        //addmenulist(&mlist, "Extensions List", NULL, NULL, 0, 0);
79                        addmenulist(&mlist, "Auto Resolution", NULL, "resolution.png", 0, 0);
80                        if(checkemu() == 1)
81                                addmenulist(&mlist, "Softcam Panel", NULL, NULL, 0, 0);
82                        //addmenulist(&mlist, "TV / Radio Switch", NULL, NULL, 0, 0);
83                        addmenulist(&mlist, "Multi EPG", NULL, NULL, 0, 0);
84                        addmenulist(&mlist, "Graphic Multi EPG", NULL, NULL, 0, 0);
85                        addmenulist(&mlist, "Sleep Timer", NULL, NULL, 0, 0);
86                        addmenulist(&mlist, "Child Protection", NULL, NULL, 0, 0);
87                        addmenulist(&mlist, "Subchannel", NULL, NULL, 0, 0);
88                        addmenulist(&mlist, "Downloads", NULL, NULL, 0, 0);
89                }
90       
91                mbox = menulistbox(mlist, NULL, skintitle, NULL, NULL, NULL, 1, 0);
92                if(mbox != NULL) keyconf = mbox->name;
93                free(tmpstr); tmpstr = NULL;
94        }
95        else
96        {
97                if(key == 0) keyconf = getconfig("bluekey", NULL);
98                if(key == 1) keyconf = getconfig("redkey", NULL);
99                if(key == 2) keyconf = getconfig("pluginkey", NULL);
100                if(key == 3) keyconf = getconfig("mediakey", NULL);
101        }
102       
103        if(flag == 0 && keyconf == NULL)
104        {
105                if(key == 1) screenkeyactions(1, 1);
106                if(key == 2) screenkeyactions(2, 1);
107                if(key == 3) screenkeyactions(3, 1);
108                freemenulist(mlist, 1); mlist = NULL;
109                return;
110        }
111
112        if(status.security == 0 && checkpluginskip(keyconf) == 1) return;
113                                               
114        debug(60, "key=%s", keyconf);
115        if(ostrcmp(keyconf, "Softcam Panel") == 0)
116        {
117                screensoftcam();
118                freemenulist(mlist, 1); mlist = NULL;
119                resettvpic();
120                return;
121        }
122        else if(ostrcmp(keyconf, "Subchannel") == 0)
123        {
124                screenlinkedchannel();
125                freemenulist(mlist, 1); mlist = NULL;
126                resettvpic();
127                return;
128        }
129        else if(ostrcmp(keyconf, "Auto Resolution") == 0)
130        {
131                keyactions_setres();
132                freemenulist(mlist, 1); mlist = NULL;
133                resettvpic();
134                return;
135        }
136        else if(ostrcmp(keyconf, "Extensions List") == 0)
137        {
138                screenkeyactions(1, 1);
139                freemenulist(mlist, 1); mlist = NULL;
140                resettvpic();
141                return;
142        }
143        else if(ostrcmp(keyconf, "Multi EPG") == 0)
144        {
145                screenmultiepg(NULL, NULL, 0);
146                freemenulist(mlist, 1); mlist = NULL;
147                resettvpic();
148                return;
149        }
150        else if(ostrcmp(keyconf, "Graphic Multi EPG") == 0)
151        {
152                screengmultiepg(NULL, NULL, 0);
153                freemenulist(mlist, 1); mlist = NULL;
154                resettvpic();
155                return;
156        }
157        else if(ostrcmp(keyconf, "Sleep Timer") == 0)
158        {
159                screenpowerofftimer();
160                freemenulist(mlist, 1); mlist = NULL;
161                resettvpic();
162                return;
163        }
164        else if(ostrcmp(keyconf, "Child Protection") == 0)
165        {
166                screenpin();
167                freemenulist(mlist, 1); mlist = NULL;
168                resettvpic();
169                return;
170        }
171        else if(ostrcmp(keyconf, "Downloads") == 0)
172        {
173                screenbgdownload(0);
174                freemenulist(mlist, 1); mlist = NULL;
175                resettvpic();
176                return;
177        }
178        else if(ostrcmp(keyconf, "MediaDB Scan Info") == 0)
179        {
180                get_mediadb_scan_info();
181                freemenulist(mlist, 1); mlist = NULL;
182                resettvpic();
183                return;
184        }
185        else if(ostrcmp(keyconf, "RecordPlayer") == 0)
186        {
187                screenplay(NULL, NULL, 1, 0);
188                freemenulist(mlist, 1); mlist = NULL;
189                resettvpic();
190                return;
191        }
192        else if(ostrcmp(keyconf, "MiniPlayer") == 0)
193        {
194                screenplay(NULL, NULL, 0, 0);
195                freemenulist(mlist, 1); mlist = NULL;
196                resettvpic();
197                return;
198        }
199        else if(ostrcmp(keyconf, "MediaCenter") == 0)
200        {
201                struct skin* pluginnode = getplugin("Media Center");
202                void (*startplugin)(void);
203                status.infobaraktiv = 0;
204                subtitlepause(1);
205                status.infobar = 0;
206
207                if(pluginnode != NULL)
208                {
209                        startplugin = dlsym(pluginnode->pluginhandle, "start");
210                        if(startplugin != NULL)
211                        startplugin();
212                }
213                status.infobaraktiv = 1;
214                drawscreen(skin, 0, 0);
215                subtitlepause(0);
216
217                freemenulist(mlist, 1); mlist = NULL;
218                resettvpic();
219                return;
220        }
221        else if(ostrcmp(keyconf, "Mediathek") == 0)
222        {
223                struct skin* pluginnode = getplugin("TiTan Mediathek");
224                void (*startplugin)(void);
225                status.infobaraktiv = 0;
226                subtitlepause(1);
227                status.infobar = 0;
228
229                if(pluginnode != NULL)
230                {
231                        startplugin = dlsym(pluginnode->pluginhandle, "start");
232                        if(startplugin != NULL)
233                        startplugin();
234                }
235                status.infobaraktiv = 1;
236                drawscreen(skin, 0, 0);
237                subtitlepause(0);
238
239                freemenulist(mlist, 1); mlist = NULL;
240                resettvpic();
241                return;
242        }
243               
244        pluginnode = getplugin(keyconf);
245
246        if(pluginnode != NULL)
247        {
248                startplugin = dlsym(pluginnode->pluginhandle, "start");
249                if(startplugin != NULL)
250                {
251                        resettvpic();
252                        startplugin();
253                }
254        }
255        else if(keyconf != NULL)
256        {
257                screenkeyactions(1, 1);
258                freemenulist(mlist, 1); mlist = NULL;
259                resettvpic();
260                return;
261        }
262
263        resettvpic();
264        freemenulist(mlist, 1); mlist = NULL;
265        return;
266}
267
268void keyactions_setres()
269{
270        int m_width;
271        char* res = NULL;
272        char* res_act = NULL;
273        char* res_def = NULL;
274        char* res_sd = NULL;
275       
276        if(getaktvideosize() == 0)
277        {
278                m_width = status.videosize.w;
279                if(m_width == 720)
280                {
281                        res_sd = getconfig("av_videomode_autores_sd", NULL);
282                        if(res_sd == NULL)
283                                res = ostrcat(res, "576i50", 1, 0);
284                        else
285                                res = ostrcat(res, res_sd, 1, 0);
286                }
287                else if(m_width == 1280)
288                        res = ostrcat(res, "720p50", 1, 0);
289                else if(m_width == 1920)
290                        res = ostrcat(res, "1080i50", 1, 0);   
291                else
292                        m_width = 0;
293               
294                if(m_width > 0)
295                {       
296                        res_act = getvideomode();
297                        if(ostrcmp(res_act, res) == 0)
298                        {
299                                res_def = getconfig("av_videomode", NULL);
300                                if(res_def == NULL)
301                                         res_def = res_act;
302                                setvideomode(res_def, 1);
303                                changefbresolution(res_def, 0);
304                                screenautores(res_def, 5, 0);
305                        }
306                        else
307                        {
308                                setvideomode(res, 1);
309                                changefbresolution(res, 0);
310                                screenautores(res, 5, 0);
311                        }
312                }                       
313        }
314        else
315        {
316                textbox(_("Message"), _("ERROR cant read res"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);                   
317        }
318        free(res);
319        res = NULL;
320       
321        return;
322}                               
323
324#endif
Note: See TracBrowser for help on using the repository browser.