Instant recording can now be stopped via the menu

This commit is contained in:
Klaus Schmidinger 2000-04-30 11:15:16 +02:00
parent 49ce70fdb3
commit f7ac74ede4
5 changed files with 41 additions and 17 deletions

3
MANUAL
View File

@ -52,7 +52,8 @@ Video Disk Recorder User's Manual
button. This will create a timer event named "instant" that starts
at the current time and records for two hours.
If you want to modify the recording time you need to edit the timer.
Stop instant recording by disabling or deleting the timer.
Stop instant recording by pressing the "Menu" button and selecting
"Stop Recording", or by disabling the timer.
* Replaying a Recording

33
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.11 2000/04/30 10:10:19 kls Exp $
* $Id: menu.c 1.12 2000/04/30 11:10:49 kls Exp $
*/
#include "menu.h"
@ -991,12 +991,14 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
// --- cMenuMain -------------------------------------------------------------
cMenuMain::cMenuMain(void)
cMenuMain::cMenuMain(bool Recording)
:cOsdMenu("Main")
{
Add(new cOsdItem("Channels", osChannels));
Add(new cOsdItem("Timer", osTimer));
Add(new cOsdItem("Recordings", osRecordings));
if (Recording)
Add(new cOsdItem("Stop Recording", osStopRecord));
Display();
}
@ -1008,6 +1010,8 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
case osChannels: return AddSubMenu(new cMenuChannels);
case osTimer: return AddSubMenu(new cMenuTimers);
case osRecordings: return AddSubMenu(new cMenuRecordings);
case osStopRecord: if (!Interface.Confirm("Stop Recording?"))
return osContinue;
default: if (Key == kMenu)
state = osEnd;
}
@ -1019,6 +1023,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
cRecordControl::cRecordControl(cTimer *Timer)
{
timer = Timer;
isInstant = !timer;
if (!timer) {
timer = new cTimer(true);
Timers.Add(timer);
@ -1032,14 +1037,22 @@ cRecordControl::cRecordControl(cTimer *Timer)
cRecordControl::~cRecordControl()
{
DvbApi.StopRecord();
timer->SetRecording(false);
if (timer->IsSingleEvent() && !timer->Matches()) {
// checking timer->Matches() to make sure we don't delete the timer
// if the program was cancelled before the timer's stop time!
isyslog(LOG_INFO, "deleting timer %d", timer->Index() + 1);
Timers.Del(timer);
Timers.Save();
Stop(true);
}
void cRecordControl::Stop(bool KeepInstant)
{
if (timer) {
DvbApi.StopRecord();
timer->SetRecording(false);
if ((isInstant && !KeepInstant) || (timer->IsSingleEvent() && !timer->Matches())) {
// checking timer->Matches() to make sure we don't delete the timer
// if the program was cancelled before the timer's stop time!
isyslog(LOG_INFO, "deleting timer %d", timer->Index() + 1);
Timers.Del(timer);
Timers.Save();
}
timer = NULL;
}
}

7
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.7 2000/04/29 17:54:55 kls Exp $
* $Id: menu.h 1.8 2000/04/30 10:58:49 kls Exp $
*/
#ifndef _MENU_H
@ -14,17 +14,20 @@
class cMenuMain : public cOsdMenu {
public:
cMenuMain(void);
cMenuMain(bool Recording);
virtual eOSState ProcessKey(eKeys Key);
};
class cRecordControl : public cOsdBase {
private:
cTimer *timer;
bool isInstant;
public:
cRecordControl(cTimer *Timer = NULL);
virtual ~cRecordControl();
virtual eOSState ProcessKey(eKeys Key);
void Stop(bool KeepInstant = false);
bool IsInstant(void) { return isInstant; }
};
class cReplayControl : public cOsdBase {

3
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.6 2000/04/30 09:47:52 kls Exp $
* $Id: osd.h 1.7 2000/04/30 10:37:15 kls Exp $
*/
#ifndef __OSD_H
@ -23,6 +23,7 @@ enum eOSState { osUnknown,
osTimer,
osRecordings,
osReplay,
osStopRecord,
osBack,
osEnd,
};

12
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.15 2000/04/30 10:19:52 kls Exp $
* $Id: vdr.c 1.16 2000/04/30 11:06:41 kls Exp $
*/
#include <signal.h>
@ -111,12 +111,18 @@ int main(int argc, char *argv[])
if (*Interact) {
switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu);
Menu = new cMenuMain;
Menu = new cMenuMain(RecordControl && RecordControl->IsInstant());
break;
case osReplay: DELETENULL(Menu);
DELETENULL(ReplayControl);
ReplayControl = new cReplayControl;
break;
case osStopRecord: if (RecordControl) {
RecordControl->Stop();
DELETENULL(Menu); // must make sure no menu uses the timer
DELETENULL(RecordControl);
}
break;
case osBack:
case osEnd: DELETENULL(*Interact);
break;
@ -140,7 +146,7 @@ int main(int argc, char *argv[])
RecordControl = new cRecordControl;
break;
// Menu Control:
case kMenu: Menu = new cMenuMain; break;
case kMenu: Menu = new cMenuMain(RecordControl && RecordControl->IsInstant()); break;
// Up/Down Channel Select:
case kUp:
case kDown: if (!RecordControl) {