diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2020-04-11 09:22:05 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2020-04-11 09:22:05 +0200 |
commit | 6e0f5287ea4df66847f97489f00f2c8214bad605 (patch) | |
tree | 6f37287dcaa4c1889072f16760a917d4adf93aca | |
parent | f63a066b98039663ff35d21fd42a66eb143d93ab (diff) | |
download | vdr-6e0f5287ea4df66847f97489f00f2c8214bad605.tar.gz vdr-6e0f5287ea4df66847f97489f00f2c8214bad605.tar.bz2 |
Fixed moving channels between number groups in SVDRP's MOVC command and the Channels menu, in case a channel is moved to a higher number and into a numbered group
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 6 | ||||
-rw-r--r-- | channels.c | 21 | ||||
-rw-r--r-- | channels.h | 3 | ||||
-rw-r--r-- | menu.c | 9 | ||||
-rw-r--r-- | svdrp.c | 4 |
6 files changed, 38 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 24f72e86..3d9afe94 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2918,6 +2918,7 @@ Manuel Reimer <Manuel.Reimer@gmx.de> order to avoid discontinuities for setting the environment variables HOME, USER, LOGNAME and SHELL accordingly when switching to a less privileged user id + for reporting a bug in moving channels between number groups in SVDRP's MOVC command Rene van den Braken <rene@vandenbraken.name> for reporting a bug in writing the PCR pid into the PMT in @@ -9419,3 +9419,9 @@ Video Disk Recorder Revision History the call is now automatically forwarded to QueueMessage(). - Fixed handling the S2SatelliteDeliverySystemDescriptor for transponders broadcasting in "backwards compatibility mode" according to ETSI EN 300 468 (thanks to Onur Sentürk). + +2020-04-11: + +- Fixed moving channels between number groups in SVDRP's MOVC command and the Channels + menu, in case a channel is moved to a higher number and into a numbered group + (reported by Manuel Reimer). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 4.5 2017/06/10 15:08:56 kls Exp $ + * $Id: channels.c 4.6 2020/04/11 09:22:05 kls Exp $ */ #include "channels.h" @@ -946,6 +946,25 @@ void cChannels::ReNumber(void) } } +bool cChannels::MoveNeedsDecrement(cChannel *From, cChannel *To) +{ + int Number = From->Number(); + if (Number < To->Number()) { + for (cChannel *Channel = Next(From); Channel; Channel = Next(Channel)) { + if (Channel == To) + break; + if (Channel->GroupSep()) { + if (Channel->Number() > Number) + Number = Channel->Number(); + } + else + Number++; + } + return Number == To->Number(); + } + return false; +} + void cChannels::Del(cChannel *Channel) { UnhashChannel(Channel); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.h 4.3 2017/06/10 15:06:40 kls Exp $ + * $Id: channels.h 4.4 2020/04/11 09:22:05 kls Exp $ */ #ifndef __CHANNELS_H @@ -230,6 +230,7 @@ public: int GetNextNormal(int Idx) const; ///< Get next normal channel (not group) int GetPrevNormal(int Idx) const; ///< Get previous normal channel (not group) void ReNumber(void); ///< Recalculate 'number' based on channel type + bool MoveNeedsDecrement(cChannel *From, cChannel *To); // Detect special case when moving a channel (closely related to Renumber()) void Del(cChannel *Channel); ///< Delete the given Channel from the list const cChannel *GetByNumber(int Number, int SkipGap = 0) const; cChannel *GetByNumber(int Number, int SkipGap = 0) { return const_cast<cChannel *>(static_cast<const cChannels *>(this)->GetByNumber(Number, SkipGap)); } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 4.80 2019/05/28 15:24:43 kls Exp $ + * $Id: menu.c 4.81 2020/04/11 09:22:05 kls Exp $ */ #include "menu.h" @@ -516,7 +516,6 @@ eOSState cMenuChannels::Delete(void) Channels->Del(Channel); cOsdMenu::Del(Index); Propagate(Channels); - Channels->SetModifiedByUser(); isyslog("channel %d deleted", DeletedChannel); Deleted = true; if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { @@ -541,10 +540,14 @@ void cMenuChannels::Move(int From, int To) if (FromChannel && ToChannel) { int FromNumber = FromChannel->Number(); int ToNumber = ToChannel->Number(); + if (Channels->MoveNeedsDecrement(FromChannel, ToChannel)) { + ToChannel = Channels->Prev(ToChannel); // cListBase::Move() doesn't know about the channel list's numbered groups! + To--; + } Channels->Move(FromChannel, ToChannel); cOsdMenu::Move(From, To); + SetCurrent(Get(To)); Propagate(Channels); - Channels->SetModifiedByUser(); isyslog("channel %d moved to %d", FromNumber, ToNumber); if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring()) @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 4.39 2019/05/06 15:11:15 kls Exp $ + * $Id: svdrp.c 4.40 2020/04/11 09:22:05 kls Exp $ */ #include "svdrp.h" @@ -2087,6 +2087,8 @@ void cSVDRPServer::CmdMOVC(const char *Option) int FromNumber = FromChannel->Number(); int ToNumber = ToChannel->Number(); if (FromNumber != ToNumber) { + if (Channels->MoveNeedsDecrement(FromChannel, ToChannel)) + ToChannel = Channels->Prev(ToChannel); // cListBase::Move() doesn't know about the channel list's numbered groups! Channels->Move(FromChannel, ToChannel); Channels->ReNumber(); Channels->SetModifiedByUser(); |