summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--menu.c42
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
diff --git a/HISTORY b/HISTORY
index 69212db0..080786c5 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/menu.c b/menu.c
index dd95ae61..b0a511a3 100644
--- a/menu.c
+++ b/menu.c
@@ -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)) {