source: titan/titan/scconfig.h @ 22548

Last change on this file since 22548 was 22548, checked in by nit, 10 years ago

fix

File size: 1.8 KB
Line 
1#ifndef SCCONFIG_H
2#define SCCONFIG_H
3
4void screenscconfig()
5{
6        int rcret = 0, i = 0;
7        struct skin* scconfig = getscreen("scconfig");
8        struct skin* listbox = getscreennode(scconfig, "listbox");
9        struct skin* load = getscreen("loading");
10        struct dvbdev* dvbnode = NULL;
11        char* tmpstr = NULL, *tmpnr = NULL;
12        struct skin* tmp = NULL;
13
14        listbox->aktline = 1;
15        listbox->aktpage = -1;
16
17start:
18        dvbnode = dvbdev;
19        tmp = NULL;
20        delmarkedscreennodes(scconfig, 1);
21
22        while(dvbnode != NULL)
23        {
24                if(dvbnode->type == SCDEV)
25                {
26                        i++;
27                        tmp = addlistbox(scconfig, 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                               
35                                uint32_t status = 0;
36                                scgetiscardpresent(dvbnode, &status);
37                               
38                                if(status == 1)
39                                        tmpstr = ostrcat(tmpstr, _("card present"), 1, 0);
40                                else
41                                        tmpstr = ostrcat(tmpstr, _("card not present"), 1, 0);
42                               
43                                changetext(tmp, tmpstr);
44                                free(tmpstr); tmpstr = NULL;
45                                tmp->height = listbox->fontsize + 2;
46                                tmp->handle = (void*)dvbnode;
47                        }
48                }
49                dvbnode = dvbnode->next;
50        }
51
52        drawscreen(scconfig, 0, 0);
53        addscreenrc(scconfig, listbox);
54
55        while(1)
56        {
57                rcret = waitrc(scconfig, 2000, 0);
58
59                if(rcret == getrcconfigint("rcexit", NULL)) break;
60                if(rcret == getrcconfigint("rcok", NULL)) break;
61               
62                if(listbox->select != NULL && listbox->select->handle != NULL && rcret == getrcconfigint("rcred", NULL))
63                {
64                        clearscreen(scconfig);
65                        scsetreset(((struct dvbdev*)listbox->select->handle));
66                        drawscreen(load, 0, 0);
67                        sleep(1);
68                        clearscreen(load);
69                        drawscreen(scconfig, 0, 0);
70                }
71               
72                if(rcret == RCTIMEOUT) goto start;
73        }
74
75        delmarkedscreennodes(scconfig, 1);
76        delownerrc(scconfig);
77        clearscreen(scconfig);
78}
79
80#endif
Note: See TracBrowser for help on using the repository browser.