From fcb664da93677cf540d384ee1d377493a2b475ba Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 19 Jan 2014 13:52:05 +0100 Subject: [PATCH] Improved favorites menu with whats on now / next and up to four user defined times --- HISTORY | 2 + config.c | 34 ++++++++++++++++ config.h | 17 ++++++++ po/ca_ES.po | 56 +++++++++++++++++++++---- po/de_DE.po | 56 +++++++++++++++++++++---- po/ru_RU.po | 56 +++++++++++++++++++++---- po/sk_SK.po | 56 +++++++++++++++++++++---- recmanager.c | 96 +++++++++++++++++++++++++++++++++++++++++++ recmanager.h | 2 + recmenuitem.c | 74 +++++++++++++++++++++++++++++++++ recmenuitem.h | 23 +++++++++++ recmenumanager.c | 49 ++++++++++++++++++++++ recmenumanager.h | 1 + recmenus.c | 74 ++++++++++++++++++++++++++++----- recmenus.h | 3 ++ setup.c | 104 ++++++++++++++++++++++++++++++++++++++++++++--- setup.h | 12 ++++++ 17 files changed, 670 insertions(+), 45 deletions(-) diff --git a/HISTORY b/HISTORY index 3a0a713..fa4ce67 100644 --- a/HISTORY +++ b/HISTORY @@ -109,3 +109,5 @@ Version 1.1.0 - Display baseline for current time - Added possibility to create timer from favorites results - left / right scroll page up / down in recmenu result lists +- Improved favorites menu with whats on now / next and up to four user + defined times diff --git a/config.c b/config.c index 6079382..243368c 100644 --- a/config.c +++ b/config.c @@ -45,6 +45,23 @@ cTvguideConfig::cTvguideConfig() { epgImageWidthLarge = 525; epgImageHeightLarge = 400; recMenuAskFolder = 0; + favWhatsOnNow = 1; + favWhatsOnNext = 1; + favUseTime1 = 0; + favUseTime2 = 0; + favUseTime3 = 0; + favUseTime4 = 0; + favTime1 = 0; + favTime2 = 0; + favTime3 = 0; + favTime4 = 0; + descUser1 = ""; + descUser2 = ""; + descUser3 = ""; + descUser4 = ""; + favLimitChannels = 0; + favStartChannel = 0; + favStopChannel = 0; fontIndex = 0; fontNameDefault = "VDRSymbols Sans:Book"; FontButtonDelta = 0; @@ -252,6 +269,23 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value); else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value); else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value); + else if (strcmp(Name, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value); + else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value); + else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value); + else if (strcmp(Name, "favUseTime2") == 0) favUseTime2 = atoi(Value); + else if (strcmp(Name, "favUseTime3") == 0) favUseTime3 = atoi(Value); + else if (strcmp(Name, "favUseTime4") == 0) favUseTime4 = atoi(Value); + else if (strcmp(Name, "favTime1") == 0) favTime1 = atoi(Value); + else if (strcmp(Name, "favTime2") == 0) favTime2 = atoi(Value); + else if (strcmp(Name, "favTime3") == 0) favTime3 = atoi(Value); + else if (strcmp(Name, "favTime4") == 0) favTime4 = atoi(Value); + else if (strcmp(Name, "descUser1") == 0) descUser1 = Value; + else if (strcmp(Name, "descUser2") == 0) descUser2 = Value; + else if (strcmp(Name, "descUser3") == 0) descUser3 = Value; + else if (strcmp(Name, "descUser4") == 0) descUser4 = Value; + else if (strcmp(Name, "favLimitChannels") == 0) favLimitChannels = atoi(Value); + else if (strcmp(Name, "favStartChannel") == 0) favStartChannel = atoi(Value); + else if (strcmp(Name, "favStopChannel") == 0) favStopChannel = atoi(Value); else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value); else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value); diff --git a/config.h b/config.h index c95d3c6..bb1c4b7 100644 --- a/config.h +++ b/config.h @@ -90,6 +90,23 @@ class cTvguideConfig { cString epgImagePath; cString iconPath; int recMenuAskFolder; + int favWhatsOnNow; + int favWhatsOnNext; + int favUseTime1; + int favUseTime2; + int favUseTime3; + int favUseTime4; + int favTime1; + int favTime2; + int favTime3; + int favTime4; + std::string descUser1; + std::string descUser2; + std::string descUser3; + std::string descUser4; + int favLimitChannels; + int favStartChannel; + int favStopChannel; int fontIndex; const char *fontNameDefault; int FontButtonDelta; diff --git a/po/ca_ES.po b/po/ca_ES.po index ce1a8f3..f695842 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-15 18:19+0100\n" +"POT-Creation-Date: 2014-01-19 12:51+0100\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n" "Last-Translator: My friend Thanks David \n" "Language-Team: \n" @@ -96,6 +96,12 @@ msgstr "" msgid "recordings done" msgstr "" +msgid "What's on now" +msgstr "" + +msgid "What's on next" +msgstr "" + msgid "Instant Record" msgstr "Enregistra a l'instant" @@ -405,6 +411,12 @@ msgstr "cerca resultats per temporitzador" msgid "search result for Search Timer" msgstr "cerca resultat per temporitzador" +msgid "search results for Favorite" +msgstr "" + +msgid "search result for Favorite" +msgstr "" + msgid "Nothing found for Search String" msgstr "No s'ha trobat la cadena de text" @@ -510,6 +522,9 @@ msgstr "Presentació de pantalla" msgid "Fonts and Fontsizes" msgstr "Tipus i mida de lletra" +msgid "Recording Menus and Favorites" +msgstr "" + msgid "Image Loading and Caching" msgstr "" @@ -585,12 +600,6 @@ msgstr "Salt (Botons 4 / 6) en hores" msgid "Time Format (12h/24h)" msgstr "Format de temps (12h/24h)" -msgid "Use folders for instant records" -msgstr "Utilitza carpetes per gravacions a l'instant" - -msgid "Use Remotetimers" -msgstr "Utilitza temporitzadors remots" - msgid "Display Reruns in detailed EPG View" msgstr "Mostre reemissions a l'EPG detallat" @@ -744,6 +753,39 @@ msgstr "Mida de la Font petita - Menú Cerca & Enregistra" msgid "Search & Recording Menu Header Font Size" msgstr "" +msgid "Use folders for instant records" +msgstr "Utilitza carpetes per gravacions a l'instant" + +msgid "Use Remotetimers" +msgstr "Utilitza temporitzadors remots" + +msgid "Use \"What's on now\" in favorites" +msgstr "" + +msgid "Use \"What's on next\" in favorites" +msgstr "" + +msgid "Use user defined time 1 in favorites" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "Time" +msgstr "" + +msgid "Use user defined time 2 in favorites" +msgstr "" + +msgid "Use user defined time 3 in favorites" +msgstr "" + +msgid "Use user defined time 4 in favorites" +msgstr "" + +msgid "Limit channels in favorites" +msgstr "" + msgid "Create Log Messages for image loading" msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index 5dde422..2df32bf 100755 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-15 18:19+0100\n" +"POT-Creation-Date: 2014-01-19 12:51+0100\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -93,6 +93,12 @@ msgstr "aktive Timer" msgid "recordings done" msgstr "erledigte Aufnahmen" +msgid "What's on now" +msgstr "Was läuft jetzt?" + +msgid "What's on next" +msgstr "Was läuft als nächstes?" + msgid "Instant Record" msgstr "Aufnahme" @@ -402,6 +408,12 @@ msgstr "Treffer für Suchtimer" msgid "search result for Search Timer" msgstr "Treffer für Suchtimer" +msgid "search results for Favorite" +msgstr "Suchergebnisse für Favorit" + +msgid "search result for Favorite" +msgstr "Suchergebnis für Favorit" + msgid "Nothing found for Search String" msgstr "Keine Treffer für Suchbegriff" @@ -507,6 +519,9 @@ msgstr "Anzeigeoptionen" msgid "Fonts and Fontsizes" msgstr "Schriften und Schriftgrößen" +msgid "Recording Menus and Favorites" +msgstr "Aufzeichnungsmenü und Favoriten" + msgid "Image Loading and Caching" msgstr "Image Loading und Caching" @@ -582,12 +597,6 @@ msgstr "Sehr großer Sprung (Tasten 4 / 6) in Stunden" msgid "Time Format (12h/24h)" msgstr "Zeitformat (12h/24h)" -msgid "Use folders for instant records" -msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen" - -msgid "Use Remotetimers" -msgstr "RemoteTimers benutzen" - msgid "Display Reruns in detailed EPG View" msgstr "Wiederholungen in der detailierten EPG Ansicht anzeigen" @@ -741,6 +750,39 @@ msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße" msgid "Search & Recording Menu Header Font Size" msgstr "Suchen & Aufnehmen Menu Header Schriftgröße" +msgid "Use folders for instant records" +msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen" + +msgid "Use Remotetimers" +msgstr "RemoteTimers benutzen" + +msgid "Use \"What's on now\" in favorites" +msgstr "\"Was läuft jetzt\" in Favoriten benutzen" + +msgid "Use \"What's on next\" in favorites" +msgstr "\"Was läuft als nächstes\" in Favoriten benutzen" + +msgid "Use user defined time 1 in favorites" +msgstr "Benutzerdef. Zeit 1 in Favoriten benutzen" + +msgid "Description" +msgstr "Beschreibung" + +msgid "Time" +msgstr "Zeit" + +msgid "Use user defined time 2 in favorites" +msgstr "Benutzerdef. Zeit 2 in Favoriten benutzen" + +msgid "Use user defined time 3 in favorites" +msgstr "Benutzerdef. Zeit 3 in Favoriten benutzen" + +msgid "Use user defined time 4 in favorites" +msgstr "Benutzerdef. Zeit 4 in Favoriten benutzen" + +msgid "Limit channels in favorites" +msgstr "Kanäle in Favoriten beschränken" + msgid "Create Log Messages for image loading" msgstr "Log Nachrichten für das Laden der Bilder erzeugen" diff --git a/po/ru_RU.po b/po/ru_RU.po index 5a646d8..04bb1af 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-15 18:19+0100\n" +"POT-Creation-Date: 2014-01-19 12:51+0100\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n" "Last-Translator: AmiD, ilya\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" @@ -93,6 +93,12 @@ msgstr "" msgid "recordings done" msgstr "" +msgid "What's on now" +msgstr "" + +msgid "What's on next" +msgstr "" + msgid "Instant Record" msgstr "Записать" @@ -402,6 +408,12 @@ msgstr "Совпадений найдено" msgid "search result for Search Timer" msgstr "Совпадение найдено" +msgid "search results for Favorite" +msgstr "" + +msgid "search result for Favorite" +msgstr "" + msgid "Nothing found for Search String" msgstr "Совпадений НЕ найдено" @@ -507,6 +519,9 @@ msgstr "Графические настройки" msgid "Fonts and Fontsizes" msgstr "Шрифты и размер шрифтов" +msgid "Recording Menus and Favorites" +msgstr "" + msgid "Image Loading and Caching" msgstr "" @@ -582,12 +597,6 @@ msgstr "Большой прыжок (Кнопки 4 / 6) в часах" msgid "Time Format (12h/24h)" msgstr "Формат времени (12h/24h)" -msgid "Use folders for instant records" -msgstr "Использовать директории для быстрой записи" - -msgid "Use Remotetimers" -msgstr "RemoteTimers benutzen" - msgid "Display Reruns in detailed EPG View" msgstr "Показывать повторы в подробном EPG" @@ -741,6 +750,39 @@ msgstr "Размер маленького шрифта меню Поиск & З msgid "Search & Recording Menu Header Font Size" msgstr "" +msgid "Use folders for instant records" +msgstr "Использовать директории для быстрой записи" + +msgid "Use Remotetimers" +msgstr "RemoteTimers benutzen" + +msgid "Use \"What's on now\" in favorites" +msgstr "" + +msgid "Use \"What's on next\" in favorites" +msgstr "" + +msgid "Use user defined time 1 in favorites" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "Time" +msgstr "" + +msgid "Use user defined time 2 in favorites" +msgstr "" + +msgid "Use user defined time 3 in favorites" +msgstr "" + +msgid "Use user defined time 4 in favorites" +msgstr "" + +msgid "Limit channels in favorites" +msgstr "" + msgid "Create Log Messages for image loading" msgstr "" diff --git a/po/sk_SK.po b/po/sk_SK.po index 1e20006..01dcd3c 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-15 18:19+0100\n" +"POT-Creation-Date: 2014-01-19 12:51+0100\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n" "Last-Translator: Milan Hrala \n" "Language-Team: \n" @@ -93,6 +93,12 @@ msgstr "" msgid "recordings done" msgstr "" +msgid "What's on now" +msgstr "" + +msgid "What's on next" +msgstr "" + msgid "Instant Record" msgstr "Okamite nahra" @@ -402,6 +408,12 @@ msgstr "n msgid "search result for Search Timer" msgstr "njden vsledok vyhadvania plnu" +msgid "search results for Favorite" +msgstr "" + +msgid "search result for Favorite" +msgstr "" + msgid "Nothing found for Search String" msgstr "Hadan vraz sa nenaiel" @@ -507,6 +519,9 @@ msgstr "Mo msgid "Fonts and Fontsizes" msgstr "Psma a vekosti psma" +msgid "Recording Menus and Favorites" +msgstr "" + msgid "Image Loading and Caching" msgstr "" @@ -582,12 +597,6 @@ msgstr "Ve msgid "Time Format (12h/24h)" msgstr "Formt asu (12h/24h)" -msgid "Use folders for instant records" -msgstr "Poui adresre pre okamit nahrvky" - -msgid "Use Remotetimers" -msgstr "Poui vzdialen plnova" - msgid "Display Reruns in detailed EPG View" msgstr "Reprzy v podrobnom zobrazen relcie EPG" @@ -741,6 +750,39 @@ msgstr "H msgid "Search & Recording Menu Header Font Size" msgstr "" +msgid "Use folders for instant records" +msgstr "Poui adresre pre okamit nahrvky" + +msgid "Use Remotetimers" +msgstr "Poui vzdialen plnova" + +msgid "Use \"What's on now\" in favorites" +msgstr "" + +msgid "Use \"What's on next\" in favorites" +msgstr "" + +msgid "Use user defined time 1 in favorites" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "Time" +msgstr "" + +msgid "Use user defined time 2 in favorites" +msgstr "" + +msgid "Use user defined time 3 in favorites" +msgstr "" + +msgid "Use user defined time 4 in favorites" +msgstr "" + +msgid "Limit channels in favorites" +msgstr "" + msgid "Create Log Messages for image loading" msgstr "" diff --git a/recmanager.c b/recmanager.c index 043c6fd..b3b5973 100644 --- a/recmanager.c +++ b/recmanager.c @@ -594,3 +594,99 @@ void cRecManager::GetFavorites(std::vector *favorites) { } } + +const cEvent **cRecManager::WhatsOnNow(bool nowOrNext, int &numResults) { + std::vector tmpResults; + cSchedulesLock schedulesLock; + const cSchedules *schedules = cSchedules::Schedules(schedulesLock); + const cChannel *startChannel = NULL, *stopChannel = NULL; + if (tvguideConfig.favLimitChannels) { + startChannel = Channels.GetByNumber(tvguideConfig.favStartChannel); + stopChannel = Channels.GetByNumber(tvguideConfig.favStopChannel); + } + if (!startChannel) + startChannel = Channels.First(); + + for (const cChannel *channel = startChannel; channel; channel = Channels.Next(channel)) { + if (channel->GroupSep()) continue; + const cSchedule *Schedule = schedules->GetSchedule(channel); + if (!Schedule) continue; + + const cEvent *event = NULL; + if (nowOrNext) + event = Schedule->GetPresentEvent(); + else + event = Schedule->GetFollowingEvent(); + if (event) { + tmpResults.push_back(event); + } + if (stopChannel && (stopChannel->Number() <= channel->Number())) + break; + } + numResults = tmpResults.size(); + const cEvent **results = new const cEvent *[numResults]; + for (int i=0; i tmpResults; + int favTime = 0; + if (userTime == 1) { + favTime = tvguideConfig.favTime1; + } else if (userTime == 2) { + favTime = tvguideConfig.favTime2; + } else if (userTime == 3) { + favTime = tvguideConfig.favTime3; + } else if (userTime == 4) { + favTime = tvguideConfig.favTime4; + } + + time_t now = time(0); + tm *midn = localtime(&now); + midn->tm_sec = 0; + midn->tm_min = 0; + midn->tm_hour = 0; + time_t midnight = mktime(midn); + int hours = favTime/100; + int mins = favTime - hours * 100; + time_t searchTime = midnight + hours*60*60 + mins*60; + if (searchTime < now) + searchTime += 24*60*60; + + cSchedulesLock schedulesLock; + const cSchedules *schedules = cSchedules::Schedules(schedulesLock); + const cChannel *startChannel = NULL, *stopChannel = NULL; + if (tvguideConfig.favLimitChannels) { + startChannel = Channels.GetByNumber(tvguideConfig.favStartChannel); + stopChannel = Channels.GetByNumber(tvguideConfig.favStopChannel); + } + if (!startChannel) + startChannel = Channels.First(); + + for (const cChannel *channel = startChannel; channel; channel = Channels.Next(channel)) { + if (channel->GroupSep()) continue; + const cSchedule *Schedule = schedules->GetSchedule(channel); + if (!Schedule) continue; + const cEvent *event = Schedule->GetEventAround(searchTime); + if (!event) continue; + //if event is more or less over (only 15mns left), take next + if ((event->EndTime() - searchTime) < 15*60) { + event = Schedule->Events()->Next(event); + } + if (event) + tmpResults.push_back(event); + if (stopChannel && (stopChannel->Number() <= channel->Number())) + break; + } + + numResults = tmpResults.size(); + const cEvent **results = new const cEvent *[numResults]; + for (int i=0; i *favorites); + const cEvent **WhatsOnNow(bool nowOrNext, int &numResults); + const cEvent **UserDefinedTime(int userTime, int &numResults); virtual ~cRecManager (void); }; diff --git a/recmenuitem.c b/recmenuitem.c index 5ad06ca..ec85136 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -2731,4 +2731,78 @@ eRecMenuState cRecMenuItemFavorite::ProcessKey(eKeys Key) { break; } return rmsNotConsumed; +} + +// --- cRecMenuItemFavoriteStatic ------------------------------------------------------- +cRecMenuItemFavoriteStatic::cRecMenuItemFavoriteStatic(std::string text, eRecMenuState action, bool active) { + this->text = text; + this->action = action; + pixmapText = NULL; + pixmapIcons = NULL; + selectable = true; + this->active = active; + height = 2 * font->Height();; +} + +cRecMenuItemFavoriteStatic::~cRecMenuItemFavoriteStatic(void) { + if (pixmapText) + osdManager.releasePixmap(pixmapText); + if (pixmapIcons) + osdManager.releasePixmap(pixmapIcons); +} + +void cRecMenuItemFavoriteStatic::SetPixmaps(void) { + if (!pixmap) { + pixmap = osdManager.requestPixmap(4, cRect(x, y, width, height)); + pixmapText = osdManager.requestPixmap(5, cRect(x, y, width, height)); + pixmapIcons = osdManager.requestPixmap(6, cRect(x, y, width, height)); + } else { + pixmap->SetViewPort(cRect(x, y, width, height)); + pixmapText->SetViewPort(cRect(x, y, width, height)); + pixmapIcons->SetViewPort(cRect(x, y, width, height)); + } +} + +void cRecMenuItemFavoriteStatic::Draw(void) { + int textX = DrawIcons(); + pixmapText->Fill(clrTransparent); + textX += 20; + pixmapText->DrawText(cPoint(textX, (height - fontLarge->Height())/2), text.c_str(), colorText, clrTransparent, fontLarge); +} + +void cRecMenuItemFavoriteStatic::Hide(void) { + if (pixmap) pixmap->SetLayer(-1); + if (pixmapText) pixmapText->SetLayer(-1); + if (pixmapIcons) pixmapIcons->SetLayer(-1); +} + +void cRecMenuItemFavoriteStatic::Show(void) { + if (pixmap) pixmap->SetLayer(4); + if (pixmapText) pixmapText->SetLayer(5); + if (pixmapIcons) pixmapIcons->SetLayer(6); +} + +int cRecMenuItemFavoriteStatic::DrawIcons(void) { + pixmapIcons->Fill(clrTransparent); + int iconsX = 10; + int iconSize = height / 2; + int iconY = (height - iconSize) / 2; + std::string iconSearch; + iconSearch = active ? "search_active" : "search_inactive" ; + cImage *imgSearch = imgCache.GetIcon(iconSearch, iconSize, iconSize); + if (imgSearch) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgSearch); + iconsX += iconSize + 10; + } + return iconsX; +} + +eRecMenuState cRecMenuItemFavoriteStatic::ProcessKey(eKeys Key) { + switch (Key & ~k_Repeat) { + case kOk: + return action; + default: + break; + } + return rmsNotConsumed; } \ No newline at end of file diff --git a/recmenuitem.h b/recmenuitem.h index 7f67777..5a0136e 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -73,6 +73,12 @@ enum eRecMenuState { //FAVORITES rmsFavoritesRecord, rmsFavoritesRecordConfirm, + rmsFavoritesNow, + rmsFavoritesNext, + rmsFavoritesUser1, + rmsFavoritesUser2, + rmsFavoritesUser3, + rmsFavoritesUser4, }; enum eDependend { @@ -629,4 +635,21 @@ public: eRecMenuState ProcessKey(eKeys Key); }; +// --- cRecMenuItemFavoriteStatic ------------------------------------------------------- +class cRecMenuItemFavoriteStatic : public cRecMenuItem { +private: + std::string text; + cPixmap *pixmapText; + cPixmap *pixmapIcons; + int DrawIcons(void); +public: + cRecMenuItemFavoriteStatic(std::string text, eRecMenuState action, bool active); + virtual ~cRecMenuItemFavoriteStatic(void); + void SetPixmaps(void); + void Hide(void); + void Show(void); + void Draw(void); + eRecMenuState ProcessKey(eKeys Key); +}; + #endif //__TVGUIDE_RECMENUITEM_H \ No newline at end of file diff --git a/recmenumanager.c b/recmenumanager.c index 4a8d119..2b74e79 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -720,6 +720,41 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { activeMenuBuffer2 = NULL; activeMenu->Show(); break; + case rmsFavoritesNow: + case rmsFavoritesNext: { + int numResults = 0; + bool nowOrNext; + std::string header; + if (nextState == rmsFavoritesNow) { + nowOrNext = true; + header = tr("What's on now"); + } else { + nowOrNext = false; + header = tr("What's on next"); + } + const cEvent **result = recManager->WhatsOnNow(nowOrNext, numResults); + DisplayFavoriteResults(header, result, numResults); + break; } + case rmsFavoritesUser1: { + int numResults = 0; + const cEvent **result = recManager->UserDefinedTime(1, numResults); + DisplayFavoriteResults(tvguideConfig.descUser1, result, numResults); + break; } + case rmsFavoritesUser2: { + int numResults = 0; + const cEvent **result = recManager->UserDefinedTime(2, numResults); + DisplayFavoriteResults(tvguideConfig.descUser2, result, numResults); + break; } + case rmsFavoritesUser3: { + int numResults = 0; + const cEvent **result = recManager->UserDefinedTime(3, numResults); + DisplayFavoriteResults(tvguideConfig.descUser3, result, numResults); + break; } + case rmsFavoritesUser4: { + int numResults = 0; + const cEvent **result = recManager->UserDefinedTime(4, numResults); + DisplayFavoriteResults(tvguideConfig.descUser4, result, numResults); + break; } /********************************************************************************************** * COMMON @@ -742,6 +777,20 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { return state; } +void cRecMenuManager::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 cRecMenuManager::DisplaySearchTimerList(void) { delete activeMenu; std::vector searchTimers; diff --git a/recmenumanager.h b/recmenumanager.h index b212ecc..9448c12 100644 --- a/recmenumanager.h +++ b/recmenumanager.h @@ -26,6 +26,7 @@ private: bool DisplayTimerConflict(cTimer *timer); bool DisplayTimerConflict(int timerID); void DisplayDetailedView(const cEvent *ev); + void DisplayFavoriteResults(std::string header, const cEvent **result, int numResults); public: cRecMenuManager(void); virtual ~cRecMenuManager(void); diff --git a/recmenus.c b/recmenus.c index 9717439..4cb0b67 100644 --- a/recmenus.c +++ b/recmenus.c @@ -961,12 +961,17 @@ cRecMenuSearchTimerTemplatesCreate::cRecMenuSearchTimerTemplatesCreate(TVGuideEP 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"); this->numResults = numResults; - cString message3 = tr("Using Template"); - cString infoText; + SetWidthPercent(70); + cString message1 = "", message2 = "", message3 = "", infoText = ""; + if (action2 == rmsDisabled) { + message1 = tr("search results for Search Timer"); + message2 = tr("search result for Search Timer"); + message3 = tr("Using Template"); + } else if (action2 == rmsFavoritesRecord) { + message1 = tr("search results for Favorite"); + message2 = tr("search result for Favorite"); + } if (templateName.size() > 0) { infoText = cString::sprintf("%d %s:\n\"%s\"\n%s \"%s\"", numResults, (numResults>1)?(*message1):(*message2), searchString.c_str(), *message3, templateName.c_str()); } else { @@ -1452,8 +1457,10 @@ eRecMenuState cRecMenuTimeline::ProcessKey(eKeys Key) { // --- cRecMenuFavorites --------------------------------------------------------- cRecMenuFavorites::cRecMenuFavorites(std::vector favorites) { + deleteMenuItems = false; this->favorites = favorites; - numFavorites = favorites.size(); + CreateFavoritesMenuItems(); + numFavorites = myMenuItems.size(); SetWidthPercent(70); cString header; if (numFavorites > 0) { @@ -1465,23 +1472,68 @@ cRecMenuFavorites::cRecMenuFavorites(std::vector favorites) headerItem->CalculateHeight(width - 2 * border); SetHeader(headerItem); - for (int i = 0; i < numFavorites; i++) { - AddMenuItemInitial(new cRecMenuItemFavorite(favorites[i], rmsSearchTimerTest, (i==0)?true:false)); - } - cRecMenuItem *button = new cRecMenuItemButton(tr("Close"), rmsClose, (numFavorites==0)?true:false); SetFooter(button); + + for (int i=0; isetActive(); + if (!AddMenuItemInitial(myMenuItems[i])) + break; + } + CalculateHeight(); CreatePixmap(); Arrange(); } cRecMenuFavorites::~cRecMenuFavorites(void) { + for (std::vector::iterator it = myMenuItems.begin(); it != myMenuItems.end(); it++) { + delete *it; + } + myMenuItems.clear(); +} + +void cRecMenuFavorites::CreateFavoritesMenuItems(void) { + if (tvguideConfig.favWhatsOnNow) { + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(tr("What's on now"), rmsFavoritesNow, false)); + } + if (tvguideConfig.favWhatsOnNext) { + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(tr("What's on next"), rmsFavoritesNext, false)); + } + if (tvguideConfig.favUseTime1) { + std::string desc = *cString::sprintf("%s (%s)", tvguideConfig.descUser1.c_str(), NiceTime(tvguideConfig.favTime1).c_str()); + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(desc, rmsFavoritesUser1, false)); + } + if (tvguideConfig.favUseTime2) { + std::string desc = *cString::sprintf("%s (%s)", tvguideConfig.descUser2.c_str(), NiceTime(tvguideConfig.favTime2).c_str()); + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(desc, rmsFavoritesUser2, false)); + } + if (tvguideConfig.favUseTime3) { + std::string desc = *cString::sprintf("%s (%s)", tvguideConfig.descUser3.c_str(), NiceTime(tvguideConfig.favTime3).c_str()); + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(desc, rmsFavoritesUser3, false)); + } + if (tvguideConfig.favUseTime4) { + std::string desc = *cString::sprintf("%s (%s)", tvguideConfig.descUser4.c_str(), NiceTime(tvguideConfig.favTime4).c_str()); + myMenuItems.push_back(new cRecMenuItemFavoriteStatic(desc, rmsFavoritesUser4, false)); + } + + int numAdditionalFavs = favorites.size(); + for (int i = 0; i < numAdditionalFavs; i++) { + myMenuItems.push_back(new cRecMenuItemFavorite(favorites[i], rmsSearchTimerTest, false)); + } + +} + +std::string cRecMenuFavorites::NiceTime(int favTime) { + int hours = favTime/100; + int mins = favTime - hours * 100; + return *cString::sprintf("%02d:%02d", hours, mins); } cRecMenuItem *cRecMenuFavorites::GetMenuItem(int number) { if (number > -1 && number < numFavorites) - return new cRecMenuItemFavorite(favorites[number], rmsSearchTimerTest, false); + return myMenuItems[number]; return NULL; } diff --git a/recmenus.h b/recmenus.h index c128f4e..48a090b 100644 --- a/recmenus.h +++ b/recmenus.h @@ -468,7 +468,10 @@ public: class cRecMenuFavorites: public cRecMenu { private: std::vector favorites; + std::vector myMenuItems; int numFavorites; + void CreateFavoritesMenuItems(void); + std::string NiceTime(int favTime); public: cRecMenuFavorites(std::vector favorites); cRecMenuItem *GetMenuItem(int number); diff --git a/setup.c b/setup.c index 5e7f88c..4298aab 100644 --- a/setup.c +++ b/setup.c @@ -23,6 +23,7 @@ void cTvguideSetup::Setup(void) { Add(new cOsdItem(tr("General Settings"))); Add(new cOsdItem(tr("Screen Presentation"))); Add(new cOsdItem(tr("Fonts and Fontsizes"))); + Add(new cOsdItem(tr("Recording Menus and Favorites"))); Add(new cOsdItem(tr("Image Loading and Caching"))); SetCurrent(Get(currentItem)); @@ -44,6 +45,8 @@ eOSState cTvguideSetup::ProcessKey(eKeys Key) { state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig)); if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0) state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig)); + if (strcmp(ItemText, tr("Recording Menus and Favorites")) == 0) + state = AddSubMenu(new cMenuSetupFavorites(&tmpTvguideConfig)); if (strcmp(ItemText, tr("Image Loading and Caching")) == 0) state = AddSubMenu(new cMenuSetupImageCache(&tmpTvguideConfig)); } @@ -99,6 +102,23 @@ void cTvguideSetup::Store(void) { SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent); SetupStore("footerHeightPercent", tvguideConfig.footerHeightPercent); SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder); + SetupStore("favWhatsOnNow", tvguideConfig.favWhatsOnNow); + SetupStore("favWhatsOnNext", tvguideConfig.favWhatsOnNext); + SetupStore("favUseTime1", tvguideConfig.favUseTime1); + SetupStore("favUseTime2", tvguideConfig.favUseTime2); + SetupStore("favUseTime3", tvguideConfig.favUseTime3); + SetupStore("favUseTime4", tvguideConfig.favUseTime4); + SetupStore("favTime1", tvguideConfig.favTime1); + SetupStore("favTime2", tvguideConfig.favTime2); + SetupStore("favTime3", tvguideConfig.favTime3); + SetupStore("favTime4", tvguideConfig.favTime4); + SetupStore("descUser1", tvguideConfig.descUser1.c_str()); + SetupStore("descUser2", tvguideConfig.descUser2.c_str()); + SetupStore("descUser3", tvguideConfig.descUser3.c_str()); + SetupStore("descUser4", tvguideConfig.descUser4.c_str()); + SetupStore("favLimitChannels", tvguideConfig.favLimitChannels); + SetupStore("favStartChannel", tvguideConfig.favStartChannel); + SetupStore("favStopChannel", tvguideConfig.favStopChannel); SetupStore("fontIndex", tvguideConfig.fontIndex); SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta); SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta); @@ -156,7 +176,7 @@ eOSState cMenuSetupSubMenu::ProcessKey(eKeys Key) { return state; } -//------------------------------------------------------------------------------------------------------------------ +//----- General Settings ------------------------------------------------------------------------------------------------------------- cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(tr("General Settings"), data) { themes.Load(*cString("tvguide")); @@ -196,9 +216,6 @@ void cMenuSetupGeneral::Set(void) { Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12)); Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48)); Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems)); - Add(new cMenuEditBoolItem(tr("Use folders for instant records"), &tmpTvguideConfig->recMenuAskFolder)); - if (pRemoteTimers) - Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers)); Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView)); if (tmpTvguideConfig->displayRerunsDetailEPGView) { Add(new cMenuEditIntItem(cString::sprintf("%s%s", *indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10)); @@ -218,7 +235,7 @@ eOSState cMenuSetupGeneral::ProcessKey(eKeys Key) { return state; } -//------------------------------------------------------------------------------------------------------------------ +//----- Screen Presentation ------------------------------------------------------------------------------------------------------------- cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Screen Presentation"), data) { displayModeItems[0] = "vertical"; @@ -299,7 +316,7 @@ eOSState cMenuSetupScreenLayout::ProcessKey(eKeys Key) { return state; } -//------------------------------------------------------------------------------------------------------------------ +//-----Fonts and Fontsizes ------------------------------------------------------------------------------------------------------- cMenuSetupFont::cMenuSetupFont(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Fonts and Fontsizes"), data) { cFont::GetAvailableFontNames(&fontNames); @@ -347,6 +364,81 @@ void cMenuSetupFont::Set(void) { Display(); } +//----- Recording Menus and Favorites ------------------------------------------------------------------------------------------------------- + +cMenuSetupFavorites::cMenuSetupFavorites(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Recording Menus and Favorites"), data) { + strn0cpy(description1, data->descUser1.c_str(), sizeof(description1)); + strn0cpy(description2, data->descUser2.c_str(), sizeof(description2)); + strn0cpy(description3, data->descUser3.c_str(), sizeof(description3)); + strn0cpy(description4, data->descUser4.c_str(), sizeof(description4)); + Set(); +} + +void cMenuSetupFavorites::Set(void) { + int currentItem = Current(); + Clear(); + + Add(new cMenuEditBoolItem(tr("Use folders for instant records"), &tmpTvguideConfig->recMenuAskFolder)); + if (pRemoteTimers) + Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers)); + + Add(new cMenuEditBoolItem(tr("Use \"What's on now\" in favorites"), &tmpTvguideConfig->favWhatsOnNow)); + Add(new cMenuEditBoolItem(tr("Use \"What's on next\" in favorites"), &tmpTvguideConfig->favWhatsOnNext)); + Add(new cMenuEditBoolItem(tr("Use user defined time 1 in favorites"), &tmpTvguideConfig->favUseTime1)); + if (tmpTvguideConfig->favUseTime1) { + Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description1, sizeof(description1), trVDR(FileNameChars))); + Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpTvguideConfig->favTime1)); + } + Add(new cMenuEditBoolItem(tr("Use user defined time 2 in favorites"), &tmpTvguideConfig->favUseTime2)); + if (tmpTvguideConfig->favUseTime2) { + Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description2, sizeof(description2), trVDR(FileNameChars))); + Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpTvguideConfig->favTime2)); + } + Add(new cMenuEditBoolItem(tr("Use user defined time 3 in favorites"), &tmpTvguideConfig->favUseTime3)); + if (tmpTvguideConfig->favUseTime3) { + Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description3, sizeof(description3), trVDR(FileNameChars))); + Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpTvguideConfig->favTime3)); + } + Add(new cMenuEditBoolItem(tr("Use user defined time 4 in favorites"), &tmpTvguideConfig->favUseTime4)); + if (tmpTvguideConfig->favUseTime4) { + Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Description")), description4, sizeof(description4), trVDR(FileNameChars))); + Add(new cMenuEditTimeItem(cString::sprintf("%s%s", *indent, tr("Time")), &tmpTvguideConfig->favTime4)); + } + Add(new cMenuEditBoolItem(tr("Limit channels in favorites"), &tmpTvguideConfig->favLimitChannels)); + if (tmpTvguideConfig->favLimitChannels) { + Add(new cMenuEditChanItem(tr("Start Channel"), &tmpTvguideConfig->favStartChannel)); + Add(new cMenuEditChanItem(tr("Stop Channel"), &tmpTvguideConfig->favStopChannel)); + } + + + SetCurrent(Get(currentItem)); + Display(); +} + +eOSState cMenuSetupFavorites::ProcessKey(eKeys Key) { + int tmpFavUseTime1 = tmpTvguideConfig->favUseTime1; + int tmpFavUseTime2 = tmpTvguideConfig->favUseTime2; + int tmpFavUseTime3 = tmpTvguideConfig->favUseTime3; + int tmpFavUseTime4 = tmpTvguideConfig->favUseTime4; + int tmpFavLimitChannels = tmpTvguideConfig->favLimitChannels; + eOSState state = cOsdMenu::ProcessKey(Key); + if (Key == kOk) { + tmpTvguideConfig->descUser1 = description1; + tmpTvguideConfig->descUser2 = description2; + tmpTvguideConfig->descUser3 = description3; + tmpTvguideConfig->descUser4 = description4; + } else if ((Key == kLeft)||(Key == kRight)) { + if ((tmpFavUseTime1 != tmpTvguideConfig->favUseTime1) || + (tmpFavUseTime2 != tmpTvguideConfig->favUseTime2) || + (tmpFavUseTime3 != tmpTvguideConfig->favUseTime3) || + (tmpFavUseTime4 != tmpTvguideConfig->favUseTime4) || + (tmpFavLimitChannels != tmpTvguideConfig->favLimitChannels) ) + Set(); + } + return state; +} + + //-----Image Caching------------------------------------------------------------------------------------------------------------- cMenuSetupImageCache::cMenuSetupImageCache(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Image Loading and Caching"), data) { Set(); diff --git a/setup.h b/setup.h index 9a5c47c..3555097 100644 --- a/setup.h +++ b/setup.h @@ -61,6 +61,18 @@ class cMenuSetupFont : public cMenuSetupSubMenu { cMenuSetupFont(cTvguideConfig *data); }; +class cMenuSetupFavorites : public cMenuSetupSubMenu { + protected: + char description1[256]; + char description2[256]; + char description3[256]; + char description4[256]; + void Set(void); + virtual eOSState ProcessKey(eKeys Key); + public: + cMenuSetupFavorites(cTvguideConfig *data); +}; + class cMenuSetupImageCache : public cMenuSetupSubMenu { protected: void Set(void);