summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2019-10-31 16:43:08 +0100
committerhorchi <vdr@jwendel.de>2019-10-31 16:43:08 +0100
commit2a8e85fd87e52faac05b375c4efd6c656f5ced3b (patch)
treee19d5c6fd86392008beb884dc890bb01fcabcbac
parent8f9d6729d22a7aa1d5d16763a6aacb3e8f9f276d (diff)
downloadvdr-plugin-epg2vdr-2a8e85fd87e52faac05b375c4efd6c656f5ced3b.tar.gz
vdr-plugin-epg2vdr-2a8e85fd87e52faac05b375c4efd6c656f5ced3b.tar.bz2
dev
-rw-r--r--menu.h39
-rw-r--r--menurec.c50
2 files changed, 40 insertions, 49 deletions
diff --git a/menu.h b/menu.h
index e557caa..22995a9 100644
--- a/menu.h
+++ b/menu.h
@@ -563,34 +563,37 @@ class cMenuDbRecordings : public cOsdMenu
{
public:
- cMenuDbRecordings(const char* Base = nullptr, int Level = 0, bool OpenSubMenus = false, const cRecordingFilter* Filter = nullptr);
+ cMenuDbRecordings(const char* Base = nullptr, int Level = 0, bool OpenSubMenus = false);
virtual ~cMenuDbRecordings();
+
virtual eOSState ProcessKey(eKeys Key);
- static void SetPath(const char *Path);
- static void SetRecording(const char *FileName);
+ static void SetPath(const char* Path);
+ static void SetRecording(const char* FileName);
protected:
- cString DirectoryName(void);
+ cString DirectoryName();
private:
- char* base;
- int level;
- cStateKey recordingsStateKey;
- int helpKeys;
- const cRecordingFilter* filter;
- static cString path;
- static cString fileName;
- void SetHelpKeys(void);
- void Set(bool Refresh = false);
+ void SetHelpKeys();
+ void LoadPlainList(bool Refresh = false);
bool Open(bool OpenSubMenus = false);
- eOSState Play(void);
- eOSState Rewind(void);
- // eOSState Delete(void);
- // eOSState Info(void);
- eOSState Sort(void);
+ eOSState Play();
+ eOSState Rewind();
+ // eOSState Delete();
+ // eOSState Info();
+ eOSState Sort();
eOSState Commands(eKeys Key = kNone);
+ // data
+
cMenuDb* menuDb {nullptr};
+
+ char* base {nullptr};
+ int level {-1};
+ int helpKeys {-1};
+ cStateKey recordingsStateKey; // list lock
+ static cString path;
+ static cString fileName;
};
diff --git a/menurec.c b/menurec.c
index 3b256ab..b4138eb 100644
--- a/menurec.c
+++ b/menurec.c
@@ -39,9 +39,9 @@ class cMenuDbRecordingItem : public cOsdItem
private:
const cRecording* recording {nullptr};
- int level;
+ int level {0};
char* name {nullptr};
- int totalEntries, newEntries;
+ int totalEntries {0}, newEntries {0};
cMenuDb* menuDb {nullptr};
};
@@ -50,9 +50,6 @@ cMenuDbRecordingItem::cMenuDbRecordingItem(cMenuDb* db, const cRecording* Record
menuDb = db;
recording = Recording;
level = Level;
- totalEntries = newEntries = 0;
-
- // SetText(Recording->Title('\t', true, Level));
SetText(menuDb->recordingListDb->getStrValue("TITLE"));
@@ -97,21 +94,20 @@ void cMenuDbRecordingItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index,
cString cMenuDbRecordings::path;
cString cMenuDbRecordings::fileName;
-cMenuDbRecordings::cMenuDbRecordings(const char* Base, int Level, bool OpenSubMenus, const cRecordingFilter* Filter)
+cMenuDbRecordings::cMenuDbRecordings(const char* Base, int Level, bool OpenSubMenus)
: cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6)
{
menuDb = new cMenuDb;
SetMenuCategory(mcRecording);
- base = Base ? strdup(Base) : NULL;
+ base = Base ? strdup(Base) : nullptr;
level = Setup.RecordingDirs ? Level : -1;
- filter = Filter;
- helpKeys = -1;
+
Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay
if (menuDb->dbConnected())
{
- Set();
+ LoadPlainList();
}
if (Current() < 0)
@@ -177,13 +173,13 @@ void cMenuDbRecordings::SetHelpKeys(void)
//
//***************************************************************************
-void cMenuDbRecordings::Set(bool Refresh)
+void cMenuDbRecordings::LoadPlainList(bool Refresh)
{
if (!cRecordings::GetRecordingsRead(recordingsStateKey))
return ;
recordingsStateKey.Remove();
- cRecordings* Recordings = cRecordings::GetRecordingsWrite(recordingsStateKey); // write access is necessary for sorting!
+ const cRecordings* Recordings = cRecordings::GetRecordingsRead(recordingsStateKey);
Clear();
@@ -208,7 +204,7 @@ void cMenuDbRecordings::Set(bool Refresh)
menuDb->selectRecordings->freeResult();
- recordingsStateKey.Remove(false); // sorting doesn't count as a real modification
+ recordingsStateKey.Remove(false);
if (Refresh)
Display();
@@ -339,7 +335,7 @@ bool cMenuDbRecordings::Open(bool OpenSubMenus)
t = buffer;
}
- AddSubMenu(new cMenuDbRecordings(t, level + 1, OpenSubMenus, filter));
+ AddSubMenu(new cMenuDbRecordings(t, level + 1, OpenSubMenus));
return true;
}
@@ -478,19 +474,11 @@ eOSState cMenuDbRecordings::Commands(eKeys Key)
return osContinue;
}
-eOSState cMenuDbRecordings::Sort(void)
+eOSState cMenuDbRecordings::Sort()
{
- if (HasSubMenu())
- return osContinue;
-
- if (const cMenuDbRecordingItem *ri = (cMenuDbRecordingItem *)Get(Current()))
- SetRecording(ri->Recording()->FileName()); // makes sure the Recordings menu will reposition to the current recording
+ LoadPlainList();
- IncRecordingsSortMode(DirectoryName());
- recordingsStateKey.Reset();
- Set(true);
-
- return osContinue;
+ return osContinue;
}
eOSState cMenuDbRecordings::ProcessKey(eKeys Key)
@@ -566,13 +554,13 @@ eOSState cMenuDbRecordings::ProcessKey(eKeys Key)
}
*/
- if (!HasSubMenu())
- {
- Set(true);
+ // if (!HasSubMenu())
+ // {
+ // Set(true);
- if (Key != kNone)
- SetHelpKeys();
- }
+ // if (Key != kNone)
+ // SetHelpKeys();
+ // }
return state;
}