diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-11-09 15:47:32 +0100 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2022-06-18 17:03:15 +0200 |
commit | e707ec7d4f5e3244db6edec1d11c45353bd95dbd (patch) | |
tree | e51e8d773e613ba481e82c8cf6ac2ddc14b9c33d /recmenus.c | |
parent | bb7d03c7ed49723420d78f30205592b3441c8a1e (diff) | |
download | vdr-plugin-tvguide-e707ec7d4f5e3244db6edec1d11c45353bd95dbd.tar.gz vdr-plugin-tvguide-e707ec7d4f5e3244db6edec1d11c45353bd95dbd.tar.bz2 |
Refactor cRecMenuFavorites
Diffstat (limited to 'recmenus.c')
-rw-r--r-- | recmenus.c | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -1501,28 +1501,23 @@ cRecMenuRecordingSearchNotFound::cRecMenuRecordingSearchNotFound(std::string sea ******************************************************************************************/ // --- cRecMenuFavorites --------------------------------------------------------- +cRecMenuFavorites::cRecMenuFavorites(std::vector<cTVGuideSearchTimer> favorites) { // OK + SetWidthPercent(70); -cRecMenuFavorites::cRecMenuFavorites(std::vector<cTVGuideSearchTimer> favorites) { deleteMenuItems = false; this->favorites = favorites; + + const cString line1 = cString::sprintf("%s", (numFavorites > 0) ? tr("Favorites") : tr("No Favorites available")); + + AddHeader(new cRecMenuItemInfo(*line1, 1, "", "", "", width - 2 * border, true)); + CreateFavoritesMenuItems(); - numFavorites = myMenuItems.size(); - SetWidthPercent(70); - cString header; - if (numFavorites > 0) { - header = tr("Favorites"); - } else { - header = tr("No Favorites available"); - } - cRecMenuItemInfo *headerItem = new cRecMenuItemInfo(*header, true); - headerItem->CalculateHeight(width - 2 * border); - SetHeader(headerItem); - cRecMenuItem *button = new cRecMenuItemButton(tr("Close"), rmsClose, (numFavorites==0)?true:false); - SetFooter(button); +// AddFooter has to be after CreateFavoritesMenuItems because of numFavorites + AddFooter(new cRecMenuItemButton(tr("Close"), rmsClose, (numFavorites) ? false : true)); - for (int i=0; i<numFavorites; i++) { - if (i==0) + for (int i = 0; i < numFavorites; i++) { + if (i == 0) myMenuItems[i]->setActive(); if (!AddMenuItemInitial(myMenuItems[i])) break; @@ -1568,11 +1563,11 @@ void cRecMenuFavorites::CreateFavoritesMenuItems(void) { for (int i = 0; i < numAdditionalFavs; i++) { myMenuItems.push_back(new cRecMenuItemFavorite(favorites[i], rmsSearchTimerTest, false)); } - + numFavorites = myMenuItems.size(); } std::string cRecMenuFavorites::NiceTime(int favTime) { - int hours = favTime/100; + int hours = favTime / 100; int mins = favTime - hours * 100; return *cString::sprintf("%02d:%02d", hours, mins); } |