From 662a17df88a607e0179b2bb63cd984fafcc5d784 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 17 Jan 2014 16:11:12 +0100 Subject: [PATCH] Added possibility to create timer from favorites results --- HISTORY | 1 + recmenuitem.h | 5 ++++- recmenumanager.c | 33 ++++++++++++++++++++++++++++++--- recmenumanager.h | 1 + recmenus.c | 11 ++++++----- recmenus.h | 5 +++-- 6 files changed, 45 insertions(+), 11 deletions(-) diff --git a/HISTORY b/HISTORY index e6259fb..0d00852 100644 --- a/HISTORY +++ b/HISTORY @@ -107,3 +107,4 @@ Version 1.1.0 are displayed - Favorites menu with EPG Search favorite timers with blue key - Display baseline for current time +- Added possibility to create timer from favorites results diff --git a/recmenuitem.h b/recmenuitem.h index 68d08aa..7f67777 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -15,6 +15,7 @@ enum eRecMenuState { rmsRefresh, rmsContinue, rmsClose, + rmsDisabled, //INSTANT TIMER rmsInstantRecord, rmsInstantRecordFolder, @@ -69,7 +70,9 @@ enum eRecMenuState { rmsTimelineTimerEdit, rmsTimelineTimerSave, rmsTimelineTimerDelete, - rmsDisabled, + //FAVORITES + rmsFavoritesRecord, + rmsFavoritesRecordConfirm, }; enum eDependend { diff --git a/recmenumanager.c b/recmenumanager.c index da6af92..4a8d119 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -9,6 +9,7 @@ cRecMenuManager::cRecMenuManager(void) { active = false; activeMenu = NULL; activeMenuBuffer = NULL; + activeMenuBuffer2 = NULL; recManager = new cRecManager(); recManager->SetEPGSearchPlugin(); timerConflicts = NULL; @@ -315,6 +316,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { //caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate, cRecMenuSearchTimers, cRecMenuFavorites //show results of currently choosen search timer cTVGuideSearchTimer searchTimer; + bool showRecIcon = false; if (cRecMenuSearchTimerEdit *menu = dynamic_cast(activeMenu)) { searchTimer = menu->GetSearchTimer(); } else if (cRecMenuSearchTimers *menu = dynamic_cast(activeMenu)) { @@ -326,6 +328,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { searchTimer.Parse(true); } else if (cRecMenuFavorites *menu = dynamic_cast(activeMenu)) { searchTimer = menu->GetFavorite(); + showRecIcon = true; } else break; int numSearchResults = 0; std::string searchString = searchTimer.BuildSearchString(); @@ -333,7 +336,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { if (numSearchResults) { activeMenuBuffer = activeMenu; activeMenuBuffer->Hide(); - activeMenu = new cRecMenuSearchTimerResults(searchTimer.SearchString(), searchResult, numSearchResults); + activeMenu = new cRecMenuSearchTimerResults(searchTimer.SearchString(), searchResult, numSearchResults, "", showRecIcon?rmsFavoritesRecord:rmsDisabled); activeMenu->Display(); } else { activeMenuBuffer = activeMenu; @@ -531,10 +534,10 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { } else break; if (!ev) break; - cTimer *timer = recManager->createTimer(ev, ""); + recManager->createTimer(ev, ""); activeMenuBuffer = activeMenu; activeMenuBuffer->Hide(); - activeMenu = new cRecMenuSearchConfirmTimer(ev); + activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsSearchRecordConfirm); activeMenu->Display(); break;} case rmsSearchRecordConfirm: @@ -694,6 +697,30 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { activeMenu = new cRecMenuTimeline(timerConflicts); activeMenu->Display(); break; } + /********************************************************************************************** + * FAVORITES + *********************************************************************************************/ + case rmsFavoritesRecord: { + //caller: cRecMenuSearchTimerResults + const cEvent *ev = NULL; + if (cRecMenuSearchTimerResults *menu = dynamic_cast(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; + activeMenu->Show(); + break; + /********************************************************************************************** * COMMON *********************************************************************************************/ diff --git a/recmenumanager.h b/recmenumanager.h index 030b6bd..b212ecc 100644 --- a/recmenumanager.h +++ b/recmenumanager.h @@ -13,6 +13,7 @@ private: bool active; cRecMenu *activeMenu; cRecMenu *activeMenuBuffer; + cRecMenu *activeMenuBuffer2; const cEvent *event; cRecManager *recManager; cTVGuideTimerConflicts *timerConflicts; diff --git a/recmenus.c b/recmenus.c index 338083a..9717439 100644 --- a/recmenus.c +++ b/recmenus.c @@ -958,8 +958,9 @@ cRecMenuSearchTimerTemplatesCreate::cRecMenuSearchTimerTemplatesCreate(TVGuideEP // --- cRecMenuSearchTimerResults --------------------------------------------------------- -cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString, const cEvent **searchResults, int numResults, std::string templateName) { +cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString, const cEvent **searchResults, int numResults, std::string templateName, eRecMenuState action2) { this->searchResults = searchResults; + this->action2 = action2; SetWidthPercent(70); cString message1 = tr("search results for Search Timer"); cString message2 = tr("search result for Search Timer"); @@ -979,7 +980,7 @@ cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString, SetFooter(buttons); if (searchResults && (numResults > 0)) { for (int i=0; i= 0) && (number < numResults)) { - cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsDisabled, false); + cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, action2, false); return result; } return NULL; @@ -1192,7 +1193,7 @@ const cEvent *cRecMenuSearchResults::GetEvent(void) { // --- cRecMenuSearchConfirmTimer --------------------------------------------------------- -cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event) { +cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRecMenuState nextAction) { SetWidthPercent(50); cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); cString message = tr("Timer created"); @@ -1207,7 +1208,7 @@ cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event) { cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); infoItem->CalculateHeight(width - 2 * border); AddMenuItem(infoItem); - AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchRecordConfirm, true, true)); + AddMenuItem(new cRecMenuItemButton(tr("OK"), nextAction, true, true)); CalculateHeight(); CreatePixmap(); Arrange(); diff --git a/recmenus.h b/recmenus.h index 1c92505..c128f4e 100644 --- a/recmenus.h +++ b/recmenus.h @@ -291,8 +291,9 @@ class cRecMenuSearchTimerResults: public cRecMenu { private: const cEvent **searchResults; int numResults; + eRecMenuState action2; public: - cRecMenuSearchTimerResults(std::string searchString, const cEvent **searchResults, int numResults, std::string templateName = ""); + cRecMenuSearchTimerResults(std::string searchString, const cEvent **searchResults, int numResults, std::string templateName = "", eRecMenuState action2 = rmsDisabled); cRecMenuItem *GetMenuItem(int number); int GetTotalNumMenuItems(void); virtual ~cRecMenuSearchTimerResults(void) { @@ -379,7 +380,7 @@ public: // --- cRecMenuSearchConfirmTimer --------------------------------------------------------- class cRecMenuSearchConfirmTimer: public cRecMenu { public: - cRecMenuSearchConfirmTimer(const cEvent *event); + cRecMenuSearchConfirmTimer(const cEvent *event, eRecMenuState nextAction); virtual ~cRecMenuSearchConfirmTimer(void) {}; };