source: titan/titan/keyactions.h @ 12241

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

[titan] del av_videomode_default and use av_videomode

File size: 4.1 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, *mlistbox = NULL;
16        struct skin* plugin = getscreen("plugin");
17        struct skin* child = plugin->child;
18       
19        if(flag == 1)
20        {
21                char* skintitle = "Key Action - Plugins";
22       
23                if(key == 1)
24                {
25                        while(child != NULL)
26                        {
27                                if(child->del == PLUGINDELMARK)
28                                {
29                                        tmpstr = ostrcat(tmpstr, child->name, 1, 0);
30                                        debug(60, "key: %s", child->name);
31                                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
32                                }
33                                child = child->next;
34                        }
35                }
36       
37                //tmpstr = ostrcat(tmpstr, "Extensions List\n", 1, 0);
38                tmpstr = ostrcat(tmpstr, "Auto Resolution\n", 1, 0);
39                if(checkemu() == 1)
40                        tmpstr = ostrcat(tmpstr, "Softcam Panel\n", 1, 0);
41                //tmpstr = ostrcat(tmpstr, "TV / Radio Switch\n", 1, 0);
42                tmpstr = ostrcat(tmpstr, "Multi EPG\n", 1, 0);
43                tmpstr = ostrcat(tmpstr, "Graphic Multi EPG\n", 1, 0);
44                tmpstr = ostrcat(tmpstr, "Sleep Timer\n", 1, 0);
45                tmpstr = ostrcat(tmpstr, "Child Protection\n", 1, 0);
46                tmpstr = ostrcat(tmpstr, "Subchannel\n", 1, 0);
47       
48                mlistbox = menulistbox(NULL, tmpstr, NULL, skintitle, NULL, 1, 0);
49                keyconf = mlistbox;
50                free(tmpstr); tmpstr = NULL;
51        }
52        else
53        {
54                if (key == 0) keyconf = getconfig("bluekey", NULL);
55                if (key == 1) keyconf = getconfig("redkey", NULL);
56        }
57       
58        if(flag == 0 && keyconf == NULL)
59        {
60                if(key == 1) screenkeyactions(1, 1);
61                free(mlistbox); mlistbox = NULL;
62                return;
63        }
64       
65        debug(60, "key=%s", keyconf);
66        if(ostrcmp(keyconf, "Softcam Panel") == 0)
67        {
68                pluginnode = getplugin("Panel");
69               
70                if(pluginnode != NULL)
71                {
72                        startplugin = dlsym(pluginnode->pluginhandle, "screenpanel_softcam");
73                        if(startplugin != NULL){
74                                startplugin();
75                        }
76                        free(mlistbox); mlistbox = NULL;
77                        return;
78                }
79        }
80        else if(ostrcmp(keyconf, "Subchannel") == 0)
81        {
82                screenlinkedchannel();
83                free(mlistbox); mlistbox = NULL;
84                return;
85        }
86        else if(ostrcmp(keyconf, "Auto Resolution") == 0)
87        {
88                keyactions_setres();
89                free(mlistbox); mlistbox = NULL;
90                return;
91        }
92        else if(ostrcmp(keyconf, "Extensions List") == 0)
93        {
94                screenkeyactions(1, 1);
95                free(mlistbox); mlistbox = NULL;
96                return;
97        }
98        else if(ostrcmp(keyconf, "Multi EPG") == 0)
99        {
100                screenmultiepg(NULL, NULL, 0);
101                free(mlistbox); mlistbox = NULL;
102                return;
103        }
104        else if(ostrcmp(keyconf, "Graphic Multi EPG") == 0)
105        {
106                screengmultiepg(NULL, NULL, 0);
107                free(mlistbox); mlistbox = NULL;
108                return;
109        }
110        else if(ostrcmp(keyconf, "Sleep Timer") == 0)
111        {
112                screenpowerofftimer();
113                free(mlistbox); mlistbox = NULL;
114                return;
115        }
116        else if(ostrcmp(keyconf, "Child Protection") == 0)
117        {
118                screenpin();
119                free(mlistbox); mlistbox = NULL;
120                return;
121        }
122                       
123        pluginnode = getplugin(keyconf);
124
125        if(pluginnode != NULL)
126        {
127                startplugin = dlsym(pluginnode->pluginhandle, "start");
128                if(startplugin != NULL)
129                        startplugin();
130        }
131
132        free(mlistbox); mlistbox = NULL;
133        debug(1000, "out");
134        return;
135}
136
137void keyactions_setres()
138{
139        int m_width;
140        char* res = NULL;
141        char* res_act = NULL;
142        char* res_def = NULL;
143        char* res_sd = NULL;
144       
145        if(getaktvideosize() == 0)
146        {
147                m_width = status.videosize.w;
148                if(m_width == 720)
149                {
150                        res_sd = getconfig("av_videomode_autores_sd", NULL);
151                        if(res_sd == NULL)
152                                res = ostrcat(res, "576i50", 1, 0);
153                        else
154                                res = ostrcat(res, res_sd, 1, 0);
155                }
156                else if(m_width == 1280)
157                        res = ostrcat(res, "720p50", 1, 0);
158                else if(m_width == 1920)
159                        res = ostrcat(res, "1080i50", 1, 0);   
160                else
161                        m_width = 0;
162               
163                if(m_width > 0)
164                {       
165                        res_act = getvideomode();
166                        if(ostrcmp(res_act, res) == 0)
167                        {
168                                res_def = getconfig("av_videomode", NULL);
169                                if(res_def == NULL)
170                                         res_def = res_act;
171                                setvideomode(res_def, 1);
172                                changefbresolution(res_def);
173                                sleep(2);
174                                screenautores(res_def, 5, 0);                   
175                        }
176                        else
177                        {
178                                setvideomode(res, 1);
179                                changefbresolution(res);
180                                sleep(2);
181                                screenautores(res, 5, 0);
182                        }
183                }                       
184        }
185        else
186        {
187                textbox(_("Message"), _("ERROR cant read res"), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 5, 0);                 
188        }
189        free(res);
190        res = NULL;
191       
192        return;
193}                               
194
195#endif
Note: See TracBrowser for help on using the repository browser.