The "Select folder" menu now adds the folder names of all existing recordings to any names that have been predefined in "folders.conf"

This commit is contained in:
Klaus Schmidinger 2015-02-04 13:20:37 +01:00
parent f2807bc782
commit 3e06c99a0a
3 changed files with 45 additions and 1 deletions

View File

@ -3171,6 +3171,8 @@ S
changed after VDR has been started changed after VDR has been started
for reporting that the change "Fixed some compiler warnings with Clang 3.4.1" caused for reporting that the change "Fixed some compiler warnings with Clang 3.4.1" caused
ci.c to no longer compile with older versions of gcc ci.c to no longer compile with older versions of gcc
for suggesting to make the "Select folder" menu add the folder names of all existing
recordings to any names that have been predefined in "folders.conf"
Peter Münster <pmlists@free.fr> Peter Münster <pmlists@free.fr>
for fixing 'make install' to not overwrite existing configuration files for fixing 'make install' to not overwrite existing configuration files

View File

@ -8492,3 +8492,5 @@ Video Disk Recorder Revision History
recording's folder path name (suggested by Christoph Haubrich). See MANUAL, section recording's folder path name (suggested by Christoph Haubrich). See MANUAL, section
"Managing folders" for details. "Managing folders" for details.
- Updated the Italian OSD texts (thanks to Nino Gerbino). - Updated the Italian OSD texts (thanks to Nino Gerbino).
- The "Select folder" menu now adds the folder names of all existing recordings to
any names that have been predefined in "folders.conf" (suggested by Sören Moch).

42
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 3.40 2015/02/04 09:21:55 kls Exp $ * $Id: menu.c 3.41 2015/02/04 12:18:27 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -766,8 +766,48 @@ void cMenuFolder::SetHelpKeys(void)
} }
} }
#define FOLDERDELIMCHARSUBST 0x01
static void AddRecordingFolders(cList<cNestedItem> *List, char *Path)
{
if (Path) {
char *p = strchr(Path, FOLDERDELIMCHARSUBST);
if (p)
*p++ = 0;
cNestedItem *Folder;
for (Folder = List->First(); Folder; Folder = List->Next(Folder)) {
if (strcmp(Path, Folder->Text()) == 0)
break;
}
if (!Folder)
List->Add(Folder = new cNestedItem(Path));
if (p) {
Folder->SetSubItems(true);
AddRecordingFolders(Folder->SubItems(), p);
}
}
else {
cThreadLock RecordingsLock(&Recordings);
cStringList Dirs;
for (cRecording *Recording = Recordings.First(); Recording; Recording = Recordings.Next(Recording)) {
cString Folder = Recording->Folder();
strreplace((char *)*Folder, FOLDERDELIMCHAR, FOLDERDELIMCHARSUBST); // makes sure parent folders come before subfolders
if (Dirs.Find(Folder) < 0)
Dirs.Append(strdup(Folder));
}
Dirs.Sort();
for (int i = 0; i < Dirs.Size(); i++) {
char *s = Dirs[i];
if (*s)
AddRecordingFolders(&Folders, s);
}
}
}
void cMenuFolder::Set(const char *CurrentFolder) void cMenuFolder::Set(const char *CurrentFolder)
{ {
static int RecordingsState = -1;
if (list == &Folders && Recordings.StateChanged(RecordingsState))
AddRecordingFolders(&Folders, NULL);
firstFolder = NULL; firstFolder = NULL;
Clear(); Clear();
if (!isempty(dir)) { if (!isempty(dir)) {