summaryrefslogtreecommitdiff
path: root/setup.c
blob: d512fa714ceb357e3f304be97c6cd46d11246a4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include "setup.h"

cTvGuideSetup::cTvGuideSetup() {
    tmpConfig = config;
    displayModeItems[0] = "vertical";
    displayModeItems[1] = "horizontal";
    jumpMode[0] = tr("x channels back / forward");
    jumpMode[1] = tr("previous / next channel group");
    numMode[0] = tr("Timely Jump");
    numMode[1] = tr("Jump to specific channel");
    blueMode[0] = tr("Blue: Channel Switch, Ok: Detailed EPG");
    blueMode[1] = tr("Blue: Detailed EPG, Ok: Channel Switch");
    blueMode[2] = tr("Blue: Favorites / Switch, Ok: Detailed EPG");
    strn0cpy(description1, tmpConfig.descUser1.c_str(), sizeof(description1));
    strn0cpy(description2, tmpConfig.descUser2.c_str(), sizeof(description2));
    strn0cpy(description3, tmpConfig.descUser3.c_str(), sizeof(description3));
    strn0cpy(description4, tmpConfig.descUser4.c_str(), sizeof(description4));
    recFolderMode[0] = tr("Always use root video folder");
    recFolderMode[1] = tr("Select from folder list");
    recFolderMode[2] = tr("Use fixed folder");
    strn0cpy(fixedFolder, tmpConfig.instRecFixedFolder.c_str(), sizeof(fixedFolder));
    useSubtitleRerunTexts[0] = tr("never");
    useSubtitleRerunTexts[1] = tr("if exists");
    useSubtitleRerunTexts[2] = tr("always");
    Setup();
}

cTvGuideSetup::~cTvGuideSetup() {
}

void cTvGuideSetup::Setup(void) {
    int current = Current();
    Clear();

    cString indent = "    ";

    Add(new cMenuEditBoolItem(tr("Show Main Menu Entry"), &tmpConfig.showMainMenuEntry));
    Add(new cMenuEditBoolItem(tr("Replace VDR Schedules Menu"), &tmpConfig.replaceOriginalSchedule));
    Add(new cMenuEditStraItem(tr("Display Mode"), &tmpConfig.displayMode, 2,  displayModeItems));
    Add(new cMenuEditIntItem(tr("Channels to display in horizontal View"), &tmpConfig.channelsPerPageHorizontal, 3, 12));
    Add(new cMenuEditIntItem(tr("Channels to display in vertical View"), &tmpConfig.channelsPerPageVertical, 3, 12));
    Add(new cMenuEditIntItem(tr("Number of Hours to display"), &tmpConfig.displayHours, 3, 12));
    Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpConfig.bigStepHours, 1, 12));
    Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpConfig.hugeStepHours, 13, 48));
    Add(new cMenuEditBoolItem(tr("Hide last Channel Group"), &tmpConfig.hideLastChannelGroup));
    Add(new cMenuEditStraItem(tr("Channel Jump Mode (Keys Green / Yellow)"), &tmpConfig.channelJumpMode, 2,  jumpMode));
    Add(new cMenuEditBoolItem(tr("Close TVGuide after channel switch"), &tmpConfig.closeOnSwitch));
    Add(new cMenuEditStraItem(tr("Functionality of numeric Keys"), &tmpConfig.numKeyMode, 2,  numMode));
    Add(new cMenuEditStraItem(tr("Keys Blue and OK"), &tmpConfig.blueKeyMode, 3,  blueMode));
    Add(new cMenuEditBoolItem(tr("\"Intelligent\" channel switch mode"), &tmpConfig.intelligentSwitch));
    Add(new cMenuEditIntItem(tr("Maximum number of reruns to display"), &tmpConfig.rerunAmount, 1, 100));
    Add(new cMenuEditIntItem(tr("Minimum timely distance of rerun (in hours)"), &tmpConfig.rerunDistance, 0, 1000));
    Add(new cMenuEditIntItem(tr("Limit Channel Numbers for reruns"), &tmpConfig.rerunMaxChannel, 0, 1000, tr("no limit")));

    Add(new cMenuEditStraItem(tr("Folder for instant Recordings"), &tmpConfig.instRecFolderMode, 3,  recFolderMode));
    if (tmpConfig.instRecFolderMode == eFolderFixed) {
        Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Folder")), fixedFolder, sizeof(fixedFolder), trVDR(FileNameChars)));
    }
    if (pRemoteTimers)
        Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpConfig.useRemoteTimers));

    Add(new cMenuEditBoolItem(tr("Use \"What's on now\" in favorites"), &tmpConfig.favWhatsOnNow));
    Add(new cMenuEditBoolItem(tr("Use \"What's on next\" in favorites"), &tmpConfig.favWhatsOnNext));
    Add(new cMenuEditBoolItem(tr("Use user defined time 1 in favorites"), &tmpConfig.favUseTime1));
    if (tmpConfig.favUseTime1) {
        Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description1, sizeof(description1), trVDR(FileNameChars)));
        Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpConfig.favTime1));
    }
    Add(new cMenuEditBoolItem(tr("Use user defined time 2 in favorites"), &tmpConfig.favUseTime2));
    if (tmpConfig.favUseTime2) {
        Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description2, sizeof(description2), trVDR(FileNameChars)));
        Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpConfig.favTime2));
    }
    Add(new cMenuEditBoolItem(tr("Use user defined time 3 in favorites"), &tmpConfig.favUseTime3));
    if (tmpConfig.favUseTime3) {
        Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description3, sizeof(description3), trVDR(FileNameChars)));
        Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpConfig.favTime3));
    }
    Add(new cMenuEditBoolItem(tr("Use user defined time 4 in favorites"), &tmpConfig.favUseTime4));
    if (tmpConfig.favUseTime4) {
        Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description4, sizeof(description4), trVDR(FileNameChars)));
        Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpConfig.favTime4));
    }
    Add(new cMenuEditBoolItem(tr("Limit channels in favorites"), &tmpConfig.favLimitChannels));
    if (tmpConfig.favLimitChannels) {
        Add(new cMenuEditChanItem(tr("Start Channel"), &tmpConfig.favStartChannel));
        Add(new cMenuEditChanItem(tr("Stop Channel"), &tmpConfig.favStopChannel));
    }

    SetCurrent(Get(current));
    Display();
}

