When sorting recordings by name, folders are now always at the top of the list

This commit is contained in:
Klaus Schmidinger 2013-03-03 11:04:22 +01:00
parent e0448bded8
commit f239934bf9
3 changed files with 10 additions and 8 deletions

View File

@ -7682,3 +7682,4 @@ Video Disk Recorder Revision History
- Changed the calls to Skins.QueueMessage() in vdr.c that are related to reporting the
status of the editing process back to Skins.Message() in order to have them appear
immediately.
- When sorting recordings by name, folders are now always at the top of the list.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 2.88 2013/02/17 13:17:55 kls Exp $
* $Id: recording.c 2.89 2013/03/03 10:54:05 kls Exp $
*/
#include "recording.h"
@ -910,7 +910,7 @@ cRecording::~cRecording()
delete info;
}
char *cRecording::StripEpisodeName(char *s)
char *cRecording::StripEpisodeName(char *s, bool Strip)
{
char *t = s, *s1 = NULL, *s2 = NULL;
while (*t) {
@ -931,8 +931,10 @@ char *cRecording::StripEpisodeName(char *s)
// by '0' in SortName() (see below), which will result in the desired
// sequence:
*s1 = '1';
s1++;
memmove(s1, s2, t - s2 + 1);
if (Strip) {
s1++;
memmove(s1, s2, t - s2 + 1);
}
}
return s;
}
@ -941,8 +943,7 @@ char *cRecording::SortName(void) const
{
char **sb = (RecordingsSortMode == rsmName) ? &sortBufferName : &sortBufferTime;
if (!*sb) {
char *s = (RecordingsSortMode == rsmName) ? strdup(FileName() + strlen(VideoDirectory))
: StripEpisodeName(strdup(FileName() + strlen(VideoDirectory)));
char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory)), RecordingsSortMode != rsmName);
strreplace(s, '/', '0'); // some locales ignore '/' when sorting
int l = strxfrm(NULL, s, 0) + 1;
*sb = MALLOC(char, l);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 2.44 2013/02/14 15:13:14 kls Exp $
* $Id: recording.h 2.45 2013/03/03 10:48:39 kls Exp $
*/
#ifndef __RECORDING_H
@ -97,7 +97,7 @@ private:
cRecordingInfo *info;
cRecording(const cRecording&); // can't copy cRecording
cRecording &operator=(const cRecording &); // can't assign cRecording
static char *StripEpisodeName(char *s);
static char *StripEpisodeName(char *s, bool Strip);
char *SortName(void) const;
int GetResume(void) const;
time_t start;