Fixed setting the current item and counter values in the Recordings menu after deleting the last recording in a subfolder

This commit is contained in:
Klaus Schmidinger 2016-12-09 15:00:55 +01:00
parent d6c26af696
commit 031bbcef40
2 changed files with 22 additions and 18 deletions

View File

@ -8828,7 +8828,7 @@ Video Disk Recorder Revision History
- Empty adaptation field TS packets are now skipped when recording (thanks to - Empty adaptation field TS packets are now skipped when recording (thanks to
Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel). Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel).
2016-12-08: Version 2.3.2 2016-12-09: Version 2.3.2
- Fixed a crash when deleting a recording (reported by Oliver Endriss). - Fixed a crash when deleting a recording (reported by Oliver Endriss).
- Fixed an overflow of PIDs in a receiver (thanks to Robert Hannebauer). - Fixed an overflow of PIDs in a receiver (thanks to Robert Hannebauer).
@ -8844,3 +8844,5 @@ Video Disk Recorder Revision History
the menu or through SVDRP (as well as other operations that try to acquire a the menu or through SVDRP (as well as other operations that try to acquire a
read lock within a write lock). read lock within a write lock).
- Fixed a crash when trying to delete a channel that is being used by a timer. - Fixed a crash when trying to delete a channel that is being used by a timer.
- Fixed setting the current item and counter values in the Recordings menu after
deleting the last recording in a subfolder.

36
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.15 2016/12/08 10:48:16 kls Exp $ * $Id: menu.c 4.16 2016/12/09 14:54:24 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2954,10 +2954,9 @@ void cMenuRecordings::Set(bool Refresh)
const char *CurrentRecording = *fileName ? *fileName : cReplayControl::LastReplayed(); const char *CurrentRecording = *fileName ? *fileName : cReplayControl::LastReplayed();
cRecordings *Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); // write access is necessary for sorting! cRecordings *Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); // write access is necessary for sorting!
cMenuRecordingItem *LastItem = NULL; cMenuRecordingItem *LastItem = NULL;
if (Refresh) { if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()))
if (cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current())) CurrentRecording = ri->Recording()->FileName();
CurrentRecording = ri->Recording()->FileName(); int current = Current();
}
Clear(); Clear();
GetRecordingsSortMode(DirectoryName()); GetRecordingsSortMode(DirectoryName());
Recordings->Sort(); Recordings->Sort();
@ -2994,11 +2993,13 @@ void cMenuRecordings::Set(bool Refresh)
LastDir->IncrementCounter(Recording->IsNew()); LastDir->IncrementCounter(Recording->IsNew());
} }
} }
if (Current() < 0)
SetCurrent(Get(current)); // last resort, in case the recording was deleted
SetMenuSortMode(RecordingsSortMode == rsmName ? msmName : msmTime); SetMenuSortMode(RecordingsSortMode == rsmName ? msmName : msmTime);
recordingsStateKey.Remove(false); // sorting doesn't count as a real modification recordingsStateKey.Remove(false); // sorting doesn't count as a real modification
if (Refresh)
Display();
} }
if (Refresh)
Display();
} }
void cMenuRecordings::SetPath(const char *Path) void cMenuRecordings::SetPath(const char *Path)
@ -3172,8 +3173,6 @@ eOSState cMenuRecordings::Sort(void)
eOSState cMenuRecordings::ProcessKey(eKeys Key) eOSState cMenuRecordings::ProcessKey(eKeys Key)
{ {
if (!HasSubMenu())
Set(); // react on any changes to the recordings list
bool HadSubMenu = HasSubMenu(); bool HadSubMenu = HasSubMenu();
eOSState state = cOsdMenu::ProcessKey(Key); eOSState state = cOsdMenu::ProcessKey(Key);
@ -3199,7 +3198,8 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
return state; // closes all recording menus except for the top one return state; // closes all recording menus except for the top one
Set(); // this is the top level menu, so we refresh it... Set(); // this is the top level menu, so we refresh it...
Open(true); // ...and open any necessary submenus to show the new name Open(true); // ...and open any necessary submenus to show the new name
Display(); if (!HasSubMenu())
Display();
path = NULL; path = NULL;
fileName = NULL; fileName = NULL;
} }
@ -3211,14 +3211,16 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
ri->SetRecording(riSub->Recording()); ri->SetRecording(riSub->Recording());
} }
} }
if (Key == kYellow && HadSubMenu && !HasSubMenu()) {
// the last recording in a subdirectory was deleted, so let's go back up
cOsdMenu::Del(Current());
if (!Count())
return osBack;
Display();
}
if (!HasSubMenu()) { if (!HasSubMenu()) {
if (HadSubMenu) {
if (Key == kYellow) {
// the last recording in a subdirectory was deleted, so let's go back up
cOsdMenu::Del(Current());
if (!Count())
return osBack;
}
}
Set(true);
if (Key != kNone) if (Key != kNone)
SetHelpKeys(); SetHelpKeys();
} }