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 - 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 status of the editing process back to Skins.Message() in order to have them appear
immediately. 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "recording.h"
@ -910,7 +910,7 @@ cRecording::~cRecording()
delete info; delete info;
} }
char *cRecording::StripEpisodeName(char *s) char *cRecording::StripEpisodeName(char *s, bool Strip)
{ {
char *t = s, *s1 = NULL, *s2 = NULL; char *t = s, *s1 = NULL, *s2 = NULL;
while (*t) { while (*t) {
@ -931,9 +931,11 @@ char *cRecording::StripEpisodeName(char *s)
// by '0' in SortName() (see below), which will result in the desired // by '0' in SortName() (see below), which will result in the desired
// sequence: // sequence:
*s1 = '1'; *s1 = '1';
if (Strip) {
s1++; s1++;
memmove(s1, s2, t - s2 + 1); memmove(s1, s2, t - s2 + 1);
} }
}
return s; return s;
} }
@ -941,8 +943,7 @@ char *cRecording::SortName(void) const
{ {
char **sb = (RecordingsSortMode == rsmName) ? &sortBufferName : &sortBufferTime; char **sb = (RecordingsSortMode == rsmName) ? &sortBufferName : &sortBufferTime;
if (!*sb) { if (!*sb) {
char *s = (RecordingsSortMode == rsmName) ? strdup(FileName() + strlen(VideoDirectory)) char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory)), RecordingsSortMode != rsmName);
: StripEpisodeName(strdup(FileName() + strlen(VideoDirectory)));
strreplace(s, '/', '0'); // some locales ignore '/' when sorting strreplace(s, '/', '0'); // some locales ignore '/' when sorting
int l = strxfrm(NULL, s, 0) + 1; int l = strxfrm(NULL, s, 0) + 1;
*sb = MALLOC(char, l); *sb = MALLOC(char, l);

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: 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 #ifndef __RECORDING_H
@ -97,7 +97,7 @@ private:
cRecordingInfo *info; cRecordingInfo *info;
cRecording(const cRecording&); // can't copy cRecording cRecording(const cRecording&); // can't copy cRecording
cRecording &operator=(const cRecording &); // can't assign 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; char *SortName(void) const;
int GetResume(void) const; int GetResume(void) const;
time_t start; time_t start;