mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuFavorites
This commit is contained in:
parent
bb7d03c7ed
commit
e707ec7d4f
31
recmenus.c
31
recmenus.c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user