-
Notifications
You must be signed in to change notification settings - Fork 1
/
reelchannellist_vdr214.diff
418 lines (376 loc) · 14.1 KB
/
reelchannellist_vdr214.diff
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
Index: activelist.c
===================================================================
--- activelist.c (revision 19502)
+++ activelist.c (working copy)
@@ -24,8 +24,9 @@
savedGlobalFilters = globalFilters;
savedFavouritesFilters = favouritesFilters;
savedWasLastMenuFav = isFav;
-
+#ifdef REELVDR
Setup.UseZonedChannelList = true;
+#endif
savedGlobalFilters.Save();
savedFavouritesFilters.Save();
Index: favourites.c
===================================================================
--- favourites.c (revision 19502)
+++ favourites.c (working copy)
@@ -5,6 +5,7 @@
#include "MenuCISlot.h"
#include <vdr/interface.h>
#include <vdr/plugin.h>
+#include "tools.h"
cChannels favourites;
@@ -29,7 +30,9 @@
}
// update Caids if they differ
+#ifdef REELVDR
ch->ForceCaIds(vdrCh->Caids());
+#endif
} else
esyslog("fav. channel '%s' not found in vdr's channel list!", ch->Name());
}
@@ -58,7 +61,9 @@
if (IsBouquetInFavourites(folderName)) return false;
cChannel *channel = new cChannel;
+#ifdef REELVDR
channel->SetGroupSep(true); /* make it a bouquet */
+#endif
channel->SetName(folderName, "", "");
favourites.Add(channel); /* add bouquet to the end of the list */
@@ -394,15 +399,15 @@
// lets not have empty menus
if (Count()==0) { // no osditems
if (mode == eFavFolders) {
- AddFloatingText(tr("No favourite folders available"), 50);
+ cUtils::AddFloatingText(this, tr("No favourite folders available"), 50);
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem(tr("Info:"), osUnknown, false));
- AddFloatingText(tr("Please select 'all Channels' to add channels to your favorites."), 50);
+ cUtils::AddFloatingText(this, tr("Please select 'all Channels' to add channels to your favorites."), 50);
} else {
- AddFloatingText(tr("No channels in this bouquet"), 50);
+ cUtils::AddFloatingText(this, tr("No channels in this bouquet"), 50);
}
} else {
if (!currentSet) {
@@ -770,7 +775,7 @@
// clear name
folderName[0] = 0;
- AddFloatingText(tr("Enter new favourites folder name"), 50);
+ cUtils::AddFloatingText(this, tr("Enter new favourites folder name"), 50);
Add(new cOsdItem("",osUnknown, false));
Add(new cMenuEditStrItem(tr("Folder name"), folderName, sizeof(folderName)-1));
@@ -843,9 +848,9 @@
SetCols(6);
if (CountFavFolders() == 0)
- AddFloatingText(tr("You have no favourite folders. Please create one before you can add the channel"), 50);
+ cUtils::AddFloatingText(this, tr("You have no favourite folders. Please create one before you can add the channel"), 50);
else
- AddFloatingText (cString::sprintf(tr("Select folder for %d channels"),
+ cUtils::AddFloatingText (this, cString::sprintf(tr("Select folder for %d channels"),
channelsToAdd.size())
, 50);
@@ -1082,7 +1087,7 @@
channel ? channel->Name() : "undefined"
);
- AddFloatingText(*note_text, 45);
+ cUtils::AddFloatingText(this, *note_text, 45);
Add(new cOsdItem("",osUnknown, false)); // blank line
// Add(new cOsdItem("",osUnknown, false)); // blank line
@@ -1259,7 +1264,7 @@
Clear();
SetCols(20);
- AddFloatingText(tr("Rename favourites folder"), 50);
+ cUtils::AddFloatingText(this, tr("Rename favourites folder"), 50);
// Add(new cOsdItem("", osUnknown, false)); //empty line
Add(new cMenuEditStrItem(tr("New folder name"), folderName, sizeof(folderName)));
@@ -1269,7 +1274,7 @@
Add(new cOsdItem("",osUnknown, false)); //blank lines
Add(new cOsdItem(tr("Info:"),osUnknown, false));
- AddFloatingText(tr("Press right key to enter folder name and Ok to rename."), 50);
+ cUtils::AddFloatingText(this, tr("Press right key to enter folder name and Ok to rename."), 50);
Display();
}
Index: menu.c
===================================================================
--- menu.c (revision 19502)
+++ menu.c (working copy)
@@ -479,7 +479,7 @@
// no channels being shown. Eg. No result from Text search.
if (Count() == 0) {
- AddFloatingText(tr("No channels found.\nPress red key to list all channels."), 50);
+ cUtils::AddFloatingText(this, tr("No channels found.\nPress red key to list all channels."), 50);
}
cString tmpTitle = globalFilters.MakeTitle();
@@ -818,7 +818,11 @@
#define PL_NAME "reelchannellist"
cPlugin *p = cPluginManager::GetPlugin(PL_NAME);
if (p)
+#ifdef REELVDR
p->SetupStore("ChannelSortMode", PL_NAME, (int)ChannelSortMode);
+#else
+ p->SetupStore("ChannelSortMode", (int)ChannelSortMode);
+#endif
else
esyslog("getting plugin %s failed! %s:%d"
, PL_NAME, __FILE__, __LINE__);
@@ -1350,7 +1354,7 @@
if (cMenuChannelList::IsSelectToAddMode()) {
cString note = cString::sprintf(tr("Add the %d selected channels to favourites with the option below:"),
cMenuChannelList::SelectedChannels.size());
- AddFloatingText(note, 45);
+ cUtils::AddFloatingText(this, note, 45);
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem(hk(tr("Add multiple channels to Favourites"))));
@@ -1359,7 +1363,7 @@
} else if (cMenuChannelList::IsSelectToDeleteMode()) {
cString note = cString::sprintf(tr("Delete the %d selected channels:"),
cMenuChannelList::SelectedChannels.size());
- AddFloatingText(note, 45);
+ cUtils::AddFloatingText(this, note, 45);
Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem(hk(tr("Delete channels"))));
@@ -1373,12 +1377,14 @@
cString note_text = cString::sprintf(tr("For channel '%s' please choose one of the following options:"),
channel->Name());
- AddFloatingText(*note_text, 45);
+ cUtils::AddFloatingText(this, *note_text, 45);
Add(new cOsdItem("",osUnknown, false)); // blank line
//Add(new cOsdItem("",osUnknown, false)); // blank line
Add(new cOsdItem(hk(tr("Move channel"))));
+#ifdef REELVDR
Add(new cOsdItem(hk(tr("Edit selected channel"))));
+#endif
//if (!IsChannelInFavourites(channel))
Add(new cOsdItem(hk(tr("Add selected channel to Favourites"))));
@@ -1460,8 +1466,10 @@
if(text) {
if (strstr(text, tr("Move channel")))
return AddSubMenu(new cMenuMoveChannels(channel));
+#ifdef REELVDR
else if(strstr(text, tr("Edit selected channel")))
return AddSubMenu(new cMenuMyEditChannel(channel));
+#endif
else if(strstr(text, tr("Search for channel")))
return AddSubMenu(new cMenuChannelSearch);
else if (strstr(text, tr("Add selected channel to Favourites"))) {
@@ -1550,7 +1558,7 @@
Clear();
SetCols(15);
- AddFloatingText(tr("Enter string to search"), 50);
+ cUtils::AddFloatingText(this, tr("Enter string to search"), 50);
Add(new cOsdItem("",osUnknown, false));
Add(new cMenuEditStrItem(tr("Search for"), searchText, sizeof(searchText)/*, tr("abcdefghijklmnopqrstuvwxyz "*/));
}
Index: MenuCISlot.c
===================================================================
--- MenuCISlot.c (revision 19502)
+++ MenuCISlot.c (working copy)
@@ -1,6 +1,7 @@
#include "MenuCISlot.h"
#include "favourites.h"
#include "menu.h"
+#include "tools.h"
cOsdMenuCISlot::cOsdMenuCISlot(cString param, bool isFav, cChannel *channel_):
cOsdMenu(trVDR("Functions: CI-slot assignment")),
@@ -86,7 +87,7 @@
*param);
- AddFloatingText(*tmp, 45);
+ cUtils::AddFloatingText(this, *tmp, 45);
//blank line
Add(new cOsdItem("", osUnknown, false));
Index: reelchannellist.c
===================================================================
--- reelchannellist.c (revision 19502)
+++ reelchannellist.c (working copy)
@@ -192,6 +192,7 @@
bool cPluginReelChannellist::Service(const char *Id, void *Data)
{
+#ifdef REELVDR
// Handle custom service requests from other plugins
if (Id && !strcmp(Id, "reload favourites list")) {
LoadFavouritesList();
@@ -308,6 +309,9 @@
return true;
}
return false;
+#else
+ return false;
+#endif
}
const char **cPluginReelChannellist::SVDRPHelpPages(void)
Index: setup.c
===================================================================
--- setup.c (revision 19502)
+++ setup.c (working copy)
@@ -2,7 +2,11 @@
int zapAllFavChannels;
+#ifdef REELVDR
cMenuReelChannelListSetup::cMenuReelChannelListSetup() : wantChOnOkTmp(Setup.WantChListOnOk)
+#else
+cMenuReelChannelListSetup::cMenuReelChannelListSetup() : wantChOnOkTmp(true)
+#endif
{
wantChOnOkModes.Append(strdup(tr("Channel Info")));
wantChOnOkModes.Append(strdup(tr("Standard")));
@@ -15,7 +19,9 @@
{
Clear();
newZapAllFavChannels = zapAllFavChannels;
+#ifdef REELVDR
wantChOnOkTmp = Setup.WantChListOnOk;
+#endif
/*
Add(new cMenuEditBoolItem(tr("Zapping in favourites list"),
@@ -31,7 +37,9 @@
void cMenuReelChannelListSetup::Store()
{
zapAllFavChannels = newZapAllFavChannels;
+#ifdef REELVDR
Setup.WantChListOnOk = wantChOnOkTmp;
+#endif
SetupStore("ZapAllFavChannels", zapAllFavChannels);
}
Index: tools.c
===================================================================
--- tools.c (revision 19502)
+++ tools.c (working copy)
@@ -153,3 +153,102 @@
return NumpadToChar(pressedNum, multiples);
}
+
+#ifndef REELVDR
+// create a new string on the heap that has a maximum 'maxlen' number of
+// characters (each can span multiple bytes)
+//
+// tries to find end of words to break the string
+// returned char* (if not NULL) must be freed by caller
+//
+// bytesCopied used by the caller to jump in the input string
+char* BreakString(const char*str, int maxlen, int &bytesCopied)
+{
+ bytesCopied = 0;
+ if (!str) return NULL;
+
+ // number of chars
+ int symCount = Utf8StrLen(str);
+
+ // convert UTF-8 multi-byte char to a single uint number
+ uint *inp_sym = new uint[symCount+1]; // +1 for the '\0'
+ int inp_sym_len = Utf8ToArray(str, inp_sym, symCount+1);
+
+ // number of chars in the string less than the maxlen
+ // TODO: if there is a '\n' in this part!
+ if (inp_sym_len <= maxlen)
+ {
+ // copy the input string
+ bytesCopied = strlen(str);
+
+ delete[] inp_sym;
+ //printf("** just copied **\n");
+ return strdup(str);
+ }
+
+ // create string on heap that can hold maxlen (multi-byte)chars
+ char *s = (char*) malloc((4*maxlen+1)*sizeof(char)); //+1 for '\0'
+
+ int i = 0;
+
+ // if no wordbreaks found, break after maxlen characters
+ int line_end = maxlen;
+
+ // donot show the char that was used to break the string
+ // for eg. ' ' is unnecessary at the end/beginning of a line
+ int skip_symbol = 0;
+
+ //the string here is longer than requested. Break it down.
+ for (i = 0; i < maxlen; ++i)
+ {
+ //look for word breaks and new lines
+ if (inp_sym[i] == '\0' || inp_sym[i] == '\n')
+ {
+ line_end = i;
+ if (inp_sym[i] != '\0')
+ skip_symbol = 1;
+ break; // found end of line exit loop
+ }
+ else if (inp_sym[i] == ' ') //space
+ {
+ line_end = i;
+ skip_symbol = 1;
+ }
+ }//for
+
+ // create char from uint array, since the char* is large enough
+ // it will be '\0' terminated
+ bytesCopied = Utf8FromArray(inp_sym, s, 4*maxlen-1,line_end);
+
+ if (skip_symbol)// jump over the last symbol since it is a ' ' or '\n'
+ ++bytesCopied;
+
+ delete[] inp_sym;
+ return s;
+}
+// breaks given text into smaller 'maxChar' length strings and
+// displays them as unselectable text on OSD
+void cUtils::AddFloatingText(cOsdMenu *m, const char* text, int maxChars)
+{
+ // empty string; display nothing
+ if(!text) return;
+
+ char *p = NULL;
+ int copied = 0;
+
+ //printf("\tFloating Text (%i): '%s'\n", maxChars, text);
+ while(*text)
+ {
+ // returns a pointer to a char string with atmost maxChars characters (not bytes)
+ // p has to be freed; p is NULL if text was null
+ p = BreakString(text, maxChars, copied);
+ text += copied; //jump bytes not chars
+ if(p)
+ {
+ m->Add(new cOsdItem(p, osUnknown,false)); // unselectable text
+ free(p); p = NULL;
+ }
+ }
+}
+#endif /* REELVDR */
+
Index: tools.h
===================================================================
--- tools.h (revision 19502)
+++ tools.h (working copy)
@@ -3,6 +3,7 @@
#include <vdr/tools.h>
#include <vdr/channels.h>
+#include <vdr/osdbase.h>
#include <vdr/epg.h>
#include <vdr/keys.h>
@@ -32,4 +33,12 @@
char NumpadChar(eKeys Key);
char NumpadToChar(unsigned int k, unsigned int multiples=0);
+#ifndef REELVDR
+class cUtils: public cOsdMenu
+{
+public:
+ static void AddFloatingText(cOsdMenu * m, const char* text, int maxlen);
+};
+#endif
+
#endif // TOOLS_H
Index: Makefile
===================================================================
--- Makefile (revision 19502)
+++ Makefile (working copy)
@@ -11,7 +11,8 @@
### The object files (add further files here):
-OBJS = $(PLUGIN).o menu.o menuitem.o channelListFilter.o tools.o MenuEditChannel.o favourites.o activelist.o MenuCISlot.o setup.o MenuMoveChannels.o
+# OBJS = $(PLUGIN).o menu.o menuitem.o channelListFilter.o tools.o MenuEditChannel.o favourites.o activelist.o MenuCISlot.o setup.o MenuMoveChannels.o
+OBJS = $(PLUGIN).o menu.o menuitem.o channelListFilter.o tools.o favourites.o activelist.o MenuCISlot.o setup.o MenuMoveChannels.o
### The directory environment: