summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-11-10 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-11-10 18:00:00 +0100
commit8b5d4040832f9a11119002fef5144a7d6705f19c (patch)
treed0b31418030bfefc8a2ce0d72e269e19ab2aa8d0 /menu.c
parent1a8a081629b736572a8f6489428975cf54448e67 (diff)
downloadvdr-patch-lnbsharing-8b5d4040832f9a11119002fef5144a7d6705f19c.tar.gz
vdr-patch-lnbsharing-8b5d4040832f9a11119002fef5144a7d6705f19c.tar.bz2
Version 1.1.16vdr-1.1.16
- Fixed saving the polarization parameter of channels that have a number in the 'source' parameter (thanks to Peter Seyringer for reporting this one). - Updated 'channels.conf.terr' (thanks to Andy Carter). - Updated 'channels.conf.cable' (thanks to Achim Lange). - First step towards a "unique channel ID". The channel ID is a human readable string, made up from several parameters of the channel's definition in the file 'channels.conf' (see man vdr(5) for details). In order for the "unique channel ID" to work, all channel definitions now must be unique with respect to the combination of their Source, Frequency and SID parameters. You may have to fix your 'channels.conf' manually if there are error messages in the log file when loading it. BE SURE TO MAKE A BACKUP COPY OF YOUR 'channels.conf' AND 'timers.conf' FILE BEFORE SWITCHING TO THIS VERSION, AND CHECK VERY CAREFULLY WHETHER YOUR TIMERS ARE STILL SET TO THE RIGHT CHANNELS! When reading an existing 'timers.conf', the channels will be identified as before by their numbers. As soon as this file is written back, the channel numbers will be replaced by the channel IDs. After that it is possible to manually edit the 'channels.conf' file and rearrange the channels without breaking the timers. Note that you can still define new timers manually by using the channel number. VDR will correctly identify the 'channel' parameter in a timer definition and use it as a channel number or a channel ID, respectively. Also, the SVDRP commands that return timer definitions will list them with channel numbers in order to stay compatible with existing applications. The channel ID is also used in the 'epg.data' file to allow EPG information from different sources to be stored, which would previously have been mixed up in case they were using the same 'service ID'. Note that the contents of an existing 'epg.data' file from a previous version will be silently ignored, since it doesn't contain the new channel IDs. When inserting EPG data into VDR via SVDRP you now also need to use the channel IDs. Currently the EPG data received from the DVB data stream only uses the 'Source' and 'Service ID' part of the channel ID. This makes it work for channels with the same service IDs on different sources (like satellites, cable or terrestrial). However, it doesn't work yet if the service IDs are not unique within a specific source. This will be fixed later. - Added missing SID parameters to 'channels.conf'. Some channels have been removed since they are apparently no longer broadcasted. - Removed dropping EPG events from "other" streams that have a duration of 86400 seconds or more (was introduced in version 1.1.10). This has become obsolete by the modification in version 1.1.13, which fixed fetching the current/next information to handle cases where the duration of an event is set wrongly and would last beyond the start time of the next event. Besides, the change in 1.1.10 broke handling EPG data for NVOD channels. - Fixed a compiler warning regarding cMenuChannels::Del() and MenuTimers::Del() hiding the base class virtual functions.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c103
1 files changed, 62 insertions, 41 deletions
diff --git a/menu.c b/menu.c
index 47ad091..2e29b02 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.222 2002/11/01 12:15:45 kls Exp $
+ * $Id: menu.c 1.224 2002/11/10 16:05:15 kls Exp $
*/
#include "menu.h"
@@ -546,16 +546,18 @@ private:
cChannel data;
void Setup(void);
public:
- cMenuEditChannel(int Index);
+ cMenuEditChannel(cChannel *Channel, bool New = false);
virtual eOSState ProcessKey(eKeys Key);
};
-cMenuEditChannel::cMenuEditChannel(int Index)
+cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New)
:cOsdMenu(tr("Edit channel"), 14)
{
- channel = Channels.Get(Index);
+ channel = Channel;
if (channel) {
data = *channel;
+ if (New)
+ channel = NULL;
Setup();
}
}
@@ -603,10 +605,26 @@ eOSState cMenuEditChannel::ProcessKey(eKeys Key)
if (state == osUnknown) {
if (Key == kOk) {
- if (channel)
- *channel = data;
- Channels.Save();
- state = osBack;
+ if (Channels.HasUniqueChannelID(&data, channel)) {
+ if (channel) {
+ *channel = data;
+ isyslog("edited channel %d %s", channel->Number(), data.ToText());
+ state = osBack;
+ }
+ else {
+ channel = new cChannel;
+ *channel = data;
+ Channels.Add(channel);
+ Channels.ReNumber();
+ isyslog("added channel %d %s", channel->Number(), data.ToText());
+ state = osUser1;
+ }
+ Channels.Save();
+ }
+ else {
+ Interface->Error(tr("Channel settings are not unique!"));
+ state = osContinue;
+ }
}
}
if (Key != kNone && (data.source & cSource::st_Mask) != (oldSource & cSource::st_Mask))
@@ -651,7 +669,7 @@ protected:
eOSState Switch(void);
eOSState Edit(void);
eOSState New(void);
- eOSState Del(void);
+ eOSState Delete(void);
virtual void Move(int From, int To);
public:
cMenuChannels(void);
@@ -696,10 +714,8 @@ eOSState cMenuChannels::Edit(void)
if (HasSubMenu() || Count() == 0)
return osContinue;
cChannel *ch = Channels.Get(Current());
- if (ch) {
- isyslog("editing channel %d", ch->Number());
- return AddSubMenu(new cMenuEditChannel(Current()));
- }
+ if (ch)
+ return AddSubMenu(new cMenuEditChannel(ch));
return osContinue;
}
@@ -707,16 +723,10 @@ eOSState cMenuChannels::New(void)
{
if (HasSubMenu())
return osContinue;
- cChannel *channel = new cChannel(Channels.Get(Current()));
- Channels.Add(channel);
- Channels.ReNumber();
- Add(new cMenuChannelItem(channel), true);
- Channels.Save();
- isyslog("channel %d added", channel->Number());
- return AddSubMenu(new cMenuEditChannel(Current()));
+ return AddSubMenu(new cMenuEditChannel(Channels.Get(Current()), true));
}
-eOSState cMenuChannels::Del(void)
+eOSState cMenuChannels::Delete(void)
{
if (Count() > 0) {
int Index = Current();
@@ -753,16 +763,27 @@ eOSState cMenuChannels::ProcessKey(eKeys Key)
{
eOSState state = cOsdMenu::ProcessKey(Key);
- if (state == osUnknown) {
- switch (Key) {
- case kOk: return Switch();
- case kRed: return Edit();
- case kGreen: return New();
- case kYellow: return Del();
- case kBlue: Mark(); break;
- default: break;
- }
- }
+ switch (state) {
+ case osUser1: {
+ cChannel *channel = Channels.Last();
+ if (channel) {
+ Add(new cMenuChannelItem(channel), true);
+ return CloseSubMenu();
+ }
+ }
+ break;
+ default:
+ if (state == osUnknown) {
+ switch (Key) {
+ case kOk: return Switch();
+ case kRed: return Edit();
+ case kGreen: return New();
+ case kYellow: return Delete();
+ case kBlue: Mark(); break;
+ default: break;
+ }
+ }
+ }
return state;
}
@@ -924,7 +945,7 @@ class cMenuTimers : public cOsdMenu {
private:
eOSState Edit(void);
eOSState New(void);
- eOSState Del(void);
+ eOSState Delete(void);
eOSState OnOff(void);
virtual void Move(int From, int To);
eOSState Summary(void);
@@ -991,7 +1012,7 @@ eOSState cMenuTimers::New(void)
return AddSubMenu(new cMenuEditTimer(timer->Index(), true));
}
-eOSState cMenuTimers::Del(void)
+eOSState cMenuTimers::Delete(void)
{
// Check if this timer is active:
cTimer *ti = CurrentTimer();
@@ -1040,7 +1061,7 @@ eOSState cMenuTimers::ProcessKey(eKeys Key)
case kOk: return Summary();
case kRed: return Edit();
case kGreen: return New();
- case kYellow: return Del();
+ case kYellow: return Delete();
case kBlue: if (Setup.SortTimers)
OnOff();
else
@@ -1068,7 +1089,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
{
eventInfo = EventInfo;
if (eventInfo) {
- cChannel *channel = Channels.GetByServiceID(eventInfo->GetServiceID());
+ cChannel *channel = Channels.GetByChannelID(eventInfo->GetChannelID());
if (channel) {
char *buffer;
asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->Name(), 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString());
@@ -1162,7 +1183,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
pArray[num] = Now ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent();
if (pArray[num]) {
- cChannel *channel = Channels.GetByServiceID(pArray[num]->GetServiceID());
+ cChannel *channel = Channels.GetByChannelID(pArray[num]->GetChannelID());
if (channel) {
pArray[num]->SetChannelNumber(channel->Number());
num++;
@@ -1192,7 +1213,7 @@ eOSState cMenuWhatsOn::Switch(void)
{
cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current());
if (item) {
- cChannel *channel = Channels.GetByServiceID(item->eventInfo->GetServiceID());
+ cChannel *channel = Channels.GetByChannelID(item->eventInfo->GetChannelID());
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
return osEnd;
}
@@ -1313,7 +1334,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
SetTitle(buffer);
free(buffer);
if (schedules) {
- const cSchedule *Schedule = Channel->Sid() ? schedules->GetSchedule(Channel->Sid()) : schedules->GetSchedule();
+ const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID());
int num = Schedule->NumEvents();
const cEventInfo **pArray = MALLOC(const cEventInfo *, num);
if (pArray) {
@@ -1376,7 +1397,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
if (!now && !next) {
int ChannelNr = 0;
if (Count()) {
- cChannel *channel = Channels.GetByServiceID(((cMenuScheduleItem *)Get(Current()))->eventInfo->GetServiceID());
+ cChannel *channel = Channels.GetByChannelID(((cMenuScheduleItem *)Get(Current()))->eventInfo->GetChannelID());
if (channel)
ChannelNr = channel->Number();
}
@@ -1403,7 +1424,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
now = next = false;
const cEventInfo *ei = cMenuWhatsOn::ScheduleEventInfo();
if (ei) {
- cChannel *channel = Channels.GetByServiceID(ei->GetServiceID());
+ cChannel *channel = Channels.GetByChannelID(ei->GetChannelID());
if (channel) {
PrepareSchedule(channel);
if (channel->Number() != cDevice::CurrentChannel()) {
@@ -2713,7 +2734,7 @@ bool cRecordControl::GetEventInfo(void)
cMutexLock MutexLock;
const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
if (Schedules) {
- const cSchedule *Schedule = Schedules->GetSchedule(channel->Sid());
+ const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
if (Schedule) {
eventInfo = Schedule->GetEventAround(Time);
if (eventInfo) {