source: titan/titan/moduleconfig.h @ 15272

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

[titan] change skin->type to bitoperation, so we can easy merge more types

File size: 3.3 KB
Line 
1#ifndef MODULECONFIG_H
2#define MODULECONFIG_H
3
4void screenmoduleconfig()
5{
6        int rcret = 0, i = 0;
7        struct skin* moduleconfig = getscreen("moduleconfig");
8        struct skin* listbox = getscreennode(moduleconfig, "listbox");
9        struct skin* tmp = NULL;
10        struct dvbdev* dvbnode = NULL;
11        char* tmpstr = NULL, *tmpnr = NULL;
12
13        listbox->aktline = 1;
14        listbox->aktpage = -1;
15
16start:
17        i = 0;
18        dvbnode = dvbdev;
19        tmp = NULL;
20        delmarkedscreennodes(moduleconfig, 1);
21
22        while(dvbnode != NULL)
23        {
24                if(dvbnode->type == CIDEV)
25                {
26                        i++;
27                        tmp = addlistbox(moduleconfig, listbox, tmp, 1);
28                        if(tmp != NULL)
29                        {
30                                tmpstr = ostrcat(tmpstr, _("Slot "), 1, 0);
31                                tmpnr = oitoa(i);
32                                tmpstr = ostrcat(tmpstr, tmpnr, 1, 1);
33                                tmpstr = ostrcat(tmpstr, ": ", 1, 0);
34                                if(dvbnode->caslot != NULL)
35                                {
36                                        if(dvbnode->caslot->name == NULL)
37                                                tmpstr = ostrcat(tmpstr, _("unknown"), 1, 0);
38                                        else
39                                                tmpstr = ostrcat(tmpstr, dvbnode->caslot->name, 1, 0);
40                                }
41                                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
42                                tmpstr = ostrcat(tmpstr, _("Status: "), 1, 0);
43                                if(dvbnode->caslot != NULL)
44                                {
45                                        if(dvbnode->caslot->status == 0)
46                                                tmpstr = ostrcat(tmpstr, _("empty"), 1, 0);
47                                        if(dvbnode->caslot->status == 1)
48                                                tmpstr = ostrcat(tmpstr, _("initializing"), 1, 0);
49                                        if(dvbnode->caslot->status == 2)
50                                                tmpstr = ostrcat(tmpstr, _("ready"), 1, 0);
51                                }
52                                changetext(tmp, tmpstr);
53                                free(tmpstr); tmpstr = NULL;
54                                tmp->height = (listbox->fontsize * 2) + (2 * 2);
55                                tmp->type = TEXTBOX;
56                                tmp->handle = (void*)dvbnode;
57                        }
58                        tmp = addlistbox(moduleconfig, listbox, tmp, 1);
59                        if(tmp != NULL)
60                        {
61                                tmpstr = ostrcat(tmpstr, "camtype_", 1, 0);
62                                tmpstr = ostrcat(tmpstr, oitoa(i - 1), 1, 1);
63                                tmp->type = CHOICEBOX;
64                                changetext(tmp, "Module Type");
65                                addchoicebox(tmp, "0", _("Single Service"));
66                                addchoicebox(tmp, "1", _("Multiple Service"));
67                                setchoiceboxselection(tmp, getconfig(tmpstr, NULL));
68                                changename(tmp, tmpstr);
69                                free(tmpstr); tmpstr = NULL;
70                        }
71                        tmp = addlistbox(moduleconfig, listbox, tmp, 1);
72                        if(tmp != NULL)
73                        {
74                                tmp->height = 20;
75                                tmp->deaktivcol = 1;
76                        }
77                }
78                dvbnode = dvbnode->next;
79        }
80
81        drawscreen(moduleconfig, 0);
82        addscreenrc(moduleconfig, listbox);
83
84        tmp = listbox->select;
85        while(1)
86        {
87                if(listbox->select != NULL && (listbox->select->type & CHOICEBOX))
88                        addscreenrc(moduleconfig, tmp);
89                rcret = waitrc(moduleconfig, 2000, 0);
90                tmp = listbox->select;
91
92                if(rcret == getrcconfigint("rcexit", NULL)) break;
93                if(rcret == getrcconfigint("rcok", NULL))
94                {
95                        tmp = listbox;
96                        while(tmp != NULL)
97                        {
98                                if(ostrncmp("camtype_", tmp->name, 8) == 0)
99                                        addconfigscreencheck(tmp->name, tmp, "0");
100                                tmp = tmp->next;
101                        }
102                        break;
103                }
104                if(listbox->select != NULL && listbox->select->handle != NULL && rcret == getrcconfigint("rcred", NULL))
105                {
106                        if(((struct dvbdev*)listbox->select->handle)->caslot != NULL)
107                                ((struct dvbdev*)listbox->select->handle)->caslot->status = 0;
108                }
109                if(listbox->select != NULL && listbox->select->handle != NULL && rcret == getrcconfigint("rcgreen", NULL))
110                {
111#ifdef CAMSUPP
112                        if((struct dvbdev*)listbox->select->handle != NULL)
113                                caappmenu((struct dvbdev*)listbox->select->handle);
114#endif
115                }
116                if(rcret == RCTIMEOUT) goto start;
117        }
118
119        delmarkedscreennodes(moduleconfig, 1);
120        delownerrc(moduleconfig);
121        clearscreen(moduleconfig);
122}
123
124#endif
Note: See TracBrowser for help on using the repository browser.