From c16bbf7422f37108580e559ca849e5aafbdac672 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 25 Sep 2005 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.33=20-=20Fixed=20two=20errors=20in=20'new?= =?UTF-8?q?plugin'=20(thanks=20to=20Alexander=20Rieger).=20-=20Fixed=20con?= =?UTF-8?q?verting=20arbitrarily=20formatted=20summary.vdr=20files=20(than?= =?UTF-8?q?ks=20to=20Thomas=20G=C3=BCnther).=20-=20Fixed=20handling=20colo?= =?UTF-8?q?r=20buttons=20in=20cMenuEditStrItem=20(thanks=20to=20Alexander?= =?UTF-8?q?=20Rieger).=20-=20Added=20cChannel::LinkChannels()=20and=20cCha?= =?UTF-8?q?nnel::RefChannel()=20(suggested=20by=20Helmut=20Auer).=20=20=20?= =?UTF-8?q?Note=20that=20VDR=20itself=20doesn't=20actually=20use=20the=20l?= =?UTF-8?q?inked=20channels,=20yet,=20so=20there=20is=20=20=20no=20guarant?= =?UTF-8?q?ee=20that=20this=20really=20works=20under=20all=20circumstances?= =?UTF-8?q?.=20-=20Added=20a=20missing=20include=20statement=20to=20the=20?= =?UTF-8?q?'sky'=20plugin=20(thanks=20to=20Alfred=20Zastrow=20=20=20for=20?= =?UTF-8?q?reporting=20this=20one).=20-=20Fixed=20handling=20key=20macros?= =?UTF-8?q?=20with=20keys=20after=20@plugin=20(thanks=20to=20Rolf=20Ahrenb?= =?UTF-8?q?erg=20for=20=20=20reporting=20this=20one).=20-=20Fixed=20error?= =?UTF-8?q?=20handling=20in=20cCiTransportConnection::RecvTPDU()=20(thanks?= =?UTF-8?q?=20to=20Georg=20Acher=20=20=20for=20reporting=20this=20one).=20?= =?UTF-8?q?-=20Removed=20obsolete=20'shift'=20code=20in=20device.[hc].=20-?= =?UTF-8?q?=20The=20SVDRP=20command=20DELR=20no=20longer=20triggers=20a=20?= =?UTF-8?q?complete=20reload=20of=20the=20global=20Recordings=20=20=20list?= =?UTF-8?q?,=20but=20rather=20deletes=20that=20particular=20entry.=20-=20T?= =?UTF-8?q?he=20list=20of=20recordings=20is=20now=20read=20in=20a=20separa?= =?UTF-8?q?te=20thread,=20resulting=20in=20a=20faster=20=20=20startup=20if?= =?UTF-8?q?=20there=20are=20a=20great=20many=20of=20recordings,=20or=20the?= =?UTF-8?q?=20disk(s)=20have=20to=20spin=20up.=20=20=20If=20the=20Recordin?= =?UTF-8?q?gs=20menu=20is=20opened=20while=20the=20list=20of=20recordings?= =?UTF-8?q?=20is=20still=20being=20read,=20=20=20the=20menu=20will=20be=20?= =?UTF-8?q?updated=20accordingly.=20=20=20Plugins=20that=20access=20the=20?= =?UTF-8?q?global=20Recordings=20variable=20should=20lock=20the=20thread?= =?UTF-8?q?=20=20=20by=20putting=20something=20like?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- menu.c | 85 ++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 28 deletions(-) (limited to 'menu.c') 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(); -- cgit v1.2.3