2018-04-01 15:53:09 +02:00
|
|
|
#include "recmenu.h"
|
2013-12-07 15:51:50 +01:00
|
|
|
#include "recmenus.h"
|
|
|
|
#include "switchtimer.h"
|
2013-12-29 18:13:45 +01:00
|
|
|
#include "timerconflict.h"
|
2019-07-10 17:35:55 +02:00
|
|
|
#include "recmenuview.h"
|
2013-07-09 00:17:42 +02:00
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
cRecMenuView::cRecMenuView(void) {
|
2014-01-11 16:53:23 +01:00
|
|
|
footer = NULL;
|
2013-07-09 00:17:42 +02:00
|
|
|
active = false;
|
|
|
|
activeMenu = NULL;
|
|
|
|
activeMenuBuffer = NULL;
|
2014-01-17 16:11:12 +01:00
|
|
|
activeMenuBuffer2 = NULL;
|
2013-07-09 00:17:42 +02:00
|
|
|
recManager = new cRecManager();
|
|
|
|
recManager->SetEPGSearchPlugin();
|
2013-12-29 18:13:45 +01:00
|
|
|
timerConflicts = NULL;
|
2013-07-09 00:17:42 +02:00
|
|
|
detailViewActive = false;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
cRecMenuView::~cRecMenuView(void) {
|
2013-07-09 00:17:42 +02:00
|
|
|
if (activeMenu) {
|
|
|
|
active = false;
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = NULL;
|
|
|
|
}
|
2013-12-29 18:13:45 +01:00
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
timerConflicts = NULL;
|
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
delete recManager;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::Start(const cEvent *event) {
|
2013-07-09 00:17:42 +02:00
|
|
|
active = true;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
detailViewActive = false;
|
|
|
|
SetBackground();
|
|
|
|
this->event = event;
|
2013-07-20 13:46:26 +02:00
|
|
|
activeMenu = new cRecMenuMain(recManager->EpgSearchAvailable(), recManager->CheckEventForTimer(event), SwitchTimers.EventInSwitchList(event));
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::StartFavorites(void) {
|
2014-01-14 18:00:32 +01:00
|
|
|
active = true;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
detailViewActive = false;
|
|
|
|
SetBackground();
|
|
|
|
std::vector<cTVGuideSearchTimer> favorites;
|
|
|
|
recManager->GetFavorites(&favorites);
|
|
|
|
activeMenu = new cRecMenuFavorites(favorites);
|
|
|
|
activeMenu->Display();
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::Close(void) {
|
2013-07-09 00:17:42 +02:00
|
|
|
event = NULL;
|
|
|
|
active = false;
|
|
|
|
if (activeMenu) {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = NULL;
|
|
|
|
}
|
2013-12-29 18:13:45 +01:00
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
timerConflicts = NULL;
|
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
DeleteBackground();
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::SetBackground(void) {
|
2013-12-21 11:25:03 +01:00
|
|
|
int backgroundWidth = geoManager.osdWidth;
|
|
|
|
int backgroundHeight = geoManager.osdHeight;
|
2013-07-09 00:17:42 +02:00
|
|
|
pixmapBackground = osdManager.requestPixmap(3, cRect(0, 0, backgroundWidth, backgroundHeight));
|
|
|
|
pixmapBackground->Fill(theme.Color(clrRecMenuBackground));
|
|
|
|
if (tvguideConfig.scaleVideo) {
|
2013-12-21 11:25:03 +01:00
|
|
|
int tvHeight = geoManager.statusHeaderHeight;
|
2013-07-09 00:17:42 +02:00
|
|
|
int tvWidth = tvHeight * 16 / 9;
|
2013-12-21 11:25:03 +01:00
|
|
|
int tvX = geoManager.osdWidth - tvWidth;
|
2013-07-09 00:17:42 +02:00
|
|
|
pixmapBackground->DrawRectangle(cRect(tvX, 0, tvWidth, tvHeight), clrTransparent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::DeleteBackground(void) {
|
2013-07-09 00:17:42 +02:00
|
|
|
osdManager.releasePixmap(pixmapBackground);
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
2013-07-09 00:17:42 +02:00
|
|
|
eOSState state = osContinue;
|
|
|
|
switch (nextState) {
|
2018-04-01 15:53:09 +02:00
|
|
|
/***************************************************************************************
|
|
|
|
* INSTANT RECORDING
|
2014-01-10 12:44:01 +01:00
|
|
|
****************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsInstantRecord: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu or folder chooser
|
|
|
|
//Creating timer for active Event, if no conflict, confirm and exit
|
|
|
|
std::string recFolder = "";
|
|
|
|
if (cRecMenuAskFolder *menu = dynamic_cast<cRecMenuAskFolder*>(activeMenu)) {
|
|
|
|
recFolder = menu->GetFolder();
|
2013-07-18 17:59:59 +02:00
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
cTimer *timer = recManager->createTimer(event, recFolder);
|
|
|
|
if (!DisplayTimerConflict(timer)) {
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu = new cRecMenuConfirmTimer(event);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
2013-07-18 17:59:59 +02:00
|
|
|
case rmsInstantRecordFolder:
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu
|
2013-07-18 17:59:59 +02:00
|
|
|
//Asking for Folder
|
|
|
|
delete activeMenu;
|
2013-07-19 15:30:41 +02:00
|
|
|
activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord);
|
2013-07-18 17:59:59 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsIgnoreTimerConflict:
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflict
|
2013-07-09 00:17:42 +02:00
|
|
|
//Confirming created Timer
|
2014-01-10 12:44:01 +01:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuConfirmTimer(event);
|
|
|
|
activeMenu->Display();
|
2013-07-09 00:17:42 +02:00
|
|
|
break;
|
|
|
|
case rmsTimerConflictShowInfo: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflict
|
|
|
|
int timerIndex;
|
|
|
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
|
|
|
timerIndex = menu->GetTimerConflictIndex();
|
|
|
|
} else break;
|
2013-12-29 18:13:45 +01:00
|
|
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
|
|
|
const cTimer *t = Timers->Get(timerID);
|
|
|
|
#else
|
2013-07-09 00:17:42 +02:00
|
|
|
cTimer *t = Timers.Get(timerID);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-07-09 00:17:42 +02:00
|
|
|
if (t) {
|
|
|
|
const cEvent *ev = t->Event();
|
|
|
|
if (ev) {
|
2014-01-11 16:53:23 +01:00
|
|
|
DisplayDetailedView(ev);
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
|
|
|
}
|
2014-01-11 16:53:23 +01:00
|
|
|
break; }
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsDeleteTimerConflictMenu: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflict
|
|
|
|
//delete timer out of current timer conflict
|
|
|
|
int timerIndex;
|
|
|
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
|
|
|
timerIndex = menu->GetTimerConflictIndex();
|
|
|
|
} else break;
|
2013-12-29 18:13:45 +01:00
|
|
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
2013-07-09 00:17:42 +02:00
|
|
|
recManager->DeleteTimer(timerID);
|
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (!DisplayTimerConflict(timerID)) {
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu = new cRecMenuConfirmTimer(event);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case rmsEditTimerConflictMenu: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflict
|
|
|
|
//edit timer out of current timer conflict
|
|
|
|
int timerIndex;
|
|
|
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
|
|
|
timerIndex = menu->GetTimerConflictIndex();
|
|
|
|
} else break;
|
2013-12-29 18:13:45 +01:00
|
|
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
|
|
|
const cTimer *timer = Timers->Get(timerID);
|
|
|
|
#else
|
2019-03-30 18:06:47 +01:00
|
|
|
const cTimer *timer = Timers.Get(timerID);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-07-09 00:17:42 +02:00
|
|
|
if (timer) {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimerConflictMenu);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case rmsSaveTimerConflictMenu: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuEditTimer
|
|
|
|
//save timer from current timer conflict
|
|
|
|
cTimer timerModified;
|
2018-03-08 13:02:38 +01:00
|
|
|
const cTimer *originalTimer;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
|
|
|
|
timerModified = menu->GetTimer();
|
|
|
|
originalTimer = menu->GetOriginalTimer();
|
|
|
|
} else break;
|
|
|
|
recManager->SaveTimer(originalTimer, timerModified);
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (!DisplayTimerConflict(originalTimer)) {
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu = new cRecMenuConfirmTimer(event);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case rmsDeleteTimer:
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu
|
|
|
|
//delete timer for active event
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
|
|
|
if (recManager->IsRecorded(event)) {
|
|
|
|
activeMenu = new cRecMenuAskDeleteTimer(event);
|
|
|
|
} else {
|
|
|
|
recManager->DeleteTimer(event);
|
|
|
|
activeMenu = new cRecMenuConfirmDeleteTimer(event);
|
|
|
|
}
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
|
|
|
case rmsDeleteTimerConfirmation:
|
2014-01-10 12:44:01 +01:00
|
|
|
//delete running timer for active event
|
2013-07-09 00:17:42 +02:00
|
|
|
recManager->DeleteTimer(event);
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuConfirmDeleteTimer(event);
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
|
|
|
case rmsEditTimer: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//edit timer for active event
|
2018-03-31 18:07:08 +02:00
|
|
|
const cTimer *timer;
|
2019-03-30 18:06:47 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-31 18:07:08 +02:00
|
|
|
{
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
2018-03-31 18:07:08 +02:00
|
|
|
timer = recManager->GetTimerForEvent(event);
|
|
|
|
}
|
2018-03-08 13:02:38 +01:00
|
|
|
#else
|
2019-03-30 18:06:47 +01:00
|
|
|
timer = recManager->GetTimerForEvent(event);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-07-09 00:17:42 +02:00
|
|
|
if (timer) {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimer);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case rmsSaveTimer: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuEditTimer
|
|
|
|
//save timer for active event
|
|
|
|
cTimer timerModified;
|
2018-03-08 13:02:38 +01:00
|
|
|
const cTimer *originalTimer;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
|
|
|
|
timerModified = menu->GetTimer();
|
|
|
|
originalTimer = menu->GetOriginalTimer();
|
|
|
|
} else break;
|
|
|
|
recManager->SaveTimer(originalTimer, timerModified);
|
2013-07-09 00:17:42 +02:00
|
|
|
state = osEnd;
|
|
|
|
Close();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/***************************************************************************************
|
2014-01-10 12:44:01 +01:00
|
|
|
* SERIES TIMER
|
|
|
|
****************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsSeriesTimer: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu oder folder chooser
|
|
|
|
std::string recFolder = "";
|
|
|
|
if (cRecMenuAskFolder *menu = dynamic_cast<cRecMenuAskFolder*>(activeMenu)) {
|
|
|
|
recFolder = menu->GetFolder();
|
2013-07-19 15:30:41 +02:00
|
|
|
}
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_CHANNELS_READ;
|
|
|
|
const cChannel *channel = Channels->GetByChannelID(event->ChannelID());
|
|
|
|
#else
|
2013-07-09 00:17:42 +02:00
|
|
|
cChannel *channel = Channels.GetByChannelID(event->ChannelID());
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2014-01-10 12:44:01 +01:00
|
|
|
activeMenu = new cRecMenuSeriesTimer(channel, event, recFolder);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2013-07-19 15:30:41 +02:00
|
|
|
case rmsSeriesTimerFolder:
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu
|
|
|
|
//Asking for Folder
|
2013-07-19 15:30:41 +02:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuAskFolder(event, rmsSeriesTimer);
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsSeriesTimerCreate: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuSeriesTimer
|
|
|
|
cTimer *seriesTimer;
|
|
|
|
if (cRecMenuSeriesTimer *menu = dynamic_cast<cRecMenuSeriesTimer*>(activeMenu)) {
|
|
|
|
seriesTimer = menu->GetTimer();
|
|
|
|
} else break;
|
|
|
|
recManager->CreateSeriesTimer(seriesTimer);
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
|
|
|
* SEARCH TIMER
|
2014-01-10 12:44:01 +01:00
|
|
|
***********************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsSearchTimer:
|
2014-01-10 12:44:01 +01:00
|
|
|
//Caller: main menu
|
|
|
|
//set search String for search timer
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSearchTimer(event);
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
|
|
|
case rmsSearchTimerOptions: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//Caller: cRecMenuSearchTimer, cRecMenuSearchTimerTemplates
|
|
|
|
//Choose to set options manually or by template
|
|
|
|
std::string searchString;
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
bool reload = false;
|
|
|
|
if (cRecMenuSearchTimer *menu = dynamic_cast<cRecMenuSearchTimer*>(activeMenu)) {
|
|
|
|
searchString = menu->GetSearchString();
|
|
|
|
} else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
reload = true;
|
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (searchString.size() < 4) {
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu = new cRecMenuSearchTimer(event);
|
2018-04-01 15:53:09 +02:00
|
|
|
} else {
|
2014-01-10 12:44:01 +01:00
|
|
|
if (!reload) {
|
|
|
|
searchTimer.SetSearchString(searchString);
|
|
|
|
}
|
|
|
|
std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates;
|
|
|
|
recManager->ReadEPGSearchTemplates(&epgSearchTemplates);
|
|
|
|
if (epgSearchTemplates.size() > 0) {
|
|
|
|
activeMenu = new cRecMenuSearchTimerTemplates(searchTimer, epgSearchTemplates);
|
2013-07-09 00:17:42 +02:00
|
|
|
} else {
|
2019-04-09 18:25:58 +02:00
|
|
|
std::vector<std::string> channelGroups;
|
|
|
|
recManager->GetChannelGroups(&channelGroups);
|
2019-06-16 15:13:06 +02:00
|
|
|
activeMenu = new cRecMenuSearchTimerEdit(searchTimer, channelGroups);
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2014-01-10 12:44:01 +01:00
|
|
|
case rmsSearchTimers: {
|
|
|
|
//caller: main menu
|
|
|
|
DisplaySearchTimerList();
|
2013-07-09 00:17:42 +02:00
|
|
|
break; }
|
2019-06-19 13:24:27 +02:00
|
|
|
case rmsSearchTimerEdit: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuSearchTimers, cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplates
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else if (cRecMenuSearchTimerTemplates *menu = dynamic_cast<cRecMenuSearchTimerTemplates*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2019-04-09 18:25:58 +02:00
|
|
|
std::vector<std::string> channelGroups;
|
|
|
|
recManager->GetChannelGroups(&channelGroups);
|
2019-06-16 15:13:06 +02:00
|
|
|
activeMenu = new cRecMenuSearchTimerEdit(searchTimer, channelGroups);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2014-01-10 12:44:01 +01:00
|
|
|
case rmsSearchTimerTest: {
|
2014-01-14 18:00:32 +01:00
|
|
|
//caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate, cRecMenuSearchTimers, cRecMenuFavorites
|
2014-01-10 12:44:01 +01:00
|
|
|
//show results of currently choosen search timer
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
2014-02-07 18:15:13 +01:00
|
|
|
eRecMenuState recState = rmsDisabled;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
2014-02-07 18:15:13 +01:00
|
|
|
recState = rmsSearchTimerRecord;
|
2014-01-12 16:27:59 +01:00
|
|
|
} else if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
2014-02-07 18:15:13 +01:00
|
|
|
recState = rmsSearchTimerRecord;
|
2014-01-10 12:44:01 +01:00
|
|
|
} else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
TVGuideEPGSearchTemplate tmpl = menu->GetTemplate();
|
|
|
|
searchTimer.SetTemplate(tmpl.templValue);
|
|
|
|
searchTimer.Parse(true);
|
2014-01-14 18:00:32 +01:00
|
|
|
} else if (cRecMenuFavorites *menu = dynamic_cast<cRecMenuFavorites*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetFavorite();
|
2014-02-07 18:15:13 +01:00
|
|
|
recState = rmsFavoritesRecord;
|
2014-01-10 12:44:01 +01:00
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
int numSearchResults = 0;
|
2014-01-10 12:44:01 +01:00
|
|
|
std::string searchString = searchTimer.BuildSearchString();
|
|
|
|
const cEvent **searchResult = recManager->PerformSearchTimerSearch(searchString, numSearchResults);
|
|
|
|
if (numSearchResults) {
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
2019-06-16 13:11:28 +02:00
|
|
|
activeMenu = new cRecMenuSearchTimerResults(searchTimer.GetSearchString(), searchResult, numSearchResults, "", recState);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
} else {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
2019-06-16 13:11:28 +02:00
|
|
|
activeMenu = new cRecMenuSearchTimerNothingFound(searchTimer.GetSearchString());
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
2014-01-10 12:44:01 +01:00
|
|
|
case rmsSearchTimerSave: {
|
|
|
|
//caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate
|
|
|
|
//create new or modify existing search timer
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
TVGuideEPGSearchTemplate tmpl = menu->GetTemplate();
|
|
|
|
searchTimer.SetTemplate(tmpl.templValue);
|
|
|
|
searchTimer.Parse(true);
|
|
|
|
} else break;
|
|
|
|
bool success = recManager->SaveSearchTimer(&searchTimer);
|
|
|
|
recManager->UpdateSearchTimers();
|
|
|
|
if (searchTimer.GetID() >= 0) {
|
|
|
|
//Timer modified, show list
|
|
|
|
DisplaySearchTimerList();
|
2013-07-09 00:17:42 +02:00
|
|
|
} else {
|
2014-01-10 12:44:01 +01:00
|
|
|
//new timer, confirm
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSearchTimerCreateConfirm(success);
|
|
|
|
activeMenu->Display();
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
|
|
|
break; }
|
2014-01-10 12:44:01 +01:00
|
|
|
case rmsSearchTimerCreateWithTemplate: {
|
|
|
|
//caller: cRecMenuSearchTimerTemplates
|
|
|
|
//create new search timer from template
|
|
|
|
TVGuideEPGSearchTemplate templ;
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
if (cRecMenuSearchTimerTemplates *menu = dynamic_cast<cRecMenuSearchTimerTemplates*>(activeMenu)) {
|
|
|
|
templ = menu->GetTemplate();
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
activeMenu = new cRecMenuSearchTimerTemplatesCreate(templ, searchTimer);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
|
|
|
case rmsSearchTimerDeleteConfirm: {
|
|
|
|
//caller: cRecMenuSearchTimers
|
|
|
|
//Ask for confirmation and if timers created by this search timer should alo be deleted
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else break;
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchTimerDeleteConfirm(searchTimer);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
case rmsSearchTimerDelete:
|
2014-01-10 12:44:01 +01:00
|
|
|
case rmsSearchTimerDeleteWithTimers: {
|
|
|
|
//caller: cRecMenuSearchTimerDeleteConfirm
|
|
|
|
//actually delete searchtimer
|
|
|
|
cTVGuideSearchTimer searchTimer;
|
|
|
|
if (cRecMenuSearchTimerDeleteConfirm *menu = dynamic_cast<cRecMenuSearchTimerDeleteConfirm*>(activeMenu)) {
|
|
|
|
searchTimer = menu->GetSearchTimer();
|
|
|
|
} else break;
|
|
|
|
bool delTimers = (nextState==rmsSearchTimerDeleteWithTimers)?true:false;
|
|
|
|
recManager->DeleteSearchTimer(&searchTimer, delTimers);
|
|
|
|
delete activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
DisplaySearchTimerList();
|
|
|
|
break; }
|
2014-02-07 18:15:13 +01:00
|
|
|
case rmsSearchTimerRecord: {
|
|
|
|
//caller: cRecMenuSearchTimerResults
|
|
|
|
const cEvent *ev = NULL;
|
|
|
|
if (cRecMenuSearchTimerResults *menu = dynamic_cast<cRecMenuSearchTimerResults*>(activeMenu)) {
|
|
|
|
ev = menu->GetEvent();
|
|
|
|
} else break;
|
|
|
|
if (!ev)
|
|
|
|
break;
|
|
|
|
recManager->createTimer(ev, "");
|
|
|
|
activeMenuBuffer2 = activeMenu;
|
|
|
|
activeMenuBuffer2->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsFavoritesRecordConfirm);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
|
|
|
* SWITCH TIMER
|
2014-01-10 12:44:01 +01:00
|
|
|
***********************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsSwitchTimer:
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSwitchTimer();
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
|
|
|
case rmsSwitchTimerCreate: {
|
2014-01-10 12:44:01 +01:00
|
|
|
cSwitchTimer switchTimer;
|
|
|
|
if (cRecMenuSwitchTimer *menu = dynamic_cast<cRecMenuSwitchTimer*>(activeMenu)) {
|
|
|
|
switchTimer = menu->GetSwitchTimer();
|
|
|
|
} else break;
|
|
|
|
bool success = recManager->CreateSwitchTimer(event, switchTimer);
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSwitchTimerConfirm(success);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
case rmsSwitchTimerDelete:
|
2013-07-09 00:17:42 +02:00
|
|
|
recManager->DeleteSwitchTimer(event);
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSwitchTimerDelete();
|
|
|
|
activeMenu->Display();
|
|
|
|
break;
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
|
|
|
* RECORDINGS SEARCH
|
2014-01-10 12:44:01 +01:00
|
|
|
***********************************************************************************************/
|
|
|
|
case rmsRecordingSearch: {
|
|
|
|
//caller: main menu or rmsRecordingSearchResult
|
|
|
|
std::string searchString = event->Title();
|
|
|
|
if (cRecMenuRecordingSearchResults *menu = dynamic_cast<cRecMenuRecordingSearchResults*>(activeMenu)) {
|
|
|
|
searchString = menu->GetSearchString();
|
|
|
|
};
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
activeMenu = new cRecMenuRecordingSearch(searchString);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
2014-01-10 12:44:01 +01:00
|
|
|
break; }
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsRecordingSearchResult: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuRecordingSearch
|
|
|
|
std::string searchString;
|
|
|
|
if (cRecMenuRecordingSearch *menu = dynamic_cast<cRecMenuRecordingSearch*>(activeMenu)) {
|
|
|
|
searchString = menu->GetSearchString();
|
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (searchString.size() < 4) {
|
|
|
|
activeMenu = new cRecMenuRecordingSearch(searchString);
|
2013-07-09 00:17:42 +02:00
|
|
|
} else {
|
|
|
|
int numSearchResults = 0;
|
2018-03-08 13:02:38 +01:00
|
|
|
const cRecording **searchResult = recManager->SearchForRecordings(searchString, numSearchResults);
|
2013-07-09 00:17:42 +02:00
|
|
|
if (numSearchResults == 0) {
|
|
|
|
activeMenu = new cRecMenuRecordingSearchNotFound(searchString);
|
|
|
|
} else {
|
|
|
|
activeMenu = new cRecMenuRecordingSearchResults(searchString, searchResult, numSearchResults);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
|
|
|
* SEARCH
|
2014-01-10 12:44:01 +01:00
|
|
|
***********************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsSearch:
|
|
|
|
case rmsSearchWithOptions: {
|
2014-01-12 16:27:59 +01:00
|
|
|
//caller: main menu, cRecMenuSearch, cRecMenuSearchResults
|
2014-01-10 12:44:01 +01:00
|
|
|
bool withOptions = false;
|
|
|
|
std::string searchString = event->Title();
|
|
|
|
if (cRecMenuSearch *menu = dynamic_cast<cRecMenuSearch*>(activeMenu)) {
|
|
|
|
withOptions = true;
|
|
|
|
searchString = menu->GetSearchString();
|
2014-01-12 16:27:59 +01:00
|
|
|
} else if (cRecMenuSearchResults *menu = dynamic_cast<cRecMenuSearchResults*>(activeMenu)) {
|
|
|
|
searchString = menu->GetSearchString();
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
2014-01-10 12:44:01 +01:00
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSearch(searchString, withOptions);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
|
|
|
case rmsSearchPerform: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuSearch
|
|
|
|
Epgsearch_searchresults_v1_0 epgSearchData;
|
|
|
|
if (cRecMenuSearch *menu = dynamic_cast<cRecMenuSearch*>(activeMenu)) {
|
|
|
|
epgSearchData = menu->GetEPGSearchStruct();
|
|
|
|
} else break;
|
|
|
|
std::string searchString = epgSearchData.query;
|
2014-01-12 16:27:59 +01:00
|
|
|
if (searchString.size() < 3) {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchNothingFound(searchString, true);
|
2013-07-09 00:17:42 +02:00
|
|
|
} else {
|
|
|
|
int numSearchResults = 0;
|
2014-01-10 12:44:01 +01:00
|
|
|
const cEvent **searchResult = recManager->PerformSearch(epgSearchData, numSearchResults);
|
2013-07-09 00:17:42 +02:00
|
|
|
if (searchResult) {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuSearchResults(searchString, searchResult, numSearchResults);
|
|
|
|
} else {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchNothingFound(searchString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
|
|
|
case rmsSearchNothingFoundConfirm:
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
activeMenu->Show();
|
|
|
|
break;
|
|
|
|
case rmsSearchShowInfo: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuSearchResults, cRecMenuSearchTimerResults
|
|
|
|
const cEvent *ev = NULL;
|
|
|
|
if (cRecMenuSearchResults *menu = dynamic_cast<cRecMenuSearchResults*>(activeMenu)) {
|
|
|
|
ev = menu->GetEvent();
|
|
|
|
} else if (cRecMenuSearchTimerResults *menu = dynamic_cast<cRecMenuSearchTimerResults*>(activeMenu)) {
|
|
|
|
ev = menu->GetEvent();
|
|
|
|
} else break;
|
2013-07-09 00:17:42 +02:00
|
|
|
if (ev) {
|
2014-01-11 16:53:23 +01:00
|
|
|
DisplayDetailedView(ev);
|
2013-07-09 00:17:42 +02:00
|
|
|
}
|
|
|
|
break;}
|
|
|
|
case rmsSearchRecord: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuSearchResults
|
|
|
|
const cEvent *ev = NULL;
|
|
|
|
if (cRecMenuSearchResults *menu = dynamic_cast<cRecMenuSearchResults*>(activeMenu)) {
|
|
|
|
ev = menu->GetEvent();
|
|
|
|
} else break;
|
|
|
|
if (!ev)
|
|
|
|
break;
|
2014-01-17 16:11:12 +01:00
|
|
|
recManager->createTimer(ev, "");
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
2014-01-17 16:11:12 +01:00
|
|
|
activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsSearchRecordConfirm);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
break;}
|
|
|
|
case rmsSearchRecordConfirm:
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
2014-02-07 17:57:14 +01:00
|
|
|
activeMenu->UpdateActiveMenuItem();
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Show();
|
|
|
|
break;
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
|
|
|
* CHECK FOR TIMER CONFLICTS
|
2014-01-10 12:44:01 +01:00
|
|
|
***********************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsTimerConflicts: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: main menu
|
|
|
|
//Show timer conflict
|
2013-12-29 18:13:45 +01:00
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
}
|
|
|
|
timerConflicts = recManager->CheckTimerConflict();
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2013-12-29 18:13:45 +01:00
|
|
|
int numConflicts = timerConflicts->NumConflicts();
|
2013-07-09 00:17:42 +02:00
|
|
|
if (numConflicts > 0) {
|
2013-12-29 18:13:45 +01:00
|
|
|
activeMenu = new cRecMenuTimerConflicts(timerConflicts);
|
2013-07-09 00:17:42 +02:00
|
|
|
} else {
|
|
|
|
activeMenu = new cRecMenuNoTimerConflict();
|
|
|
|
}
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2013-12-29 18:13:45 +01:00
|
|
|
case rmsTimerConflict: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflicts
|
|
|
|
//Show timer conflict
|
2013-12-29 18:13:45 +01:00
|
|
|
if (!timerConflicts)
|
|
|
|
break;
|
2014-01-10 12:44:01 +01:00
|
|
|
int timerConflict;
|
|
|
|
if (cRecMenuTimerConflicts *menu = dynamic_cast<cRecMenuTimerConflicts*>(activeMenu)) {
|
|
|
|
timerConflict = menu->GetTimerConflict();
|
|
|
|
} else break;
|
|
|
|
timerConflicts->SetCurrentConflict(timerConflict);
|
2013-07-09 00:17:42 +02:00
|
|
|
delete activeMenu;
|
2013-12-29 18:13:45 +01:00
|
|
|
activeMenu = new cRecMenuTimerConflict(timerConflicts->GetCurrentConflict());
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
2013-12-29 18:13:45 +01:00
|
|
|
break; }
|
|
|
|
case rmsSearchRerunsTimerConflictMenu: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuTimerConflict
|
|
|
|
//Show reruns for timer from timer conflict
|
2013-12-29 18:13:45 +01:00
|
|
|
if (!timerConflicts)
|
|
|
|
break;
|
2014-01-10 12:44:01 +01:00
|
|
|
int timerConflict;
|
|
|
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
|
|
|
timerConflict = menu->GetTimerConflictIndex();
|
|
|
|
} else break;
|
|
|
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerConflict);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
|
|
|
const cTimer *timer = Timers->Get(timerID);
|
|
|
|
#else
|
2014-01-10 12:44:01 +01:00
|
|
|
cTimer *timer = Timers.Get(timerID);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-12-29 18:13:45 +01:00
|
|
|
if (timer) {
|
|
|
|
const cEvent *event = timer->Event();
|
|
|
|
if (event) {
|
|
|
|
int numReruns = 0;
|
|
|
|
const cEvent **reruns = recManager->LoadReruns(event, numReruns);
|
|
|
|
if (reruns && (numReruns > 0)) {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuRerunResults(event, reruns, numReruns);
|
|
|
|
activeMenu->Display();
|
|
|
|
} else {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuNoRerunsFound((event->Title())?event->Title():"");
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break; }
|
|
|
|
case rmsTimerConflictIgnoreReruns: {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
activeMenu->Show();
|
|
|
|
break; }
|
|
|
|
case rmsTimerConflictRecordRerun: {
|
2014-01-10 12:44:01 +01:00
|
|
|
//caller: cRecMenuRerunResults
|
|
|
|
//buffer: cRecMenuTimerConflict
|
|
|
|
if (!activeMenuBuffer)
|
|
|
|
break;
|
|
|
|
if (!timerConflicts)
|
|
|
|
break;
|
|
|
|
const cEvent *replace;
|
|
|
|
int originalConflictIndex;
|
|
|
|
if (cRecMenuRerunResults *menu = dynamic_cast<cRecMenuRerunResults*>(activeMenu)) {
|
|
|
|
replace = menu->GetRerunEvent();
|
|
|
|
} else break;
|
|
|
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenuBuffer)) {
|
|
|
|
originalConflictIndex = menu->GetTimerConflictIndex();
|
|
|
|
} else break;
|
2013-12-29 18:13:45 +01:00
|
|
|
int originalTimerID = timerConflicts->GetCurrentConflictTimerID(originalConflictIndex);
|
2018-03-08 13:30:41 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
|
|
|
const cTimer *timerOriginal = Timers->Get(originalTimerID);
|
|
|
|
#else
|
2013-12-29 18:13:45 +01:00
|
|
|
cTimer *timerOriginal = Timers.Get(originalTimerID);
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-12-29 18:13:45 +01:00
|
|
|
if (replace && timerOriginal) {
|
|
|
|
recManager->DeleteTimer(timerOriginal->Event());
|
2014-01-10 12:44:01 +01:00
|
|
|
recManager->createTimer(replace);
|
2013-12-29 18:13:45 +01:00
|
|
|
delete activeMenu;
|
|
|
|
if (activeMenuBuffer) {
|
|
|
|
delete activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
|
|
|
}
|
|
|
|
activeMenu = new cRecMenuConfirmRerunUsed(timerOriginal->Event(), replace);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
2014-01-10 12:44:01 +01:00
|
|
|
* TIMELINE
|
|
|
|
***********************************************************************************************/
|
|
|
|
case rmsTimeline: {
|
2014-01-02 11:25:58 +01:00
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
}
|
|
|
|
timerConflicts = recManager->CheckTimerConflict();
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuTimeline(timerConflicts);
|
|
|
|
activeMenu->Display();
|
2018-04-01 15:53:09 +02:00
|
|
|
break; }
|
2014-01-03 11:56:45 +01:00
|
|
|
case rmsTimelineTimerEdit: {
|
2018-03-08 13:02:38 +01:00
|
|
|
const cTimer *timer;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuTimeline *menu = dynamic_cast<cRecMenuTimeline*>(activeMenu)) {
|
|
|
|
timer = menu->GetTimer();
|
|
|
|
} else break;
|
2014-01-03 11:56:45 +01:00
|
|
|
if (timer) {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = new cRecMenuEditTimer(timer, rmsTimelineTimerSave);
|
|
|
|
activeMenu->Display();
|
2014-01-02 11:25:58 +01:00
|
|
|
}
|
|
|
|
break;}
|
2014-01-03 11:56:45 +01:00
|
|
|
case rmsTimelineTimerSave: {
|
2014-01-10 12:44:01 +01:00
|
|
|
cTimer timerModified;
|
2018-03-08 13:02:38 +01:00
|
|
|
const cTimer *originalTimer;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
|
|
|
|
timerModified = menu->GetTimer();
|
|
|
|
originalTimer = menu->GetOriginalTimer();
|
|
|
|
} else break;
|
|
|
|
recManager->SaveTimer(originalTimer, timerModified);
|
2014-01-03 11:56:45 +01:00
|
|
|
delete activeMenu;
|
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
}
|
|
|
|
timerConflicts = recManager->CheckTimerConflict();
|
|
|
|
activeMenu = new cRecMenuTimeline(timerConflicts);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
|
|
|
case rmsTimelineTimerDelete: {
|
2018-03-08 13:02:38 +01:00
|
|
|
const cTimer *timer;
|
2014-01-10 12:44:01 +01:00
|
|
|
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
|
|
|
|
timer = menu->GetOriginalTimer();
|
|
|
|
} else break;
|
2019-03-28 14:59:16 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-04-01 15:53:09 +02:00
|
|
|
{
|
|
|
|
LOCK_TIMERS_WRITE;
|
|
|
|
recManager->DeleteTimer(Timers->GetTimer(timer));
|
|
|
|
}
|
2019-03-28 14:59:16 +01:00
|
|
|
#else
|
2019-03-30 18:06:47 +01:00
|
|
|
recManager->DeleteTimer(Timers.GetTimer((cTimer*)timer));
|
2019-03-28 14:59:16 +01:00
|
|
|
#endif
|
2014-01-03 11:56:45 +01:00
|
|
|
delete activeMenu;
|
|
|
|
if (timerConflicts) {
|
|
|
|
delete timerConflicts;
|
|
|
|
}
|
|
|
|
timerConflicts = recManager->CheckTimerConflict();
|
|
|
|
activeMenu = new cRecMenuTimeline(timerConflicts);
|
|
|
|
activeMenu->Display();
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
2014-01-17 16:11:12 +01:00
|
|
|
* FAVORITES
|
|
|
|
*********************************************************************************************/
|
|
|
|
case rmsFavoritesRecord: {
|
|
|
|
//caller: cRecMenuSearchTimerResults
|
|
|
|
const cEvent *ev = NULL;
|
|
|
|
if (cRecMenuSearchTimerResults *menu = dynamic_cast<cRecMenuSearchTimerResults*>(activeMenu)) {
|
|
|
|
ev = menu->GetEvent();
|
|
|
|
} else break;
|
|
|
|
if (!ev)
|
|
|
|
break;
|
|
|
|
recManager->createTimer(ev, "");
|
|
|
|
activeMenuBuffer2 = activeMenu;
|
|
|
|
activeMenuBuffer2->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsFavoritesRecordConfirm);
|
|
|
|
activeMenu->Display();
|
|
|
|
break;}
|
|
|
|
case rmsFavoritesRecordConfirm:
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer2;
|
|
|
|
activeMenuBuffer2 = NULL;
|
2014-02-07 17:57:14 +01:00
|
|
|
activeMenu->UpdateActiveMenuItem();
|
2014-01-17 16:11:12 +01:00
|
|
|
activeMenu->Show();
|
|
|
|
break;
|
2014-01-19 13:52:05 +01:00
|
|
|
case rmsFavoritesNow:
|
|
|
|
case rmsFavoritesNext: {
|
|
|
|
int numResults = 0;
|
|
|
|
bool nowOrNext;
|
|
|
|
std::string header;
|
|
|
|
if (nextState == rmsFavoritesNow) {
|
|
|
|
nowOrNext = true;
|
|
|
|
header = tr("What's on now");
|
|
|
|
} else {
|
|
|
|
nowOrNext = false;
|
|
|
|
header = tr("What's on next");
|
|
|
|
}
|
|
|
|
const cEvent **result = recManager->WhatsOnNow(nowOrNext, numResults);
|
|
|
|
DisplayFavoriteResults(header, result, numResults);
|
|
|
|
break; }
|
|
|
|
case rmsFavoritesUser1: {
|
|
|
|
int numResults = 0;
|
|
|
|
const cEvent **result = recManager->UserDefinedTime(1, numResults);
|
|
|
|
DisplayFavoriteResults(tvguideConfig.descUser1, result, numResults);
|
|
|
|
break; }
|
|
|
|
case rmsFavoritesUser2: {
|
|
|
|
int numResults = 0;
|
|
|
|
const cEvent **result = recManager->UserDefinedTime(2, numResults);
|
|
|
|
DisplayFavoriteResults(tvguideConfig.descUser2, result, numResults);
|
|
|
|
break; }
|
|
|
|
case rmsFavoritesUser3: {
|
|
|
|
int numResults = 0;
|
|
|
|
const cEvent **result = recManager->UserDefinedTime(3, numResults);
|
|
|
|
DisplayFavoriteResults(tvguideConfig.descUser3, result, numResults);
|
|
|
|
break; }
|
|
|
|
case rmsFavoritesUser4: {
|
|
|
|
int numResults = 0;
|
|
|
|
const cEvent **result = recManager->UserDefinedTime(4, numResults);
|
|
|
|
DisplayFavoriteResults(tvguideConfig.descUser4, result, numResults);
|
|
|
|
break; }
|
2014-01-17 16:11:12 +01:00
|
|
|
|
2018-04-01 15:53:09 +02:00
|
|
|
/**********************************************************************************************
|
2014-01-10 12:44:01 +01:00
|
|
|
* COMMON
|
|
|
|
*********************************************************************************************/
|
2013-07-09 00:17:42 +02:00
|
|
|
case rmsClose: {
|
|
|
|
if (activeMenuBuffer == NULL) {
|
|
|
|
state = osEnd;
|
|
|
|
Close();
|
|
|
|
} else {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
2014-02-07 17:57:14 +01:00
|
|
|
activeMenu->UpdateActiveMenuItem();
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Show();
|
|
|
|
state = osContinue;
|
|
|
|
}
|
|
|
|
break; }
|
2018-04-01 15:53:09 +02:00
|
|
|
default:
|
2013-07-09 00:17:42 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::DisplayFavoriteResults(std::string header, const cEvent **result, int numResults) {
|
2014-01-19 13:52:05 +01:00
|
|
|
if (numResults) {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchTimerResults(header, result, numResults, "", rmsFavoritesRecord);
|
|
|
|
activeMenu->Display();
|
|
|
|
} else {
|
|
|
|
activeMenuBuffer = activeMenu;
|
|
|
|
activeMenuBuffer->Hide();
|
|
|
|
activeMenu = new cRecMenuSearchTimerNothingFound(header);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::DisplaySearchTimerList(void) {
|
2014-01-10 12:44:01 +01:00
|
|
|
delete activeMenu;
|
|
|
|
std::vector<cTVGuideSearchTimer> searchTimers;
|
|
|
|
recManager->GetSearchTimers(&searchTimers);
|
|
|
|
activeMenu = new cRecMenuSearchTimers(searchTimers);
|
|
|
|
activeMenu->Display();
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
|
2018-03-08 13:02:38 +01:00
|
|
|
int timerID = 0;
|
2019-03-30 18:06:47 +01:00
|
|
|
#if VDRVERSNUM >= 20301
|
2018-03-08 13:02:38 +01:00
|
|
|
LOCK_TIMERS_READ;
|
|
|
|
for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) {
|
|
|
|
#else
|
2019-03-30 18:06:47 +01:00
|
|
|
for (const cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
|
2018-03-08 13:02:38 +01:00
|
|
|
#endif
|
2013-07-09 00:17:42 +02:00
|
|
|
if (t == timer)
|
2014-01-10 12:44:01 +01:00
|
|
|
return DisplayTimerConflict(timerID);
|
2013-07-09 00:17:42 +02:00
|
|
|
timerID++;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
bool cRecMenuView::DisplayTimerConflict(int timerID) {
|
2013-12-29 18:13:45 +01:00
|
|
|
if (timerConflicts)
|
|
|
|
delete timerConflicts;
|
|
|
|
timerConflicts = recManager->CheckTimerConflict();
|
|
|
|
if (!timerConflicts)
|
|
|
|
return false;
|
|
|
|
int showTimerConflict = timerConflicts->GetCorrespondingConflict(timerID);
|
2013-07-09 00:17:42 +02:00
|
|
|
if (showTimerConflict > -1) {
|
2013-12-29 18:13:45 +01:00
|
|
|
timerConflicts->SetCurrentConflict(showTimerConflict);
|
|
|
|
cTVGuideTimerConflict *conflict = timerConflicts->GetCurrentConflict();
|
|
|
|
if (!conflict)
|
|
|
|
return false;
|
|
|
|
activeMenu = new cRecMenuTimerConflict(conflict);
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Display();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
void cRecMenuView::DisplayDetailedView(const cEvent *ev) {
|
2014-01-11 16:53:23 +01:00
|
|
|
activeMenu->Hide();
|
|
|
|
detailView = new cDetailView(ev, footer);
|
2014-01-25 15:04:03 +01:00
|
|
|
footer->SetDetailedViewMode(true);
|
2014-01-11 16:53:23 +01:00
|
|
|
detailView->Start();
|
|
|
|
detailViewActive = true;
|
|
|
|
}
|
|
|
|
|
2019-07-10 17:35:55 +02:00
|
|
|
eOSState cRecMenuView::ProcessKey(eKeys Key) {
|
2013-07-09 00:17:42 +02:00
|
|
|
eOSState state = osContinue;
|
|
|
|
eRecMenuState nextState = rmsContinue;
|
|
|
|
if (!activeMenu)
|
|
|
|
return state;
|
|
|
|
if (detailViewActive) {
|
|
|
|
state = detailView->ProcessKey(Key);
|
|
|
|
if (state == osEnd) {
|
|
|
|
delete detailView;
|
|
|
|
detailView = NULL;
|
|
|
|
detailViewActive = false;
|
|
|
|
activeMenu->Show();
|
|
|
|
state = osContinue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nextState = activeMenu->ProcessKey(Key);
|
|
|
|
if ((nextState == rmsClose) || ((nextState == rmsNotConsumed)&&(Key == kBack))){
|
|
|
|
if (activeMenuBuffer == NULL) {
|
|
|
|
state = osEnd;
|
|
|
|
Close();
|
|
|
|
} else {
|
|
|
|
delete activeMenu;
|
|
|
|
activeMenu = activeMenuBuffer;
|
|
|
|
activeMenuBuffer = NULL;
|
2014-02-07 17:57:14 +01:00
|
|
|
activeMenu->UpdateActiveMenuItem();
|
2013-07-09 00:17:42 +02:00
|
|
|
activeMenu->Show();
|
|
|
|
state = osContinue;
|
|
|
|
osdManager.flush();
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
state = StateMachine(nextState);
|
|
|
|
}
|
|
|
|
osdManager.flush();
|
|
|
|
return state;
|
2018-03-31 15:21:32 +02:00
|
|
|
}
|