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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
/*
* setup.cpp: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#include "setup.h"
// --- cMenuSetupInfosatepg
cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global)
{
global=Global;
newFrequency = global->Frequency;
newPolarization = global->Polarization;
newSrate = global->Srate;
newPid = global->Pid;
newWaitTime = global->WaitTime;
newEventTimeDiff= (int) (global->EventTimeDiff/60);
newNoWakeup=global->NoWakeup;
newNoDeferredShutdown=global->NoDeferredShutdown;
Add (NewTitle (tr ("Scan parameter")));
cString buffer = cString::sprintf("%s:\t%s",tr("Source"), "S19.2E"); // just for info
Add (new cOsdItem (buffer,osUnknown,false));
cOsdItem *firstItem = new cMenuEditIntItem (tr ("Frequency"), &newFrequency);
Add (firstItem);
Add (new cMenuEditChrItem (tr ("Polarization"), &newPolarization,"hlvr"));
Add (new cMenuEditIntItem (tr ("Srate"), &newSrate));
Add (new cMenuEditIntItem (tr ("Pid"), &newPid,1,8191));
if (global->Channel()>0)
{
buffer = cString::sprintf("-> %s:\t%i",tr("Using channel"), global->Channel());
}
else
{
buffer = cString::sprintf("-> %s:\t%s",tr("Using channel"),tr("none"));
}
Add (new cOsdItem (buffer,osUnknown,false));
Add (NewTitle (tr ("Event options")));
Add (new cMenuEditIntItem (tr ("Wait time [s]"), &newWaitTime,MIN_WAITTIME,MAX_WAITTIME));
Add (new cMenuEditIntItem (tr ("Time difference [min]"), &newEventTimeDiff,
MIN_EVENTTIMEDIFF,MAX_EVENTTIMEDIFF));
Add (NewTitle (tr ("General options")));
Add (new cMenuEditBoolItem(tr("Prevent wakeup"),&newNoWakeup));
Add (new cMenuEditBoolItem(tr("Prevent deferred shutdown"),&newNoDeferredShutdown));
if (global->InfosatChannels())
{
Add (NewTitle (tr ("Infosat channels")),true);
chanCurrent=Current() +1;
SetCurrent (firstItem);
for (int i=0; i<global->InfosatChannels(); i++)
{
cChannel *chan = Channels.GetByChannelID (global->GetChannelID (i));
if (!chan) continue;
int chanuse=global->GetChannelUsage(i);
cString buffer = cString::sprintf ("%s:\t%s",chan->Name(),chanuse ? tr ("used") : "");
Add (new cOsdItem (buffer));
}
}
}
cOsdItem *cMenuSetupInfosatepg::NewTitle (const char *s)
{
cString buffer = cString::sprintf("---- %s ----", s);
return new cOsdItem (buffer,osUnknown,false);
}
void cMenuSetupInfosatepg::Store (void)
{
bool bResetProcessed=false;
bool bResetReceivedAll=false;
if (global->EventTimeDiff!= (60*newEventTimeDiff)) bResetProcessed=true;
if ((global->Frequency!=newFrequency) || (global->Polarization!=newPolarization) ||
(global->Srate!=newSrate) || (global->Pid!=newPid))
{
bResetReceivedAll=true;
}
SetupStore ("Frequency", global->Frequency = newFrequency);
SetupStore ("Polarization", global->Polarization = newPolarization);
SetupStore ("Srate", global->Srate = newSrate);
SetupStore ("Pid", global->Pid = newPid);
SetupStore ("WaitTime", global->WaitTime = newWaitTime);
SetupStore ("EventTimeDiff", newEventTimeDiff);
SetupStore ("NoWakeup",global->NoWakeup=newNoWakeup);
SetupStore ("NoDeferredShutdown",global->NoDeferredShutdown=newNoDeferredShutdown);
global->EventTimeDiff = 60*newEventTimeDiff;
if (bResetReceivedAll)
{
if (global->FindReceiverChannel())
{
dsyslog ("infosatepg: receive files again");
global->ResetReceivedAll();
}
else
{
esyslog("infosatepg: found no channel to receive, check setup");
}
}
else if (bResetProcessed)
{
dsyslog ("infosatepg: reprocess files (later)");
global->ResetProcessed();
}
}
eOSState cMenuSetupInfosatepg::Edit()
{
if (HasSubMenu() || Count() ==0)
return osUnknown;
if (Current() >=chanCurrent)
{
int chanIndex=Current()-chanCurrent;
if (chanIndex<global->InfosatChannels())
{
eOSState state=AddSubMenu (new cMenuSetupChannelMenu (global,chanIndex));
cChannel *chan = Channels.GetByChannelID (global->GetChannelID (chanIndex));
if (chan)
{
int chanuse=global->GetChannelUsage(chanIndex);
cString buffer = cString::sprintf ("%s:\t%s",chan->Name(),chanuse ? tr ("used") : "");
cOsdItem *osd=Get(Current());
osd->SetText(buffer);
}
return state;
}
else
{
return osUnknown;
}
}
else
return osUnknown;
}
eOSState cMenuSetupInfosatepg::ProcessKey (eKeys Key)
{
eOSState state = cOsdMenu::ProcessKey (Key);
switch (state)
{
default:
if (state==osUnknown)
{
switch (Key)
{
case kOk:
state=Edit();
if (state==osUnknown)
{
Store();
state=osBack;
}
break;
default:
break;
}
}
}
return state;
}
cMenuSetupChannelMenu::cMenuSetupChannelMenu (cGlobalInfosatepg *Global, int Index)
{
SetPlugin (cPluginManager::GetPlugin (PLUGIN_NAME_I18N));
global=Global;
index=Index;
newChannelUse=global->GetChannelUsage(index);
if (newChannelUse<0) newChannelUse=USE_NOTHING; // to be safe!
newDays=global->GetChannelDays(index);
if (newDays<=0) newDays=1;
cChannel *channel = Channels.GetByChannelID (global->GetChannelID (index));
if (!channel) return;
SetHelp(tr("Button$Reset"),tr("Button$Copy"));
cString buffer = cString::sprintf("---- %s ----", channel->Name());
Add (new cOsdItem (buffer,osUnknown,false));
Add(new cMenuEditIntItem(tr("Days in advance"),&newDays,1,EPG_DAYS));
Add(new cMenuEditBitItem(tr("Short text"),(uint *) &newChannelUse,USE_SHORTTEXT));
Add(new cMenuEditBitItem(tr("Long text"),(uint *) &newChannelUse,USE_LONGTEXT));
Add(new cMenuEditBitItem(tr("Merge long texts"),(uint *) &newChannelUse,USE_MERGELONGTEXT));
Add(new cMenuEditBitItem(tr("Extended EPG"),(uint *) &newChannelUse,USE_EXTEPG));
Add(new cMenuEditBitItem(tr("Append non existing events"),(uint *) &newChannelUse,USE_APPEND));
}
void cMenuSetupChannelMenu::Store (void)
{
bool bReprocess=false;
cChannel *channel = Channels.GetByChannelID (global->GetChannelID (index));
if (!channel) return;
cString ChannelID = channel->GetChannelID().ToString();
cString name = cString::sprintf("Channel-%s",*ChannelID);
if (!*name) return;
if (global->SetChannelOptions(index,newChannelUse,newDays)) bReprocess=true;
int setupval=newChannelUse+(newDays<<16);
SetupStore (name,setupval);
if (bReprocess)
{
dsyslog ("infosatepg: reprocess files (later)");
global->ResetProcessed();
}
}
eOSState cMenuSetupChannelMenu::ProcessKey (eKeys Key)
{
eOSState state = cOsdMenu::ProcessKey (Key);
switch (state)
{
default:
if (state==osUnknown)
{
switch (Key)
{
case kRed:
if (Skins.Message(mtInfo,tr("Reset all channel settings?"))==kOk)
{
newDays=1;
newChannelUse=USE_NOTHING;
int oldindex=index;
for (index=0; index<global->InfosatChannels(); index++) Store();
index=oldindex;
state=osBack;
}
else
{
state=osContinue;
}
break;
case kGreen:
if (Skins.Message(mtInfo,tr("Copy settings to all channels?"))==kOk)
{
int oldindex=index;
for (index=0; index<global->InfosatChannels(); index++) Store();
index=oldindex;
}
state=osContinue;
break;
case kOk:
Store();
state=osBack;
break;
default:
break;
}
}
}
return state;
}
|