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

Fixed editing a remote timer immediately after it has been created

This commit is contained in:
Klaus Schmidinger 2017-04-20 10:08:04 +02:00
parent 1efd5e6b7e
commit 686831caf5
4 changed files with 17 additions and 10 deletions

View File

@ -8982,3 +8982,4 @@ Video Disk Recorder Revision History
statistics about the currently received signal. statistics about the currently received signal.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed displaying remote timers in the main menu of skin LCARS. - Fixed displaying remote timers in the main menu of skin LCARS.
- Fixed editing a remote timer immediately after it has been created.

10
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 4.24 2017/04/03 12:26:23 kls Exp $ * $Id: menu.c 4.25 2017/04/20 09:15:49 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1088,8 +1088,12 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
case kOk: if (timer) { case kOk: if (timer) {
LOCK_TIMERS_WRITE; LOCK_TIMERS_WRITE;
if (!addIfConfirmed && !Timers->Contains(timer)) { if (!addIfConfirmed && !Timers->Contains(timer)) {
Skins.Message(mtWarning, tr("Timer has been deleted!")); if (cTimer *t = Timers->GetById(timer->Id(), timer->Remote()))
break; timer = t;
else {
Skins.Message(mtWarning, tr("Timer has been deleted!"));
break;
}
} }
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
if (const cChannel *Channel = Channels->GetByNumber(channel)) if (const cChannel *Channel = Channels->GetByNumber(channel))

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: timers.c 4.8 2017/03/30 15:08:11 kls Exp $ * $Id: timers.c 4.9 2017/04/20 09:15:06 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -739,11 +739,13 @@ int cTimers::NewTimerId(void)
return ++lastTimerId; // no need for locking, the caller must have a lock on the global Timers list return ++lastTimerId; // no need for locking, the caller must have a lock on the global Timers list
} }
const cTimer *cTimers::GetById(int Id) const const cTimer *cTimers::GetById(int Id, const char *Remote) const
{ {
for (const cTimer *ti = First(); ti; ti = Next(ti)) { for (const cTimer *ti = First(); ti; ti = Next(ti)) {
if (!ti->Remote() && ti->Id() == Id) if (ti->Id() == Id) {
return ti; if (!Remote && !ti->Remote() || Remote && ti->Remote() && strcmp(Remote, ti->Remote()) == 0)
return ti;
}
} }
return NULL; return NULL;
} }

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: timers.h 4.7 2017/03/30 15:22:36 kls Exp $ * $Id: timers.h 4.8 2017/04/20 09:09:45 kls Exp $
*/ */
#ifndef __TIMERS_H #ifndef __TIMERS_H
@ -168,8 +168,8 @@ public:
///< } ///< }
static bool Load(const char *FileName); static bool Load(const char *FileName);
static int NewTimerId(void); static int NewTimerId(void);
const cTimer *GetById(int Id) const; const cTimer *GetById(int Id, const char *Remote = NULL) const;
cTimer *GetById(int Id) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetById(Id)); }; cTimer *GetById(int Id, const char *Remote = NULL) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetById(Id, Remote)); };
const cTimer *GetTimer(const cTimer *Timer) const; const cTimer *GetTimer(const cTimer *Timer) const;
cTimer *GetTimer(const cTimer *Timer) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetTimer(Timer)); }; cTimer *GetTimer(const cTimer *Timer) { return const_cast<cTimer *>(static_cast<const cTimers *>(this)->GetTimer(Timer)); };
const cTimer *GetMatch(time_t t) const; const cTimer *GetMatch(time_t t) const;