summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2013-03-03 11:04:22 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2013-03-03 11:04:22 +0100
commitf239934bf99abcb910002526bf95d226ac66ce03 (patch)
treeffd2cf2977246b88fab3323026bf600b85df4080
parente0448bded8d69568291e5ce1e515396dad97d0c9 (diff)
downloadvdr-f239934bf99abcb910002526bf95d226ac66ce03.tar.gz
vdr-f239934bf99abcb910002526bf95d226ac66ce03.tar.bz2
When sorting recordings by name, folders are now always at the top of the list
-rw-r--r--HISTORY1
-rw-r--r--recording.c13
-rw-r--r--recording.h4
3 files changed, 10 insertions, 8 deletions
diff --git a/HISTORY b/HISTORY
index 62a49388..671a901a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/recording.c b/recording.c
index 3359de36..ede7c1b9 100644
--- a/recording.c
+++ b/recording.c
@@ -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);
diff --git a/recording.h b/recording.h
index 48d6f683..4807fc9d 100644
--- a/recording.h
+++ b/recording.h
@@ -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;