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
27
recmenus.c
27
recmenus.c
@ -1501,25 +1501,20 @@ cRecMenuRecordingSearchNotFound::cRecMenuRecordingSearchNotFound(std::string sea
|
|||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
|
|
||||||
// --- cRecMenuFavorites ---------------------------------------------------------
|
// --- cRecMenuFavorites ---------------------------------------------------------
|
||||||
|
cRecMenuFavorites::cRecMenuFavorites(std::vector<cTVGuideSearchTimer> favorites) { // OK
|
||||||
|
SetWidthPercent(70);
|
||||||
|
|
||||||
cRecMenuFavorites::cRecMenuFavorites(std::vector<cTVGuideSearchTimer> favorites) {
|
|
||||||
deleteMenuItems = false;
|
deleteMenuItems = false;
|
||||||
this->favorites = favorites;
|
this->favorites = favorites;
|
||||||
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);
|
const cString line1 = cString::sprintf("%s", (numFavorites > 0) ? tr("Favorites") : tr("No Favorites available"));
|
||||||
SetFooter(button);
|
|
||||||
|
AddHeader(new cRecMenuItemInfo(*line1, 1, "", "", "", width - 2 * border, true));
|
||||||
|
|
||||||
|
CreateFavoritesMenuItems();
|
||||||
|
|
||||||
|
// 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++) {
|
for (int i = 0; i < numFavorites; i++) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -1568,7 +1563,7 @@ void cRecMenuFavorites::CreateFavoritesMenuItems(void) {
|
|||||||
for (int i = 0; i < numAdditionalFavs; i++) {
|
for (int i = 0; i < numAdditionalFavs; i++) {
|
||||||
myMenuItems.push_back(new cRecMenuItemFavorite(favorites[i], rmsSearchTimerTest, false));
|
myMenuItems.push_back(new cRecMenuItemFavorite(favorites[i], rmsSearchTimerTest, false));
|
||||||
}
|
}
|
||||||
|
numFavorites = myMenuItems.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cRecMenuFavorites::NiceTime(int favTime) {
|
std::string cRecMenuFavorites::NiceTime(int favTime) {
|
||||||
|
Loading…
Reference in New Issue
Block a user