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
- Favorites menu with EPG Search favorite timers with blue key
- Display baseline for current time
- Added possibility to create timer from favorites results

View File

@ -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 {

View File

@ -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<cRecMenuSearchTimerEdit*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
} else if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
@ -326,6 +328,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
searchTimer.Parse(true);
} else if (cRecMenuFavorites *menu = dynamic_cast<cRecMenuFavorites*>(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<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
*********************************************************************************************/

View File

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

View File

@ -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<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;
}
}
@ -990,7 +991,7 @@ cRecMenuSearchTimerResults::cRecMenuSearchTimerResults(std::string searchString,
cRecMenuItem *cRecMenuSearchTimerResults::GetMenuItem(int number) {
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 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();

View File

@ -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) {};
};