void cTvGuideSetup::Store(void) {
    config = tmpConfig;
    SetupStore("showMainMenuEntry", config.showMainMenuEntry);
    SetupStore("replaceOriginalSchedule", config.replaceOriginalSchedule);
    SetupStore("displayMode", config.displayMode);
    SetupStore("channelsPerPageHorizontal", config.channelsPerPageHorizontal);
    SetupStore("channelsPerPageVertical", config.channelsPerPageVertical);
    SetupStore("displayHours", config.displayHours);
    SetupStore("bigStepHours", config.bigStepHours);
    SetupStore("hugeStepHours", config.hugeStepHours);
    SetupStore("hideLastChannelGroup", config.hideLastChannelGroup);
    SetupStore("channelJumpMode", config.channelJumpMode);
    SetupStore("closeOnSwitch", config.closeOnSwitch);
    SetupStore("numKeyMode", config.numKeyMode);
    SetupStore("blueKeyMode", config.blueKeyMode);
    SetupStore("intelligentSwitch", config.intelligentSwitch);
    SetupStore("rerunAmount", config.rerunAmount);
    SetupStore("rerunDistance", config.rerunDistance);
    SetupStore("rerunMaxChannel", config.rerunMaxChannel);
    SetupStore("useRemoteTimers", config.useRemoteTimers);
    SetupStore("instRecFolderMode", config.instRecFolderMode);
    SetupStore("instRecFixedFolder", config.instRecFixedFolder.c_str());
    SetupStore("favWhatsOnNow", config.favWhatsOnNow);
    SetupStore("favWhatsOnNext", config.favWhatsOnNext);
    SetupStore("favUseTime1", config.favUseTime1);
    SetupStore("favUseTime2", config.favUseTime2);
    SetupStore("favUseTime3", config.favUseTime3);
    SetupStore("favUseTime4", config.favUseTime4);
    SetupStore("favTime1", config.favTime1);
    SetupStore("favTime2", config.favTime2);
    SetupStore("favTime3", config.favTime3);
    SetupStore("favTime4", config.favTime4);
    SetupStore("descUser1", config.descUser1.c_str());
    SetupStore("descUser2", config.descUser2.c_str());
    SetupStore("descUser3", config.descUser3.c_str());
    SetupStore("descUser4", config.descUser4.c_str());
    SetupStore("favLimitChannels", config.favLimitChannels);
    SetupStore("favStartChannel", config.favStartChannel);
    SetupStore("favStopChannel", config.favStopChannel);
}

eOSState cTvGuideSetup::ProcessKey(eKeys Key) {
    int tmpFavUseTime1 = tmpConfig.favUseTime1;
    int tmpFavUseTime2 = tmpConfig.favUseTime2;
    int tmpFavUseTime3 = tmpConfig.favUseTime3;
    int tmpFavUseTime4 = tmpConfig.favUseTime4;
    int tmpFavLimitChannels = tmpConfig.favLimitChannels;
    int tmpFolderMode = tmpConfig.instRecFolderMode;
    eOSState state = cOsdMenu::ProcessKey(Key);
    if (Key == kOk) {
        tmpConfig.descUser1 = description1;
        tmpConfig.descUser2 = description2;
        tmpConfig.descUser3 = description3;
        tmpConfig.descUser4 = description4;
        tmpConfig.instRecFixedFolder = fixedFolder;
        Store();
    } else if ((Key == kLeft)||(Key == kRight)) {
        if ((tmpFavUseTime1 != tmpConfig.favUseTime1) ||
            (tmpFavUseTime2 != tmpConfig.favUseTime2) ||
            (tmpFavUseTime3 != tmpConfig.favUseTime3) ||
            (tmpFavUseTime4 != tmpConfig.favUseTime4) ||
            (tmpFavLimitChannels != tmpConfig.favLimitChannels) ||
            (tmpFolderMode != tmpConfig.instRecFolderMode) )
            Setup();
    }
    return state;
}