Changes in cRecManager::DeleteTimer

This commit is contained in:
kamel5 2018-04-01 15:53:09 +02:00 committed by kamel5
parent 91488f0f60
commit aa26a69ef8
3 changed files with 41 additions and 48 deletions

View File

@ -180,9 +180,9 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
void cRecManager::DeleteTimer(int timerID) { void cRecManager::DeleteTimer(int timerID) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__); dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
const cTimer *t; cTimer *t;
{ {
LOCK_TIMERS_READ; LOCK_TIMERS_WRITE;
t = Timers->Get(timerID); t = Timers->Get(timerID);
} }
#else #else
@ -207,9 +207,9 @@ void cRecManager::DeleteTimer(const cEvent *event) {
void cRecManager::DeleteLocalTimer(const cEvent *event) { void cRecManager::DeleteLocalTimer(const cEvent *event) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__); dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
const cTimer *t; cTimer *t;
{ {
LOCK_TIMERS_READ; LOCK_TIMERS_WRITE;
t = Timers->GetMatch(event); t = Timers->GetMatch(event);
} }
#else #else
@ -220,29 +220,23 @@ void cRecManager::DeleteLocalTimer(const cEvent *event) {
DeleteTimer(t); DeleteTimer(t);
} }
#if VDRVERSNUM >= 20301
void cRecManager::DeleteTimer(const cTimer *timer) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
LOCK_TIMERS_WRITE;
cTimers* timers = Timers;
cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast
if (t->Recording()) {
t->Skip();
cRecordControls::Process(timers, time(NULL));
}
#else
void cRecManager::DeleteTimer(cTimer *timer) { void cRecManager::DeleteTimer(cTimer *timer) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
#if VDRVERSNUM >= 20301
LOCK_TIMERS_WRITE;
#endif
if (timer->Recording()) { if (timer->Recording()) {
timer->Skip(); timer->Skip();
#if VDRVERSNUM >= 20301
cRecordControls::Process(Timers, time(NULL));
#else
cRecordControls::Process(time(NULL)); cRecordControls::Process(time(NULL));
}
#endif #endif
}
isyslog("timer %s deleted", *timer->ToDescr()); isyslog("timer %s deleted", *timer->ToDescr());
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
timers->Del(t, true); Timers->Del(timer, true);
timers->SetModified(); Timers->SetModified();
#else #else
Timers.Del(timer, true); Timers.Del(timer, true);
Timers.SetModified(); Timers.SetModified();

View File

@ -37,11 +37,7 @@ public:
cTimer *createLocalTimer(const cEvent *event, std::string path); cTimer *createLocalTimer(const cEvent *event, std::string path);
cTimer *createRemoteTimer(const cEvent *event, std::string path); cTimer *createRemoteTimer(const cEvent *event, std::string path);
void SetTimerPath(cTimer *timer, const cEvent *event, std::string path); void SetTimerPath(cTimer *timer, const cEvent *event, std::string path);
#if VDRVERSNUM >= 20301
void DeleteTimer(const cTimer *timer);
#else
void DeleteTimer(cTimer *timer); void DeleteTimer(cTimer *timer);
#endif
void DeleteTimer(int timerID); void DeleteTimer(int timerID);
void DeleteTimer(const cEvent *event); void DeleteTimer(const cEvent *event);
void DeleteLocalTimer(const cEvent *event); void DeleteLocalTimer(const cEvent *event);
@ -76,4 +72,4 @@ public:
virtual ~cRecManager (void); virtual ~cRecManager (void);
}; };
#endif //__TVGUIDE_RECMMANAGER_H #endif //__TVGUIDE_RECMMANAGER_H

View File

