diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2021-05-21 10:41:46 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2021-05-21 10:41:46 +0200 |
commit | ada85b693e41d9f41393e266f9a7829a6f69ac6b (patch) | |
tree | df11c89e06a87dde04b7b7d572ef630ce721061b /menu.c | |
parent | a1a8c5d94c4cc2ed6cc5b77c1c3a9bda4796b782 (diff) | |
download | vdr-ada85b693e41d9f41393e266f9a7829a6f69ac6b.tar.gz vdr-ada85b693e41d9f41393e266f9a7829a6f69ac6b.tar.bz2 |
The 'Edit path' dialog now also shows the total size of all recordings in that path
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 5.5 2021/05/19 11:22:20 kls Exp $ + * $Id: menu.c 5.6 2021/05/21 10:41:31 kls Exp $ */ #include "menu.h" @@ -2549,6 +2549,23 @@ cMenuPathEdit::cMenuPathEdit(const char *Path) p->SetSelectable(!pathIsInUse); Add(p = new cMenuEditStrItem(tr("Name"), name, sizeof(name))); p->SetSelectable(!pathIsInUse); + if (*path) { + int DirSize = 0; + { + LOCK_RECORDINGS_READ; + for (const cRecording *Recording = Recordings->First(); Recording; Recording = Recordings->Next(Recording)) { + if (Recording->IsInPath(path)) { + int FileSizeMB = Recording->FileSizeMB(); + if (FileSizeMB > 0 ) + DirSize += FileSizeMB; + } + } + } + if (DirSize > 1023) + Add(new cOsdItem(cString::sprintf("%s:\t%.2f GB", tr("Size"), DirSize / 1024.), osUnknown, false)); + else + Add(new cOsdItem(cString::sprintf("%s:\t%d MB", tr("Size"), DirSize), osUnknown, false)); + } if (pathIsInUse) { Add(new cOsdItem("", osUnknown, false)); Add(new cOsdItem(tr("This folder is currently in use - no changes are possible!"), osUnknown, false)); |