source: titan/titan/keyactions.h @ 15158

Last change on this file since 15158 was 15158, checked in by nit, 12 years ago

[titan] add textfield to menulist

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