summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-04-30 11:15:16 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-04-30 11:15:16 +0200
commitf7ac74ede445b099e8fa97a15674f2b4ecde279a (patch)
tree508f111a8996e2d0fddab37bbe5251f69f39b2eb
parent49ce70fdb39d1505d593da179f52c8f1f0bdcfb1 (diff)
downloadvdr-f7ac74ede445b099e8fa97a15674f2b4ecde279a.tar.gz
vdr-f7ac74ede445b099e8fa97a15674f2b4ecde279a.tar.bz2
Instant recording can now be stopped via the menu
-rw-r--r--MANUAL3
-rw-r--r--menu.c33
-rw-r--r--menu.h7
-rw-r--r--osd.h3
-rw-r--r--vdr.c12
5 files changed, 41 insertions, 17 deletions
diff --git a/MANUAL b/MANUAL
index 36a62987..27759dbd 100644
--- a/MANUAL
+++ b/MANUAL
@@ -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
diff --git a/menu.c b/menu.c
index f5d1aa7a..f6bd4a40 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.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;
}
}
diff --git a/menu.h b/menu.h
index 6b647a8a..47bc993b 100644
--- a/menu.h
+++ b/menu.h
@@ -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 {
diff --git a/osd.h b/osd.h
index cf7ac06d..6c7aa4a5 100644
--- a/osd.h
+++ b/osd.h
@@ -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,
};
diff --git a/vdr.c b/vdr.c
index e58327d7..32ae9eba 100644
--- a/vdr.c
+++ b/vdr.c
@@ -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) {