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 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 a description of the new item in the "Edit Timer" menu and the enhanced
functionality of the "Blue" button in the "Timers" menu. 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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> * Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it> * Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -422,6 +422,16 @@ const tPhrase Phrases[] = {
"Slette opptak?", "Slette opptak?",
"Poistetaanko nauhoitus?", "Poistetaanko nauhoitus?",
}, },
{ "Timer still recording - really delete?",
"Timer zeichnet auf - trotzdem löschen?",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
{ "Stop recording?", { "Stop recording?",
"Aufzeichnung beenden?", "Aufzeichnung beenden?",
"Koncaj snemanje?", "Koncaj snemanje?",

52
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -1749,26 +1749,33 @@ eOSState cMenuRecordings::Del(void)
{ {
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri && !ri->IsDirectory()) { if (ri && !ri->IsDirectory()) {
//XXX what if this recording's file is currently in use??? if (Interface->Confirm(tr("Delete recording?"))) {
//XXX if (!ti->recording) { cRecordControl *rc = cRecordControls::GetRecordControl(ri->FileName());
if (Interface->Confirm(tr("Delete recording?"))) { if (rc) {
cRecording *recording = GetRecording(ri); if (Interface->Confirm(tr("Timer still recording - really delete?"))) {
if (recording) { cTimer *timer = rc->Timer();
if (recording->Delete()) { if (timer) {
cReplayControl::ClearLastReplayed(ri->FileName()); timer->SkipToday();
cOsdMenu::Del(Current()); cRecordControls::Process(time(NULL));
Recordings.Del(recording);
Display();
if (!Count())
return osBack;
} }
else
Interface->Error(tr("Error while deleting recording!"));
} }
else
return osContinue;
} }
//XXX } cRecording *recording = GetRecording(ri);
//XXX else if (recording) {
//XXX Interface->Error(tr("Timer is 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; return osContinue;
} }
@ -2560,6 +2567,15 @@ const char *cRecordControls::GetInstantId(const char *LastInstantId)
return NULL; 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) void cRecordControls::Process(time_t t)
{ {
for (int i = 0; i < MAXDVBAPI; i++) { 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef _MENU_H
@ -92,6 +92,8 @@ public:
void Stop(bool KeepInstant = false); void Stop(bool KeepInstant = false);
bool IsInstant(void) { return instantId; } bool IsInstant(void) { return instantId; }
const char *InstantId(void) { return instantId; } const char *InstantId(void) { return instantId; }
const char *FileName(void) { return fileName; }
cTimer *Timer(void) { return timer; }
}; };
class cRecordControls { class cRecordControls {
@ -103,6 +105,7 @@ public:
static void Stop(cDvbApi *DvbApi); static void Stop(cDvbApi *DvbApi);
static bool StopPrimary(bool DoIt = false); static bool StopPrimary(bool DoIt = false);
static const char *GetInstantId(const char *LastInstantId); static const char *GetInstantId(const char *LastInstantId);
static cRecordControl *GetRecordControl(const char *FileName);
static void Process(time_t t); static void Process(time_t t);
static bool Active(void); static bool Active(void);
}; };