source: titan/titan/timeshiftsettings.h @ 24223

Last change on this file since 24223 was 20750, checked in by nit, 11 years ago

[titan] fix

File size: 3.4 KB
Line 
1#ifndef TIMESHIFTSETTINGS_H
2#define TIMESHIFTSETTINGS_H
3
4void timeshiftplaydisable()
5{
6        int end = 0;
7        struct skin* node = skin;
8        struct skin* child = NULL;
9
10        while(node != NULL)
11        {
12                child = node->child;
13                while(child != NULL)
14                {
15                        if(ostrcmp("mediaplayer", child->name) == 0)
16                        {
17                                if(status.timeshifttype == 0)
18                                        child->locked = 1;
19                                else if(status.timeshifttype == 1)
20                                        child->locked = 0;
21                                end = 1;
22                                break;
23                        }
24                        child = child->next;
25                }
26                if(end == 1) break;
27                node = node->next;
28        }
29}
30
31void screentimeshiftsettings()
32{
33        int rcret = 0, ret = 0, change = 0;
34       
35        struct skin* timeshiftsettings = getscreen("timeshiftsettings");
36        struct skin* listbox = getscreennode(timeshiftsettings, "listbox");
37        struct skin* timeshifttype = getscreennode(timeshiftsettings, "timeshifttype");
38        struct skin* deltimeshift = getscreennode(timeshiftsettings, "deltimeshift");
39        struct skin* asktimeshift = getscreennode(timeshiftsettings, "asktimeshift");
40  struct skin* timeshiftnumkeys = getscreennode(timeshiftsettings, "timeshiftnumkeys");
41        struct skin* tmp = NULL;
42       
43        if(status.timeshifttype == 0 && status.timeshift > 0)
44        {
45                textbox(_("Message"), _("Timeshiftsettings not allowed\nif timeshift is running !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
46                return;
47        }
48       
49        addchoicebox(timeshifttype, "0", _("normal"));
50        addchoicebox(timeshifttype, "1", _("permanent"));
51        setchoiceboxselection(timeshifttype, getconfig("timeshifttype", NULL));
52
53        addchoicebox(deltimeshift, "0", _("ask"));
54        addchoicebox(deltimeshift, "1", _("allways del file"));
55        addchoicebox(deltimeshift, "2", _("never del file"));
56        setchoiceboxselection(deltimeshift, getconfig("deltimeshift", NULL));
57
58        addchoicebox(asktimeshift, "0", _("yes"));
59        addchoicebox(asktimeshift, "1", _("no"));
60        setchoiceboxselection(asktimeshift, getconfig("asktimeshift", NULL));
61 
62  addchoicebox(timeshiftnumkeys, "0", _("yes"));
63        addchoicebox(timeshiftnumkeys, "1", _("no"));
64        setchoiceboxselection(timeshiftnumkeys, getconfig("timeshiftnumkeys", NULL));
65       
66        drawscreen(timeshiftsettings, 0, 0);
67        addscreenrc(timeshiftsettings, listbox);
68
69        tmp = listbox->select;
70        while(1)
71        {
72                addscreenrc(timeshiftsettings, tmp);
73                rcret = waitrc(timeshiftsettings, 0, 0);
74                tmp = listbox->select;
75
76                if(rcret == getrcconfigint("rcexit", NULL)) break;
77                if(rcret == getrcconfigint("rcok", NULL))
78                {
79                        addconfigscreencheck("deltimeshift", deltimeshift, "0");
80                       
81                        //check if timeshifttype change
82                        if(ostrcmp(timeshifttype->ret, getconfig("timeshifttype", NULL)) != 0)
83                                change = 1;
84                        if(ostrcmp(timeshifttype->ret, "0") == 0 && getconfig("timeshifttype", NULL) == NULL)
85                                change = 0;
86                       
87                        addconfigscreencheck("timeshifttype", timeshifttype, "0");
88                        status.timeshifttype = getconfigint("timeshifttype", NULL);
89                        addconfigscreencheck("asktimeshift", asktimeshift, "0");
90                        status.asktimeshift = getconfigint("asktimeshift", NULL);
91      addconfigscreencheck("timeshiftnumkeys", timeshiftnumkeys, "0");
92                        break;
93                }
94        }
95
96        timeshiftplaydisable();
97        delownerrc(timeshiftsettings);
98        clearscreen(timeshiftsettings);
99        drawscreen(skin, 0, 0);
100
101        //zap on change so timeshift is ended or started
102        if(change == 1)
103        {
104                ret = servicestop(status.aktservice, 1, 1);
105                if(ret == 0)
106                {
107                        status.aktservice->transponder = NULL;
108                        servicecheckret(servicestart(status.aktservice->channel, NULL, NULL, 5), 0);
109                }
110        }
111}
112
113#endif
Note: See TracBrowser for help on using the repository browser.