source: titan/titan/keyactions.h @ 42143

Last change on this file since 42143 was 33139, checked in by obi, 9 years ago

update demo stuff

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