diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-11-11 12:55:10 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-11-11 12:55:10 +0100 |
commit | 9c499caf87d6d8f3758a8968d35c71d33927cc0e (patch) | |
tree | 58e8b1b49f5002d2cf7d584537ec420418b07405 | |
parent | 6bc436aeed0322155dc0d6a0a9ebeb1baa63f0d5 (diff) | |
download | vdr-9c499caf87d6d8f3758a8968d35c71d33927cc0e.tar.gz vdr-9c499caf87d6d8f3758a8968d35c71d33927cc0e.tar.bz2 |
Avoiding multiple definitions of the same timer in the 'Schedule' menu
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | menu.c | 53 |
2 files changed, 38 insertions, 17 deletions
@@ -276,3 +276,5 @@ Video Disk Recorder Revision History add new languages). - Fixed learning keys on the PC keyboard (display oscillated). - Fixed a timing problem with OSD refresh and SVDRP. +- Avoiding multiple definitions of the same timer in the "Schedule" menu (this + could happen when pressing the "Red" button while editing the timer). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.44 2000/11/11 09:58:12 kls Exp $ + * $Id: menu.c 1.45 2000/11/11 12:55:10 kls Exp $ */ #include "menu.h" @@ -909,16 +909,21 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key) eOSState state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { - if (Key == kOk) { - if (!*data.file) - strcpy(data.file, Channels.GetChannelNameByNumber(data.channel)); - if (timer && memcmp(timer, &data, sizeof(data)) != 0) { - *timer = data; - Timers.Save(); - isyslog(LOG_INFO, "timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive"); - } - state = osBack; - } + switch (Key) { + case kOk: if (!*data.file) + strcpy(data.file, Channels.GetChannelNameByNumber(data.channel)); + if (timer && memcmp(timer, &data, sizeof(data)) != 0) { + *timer = data; + Timers.Save(); + isyslog(LOG_INFO, "timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive"); + } + return osBack; + case kRed: + case kGreen: + case kYellow: + case kBlue: return osContinue; + default: break; + } } return state; } @@ -1208,9 +1213,16 @@ eOSState cMenuWhatsOn::Record(void) cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current()); if (item) { cTimer *timer = new cTimer(item->eventInfo); - Timers.Add(timer); - Timers.Save(); - isyslog(LOG_INFO, "timer %d added", timer->Index() + 1); + cTimer *t = Timers.GetTimer(timer); + if (!t) { + Timers.Add(timer); + Timers.Save(); + isyslog(LOG_INFO, "timer %d added", timer->Index() + 1); + } + else { + delete timer; + timer = t; + } return AddSubMenu(new cMenuEditTimer(timer->Index(), true)); } return osContinue; @@ -1314,9 +1326,16 @@ eOSState cMenuSchedule::Record(void) cMenuScheduleItem *item = (cMenuScheduleItem *)Get(Current()); if (item) { cTimer *timer = new cTimer(item->eventInfo); - Timers.Add(timer); - Timers.Save(); - isyslog(LOG_INFO, "timer %d added", timer->Index() + 1); + cTimer *t = Timers.GetTimer(timer); + if (!t) { + Timers.Add(timer); + Timers.Save(); + isyslog(LOG_INFO, "timer %d added", timer->Index() + 1); + } + else { + delete timer; + timer = t; + } return AddSubMenu(new cMenuEditTimer(timer->Index(), true)); } return osContinue; |