@ -1,4 +1,4 @@
#include "recmenu.h" #include "recmenu.h"
#include "recmenus.h" #include "recmenus.h"
#include "switchtimer.h" #include "switchtimer.h"
#include "timerconflict.h" #include "timerconflict.h"
@ -87,8 +87,8 @@ void cRecMenuManager::DeleteBackground(void) {
eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
eOSState state = osContinue; eOSState state = osContinue;
switch (nextState) { switch (nextState) {
/*************************************************************************************** /***************************************************************************************
* INSTANT RECORDING * INSTANT RECORDING
****************************************************************************************/ ****************************************************************************************/
case rmsInstantRecord: { case rmsInstantRecord: {
//caller: main menu or folder chooser //caller: main menu or folder chooser
@ -248,7 +248,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
state = osEnd; state = osEnd;
Close(); Close();
break; } break; }
/*************************************************************************************** /***************************************************************************************
* SERIES TIMER * SERIES TIMER
****************************************************************************************/ ****************************************************************************************/
case rmsSeriesTimer: { case rmsSeriesTimer: {
@ -285,8 +285,8 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer); activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* SEARCH TIMER * SEARCH TIMER
***********************************************************************************************/ ***********************************************************************************************/
case rmsSearchTimer: case rmsSearchTimer:
//Caller: main menu //Caller: main menu
@ -310,7 +310,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
delete activeMenu; delete activeMenu;
if (searchString.size() < 4) { if (searchString.size() < 4) {
activeMenu = new cRecMenuSearchTimer(event); activeMenu = new cRecMenuSearchTimer(event);
} else { } else {
if (!reload) { if (!reload) {
searchTimer.SetSearchString(searchString); searchTimer.SetSearchString(searchString);
} }
@ -429,7 +429,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuSearchTimerDeleteConfirm(searchTimer); activeMenu = new cRecMenuSearchTimerDeleteConfirm(searchTimer);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSearchTimerDelete: case rmsSearchTimerDelete:
case rmsSearchTimerDeleteWithTimers: { case rmsSearchTimerDeleteWithTimers: {
//caller: cRecMenuSearchTimerDeleteConfirm //caller: cRecMenuSearchTimerDeleteConfirm
//actually delete searchtimer //actually delete searchtimer
@ -457,8 +457,8 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsFavoritesRecordConfirm); activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsFavoritesRecordConfirm);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* SWITCH TIMER * SWITCH TIMER
***********************************************************************************************/ ***********************************************************************************************/
case rmsSwitchTimer: case rmsSwitchTimer:
delete activeMenu; delete activeMenu;
@ -475,14 +475,14 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuSwitchTimerConfirm(success); activeMenu = new cRecMenuSwitchTimerConfirm(success);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSwitchTimerDelete: case rmsSwitchTimerDelete:
recManager->DeleteSwitchTimer(event); recManager->DeleteSwitchTimer(event);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSwitchTimerDelete(); activeMenu = new cRecMenuSwitchTimerDelete();
activeMenu->Display(); activeMenu->Display();
break; break;
/********************************************************************************************** /**********************************************************************************************
* RECORDINGS SEARCH * RECORDINGS SEARCH
***********************************************************************************************/ ***********************************************************************************************/
case rmsRecordingSearch: { case rmsRecordingSearch: {
//caller: main menu or rmsRecordingSearchResult //caller: main menu or rmsRecordingSearchResult
@ -518,8 +518,8 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
activeMenu->Display(); activeMenu->Display();
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* SEARCH * SEARCH
***********************************************************************************************/ ***********************************************************************************************/
case rmsSearch: case rmsSearch:
case rmsSearchWithOptions: { case rmsSearchWithOptions: {
@ -600,8 +600,8 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->UpdateActiveMenuItem(); activeMenu->UpdateActiveMenuItem();
activeMenu->Show(); activeMenu->Show();
break; break;
/********************************************************************************************** /**********************************************************************************************
* CHECK FOR TIMER CONFLICTS * CHECK FOR TIMER CONFLICTS
***********************************************************************************************/ ***********************************************************************************************/
case rmsTimerConflicts: { case rmsTimerConflicts: {
//caller: main menu //caller: main menu
@ -708,7 +708,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* TIMELINE * TIMELINE
***********************************************************************************************/ ***********************************************************************************************/
case rmsTimeline: { case rmsTimeline: {
@ -719,7 +719,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuTimeline(timerConflicts); activeMenu = new cRecMenuTimeline(timerConflicts);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsTimelineTimerEdit: { case rmsTimelineTimerEdit: {
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
const cTimer *timer; const cTimer *timer;
@ -764,7 +764,10 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timer = menu->GetOriginalTimer(); timer = menu->GetOriginalTimer();
} else break; } else break;
recManager->DeleteTimer(timer); {
LOCK_TIMERS_WRITE;
recManager->DeleteTimer(Timers->GetTimer(timer));
}
delete activeMenu; delete activeMenu;
if (timerConflicts) { if (timerConflicts) {
delete timerConflicts; delete timerConflicts;
@ -773,7 +776,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuTimeline(timerConflicts); activeMenu = new cRecMenuTimeline(timerConflicts);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* FAVORITES * FAVORITES
*********************************************************************************************/ *********************************************************************************************/
case rmsFavoritesRecord: { case rmsFavoritesRecord: {
@ -833,7 +836,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
DisplayFavoriteResults(tvguideConfig.descUser4, result, numResults); DisplayFavoriteResults(tvguideConfig.descUser4, result, numResults);
break; } break; }
/********************************************************************************************** /**********************************************************************************************
* COMMON * COMMON
*********************************************************************************************/ *********************************************************************************************/
case rmsClose: { case rmsClose: {
@ -849,7 +852,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
state = osContinue; state = osContinue;
} }
break; } break; }
default: default:
break; break;
} }
return state; return state;