Added possibility to create timer from favorites results

This commit is contained in:
louis 2014-01-17 16:11:12 +01:00
parent 497f95aa6f
commit 662a17df88
6 changed files with 45 additions and 11 deletions

View File

@ -107,3 +107,4 @@ Version 1.1.0
are displayed are displayed
- Favorites menu with EPG Search favorite timers with blue key - Favorites menu with EPG Search favorite timers with blue key
- Display baseline for current time - Display baseline for current time
- Added possibility to create timer from favorites results

View File

@ -15,6 +15,7 @@ enum eRecMenuState {
rmsRefresh, rmsRefresh,
rmsContinue, rmsContinue,
rmsClose, rmsClose,
rmsDisabled,
//INSTANT TIMER //INSTANT TIMER
rmsInstantRecord, rmsInstantRecord,
rmsInstantRecordFolder, rmsInstantRecordFolder,
@ -69,7 +70,9 @@ enum eRecMenuState {
rmsTimelineTimerEdit, rmsTimelineTimerEdit,
rmsTimelineTimerSave, rmsTimelineTimerSave,
rmsTimelineTimerDelete, rmsTimelineTimerDelete,
rmsDisabled, //FAVORITES
rmsFavoritesRecord,
rmsFavoritesRecordConfirm,
}; };
enum eDependend { enum eDependend {

View File

@ -9,6 +9,7 @@ cRecMenuManager::cRecMenuManager(void) {
active = false; active = false;
activeMenu = NULL; activeMenu = NULL;
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
activeMenuBuffer2 = NULL;
recManager = new cRecManager(); recManager = new cRecManager();
recManager->SetEPGSearchPlugin(); recManager->SetEPGSearchPlugin();
timerConflicts = NULL; timerConflicts = NULL;
@ -315,6 +316,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
//caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate, cRecMenuSearchTimers, cRecMenuFavorites //caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate, cRecMenuSearchTimers, cRecMenuFavorites
//show results of currently choosen search timer //show results of currently choosen search timer
cTVGuideSearchTimer searchTimer; cTVGuideSearchTimer searchTimer;
bool showRecIcon = false;
if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) { if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
searchTimer = menu->GetSearchTimer(); searchTimer = menu->GetSearchTimer();
} else if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) { } else if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
@ -326,6 +328,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
searchTimer.Parse(true); searchTimer.Parse(true);
} else if (cRecMenuFavorites *menu = dynamic_cast<cRecMenuFavorites*>(activeMenu)) { } else if (cRecMenuFavorites *menu = dynamic_cast<cRecMenuFavorites*>(activeMenu)) {
searchTimer = menu->GetFavorite(); searchTimer = menu->GetFavorite();
showRecIcon = true;
} else break; } else break;
int numSearchResults = 0; int numSearchResults = 0;
std::string searchString = searchTimer.BuildSearchString(); std::string searchString = searchTimer.BuildSearchString();
@ -333,7 +336,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
if (numSearchResults) { if (numSearchResults) {
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerResults(searchTimer.SearchString(), searchResult, numSearchResults); activeMenu = new cRecMenuSearchTimerResults(searchTimer.SearchString(), searchResult, numSearchResults, "", showRecIcon?rmsFavoritesRecord:rmsDisabled);
activeMenu->Display(); activeMenu->Display();
} else { } else {
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
@ -531,10 +534,10 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} else break; } else break;
if (!ev) if (!ev)
break; break;
cTimer *timer = recManager->createTimer(ev, ""); recManager->createTimer(ev, "");
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchConfirmTimer(ev); activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsSearchRecordConfirm);
activeMenu->Display(); activeMenu->Display();
break;} break;}
case rmsSearchRecordConfirm: case rmsSearchRecordConfirm:
@ -694,6 +697,30 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuTimeline(timerConflicts); activeMenu = new cRecMenuTimeline(timerConflicts);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/**********************************************************************************************
* 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;
activeMenu->Show();
break;
/********************************************************************************************** /**********************************************************************************************
* COMMON * COMMON
*********************************************************************************************/ *********************************************************************************************/

View File

