diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-02-04 13:20:37 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-02-04 13:20:37 +0100 |
commit | 3e06c99a0a5baabc669fecb134c2c8f94d2754c2 (patch) | |
tree | 591d882dea2415f3c157d82c516e9fee6d001539 | |
parent | f2807bc7828acd80bbeacbdcd8c96c76e7bc8678 (diff) | |
download | vdr-3e06c99a0a5baabc669fecb134c2c8f94d2754c2.tar.gz vdr-3e06c99a0a5baabc669fecb134c2c8f94d2754c2.tar.bz2 |
The "Select folder" menu now adds the folder names of all existing recordings to any names that have been predefined in "folders.conf"
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | menu.c | 42 |
3 files changed, 45 insertions, 1 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2fb49f6e..3fa3c065 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3171,6 +3171,8 @@ Sören Moch <smoch@web.de> changed after VDR has been started 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 + 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> for fixing 'make install' to not overwrite existing configuration files @@ -8492,3 +8492,5 @@ Video Disk Recorder Revision History recording's folder path name (suggested by Christoph Haubrich). See MANUAL, section "Managing folders" for details. - 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). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -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) { + static int RecordingsState = -1; + if (list == &Folders && Recordings.StateChanged(RecordingsState)) + AddRecordingFolders(&Folders, NULL); firstFolder = NULL; Clear(); if (!isempty(dir)) { |