summaryrefslogtreecommitdiff
path: root/setup.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2017-03-13 18:44:47 +0100
committerJochen Dolze <vdr@dolze.de>2017-03-13 18:44:47 +0100
commit05bd94edbff42a5cc688b129706abeb1d31dba10 (patch)
tree4beeda1b823beffe4c82a9ed264e57ec5a7a64e7 /setup.cpp
parentb48e0bec3c87531c872da028d4fb87c65f3e050e (diff)
downloadvdr-plugin-xmltv2vdr-05bd94edbff42a5cc688b129706abeb1d31dba10.tar.gz
vdr-plugin-xmltv2vdr-05bd94edbff42a5cc688b129706abeb1d31dba10.tar.bz2
Added compatibility for VDR >= 2.3.1
Diffstat (limited to 'setup.cpp')
-rw-r--r--setup.cpp96
1 files changed, 68 insertions, 28 deletions
diff --git a/setup.cpp b/setup.cpp
index 4038c8c..b64c8c0 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -11,7 +11,11 @@
#include <vdr/i18n.h>
#include <time.h>
+#if VDRVERSNUM>=20301
+#define CHNUMWIDTH (numdigits(cChannels::MaxNumber())+1)
+#else
#define CHNUMWIDTH (numdigits(Channels.MaxNumber())+1)
+#endif
#define NewTitle(x) new cOsdItem(cString::sprintf("%s%s%s", "---- ",x," ----"),osUnknown,false)
@@ -149,16 +153,28 @@ void cMenuSetupXmltv2vdr::Output(void)
{
for (int x=0; x<map->NumChannelIDs(); x++)
{
- cChannel *chan=Channels.GetByChannelID(map->ChannelIDs()[x]);
- if (chan)
- {
- mapped=true;
- }
- else
+#if VDRVERSNUM>=20301
+ cStateKey StateKeyChan;
+ const cChannels *Channels=cChannels::GetChannelsRead(StateKeyChan);
+ if (Channels)
{
- // invalid channelid? remove from list
- map->RemoveChannel(map->ChannelIDs()[x],true);
+ const cChannel *chan=Channels->GetByChannelID(map->ChannelIDs()[x]);
+#else
+ cChannel *chan=Channels.GetByChannelID(map->ChannelIDs()[x]);
+#endif
+ if (chan)
+ {
+ mapped=true;
+ }
+ else
+ {
+ // invalid channelid? remove from list
+ map->RemoveChannel(map->ChannelIDs()[x],true);
+ }
+#if VDRVERSNUM>=20301
+ StateKeyChan.Remove();
}
+#endif
}
}
cString buffer = cString::sprintf("%s:\t%s",channels[i],mapped ? tr("mapped") : "");
@@ -1126,19 +1142,31 @@ void cMenuSetupXmltv2vdrChannelMap::output(void)
Add(NewTitle(tr("epg source channel mappings")),true);
for (int i=0; i<lmap->NumChannelIDs(); i++)
{
- cChannel *chan=Channels.GetByChannelID(lmap->ChannelIDs()[i]);
- if (chan)
+#if VDRVERSNUM>=20301
+ cStateKey StateKeyChan;
+ const cChannels *Channels=cChannels::GetChannelsRead(StateKeyChan);
+ if (Channels)
{
- cString buffer = cString::sprintf("%-*i %s", CHNUMWIDTH, chan->Number(),chan->Name());
- Add(new cOsdItem(buffer),true);
- if (!hasmaps) cm=Current();
- hasmaps=true;
- }
- else
- {
- // invalid channelid? remove from list
- lmap->RemoveChannel(lmap->ChannelIDs()[i],true);
+ const cChannel *chan=Channels->GetByChannelID(lmap->ChannelIDs()[i]);
+#else
+ cChannel *chan=Channels.GetByChannelID(lmap->ChannelIDs()[i]);
+#endif
+ if (chan)
+ {
+ cString buffer = cString::sprintf("%-*i %s", CHNUMWIDTH, chan->Number(),chan->Name());
+ Add(new cOsdItem(buffer),true);
+ if (!hasmaps) cm=Current();
+ hasmaps=true;
+ }
+ else
+ {
+ // invalid channelid? remove from list
+ lmap->RemoveChannel(lmap->ChannelIDs()[i],true);
+ }
+#if VDRVERSNUM>=20301
+ StateKeyChan.Remove();
}
+#endif
}
lmap->RemoveInvalidChannels();
if (!hasmaps)
@@ -1338,21 +1366,33 @@ cMenuSetupXmltv2vdrChannelsVDR::cMenuSetupXmltv2vdrChannelsVDR(cGlobals *Global,
SetHelp(NULL,NULL,tr("Button$Choose"));
SetTitle(Title);
- for (cChannel *channel = Channels.First(); channel; channel=Channels.Next(channel))
+#if VDRVERSNUM>=20301
+ cStateKey StateKeyChan;
+ const cChannels *Channels=cChannels::GetChannelsRead(StateKeyChan);
+ if (Channels)
{
- if (!channel->GroupSep())
+ for (const cChannel *channel=Channels->First(); channel; channel=Channels->Next(channel))
+#else
+ for (cChannel *channel = Channels.First(); channel; channel=Channels.Next(channel))
+#endif
{
- cString buf= cString::sprintf("%d\t%s",channel->Number(),channel->Name());
- if ((epgmappingexists(channel->GetChannelID(),Channel)) || (map->EPGMappingExists(channel->GetChannelID())))
+ if (!channel->GroupSep())
{
- Add(new cOsdItem(buf,osUnknown,false));
- }
- else
- {
- Add(new cOsdItem(buf));
+ cString buf= cString::sprintf("%d\t%s",channel->Number(),channel->Name());
+ if ((epgmappingexists(channel->GetChannelID(),Channel)) || (map->EPGMappingExists(channel->GetChannelID())))
+ {
+ Add(new cOsdItem(buf,osUnknown,false));
+ }
+ else
+ {
+ Add(new cOsdItem(buf));
+ }
}
}
+#if VDRVERSNUM>=20301
+ StateKeyChan.Remove();
}
+#endif
}
bool cMenuSetupXmltv2vdrChannelsVDR::epgmappingexists(tChannelID channelid, const char *channel2ignore)