@ -13,6 +13,7 @@ private:
bool active; bool active;
cRecMenu *activeMenu; cRecMenu *activeMenu;
cRecMenu *activeMenuBuffer; cRecMenu *activeMenuBuffer;
cRecMenu *activeMenuBuffer2;
const cEvent *event; const cEvent *event;
cRecManager *recManager; cRecManager *recManager;
cTVGuideTimerConflicts *timerConflicts; cTVGuideTimerConflicts *timerConflicts;

View File

@ -958,8 +958,9 @@ cRecMenuSearchTimerTemplatesCreate::cRecMenuSearchTimerTemplatesCreate(TVGuideEP
// --- cRecMenuSearchTimerResults --------------------------------------------------------- // --- 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->searchResults = searchResults;
this->action2 = action2;
SetWidthPercent(70); SetWidthPercent(70);
cString message1 = tr("search results for Search Timer"); cString message1 = tr("search results for Search Timer");
cString message2 = tr("search result for Search Timer"); cString message2 = tr("search result for Search Timer");
@ -979,7 +980,7 @@ cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString,
SetFooter(buttons); SetFooter(buttons);
if (searchResults && (numResults > 0)) { if (searchResults && (numResults > 0)) {
for (int i=0; i<numResults; i++) { for (int i=0; i<numResults; i++) {
if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, rmsDisabled, (i==0)?true:false))) if (!AddMenuItemInitial(new cRecMenuItemEvent(searchResults[i], rmsSearchShowInfo, action2, (i==0)?true:false)))
break; break;
} }
} }
@ -990,7 +991,7 @@ cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString,
cRecMenuItem *cRecMenuSearchTimerResults::GetMenuItem(int number) { cRecMenuItem *cRecMenuSearchTimerResults::GetMenuItem(int number) {
if ((number >= 0) && (number < numResults)) { if ((number >= 0) && (number < numResults)) {
cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, rmsDisabled, false); cRecMenuItem *result = new cRecMenuItemEvent(searchResults[number], rmsSearchShowInfo, action2, false);
return result; return result;
} }
return NULL; return NULL;
@ -1192,7 +1193,7 @@ const cEvent *cRecMenuSearchResults::GetEvent(void) {
// --- cRecMenuSearchConfirmTimer --------------------------------------------------------- // --- cRecMenuSearchConfirmTimer ---------------------------------------------------------
cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event) { cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event, eRecMenuState nextAction) {
SetWidthPercent(50); SetWidthPercent(50);
cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); cString channelName = Channels.GetByChannelID(event->ChannelID())->Name();
cString message = tr("Timer created"); cString message = tr("Timer created");
@ -1207,7 +1208,7 @@ cRecMenuSearchConfirmTimer::cRecMenuSearchConfirmTimer(const cEvent *event) {
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text);
infoItem->CalculateHeight(width - 2 * border); infoItem->CalculateHeight(width - 2 * border);
AddMenuItem(infoItem); AddMenuItem(infoItem);
AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsSearchRecordConfirm, true, true)); AddMenuItem(new cRecMenuItemButton(tr("OK"), nextAction, true, true));
CalculateHeight(); CalculateHeight();
CreatePixmap(); CreatePixmap();
Arrange(); Arrange();

View File

@ -291,8 +291,9 @@ class cRecMenuSearchTimerResults: public cRecMenu {
private: private:
const cEvent **searchResults; const cEvent **searchResults;
int numResults; int numResults;
eRecMenuState action2;
public: 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); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuSearchTimerResults(void) { virtual ~cRecMenuSearchTimerResults(void) {
@ -379,7 +380,7 @@ public:
// --- cRecMenuSearchConfirmTimer --------------------------------------------------------- // --- cRecMenuSearchConfirmTimer ---------------------------------------------------------
class cRecMenuSearchConfirmTimer: public cRecMenu { class cRecMenuSearchConfirmTimer: public cRecMenu {
public: public:
cRecMenuSearchConfirmTimer(const cEvent *event); cRecMenuSearchConfirmTimer(const cEvent *event, eRecMenuState nextAction);
virtual ~cRecMenuSearchConfirmTimer(void) {}; virtual ~cRecMenuSearchConfirmTimer(void) {};
}; };