1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling channels in the 'Channels' menu in case there are ':@nnn' group separators without names

This commit is contained in:
Klaus Schmidinger 2002-12-22 12:49:10 +01:00
parent da98c3de72
commit de1366fc7e
3 changed files with 26 additions and 10 deletions

View File

@ -494,6 +494,8 @@ Andreas Kool <akool@akool.de>
Guy Roussin <guy.roussin@teledetection.fr> Guy Roussin <guy.roussin@teledetection.fr>
for suggesting not to display channel group delimiters without text for suggesting not to display channel group delimiters without text
for reporting a bug in handling channels in the "Channels" menu in case there are
':@nnn' group separators without names
Georg Hitsch <georg@hitsch.at> Georg Hitsch <georg@hitsch.at>
for his help in keeping 'channels.conf' up to date for his help in keeping 'channels.conf' up to date

View File

@ -1907,3 +1907,5 @@ Video Disk Recorder Revision History
When reading the 'epg.data' file VDR only interprets the channel IDs, everyting When reading the 'epg.data' file VDR only interprets the channel IDs, everyting
else is optional and has no meaning to VDR. else is optional and has no meaning to VDR.
- Fixed the 'channels.conf' entries for "Studio Universal" and "Disney Channel". - Fixed the 'channels.conf' entries for "Studio Universal" and "Disney Channel".
- Fixed handling channels in the "Channels" menu in case there are ':@nnn' group
separators without names (thanks to Guy Roussin for reporting this one).

32
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.228 2002/12/01 10:31:55 kls Exp $ * $Id: menu.c 1.229 2002/12/22 12:40:43 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -645,6 +645,7 @@ private:
public: public:
cMenuChannelItem(cChannel *Channel); cMenuChannelItem(cChannel *Channel);
virtual void Set(void); virtual void Set(void);
cChannel *Channel(void) { return channel; }
}; };
cMenuChannelItem::cMenuChannelItem(cChannel *Channel) cMenuChannelItem::cMenuChannelItem(cChannel *Channel)
@ -669,6 +670,7 @@ void cMenuChannelItem::Set(void)
class cMenuChannels : public cOsdMenu { class cMenuChannels : public cOsdMenu {
private: private:
cChannel *GetChannel(int Index);
void Propagate(void); void Propagate(void);
protected: protected:
eOSState Switch(void); eOSState Switch(void);
@ -691,6 +693,12 @@ cMenuChannels::cMenuChannels(void)
SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark")); SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark"));
} }
cChannel *cMenuChannels::GetChannel(int Index)
{
cMenuChannelItem *p = (cMenuChannelItem *)Get(Index);
return p ? (cChannel *)p->Channel() : NULL;
}
void cMenuChannels::Propagate(void) void cMenuChannels::Propagate(void)
{ {
Channels.ReNumber(); Channels.ReNumber();
@ -703,7 +711,7 @@ void cMenuChannels::Propagate(void)
eOSState cMenuChannels::Switch(void) eOSState cMenuChannels::Switch(void)
{ {
cChannel *ch = Channels.Get(Current()); cChannel *ch = GetChannel(Current());
if (ch) if (ch)
cDevice::PrimaryDevice()->SwitchChannel(ch, true); cDevice::PrimaryDevice()->SwitchChannel(ch, true);
return osEnd; return osEnd;
@ -713,7 +721,7 @@ eOSState cMenuChannels::Edit(void)
{ {
if (HasSubMenu() || Count() == 0) if (HasSubMenu() || Count() == 0)
return osContinue; return osContinue;
cChannel *ch = Channels.Get(Current()); cChannel *ch = GetChannel(Current());
if (ch) if (ch)
return AddSubMenu(new cMenuEditChannel(ch)); return AddSubMenu(new cMenuEditChannel(ch));
return osContinue; return osContinue;
@ -730,7 +738,7 @@ eOSState cMenuChannels::Delete(void)
{ {
if (Count() > 0) { if (Count() > 0) {
int Index = Current(); int Index = Current();
cChannel *channel = Channels.Get(Index); cChannel *channel = GetChannel(Current());
int DeletedChannel = channel->Number(); int DeletedChannel = channel->Number();
// Check if there is a timer using this channel: // Check if there is a timer using this channel:
for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) { for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) {
@ -751,12 +759,16 @@ eOSState cMenuChannels::Delete(void)
void cMenuChannels::Move(int From, int To) void cMenuChannels::Move(int From, int To)
{ {
int FromNumber = Channels.Get(From)->Number(); cChannel *FromChannel = GetChannel(From);
int ToNumber = Channels.Get(To)->Number(); cChannel *ToChannel = GetChannel(To);
Channels.Move(From, To); if (FromChannel && ToChannel) {
cOsdMenu::Move(From, To); int FromNumber = FromChannel->Number();
Propagate(); int ToNumber = ToChannel->Number();
isyslog("channel %d moved to %d", FromNumber, ToNumber); Channels.Move(FromChannel, ToChannel);
cOsdMenu::Move(From, To);
Propagate();
isyslog("channel %d moved to %d", FromNumber, ToNumber);
}
} }
eOSState cMenuChannels::ProcessKey(eKeys Key) eOSState cMenuChannels::ProcessKey(eKeys Key)