summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recmenuview.c397
1 files changed, 190 insertions, 207 deletions
diff --git a/recmenuview.c b/recmenuview.c
index 68a02f5..0fa771d 100644
--- a/recmenuview.c
+++ b/recmenuview.c
@@ -84,12 +84,76 @@ void cRecMenuView::DeleteBackground(void) {
osdManager.releasePixmap(pixmapBackground);
}
+void cRecMenuView::DisplaySearchTimerList(void) {
+ delete activeMenu;
+ std::vector<cTVGuideSearchTimer> searchTimers;
+ recManager->GetSearchTimers(&searchTimers);
+ activeMenu = new cRecMenuSearchTimers(searchTimers);
+ activeMenu->Display();
+}
+
+bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
+ int timerID = 0;
+#if VDRVERSNUM >= 20301
+ LOCK_TIMERS_READ;
+ for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) {
+#else
+ for (const cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
+#endif
+ if (t == timer)
+ return DisplayTimerConflict(timerID);
+ timerID++;
+ }
+ return false;
+}
+
+bool cRecMenuView::DisplayTimerConflict(int timerID) {
+ if (timerConflicts)
+ delete timerConflicts;
+ timerConflicts = recManager->CheckTimerConflict();
+ if (!timerConflicts)
+ return false;
+ int showTimerConflict = timerConflicts->GetCorrespondingConflict(timerID);
+ if (showTimerConflict > -1) {
+ timerConflicts->SetCurrentConflict(showTimerConflict);
+ cTVGuideTimerConflict *conflict = timerConflicts->GetCurrentConflict();
+ if (!conflict)
+ return false;
+ activeMenu = new cRecMenuTimerConflict(conflict);
+ activeMenu->Display();
+ return true;
+ }
+ return false;
+}
+
+void cRecMenuView::DisplayFavoriteResults(std::string header, const cEvent **result, int numResults) {
+ 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();
+ }
+}
+
+void cRecMenuView::DisplayDetailedView(const cEvent *ev) {
+ activeMenu->Hide();
+ detailView = new cDetailView(ev, footer);
+ footer->SetDetailedViewMode(true);
+ detailView->Start();
+ detailViewActive = true;
+}
+
eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
eOSState state = osContinue;
switch (nextState) {
- /***************************************************************************************
- * INSTANT RECORDING
- ****************************************************************************************/
+/***************************************************************************************
+* INSTANT RECORDING
+****************************************************************************************/
case rmsInstantRecord: {
//caller: main menu or folder chooser
//Creating timer for active Event, if no conflict, confirm and exit
@@ -111,6 +175,47 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord);
activeMenu->Display();
break;
+ case rmsDeleteTimer: {
+ //caller: main menu
+ //delete timer for active event
+ delete activeMenu;
+ if (recManager->IsRecorded(event)) {
+ activeMenu = new cRecMenuAskDeleteTimer(event);
+ } else {
+ recManager->DeleteTimer(event);
+ activeMenu = new cRecMenuConfirmDeleteTimer(event);
+ }
+ activeMenu->Display();
+ break; }
+ case rmsDeleteTimerConfirmation: {
+ //delete running timer for active event
+ recManager->DeleteTimer(event);
+ delete activeMenu;
+ activeMenu = new cRecMenuConfirmDeleteTimer(event);
+ activeMenu->Display();
+ break; }
+ case rmsEditTimer: {
+ //edit timer for active event
+ const cTimer *timer = recManager->GetTimerForEvent(event);
+ if (timer) {
+ delete activeMenu;
+ activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimer);
+ activeMenu->Display();
+ }
+ break; }
+ case rmsSaveTimer: {
+ //caller: cRecMenuEditTimer
+ //save timer for active event
+ cTimer timerModified;
+ const cTimer *originalTimer;
+ if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
+ timerModified = menu->GetTimer();
+ originalTimer = menu->GetOriginalTimer();
+ } else break;
+ recManager->SaveTimer(originalTimer, timerModified);
+ Close();
+ state = osEnd;
+ break; }
case rmsIgnoreTimerConflict:
//caller: cRecMenuTimerConflict
//Confirming created Timer
@@ -189,58 +294,9 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu->Display();
}
break; }
- case rmsDeleteTimer:
- //caller: main menu
- //delete timer for active event
- delete activeMenu;
- if (recManager->IsRecorded(event)) {
- activeMenu = new cRecMenuAskDeleteTimer(event);
- } else {
- recManager->DeleteTimer(event);
- activeMenu = new cRecMenuConfirmDeleteTimer(event);
- }
- activeMenu->Display();
- break;
- case rmsDeleteTimerConfirmation:
- //delete running timer for active event
- recManager->DeleteTimer(event);
- delete activeMenu;
- activeMenu = new cRecMenuConfirmDeleteTimer(event);
- activeMenu->Display();
- break;
- case rmsEditTimer: {
- //edit timer for active event
- const cTimer *timer;
-#if VDRVERSNUM >= 20301
- {
- LOCK_TIMERS_READ;
- timer = recManager->GetTimerForEvent(event);
- }
-#else
- timer = recManager->GetTimerForEvent(event);
-#endif
- if (timer) {
- delete activeMenu;
- activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimer);
- activeMenu->Display();
- }
- break; }
- case rmsSaveTimer: {
- //caller: cRecMenuEditTimer
- //save timer for active event
- cTimer timerModified;
- const cTimer *originalTimer;
- if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
- timerModified = menu->GetTimer();
- originalTimer = menu->GetOriginalTimer();
- } else break;
- recManager->SaveTimer(originalTimer, timerModified);
- state = osEnd;
- Close();
- break; }
- /***************************************************************************************
- * SERIES TIMER
- ****************************************************************************************/
+/***************************************************************************************
+* SERIES TIMER
+****************************************************************************************/
case rmsSeriesTimer: {
//caller: main menu oder folder chooser
std::string recFolder = "";
@@ -275,9 +331,9 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer);
activeMenu->Display();
break; }
- /**********************************************************************************************
- * SEARCH TIMER
- ***********************************************************************************************/
+/**********************************************************************************************
+* SEARCH TIMER
+***********************************************************************************************/
case rmsSearchTimer:
//Caller: main menu
//set search String for search timer
@@ -363,13 +419,12 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerResults(searchTimer.GetSearchString(), searchResult, numSearchResults, "", recState);
- activeMenu->Display();
} else {
activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerNothingFound(searchTimer.GetSearchString());
- activeMenu->Display();
}
+ activeMenu->Display();
break; }
case rmsSearchTimerSave: {
//caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate
@@ -448,66 +503,9 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuSearchConfirmTimer(ev, rmsFavoritesRecordConfirm);
activeMenu->Display();
break; }
- /**********************************************************************************************
- * SWITCH TIMER
- ***********************************************************************************************/
- case rmsSwitchTimer:
- delete activeMenu;
- activeMenu = new cRecMenuSwitchTimer();
- activeMenu->Display();
- break;
- case rmsSwitchTimerCreate: {
- cSwitchTimer switchTimer;
- if (cRecMenuSwitchTimer *menu = dynamic_cast<cRecMenuSwitchTimer*>(activeMenu)) {
- switchTimer = menu->GetSwitchTimer();
- } else break;
- bool success = recManager->CreateSwitchTimer(event, switchTimer);
- delete activeMenu;
- activeMenu = new cRecMenuSwitchTimerConfirm(success);
- activeMenu->Display();
- break; }
- case rmsSwitchTimerDelete:
- recManager->DeleteSwitchTimer(event);
- delete activeMenu;
- activeMenu = new cRecMenuSwitchTimerDelete();
- activeMenu->Display();
- break;
- /**********************************************************************************************
- * RECORDINGS SEARCH
- ***********************************************************************************************/
- case rmsRecordingSearch: {
- //caller: main menu or rmsRecordingSearchResult
- std::string searchString = event->Title();
- if (cRecMenuRecordingSearchResults *menu = dynamic_cast<cRecMenuRecordingSearchResults*>(activeMenu)) {
- searchString = menu->GetSearchString();
- };
- delete activeMenu;
- activeMenu = new cRecMenuRecordingSearch(searchString);
- activeMenu->Display();
- break; }
- case rmsRecordingSearchResult: {
- //caller: cRecMenuRecordingSearch
- std::string searchString;
- if (cRecMenuRecordingSearch *menu = dynamic_cast<cRecMenuRecordingSearch*>(activeMenu)) {
- searchString = menu->GetSearchString();
- } else break;
- delete activeMenu;
- if (searchString.size() < 4) {
- activeMenu = new cRecMenuRecordingSearch(searchString);
- } else {
- int numSearchResults = 0;
- const cRecording **searchResult = recManager->SearchForRecordings(searchString, numSearchResults);
- if (numSearchResults == 0) {
- activeMenu = new cRecMenuRecordingSearchNotFound(searchString);
- } else {
- activeMenu = new cRecMenuRecordingSearchResults(searchString, searchResult, numSearchResults);
- }
- }
- activeMenu->Display();
- break; }
- /**********************************************************************************************
- * SEARCH
- ***********************************************************************************************/
+/**********************************************************************************************
+* SEARCH
+***********************************************************************************************/
case rmsSearch:
case rmsSearchWithOptions: {
//caller: main menu, cRecMenuSearch, cRecMenuSearchResults
@@ -587,9 +585,33 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu->UpdateActiveMenuItem();
activeMenu->Show();
break;
- /**********************************************************************************************
- * CHECK FOR TIMER CONFLICTS
- ***********************************************************************************************/
+/**********************************************************************************************
+* SWITCH TIMER
+***********************************************************************************************/
+ case rmsSwitchTimer:
+ delete activeMenu;
+ activeMenu = new cRecMenuSwitchTimer();
+ activeMenu->Display();
+ break;
+ case rmsSwitchTimerCreate: {
+ cSwitchTimer switchTimer;
+ if (cRecMenuSwitchTimer *menu = dynamic_cast<cRecMenuSwitchTimer*>(activeMenu)) {
+ switchTimer = menu->GetSwitchTimer();
+ } else break;
+ bool success = recManager->CreateSwitchTimer(event, switchTimer);
+ delete activeMenu;
+ activeMenu = new cRecMenuSwitchTimerConfirm(success);
+ activeMenu->Display();
+ break; }
+ case rmsSwitchTimerDelete:
+ recManager->DeleteSwitchTimer(event);
+ delete activeMenu;
+ activeMenu = new cRecMenuSwitchTimerDelete();
+ activeMenu->Display();
+ break;
+/**********************************************************************************************
+* CHECK FOR TIMER CONFLICTS
+***********************************************************************************************/
case rmsTimerConflicts: {
//caller: main menu
//Show timer conflict
@@ -645,13 +667,12 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
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();
+ activeMenu = new cRecMenuNoRerunsFound((event->Title()) ? event->Title() : "");
}
+ activeMenu->Display();
}
}
break; }
@@ -695,9 +716,9 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu->Display();
}
break; }
- /**********************************************************************************************
- * TIMELINE
- ***********************************************************************************************/
+/**********************************************************************************************
+* TIMELINE
+***********************************************************************************************/
case rmsTimeline: {
if (timerConflicts) {
delete timerConflicts;
@@ -739,14 +760,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timer = menu->GetOriginalTimer();
} else break;
-#if VDRVERSNUM >= 20301
- {
- LOCK_TIMERS_WRITE;
- recManager->DeleteTimer(Timers->GetTimer(timer));
- }
-#else
- recManager->DeleteTimer(Timers.GetTimer((cTimer*)timer));
-#endif
+ recManager->DeleteTimer(timer);
delete activeMenu;
if (timerConflicts) {
delete timerConflicts;
@@ -755,9 +769,42 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuTimeline(timerConflicts);
activeMenu->Display();
break; }
- /**********************************************************************************************
- * FAVORITES
- *********************************************************************************************/
+/**********************************************************************************************
+* RECORDINGS SEARCH
+***********************************************************************************************/
+ case rmsRecordingSearch: {
+ //caller: main menu or rmsRecordingSearchResult
+ std::string searchString = event->Title();
+ if (cRecMenuRecordingSearchResults *menu = dynamic_cast<cRecMenuRecordingSearchResults*>(activeMenu)) {
+ searchString = menu->GetSearchString();
+ };
+ delete activeMenu;
+ activeMenu = new cRecMenuRecordingSearch(searchString);
+ activeMenu->Display();
+ break; }
+ case rmsRecordingSearchResult: {
+ //caller: cRecMenuRecordingSearch
+ std::string searchString;
+ if (cRecMenuRecordingSearch *menu = dynamic_cast<cRecMenuRecordingSearch*>(activeMenu)) {
+ searchString = menu->GetSearchString();
+ } else break;
+ delete activeMenu;
+ if (searchString.size() < 4) {
+ activeMenu = new cRecMenuRecordingSearch(searchString);
+ } else {
+ int numSearchResults = 0;
+ const cRecording **searchResult = recManager->SearchForRecordings(searchString, numSearchResults);
+ if (numSearchResults == 0) {
+ activeMenu = new cRecMenuRecordingSearchNotFound(searchString);
+ } else {
+ activeMenu = new cRecMenuRecordingSearchResults(searchString, searchResult, numSearchResults);
+ }
+ }
+ activeMenu->Display();
+ break; }
+/**********************************************************************************************
+* FAVORITES
+*********************************************************************************************/
case rmsFavoritesRecord: {
//caller: cRecMenuSearchTimerResults
const cEvent *ev = NULL;
@@ -815,9 +862,9 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
DisplayFavoriteResults(tvguideConfig.descUser4, result, numResults);
break; }
- /**********************************************************************************************
- * COMMON
- *********************************************************************************************/
+/**********************************************************************************************
+* COMMON
+*********************************************************************************************/
case rmsClose: {
if (activeMenuBuffer == NULL) {
state = osEnd;
@@ -837,70 +884,6 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
return state;
}
-void cRecMenuView::DisplayFavoriteResults(std::string header, const cEvent **result, int numResults) {
- 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();
- }
-}
-
-void cRecMenuView::DisplaySearchTimerList(void) {
- delete activeMenu;
- std::vector<cTVGuideSearchTimer> searchTimers;
- recManager->GetSearchTimers(&searchTimers);
- activeMenu = new cRecMenuSearchTimers(searchTimers);
- activeMenu->Display();
-}
-
-bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
- int timerID = 0;
-#if VDRVERSNUM >= 20301
- LOCK_TIMERS_READ;
- for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) {
-#else
- for (const cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
-#endif
- if (t == timer)
- return DisplayTimerConflict(timerID);
- timerID++;
- }
- return false;
-}
-
-bool cRecMenuView::DisplayTimerConflict(int timerID) {
- if (timerConflicts)
- delete timerConflicts;
- timerConflicts = recManager->CheckTimerConflict();
- if (!timerConflicts)
- return false;
- int showTimerConflict = timerConflicts->GetCorrespondingConflict(timerID);
- if (showTimerConflict > -1) {
- timerConflicts->SetCurrentConflict(showTimerConflict);
- cTVGuideTimerConflict *conflict = timerConflicts->GetCurrentConflict();
- if (!conflict)
- return false;
- activeMenu = new cRecMenuTimerConflict(conflict);
- activeMenu->Display();
- return true;
- }
- return false;
-}
-
-void cRecMenuView::DisplayDetailedView(const cEvent *ev) {
- activeMenu->Hide();
- detailView = new cDetailView(ev, footer);
- footer->SetDetailedViewMode(true);
- detailView->Start();
- detailViewActive = true;
-}
-
eOSState cRecMenuView::ProcessKey(eKeys Key) {
eOSState state = osContinue;
eRecMenuState nextState = rmsContinue;