summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-09-25 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2005-09-25 18:00:00 +0200
commitc16bbf7422f37108580e559ca849e5aafbdac672 (patch)
tree8ee8d17a971364a9231a83abf5bcff4e30bed9b3 /menu.c
parentd5c85f5ff84ffea666c63eca5dbe04632283cb04 (diff)
downloadvdr-patch-lnbsharing-c16bbf7422f37108580e559ca849e5aafbdac672.tar.gz
vdr-patch-lnbsharing-c16bbf7422f37108580e559ca849e5aafbdac672.tar.bz2
Version 1.3.33vdr-1.3.33
- Fixed two errors in 'newplugin' (thanks to Alexander Rieger). - Fixed converting arbitrarily formatted summary.vdr files (thanks to Thomas Günther). - Fixed handling color buttons in cMenuEditStrItem (thanks to Alexander Rieger). - Added cChannel::LinkChannels() and cChannel::RefChannel() (suggested by Helmut Auer). Note that VDR itself doesn't actually use the linked channels, yet, so there is no guarantee that this really works under all circumstances. - Added a missing include statement to the 'sky' plugin (thanks to Alfred Zastrow for reporting this one). - Fixed handling key macros with keys after @plugin (thanks to Rolf Ahrenberg for reporting this one). - Fixed error handling in cCiTransportConnection::RecvTPDU() (thanks to Georg Acher for reporting this one). - Removed obsolete 'shift' code in device.[hc]. - The SVDRP command DELR no longer triggers a complete reload of the global Recordings list, but rather deletes that particular entry. - The list of recordings is now read in a separate thread, resulting in a faster startup if there are a great many of recordings, or the disk(s) have to spin up. If the Recordings menu is opened while the list of recordings is still being read, the menu will be updated accordingly. Plugins that access the global Recordings variable should lock the thread by putting something like cThreadLock RecordingsLock(&Recordings); into the respective code block. Thanks to Carsten Koch for his help in testing and debugging this. - The 'new' indicator in the Recordings menu is now kept up-to-date (thanks to Thomas Günther). - Updated the Romanian OSD texts (thanks to Lucian Muresan). - Updated the Russian OSD texts (thanks to Oleg Roitburd). - The '.update' file in the video directory is now touched when a recording is added or deleted, so that other VDR instances can update their lists (thanks to Alexander Rieger). - Made the function ExchangeChars() public (suggested by Lucian Muresan).
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c85
1 files changed, 57 insertions, 28 deletions
diff --git a/menu.c b/menu.c
index 9709212..a28c8a8 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 1.359 2005/09/03 11:42:27 kls Exp $
+ * $Id: menu.c 1.362 2005/09/25 13:37:21 kls Exp $
*/
#include "menu.h"
@@ -1506,35 +1506,12 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
{
base = Base ? strdup(Base) : NULL;
level = Setup.RecordingDirs ? Level : -1;
+ Recordings.StateChanged(recordingsState); // just to get the current state
Display(); // this keeps the higher level menus from showing up briefly when pressing 'Back' during replay
- const char *LastReplayed = cReplayControl::LastReplayed();
- cMenuRecordingItem *LastItem = NULL;
- char *LastItemText = NULL;
- if (!Base)
- Recordings.Sort();
- for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
- if (!Base || (strstr(recording->Name(), Base) == recording->Name() && recording->Name()[strlen(Base)] == '~')) {
- cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
- if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) {
- Add(Item);
- LastItem = Item;
- free(LastItemText);
- LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters!
- }
- else
- delete Item;
- if (LastItem) {
- if (LastReplayed && strcmp(LastReplayed, recording->FileName()) == 0)
- SetCurrent(LastItem);
- if (LastItem->IsDirectory())
- LastItem->IncrementCounter(recording->IsNew());
- }
- }
- }
- free(LastItemText);
+ Set();
if (Current() < 0)
SetCurrent(First());
- else if (OpenSubMenus && Open(true))
+ else if (OpenSubMenus && cReplayControl::LastReplayed() && Open(true))
return;
SetHelpKeys();
}
@@ -1570,6 +1547,45 @@ void cMenuRecordings::SetHelpKeys(void)
}
}
+void cMenuRecordings::Set(bool Refresh)
+{
+ const char *CurrentRecording = cReplayControl::LastReplayed();
+ cMenuRecordingItem *LastItem = NULL;
+ char *LastItemText = NULL;
+ cThreadLock RecordingsLock(&Recordings);
+ if (Refresh) {
+ cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
+ if (ri) {
+ cRecording *Recording = GetRecording(ri);
+ if (Recording)
+ CurrentRecording = Recording->FileName();
+ }
+ }
+ Clear();
+ Recordings.Sort();
+ for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
+ if (!base || (strstr(recording->Name(), base) == recording->Name() && recording->Name()[strlen(base)] == '~')) {
+ cMenuRecordingItem *Item = new cMenuRecordingItem(recording, level);
+ if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) {
+ Add(Item);
+ LastItem = Item;
+ free(LastItemText);
+ LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters!
+ }
+ else
+ delete Item;
+ if (LastItem) {
+ if (CurrentRecording && strcmp(CurrentRecording, recording->FileName()) == 0)
+ SetCurrent(LastItem);
+ if (LastItem->IsDirectory())
+ LastItem->IncrementCounter(recording->IsNew());
+ }
+ }
+ }
+ free(LastItemText);
+ Display();
+}
+
cRecording *cMenuRecordings::GetRecording(cMenuRecordingItem *Item)
{
cRecording *recording = Recordings.GetByName(Item->FileName());
@@ -1654,8 +1670,8 @@ eOSState cMenuRecordings::Delete(void)
if (recording) {
if (recording->Delete()) {
cReplayControl::ClearLastReplayed(ri->FileName());
+ Recordings.DelByName(ri->FileName());
cOsdMenu::Del(Current());
- Recordings.Del(recording);
SetHelpKeys();
Display();
if (!Count())
@@ -1716,6 +1732,9 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
case kYellow: return Delete();
case kBlue: return Info();
case k1...k9: return Commands(Key);
+ case kNone: if (Recordings.StateChanged(recordingsState))
+ Set(true);
+ break;
default: break;
}
}
@@ -2202,6 +2221,8 @@ cMenuSetupRecord::cMenuSetupRecord(void)
// --- cMenuSetupReplay ------------------------------------------------------
class cMenuSetupReplay : public cMenuSetupBase {
+protected:
+ virtual void Store(void);
public:
cMenuSetupReplay(void);
};
@@ -2214,6 +2235,13 @@ cMenuSetupReplay::cMenuSetupReplay(void)
Add(new cMenuEditIntItem(tr("Setup.Replay$Resume ID"), &data.ResumeID, 0, 99));
}
+void cMenuSetupReplay::Store(void)
+{
+ if (Setup.ResumeID != data.ResumeID)
+ Recordings.ResetResume();
+ cMenuSetupBase::Store();
+}
+
// --- cMenuSetupMisc --------------------------------------------------------
class cMenuSetupMisc : public cMenuSetupBase {
@@ -2597,6 +2625,7 @@ static void SetTrackDescriptions(bool Live)
}
}
else if (cReplayControl::LastReplayed()) {
+ cThreadLock RecordingsLock(&Recordings);
cRecording *Recording = Recordings.GetByName(cReplayControl::LastReplayed());
if (Recording)
Components = Recording->Info()->Components();