1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The Recordings menu can now be called with a cRecordingFilter

This commit is contained in:
Klaus Schmidinger 2013-12-25 12:13:00 +01:00
parent b936cb366f
commit f6283b8e91
4 changed files with 19 additions and 5 deletions

View File

@ -2868,6 +2868,8 @@ Lars Hanisch <dvb@flensrocker.de>
for reporting a possible crash if the recordings list is updated externally while the for reporting a possible crash if the recordings list is updated externally while the
Recordings menu is open Recordings menu is open
for reporting a missing closing ')' in the help entry of the --vfat option for reporting a missing closing ')' in the help entry of the --vfat option
for making the Recordings menu able to be called with a cRecordingFilter, which allows
the caller to have it display only a certain subset of the recordings
Alex Lasnier <alex@fepg.org> Alex Lasnier <alex@fepg.org>
for adding tuning support for ATSC devices for adding tuning support for ATSC devices

View File

@ -8072,3 +8072,6 @@ Video Disk Recorder Revision History
- Fixed setting the name of the video directory to avoid a crash when using --genindex, - Fixed setting the name of the video directory to avoid a crash when using --genindex,
and also to use the correct directory with --edit (the latter reported by Marko and also to use the correct directory with --edit (the latter reported by Marko
Mäkelä). Mäkelä).
- The Recordings menu can now be called with a cRecordingFilter, which allows the
caller to have it display only a certain subset of the recordings (thanks to Lars
Hanisch).

7
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.13 2013/11/03 14:08:35 kls Exp $ * $Id: menu.c 3.14 2013/12/25 12:03:32 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2571,12 +2571,13 @@ void cMenuRecordingItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, b
cString cMenuRecordings::path; cString cMenuRecordings::path;
cString cMenuRecordings::fileName; cString cMenuRecordings::fileName;
cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus, const cRecordingFilter *Filter)
:cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6) :cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6)
{ {
SetMenuCategory(mcRecording); SetMenuCategory(mcRecording);
base = Base ? strdup(Base) : NULL; base = Base ? strdup(Base) : NULL;
level = Setup.RecordingDirs ? Level : -1; level = Setup.RecordingDirs ? Level : -1;
filter = Filter;
Recordings.StateChanged(recordingsState); // just to get the current state Recordings.StateChanged(recordingsState); // just to get the current state
helpKeys = -1; helpKeys = -1;
Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay
@ -2633,7 +2634,7 @@ void cMenuRecordings::Set(bool Refresh)
GetRecordingsSortMode(DirectoryName()); GetRecordingsSortMode(DirectoryName());
Recordings.Sort(); Recordings.Sort();
for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) { for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR)) { if ((!filter || filter->Filter(recording)) && (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == FOLDERDELIMCHAR))) {
cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level); cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
cMenuRecordingItem *LastDir = NULL; cMenuRecordingItem *LastDir = NULL;
if (Item->IsDirectory()) { if (Item->IsDirectory()) {

12
menu.h
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.h 3.4 2013/10/30 14:32:13 kls Exp $ * $Id: menu.h 3.5 2013/12/25 12:06:03 kls Exp $
*/ */
#ifndef __MENU_H #ifndef __MENU_H
@ -191,6 +191,13 @@ public:
cOsdObject *CamControl(void); cOsdObject *CamControl(void);
bool CamMenuActive(void); bool CamMenuActive(void);
class cRecordingFilter {
public:
virtual ~cRecordingFilter(void) {};
virtual bool Filter(const cRecording *Recording) const = 0;
///< Returns true if the given Recording shall be displayed in the Recordings menu.
};
class cMenuRecordingItem; class cMenuRecordingItem;
class cMenuRecordings : public cOsdMenu { class cMenuRecordings : public cOsdMenu {
@ -199,6 +206,7 @@ private:
int level; int level;
int recordingsState; int recordingsState;
int helpKeys; int helpKeys;
const cRecordingFilter *filter;
static cString path; static cString path;
static cString fileName; static cString fileName;
void SetHelpKeys(void); void SetHelpKeys(void);
@ -213,7 +221,7 @@ private:
protected: protected:
cString DirectoryName(void); cString DirectoryName(void);
public: public:
cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false); cMenuRecordings(const char *Base = NULL, int Level = 0, bool OpenSubMenus = false, const cRecordingFilter *Filter = NULL);
~cMenuRecordings(); ~cMenuRecordings();
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
static void SetPath(const char *Path); static void SetPath(const char *Path);