source: titan/titan/keyactions.h @ 45557

Last change on this file since 45557 was 45511, checked in by obi, 3 years ago

fix sort

File size: 6.6 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                                        else if(ostrcmp(child->name, "KodiStarter") == 0)
68                                                addmenulist(&mlist, child->name, _(child->name), child->pic, 0, 0);                                             
69                                }
70                                child = child->next;
71                        }
72                        addmenulist(&mlist, "Media Player", _("Media Player"), NULL, 0, 0);
73                }
74                else
75                {
76                        //addmenulist(&mlist, "Extensions List", _("Extensions List"), NULL, 0, 0);
77                        addmenulist(&mlist, "Auto Resolution", _("Auto Resolution"), "resolution.png", 0, 0);
78                        if(checkemu() == 1)
79                                addmenulist(&mlist, "Softcam Panel", _("Softcam Panel"), NULL, 0, 0);
80                        //addmenulist(&mlist, "TV / Radio Switch", _("TV / Radio Switch"), NULL, 0, 0);
81                        addmenulist(&mlist, "Bouquet List", _("Bouquet List"), NULL, 0, 0);
82                        addmenulist(&mlist, "Multi EPG", _("Multi EPG"), NULL, 0, 0);
83                        addmenulist(&mlist, "Graphic Multi EPG", _("Graphic Multi EPG"), NULL, 0, 0);
84                        addmenulist(&mlist, "Sleep Timer", _("Sleep Timer"), NULL, 0, 0);
85                        addmenulist(&mlist, "Child Protection", _("Child Protection"), NULL, 0, 0);
86                        addmenulist(&mlist, "Subchannel", _("Subchannel"), NULL, 0, 0);
87                        addmenulist(&mlist, "Downloads", _("Downloads"), NULL, 0, 0);
88                }
89       
90                mbox = menulistbox(mlist, NULL, skintitle, NULL, NULL, NULL, 1, 0);
91                if(mbox != NULL) keyconf = ostrcat(mbox->name, NULL, 0, 0);
92                freemenulist(mlist, 1); mlist = NULL;
93        }
94        else
95        {
96                if(key == 0) keyconf = ostrcat(getconfig("bluekey", NULL), NULL, 0, 0);
97                if(key == 1) keyconf = ostrcat(getconfig("redkey", NULL), NULL, 0, 0);
98                if(key == 2) keyconf = ostrcat(getconfig("pluginkey", NULL), NULL, 0, 0);
99                if(key == 3) keyconf = ostrcat(getconfig("mediakey", NULL), NULL, 0, 0);
100        }
101       
102        if(flag == 0 && keyconf == NULL)
103        {
104                if(key == 1) screenkeyactions(1, 1);
105                if(key == 2) screenkeyactions(2, 1);
106                if(key == 3) screenkeyactions(3, 1);
107        }
108        else
109        {
110                if(status.security == 0 && checkpluginskip(keyconf) == 1) return;
111                resettvpic();
112                                                       
113                debug(60, "key=%s", keyconf);
114                if(ostrcmp(keyconf, "Softcam Panel") == 0)
115                        screensoftcam();
116                else if(ostrcmp(keyconf, "Subchannel") == 0)
117                        screenlinkedchannel();
118                else if(ostrcmp(keyconf, "Auto Resolution") == 0)
119                        keyactions_setres();
120                else if(ostrcmp(keyconf, "Extensions List") == 0)
121                        screenkeyactions(1, 1);
122                else if(ostrcmp(keyconf, "Multi EPG") == 0)
123                        screenmultiepg(NULL, NULL, 0);
124                else if(ostrcmp(keyconf, "Graphic Multi EPG") == 0)
125                        screengmultiepg(NULL, NULL, 0);
126                else if(ostrcmp(keyconf, "Sleep Timer") == 0)
127                        screenpowerofftimer();
128                else if(ostrcmp(keyconf, "Child Protection") == 0)
129                        screenpin();
130                else if(ostrcmp(keyconf, "Downloads") == 0)
131                        screenbgdownload(0);
132                else if(ostrcmp(keyconf, "MediaDB Scan Info") == 0)
133                        get_mediadb_scan_info();
134                else if(ostrcmp(keyconf, "Record Player") == 0)
135                {
136                        int oldsort = getconfigint("dirsort", NULL);
137                        addconfigint("dirsort", 4);
138                        screenplay(NULL, NULL, 1, 0);
139                        addconfigint("dirsort", oldsort);
140                }
141                else if(ostrcmp(keyconf, "Media Player") == 0)
142                {
143                        int oldsort = getconfigint("dirsort", NULL);
144                        screenplay(NULL, NULL, 0, 0);
145                        addconfigint("dirsort", oldsort);
146                }
147                else if(ostrcmp(keyconf, "Media Plugins List") == 0)
148                        screenkeyactions(3, 1);
149                else if(ostrcmp(keyconf, "Bouquet List") == 0)
150                        screenchannellist(NULL, NULL, 2);
151                else
152                {
153                        pluginnode = getplugin(keyconf);
154               
155                        if(pluginnode != NULL)
156                        {
157                                startplugin = dlsym(pluginnode->pluginhandle, "start");
158                                if(startplugin != NULL)
159                                        startplugin();
160                        }
161                        else if(keyconf != NULL)
162                                screenkeyactions(1, 1);
163                }
164        }
165
166        free(keyconf), keyconf = NULL;
167        resettvpic();
168        return;
169}
170
171void keyactions_setres()
172{
173        int m_width;
174        char* res = NULL;
175        char* res_act = NULL;
176        char* res_def = NULL;
177        char* res_sd = NULL;
178       
179        if(getaktvideosize() == 0)
180        {
181                m_width = status.videosize.w;
182                if(m_width == 720)
183                {
184                        res_sd = getconfig("av_videomode_autores_sd", NULL);
185                        if(res_sd == NULL)
186                                res = ostrcat(res, "576i50", 1, 0);
187                        else
188                                res = ostrcat(res, res_sd, 1, 0);
189                }
190                else if(m_width == 1280)
191                        res = ostrcat(res, "720p50", 1, 0);
192                else if(m_width == 1920)
193                        res = ostrcat(res, "1080i50", 1, 0);   
194                else
195                        m_width = 0;
196               
197                if(m_width > 0)
198                {       
199                        res_act = getvideomode();
200                        if(ostrcmp(res_act, res) == 0)
201                        {
202                                res_def = getconfig("av_videomode", NULL);
203                                if(res_def == NULL)
204                                         res_def = res_act;
205                                setvideomode(res_def, 1);
206                                changefbresolution(res_def, 0);
207                                screenautores(res_def, 5, 0);
208                        }
209                        else
210                        {
211                                setvideomode(res, 1);
212                                changefbresolution(res, 0);
213                                screenautores(res, 5, 0);
214                        }
215                }                       
216        }
217        else
218        {
219                textbox(_("Message"), _("ERROR cant read res"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);                   
220        }
221        free(res);
222        res = NULL;
223       
224        return;
225}                               
226
227#endif
Note: See TracBrowser for help on using the repository browser.