Terminating timer when deleting recording

This commit is contained in:
Klaus Schmidinger 2002-02-17 14:29:13 +01:00
parent a87e7625dd
commit e18b303818
4 changed files with 52 additions and 20 deletions

View File

@ -1009,3 +1009,6 @@ Video Disk Recorder Revision History
information about the enhanced 'timers.conf' file format, and MANUAL for
a description of the new item in the "Edit Timer" menu and the enhanced
functionality of the "Blue" button in the "Timers" menu.
- When deleting a recording that is currently still being recorded, the related
timer will now automatically be terminated. If this is a repeating timer, it
will receive a "First day" setting that skips the timer for this day.

12
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.54 2002/02/17 12:36:19 kls Exp $
* $Id: i18n.c 1.55 2002/02/17 14:29:13 kls Exp $
*
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -422,6 +422,16 @@ const tPhrase Phrases[] = {
"Slette opptak?",
"Poistetaanko nauhoitus?",
},
{ "Timer still recording - really delete?",
"Timer zeichnet auf - trotzdem löschen?",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
{ "Stop recording?",
"Aufzeichnung beenden?",
"Koncaj snemanje?",

52
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.153 2002/02/17 13:00:13 kls Exp $
* $Id: menu.c 1.154 2002/02/17 14:00:54 kls Exp $
*/
#include "menu.h"
@ -1749,26 +1749,33 @@ eOSState cMenuRecordings::Del(void)
{
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri && !ri->IsDirectory()) {
//XXX what if this recording's file is currently in use???
//XXX if (!ti->recording) {
if (Interface->Confirm(tr("Delete recording?"))) {
cRecording *recording = GetRecording(ri);
if (recording) {
if (recording->Delete()) {
cReplayControl::ClearLastReplayed(ri->FileName());
cOsdMenu::Del(Current());
Recordings.Del(recording);
Display();
if (!Count())
return osBack;
if (Interface->Confirm(tr("Delete recording?"))) {
cRecordControl *rc = cRecordControls::GetRecordControl(ri->FileName());
if (rc) {
if (Interface->Confirm(tr("Timer still recording - really delete?"))) {
cTimer *timer = rc->Timer();
if (timer) {
timer->SkipToday();
cRecordControls::Process(time(NULL));
}
else
Interface->Error(tr("Error while deleting recording!"));
}
else
return osContinue;
}
//XXX }
//XXX else
//XXX Interface->Error(tr("Timer is recording!"));
cRecording *recording = GetRecording(ri);
if (recording) {
if (recording->Delete()) {
cReplayControl::ClearLastReplayed(ri->FileName());
cOsdMenu::Del(Current());
Recordings.Del(recording);
Display();
if (!Count())
return osBack;
}
else
Interface->Error(tr("Error while deleting recording!"));
}
}
}
return osContinue;
}
@ -2560,6 +2567,15 @@ const char *cRecordControls::GetInstantId(const char *LastInstantId)
return NULL;
}
cRecordControl *cRecordControls::GetRecordControl(const char *FileName)
{
for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i] && strcmp(RecordControls[i]->FileName(), FileName) == 0)
return RecordControls[i];
}
return NULL;
}
void cRecordControls::Process(time_t t)
{
for (int i = 0; i < MAXDVBAPI; i++) {

5
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.35 2002/01/20 13:38:34 kls Exp $
* $Id: menu.h 1.36 2002/02/17 13:40:41 kls Exp $
*/
#ifndef _MENU_H
@ -92,6 +92,8 @@ public:
void Stop(bool KeepInstant = false);
bool IsInstant(void) { return instantId; }
const char *InstantId(void) { return instantId; }
const char *FileName(void) { return fileName; }
cTimer *Timer(void) { return timer; }
};
class cRecordControls {
@ -103,6 +105,7 @@ public:
static void Stop(cDvbApi *DvbApi);
static bool StopPrimary(bool DoIt = false);
static const char *GetInstantId(const char *LastInstantId);
static cRecordControl *GetRecordControl(const char *FileName);
static void Process(time_t t);
static bool Active(void);
};