Added possibility to manage EPG Search Timers in red button recording menu

This commit is contained in:
louis 2014-01-10 12:44:01 +01:00
parent da40191cfc
commit 84629bde6c
30 changed files with 3165 additions and 1275 deletions

View File

@ -100,3 +100,6 @@ Version 1.1.0
- Added timer Timeline view in red button recording menu - Added timer Timeline view in red button recording menu
- Current channel positioned in middle of channellist when tvguide is - Current channel positioned in middle of channellist when tvguide is
opened opened
- Added possibility to manage EPG Search Timers in red button recording
menu
- completely refactored recording menu

View File

@ -59,7 +59,7 @@ endif
### The object files (add further files here): ### The object files (add further files here):
OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o channeljump.o config.o detailview.o dummygrid.o epggrid.o fontmanager.o footer.o geometrymanager.o grid.o headergrid.o imagecache.o imageloader.o imagemagickwrapper.o imagescaler.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o timerconflict.o tools.o tvguideosd.o OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o channeljump.o config.o detailview.o dummygrid.o epggrid.o fontmanager.o footer.o geometrymanager.o grid.o headergrid.o imagecache.o imageloader.o imagemagickwrapper.o imagescaler.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o searchtimer.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o timerconflict.o tools.o tvguideosd.o
### The main target: ### The main target:

View File

@ -70,6 +70,7 @@ cTvguideConfig::cTvguideConfig() {
FontTimeLineTimeHorizontalDelta = 0; FontTimeLineTimeHorizontalDelta = 0;
FontRecMenuItemDelta = 0; FontRecMenuItemDelta = 0;
FontRecMenuItemSmallDelta = 0; FontRecMenuItemSmallDelta = 0;
FontRecMenuItemLargeDelta = 0;
timeFormat = 1; timeFormat = 1;
useNopacityTheme = 1; useNopacityTheme = 1;
themeIndex = -1; themeIndex = -1;
@ -274,6 +275,7 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemDelta") == 0) FontRecMenuItemDelta = atoi(Value); else if (strcmp(Name, "FontRecMenuItemDelta") == 0) FontRecMenuItemDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemSmallDelta") == 0) FontRecMenuItemSmallDelta = atoi(Value); else if (strcmp(Name, "FontRecMenuItemSmallDelta") == 0) FontRecMenuItemSmallDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemLargeDelta") == 0) FontRecMenuItemLargeDelta = atoi(Value);
else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value); else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value);
else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value); else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value);
else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value); else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value);

View File

@ -107,6 +107,7 @@ class cTvguideConfig {
int FontTimeLineTimeHorizontalDelta; int FontTimeLineTimeHorizontalDelta;
int FontRecMenuItemDelta; int FontRecMenuItemDelta;
int FontRecMenuItemSmallDelta; int FontRecMenuItemSmallDelta;
int FontRecMenuItemLargeDelta;
int timeFormat; int timeFormat;
int useNopacityTheme; int useNopacityTheme;
int themeIndex; int themeIndex;

View File

@ -38,6 +38,7 @@ void cFontManager::SetFonts() {
//Fonts for RecMenu //Fonts for RecMenu
FontRecMenuItem = CreateFont(geoManager.osdHeight/30 + tvguideConfig.FontRecMenuItemDelta); FontRecMenuItem = CreateFont(geoManager.osdHeight/30 + tvguideConfig.FontRecMenuItemDelta);
FontRecMenuItemSmall = CreateFont(geoManager.osdHeight/40 + tvguideConfig.FontRecMenuItemSmallDelta); FontRecMenuItemSmall = CreateFont(geoManager.osdHeight/40 + tvguideConfig.FontRecMenuItemSmallDelta);
FontRecMenuItemLarge = CreateFont(geoManager.osdHeight/25 + tvguideConfig.FontRecMenuItemLargeDelta);
} }
void cFontManager::DeleteFonts() { void cFontManager::DeleteFonts() {
@ -64,6 +65,7 @@ void cFontManager::DeleteFonts() {
delete FontTimeLineTimeHorizontal; delete FontTimeLineTimeHorizontal;
delete FontRecMenuItem; delete FontRecMenuItem;
delete FontRecMenuItemSmall; delete FontRecMenuItemSmall;
delete FontRecMenuItemLarge;
} }
void cFontManager::InitialiseFontType(void) { void cFontManager::InitialiseFontType(void) {

View File

@ -35,5 +35,6 @@ class cFontManager {
cFont *FontMessageBoxLarge; cFont *FontMessageBoxLarge;
cFont *FontRecMenuItem; cFont *FontRecMenuItem;
cFont *FontRecMenuItemSmall; cFont *FontRecMenuItemSmall;
cFont *FontRecMenuItemLarge;
}; };
#endif //__TVGUIDE_FONTMANAGER_H #endif //__TVGUIDE_FONTMANAGER_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-12-31 14:31+0100\n" "POT-Creation-Date: 2014-01-10 11:54+0100\n"
"PO-Revision-Date: 2013-09-21 17:49+0200\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n" "Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -81,6 +81,15 @@ msgstr ""
msgid "No Timers active" msgid "No Timers active"
msgstr "" msgstr ""
msgid "inactive"
msgstr ""
msgid "active timers"
msgstr ""
msgid "recordings done"
msgstr ""
msgid "Instant Record" msgid "Instant Record"
msgstr "Enregistra a l'instant" msgstr "Enregistra a l'instant"
@ -90,12 +99,18 @@ msgstr "Esborra temporitzador"
msgid "Edit Timer" msgid "Edit Timer"
msgstr "Edita temporitzador" msgstr "Edita temporitzador"
msgid "Create Series Timer" msgid "Timer Timeline"
msgstr "Programa enregistrament de Sèries" msgstr ""
msgid "Create Search Timer" msgid "Create Search Timer"
msgstr "Cerca temporitzadors" msgstr "Cerca temporitzadors"
msgid "Manage Search Timers"
msgstr ""
msgid "Create Series Timer"
msgstr "Programa enregistrament de Sèries"
msgid "Create Switch Timer" msgid "Create Switch Timer"
msgstr "Canvia temporitzadors" msgstr "Canvia temporitzadors"
@ -105,9 +120,6 @@ msgstr "Esborra canvis de temporitzadors"
msgid "Search" msgid "Search"
msgstr "Cerca" msgstr "Cerca"
msgid "Timer Timeline"
msgstr ""
msgid "Check for Timer Conflicts" msgid "Check for Timer Conflicts"
msgstr "Comprova conflictes de temporitzadors" msgstr "Comprova conflictes de temporitzadors"
@ -261,38 +273,23 @@ msgstr "Opcions de configuració manual"
msgid "Use Template" msgid "Use Template"
msgstr "Utilitza plantilla" msgstr "Utilitza plantilla"
msgid "Creating Search Timer" msgid "Manage EPGSearch Search Timers"
msgstr "Creant cerca de temporitzador" msgstr ""
msgid "Search Term" msgid "No Search Timers Configured"
msgstr "Cercant terme" msgstr ""
msgid "Using Template" msgid "Configure Search Timer Options"
msgstr "Utilitzant plantilla" msgstr ""
msgid "Display Results for Search Timer" msgid "Save Search Timer"
msgstr "Mostra resultats de la cerca" msgstr ""
msgid "Use other Template" msgid "Search String"
msgstr "Utilitza una altra plantilla" msgstr ""
msgid "Configure Search Timer Options for Search String" msgid "Active"
msgstr "Configura opcions de cerca de temporitzadors amb text" msgstr ""
msgid "whole term must appear"
msgstr "expressió completa"
msgid "all terms must exist"
msgstr "totes les paraules"
msgid "one term must exist"
msgstr "alguna paraula"
msgid "exact match"
msgstr "coincidència exacta"
msgid "regular expression"
msgstr "expressió regular"
msgid "Search Mode" msgid "Search Mode"
msgstr "Mode de cerca" msgstr "Mode de cerca"
@ -309,29 +306,68 @@ msgstr "Utilitza descripció"
msgid "Limit Channels" msgid "Limit Channels"
msgstr "Canals restringits" msgstr "Canals restringits"
msgid "Use Time"
msgstr "Utilitza temps"
msgid "Display advanced Options"
msgstr ""
msgid "Limit Days of the Week"
msgstr ""
msgid "Time margin for start in minutes"
msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Use VPS"
msgstr ""
msgid "Avoid Repeats"
msgstr ""
msgid "Hide advanced Options"
msgstr ""
msgid "Display Results for Search Timer"
msgstr "Mostra resultats de la cerca"
msgid "Start Channel" msgid "Start Channel"
msgstr "Inicia canal" msgstr "Inicia canal"
msgid "Stop Channel" msgid "Stop Channel"
msgstr "Atura canal" msgstr "Atura canal"
msgid "Use Time"
msgstr "Utilitza temps"
msgid "Start after" msgid "Start after"
msgstr "Comença després" msgstr "Comença després"
msgid "Start before" msgid "Start before"
msgstr "Comença abans" msgstr "Comença abans"
msgid "search results for Search Timer" msgid "Select Days"
msgstr "cerca resultats per temporitzador" msgstr ""
msgid "search result for Search Timer" msgid "Number of allowed repeats"
msgstr "cerca resultat per temporitzador" msgstr ""
msgid "Nothing found for Search String" msgid "Compare Title"
msgstr "No s'ha trobat la cadena de text" msgstr ""
msgid "Compare Subtitle"
msgstr ""
msgid "Compare Description"
msgstr ""
msgid "Really delete Search Timer"
msgstr ""
msgid "Delete only Search Timer"
msgstr ""
msgid "Delete Search Timer and created Timers"
msgstr ""
msgid "Search Timer sucessfully created." msgid "Search Timer sucessfully created."
msgstr "S'ha creat cerca de temporitzador" msgstr "S'ha creat cerca de temporitzador"
@ -342,6 +378,27 @@ msgstr "Actualització de temporitzador iniciada"
msgid "Search Timer NOT sucessfully created" msgid "Search Timer NOT sucessfully created"
msgstr "No s'ha creat cerca de temporitzador" msgstr "No s'ha creat cerca de temporitzador"
msgid "Creating Search Timer"
msgstr "Creant cerca de temporitzador"
msgid "Search Term"
msgstr "Cercant terme"
msgid "Using Template"
msgstr "Utilitzant plantilla"
msgid "Use other Template"
msgstr "Utilitza una altra plantilla"
msgid "search results for Search Timer"
msgstr "cerca resultats per temporitzador"
msgid "search result for Search Timer"
msgstr "cerca resultat per temporitzador"
msgid "Nothing found for Search String"
msgstr "No s'ha trobat la cadena de text"
msgid "Configure Options for Switchtimer" msgid "Configure Options for Switchtimer"
msgstr "Opcions de configuració de canvi de temporitzador" msgstr "Opcions de configuració de canvi de temporitzador"
@ -372,12 +429,6 @@ msgstr "No s'ha creat el canvi de temporitzador"
msgid "Switch Timer deleted" msgid "Switch Timer deleted"
msgstr "Canvi de temporitzador esborrat" msgstr "Canvi de temporitzador esborrat"
msgid "Show Search Options"
msgstr "Mostra opcions de cerca"
msgid "Perform Search"
msgstr "Realitza la cerca"
msgid "Channel to Search" msgid "Channel to Search"
msgstr "Canal a cercar" msgstr "Canal a cercar"
@ -390,6 +441,12 @@ msgstr "Cerca al subtítol"
msgid "Search in Description" msgid "Search in Description"
msgstr "Cerca a la descripció" msgstr "Cerca a la descripció"
msgid "Show Search Options"
msgstr "Mostra opcions de cerca"
msgid "Perform Search"
msgstr "Realitza la cerca"
msgid "search results for" msgid "search results for"
msgstr "resultats de cerca per" msgstr "resultats de cerca per"
@ -414,6 +471,21 @@ msgstr "per"
msgid "No recordings found for" msgid "No recordings found for"
msgstr "No s'han trobat gravacions per" msgstr "No s'han trobat gravacions per"
msgid "whole term must appear"
msgstr "expressió completa"
msgid "all terms must exist"
msgstr "totes les paraules"
msgid "one term must exist"
msgstr "alguna paraula"
msgid "exact match"
msgstr "coincidència exacta"
msgid "regular expression"
msgstr "expressió regular"
msgid "General Settings" msgid "General Settings"
msgstr "Preferències" msgstr "Preferències"
@ -651,6 +723,9 @@ msgstr "Mida de la Font - Menú Cerca & Enregistra"
msgid "Search & Recording Menu Small Font Size" msgid "Search & Recording Menu Small Font Size"
msgstr "Mida de la Font petita - Menú Cerca & Enregistra" msgstr "Mida de la Font petita - Menú Cerca & Enregistra"
msgid "Search & Recording Main Menu Font Size"
msgstr ""
msgid "Create Log Messages for image loading" msgid "Create Log Messages for image loading"
msgstr "" msgstr ""
@ -680,3 +755,6 @@ msgstr ""
msgid "Recording Menus Icon Cache" msgid "Recording Menus Icon Cache"
msgstr "" msgstr ""
#~ msgid "Configure Search Timer Options for Search String"
#~ msgstr "Configura opcions de cerca de temporitzadors amb text"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-12-31 14:31+0100\n" "POT-Creation-Date: 2014-01-10 11:54+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -78,6 +78,15 @@ msgstr "Aufn"
msgid "No Timers active" msgid "No Timers active"
msgstr "Keine Timer aktiv" msgstr "Keine Timer aktiv"
msgid "inactive"
msgstr "inaktiv"
msgid "active timers"
msgstr "aktive Timer"
msgid "recordings done"
msgstr "erledigte Aufnahmen"
msgid "Instant Record" msgid "Instant Record"
msgstr "Aufnahme" msgstr "Aufnahme"
@ -87,12 +96,18 @@ msgstr "Timer löschen"
msgid "Edit Timer" msgid "Edit Timer"
msgstr "Timer bearbeiten" msgstr "Timer bearbeiten"
msgid "Create Series Timer" msgid "Timer Timeline"
msgstr "Serientimer anlegen" msgstr "Timer anzeigen"
msgid "Create Search Timer" msgid "Create Search Timer"
msgstr "Suchtimer anlegen" msgstr "Suchtimer anlegen"
msgid "Manage Search Timers"
msgstr "Suchtimer bearbeiten"
msgid "Create Series Timer"
msgstr "Serientimer anlegen"
msgid "Create Switch Timer" msgid "Create Switch Timer"
msgstr "Umschalttimer anlegen" msgstr "Umschalttimer anlegen"
@ -102,9 +117,6 @@ msgstr "Umschalttimer löschen"
msgid "Search" msgid "Search"
msgstr "Suchen" msgstr "Suchen"
msgid "Timer Timeline"
msgstr "Timer Zeitleiste"
msgid "Check for Timer Conflicts" msgid "Check for Timer Conflicts"
msgstr "Auf Timerkonflikte prüfen" msgstr "Auf Timerkonflikte prüfen"
@ -258,38 +270,23 @@ msgstr "Optionen manuell konfigurieren"
msgid "Use Template" msgid "Use Template"
msgstr "Template benutzen" msgstr "Template benutzen"
msgid "Creating Search Timer" msgid "Manage EPGSearch Search Timers"
msgstr "Suchtimer anlegen" msgstr "EPGSearch Suchtimer bearbeiten"
msgid "Search Term" msgid "No Search Timers Configured"
msgstr "Keine Suchtimer angelegt"
msgid "Configure Search Timer Options"
msgstr "Suchtimer konfigurieren"
msgid "Save Search Timer"
msgstr "Suchtimer speichern"
msgid "Search String"
msgstr "Suchbegriff" msgstr "Suchbegriff"
msgid "Using Template" msgid "Active"
msgstr "Template" msgstr "Aktiv"
msgid "Display Results for Search Timer"
msgstr "Ergebnisse für Suchtimer anzeigen"
msgid "Use other Template"
msgstr "Anderes Template benutzen"
msgid "Configure Search Timer Options for Search String"
msgstr "Suchtimer Optionen konfigurieren für Suchbegriff"
msgid "whole term must appear"
msgstr "vollständiger Ausdruck"
msgid "all terms must exist"
msgstr "alle Worte"
msgid "one term must exist"
msgstr "ein Wort"
msgid "exact match"
msgstr "exakt"
msgid "regular expression"
msgstr "Regulärer Ausdruck"
msgid "Search Mode" msgid "Search Mode"
msgstr "Suchmodus" msgstr "Suchmodus"
@ -306,29 +303,68 @@ msgstr "Beschreibung benutzen"
msgid "Limit Channels" msgid "Limit Channels"
msgstr "Kanäle einschränken" msgstr "Kanäle einschränken"
msgid "Use Time"
msgstr "Zeit benutzen"
msgid "Display advanced Options"
msgstr "Erweiterte Optionen anzeigen"
msgid "Limit Days of the Week"
msgstr "Wochentage beschränken"
msgid "Time margin for start in minutes"
msgstr "Zeit vor Start in Minuten"
msgid "Time margin for stop in minutes"
msgstr "Zeit nach Ende in Minuten"
msgid "Use VPS"
msgstr "VPS benutzen"
msgid "Avoid Repeats"
msgstr "Wiederholungen vermeiden"
msgid "Hide advanced Options"
msgstr "Erweiterte Optionen ausblenden"
msgid "Display Results for Search Timer"
msgstr "Ergebnisse für Suchtimer anzeigen"
msgid "Start Channel" msgid "Start Channel"
msgstr "Startkanal" msgstr "Startkanal"
msgid "Stop Channel" msgid "Stop Channel"
msgstr "Stopkanal" msgstr "Stopkanal"
msgid "Use Time"
msgstr "Zeit benutzen"
msgid "Start after" msgid "Start after"
msgstr "Beginn nach" msgstr "Beginn nach"
msgid "Start before" msgid "Start before"
msgstr "Beginn vor" msgstr "Beginn vor"
msgid "search results for Search Timer" msgid "Select Days"
msgstr "Treffer für Suchtimer" msgstr "Tage bestimmen"
msgid "search result for Search Timer" msgid "Number of allowed repeats"
msgstr "Treffer für Suchtimer" msgstr "Anzahl erlaubter Wiederholungen"
msgid "Nothing found for Search String" msgid "Compare Title"
msgstr "Keine Treffer für Suchbegriff" msgstr "Titel vergleichen"
msgid "Compare Subtitle"
msgstr "Untertitel vergleichen"
msgid "Compare Description"
msgstr "Beschreibung vergleichen"
msgid "Really delete Search Timer"
msgstr "Suchtimer wirklich löschen"
msgid "Delete only Search Timer"
msgstr "Nur Suchtimer löschen"
msgid "Delete Search Timer and created Timers"
msgstr "Suchtimer und erzeugte Timer löschen"
msgid "Search Timer sucessfully created." msgid "Search Timer sucessfully created."
msgstr "Suchtimer erfolgreich angelegt" msgstr "Suchtimer erfolgreich angelegt"
@ -339,6 +375,27 @@ msgstr "Suchtimer update initialisiert"
msgid "Search Timer NOT sucessfully created" msgid "Search Timer NOT sucessfully created"
msgstr "Suchtimer NICHT erfolgreich angelegt" msgstr "Suchtimer NICHT erfolgreich angelegt"
msgid "Creating Search Timer"
msgstr "Suchtimer anlegen"
msgid "Search Term"
msgstr "Suchbegriff"
msgid "Using Template"
msgstr "Template"
msgid "Use other Template"
msgstr "Anderes Template benutzen"
msgid "search results for Search Timer"
msgstr "Treffer für Suchtimer"
msgid "search result for Search Timer"
msgstr "Treffer für Suchtimer"
msgid "Nothing found for Search String"
msgstr "Keine Treffer für Suchbegriff"
msgid "Configure Options for Switchtimer" msgid "Configure Options for Switchtimer"
msgstr "Optionen für Umschalttimer konfigurieren" msgstr "Optionen für Umschalttimer konfigurieren"
@ -369,12 +426,6 @@ msgstr "Umschalttimer NICHT erfolgreich angelegt"
msgid "Switch Timer deleted" msgid "Switch Timer deleted"
msgstr "Umschalttimer gelöscht" msgstr "Umschalttimer gelöscht"
msgid "Show Search Options"
msgstr "Suchoptionen anzeigen"
msgid "Perform Search"
msgstr "Suche ausführen"
msgid "Channel to Search" msgid "Channel to Search"
msgstr "Suche auf Kanal" msgstr "Suche auf Kanal"
@ -387,6 +438,12 @@ msgstr "In Untertitel suchen"
msgid "Search in Description" msgid "Search in Description"
msgstr "In Beschreibung suchen" msgstr "In Beschreibung suchen"
msgid "Show Search Options"
msgstr "Suchoptionen anzeigen"
msgid "Perform Search"
msgstr "Suche ausführen"
msgid "search results for" msgid "search results for"
msgstr "Suchergebnisse für" msgstr "Suchergebnisse für"
@ -411,6 +468,21 @@ msgstr "für"
msgid "No recordings found for" msgid "No recordings found for"
msgstr "Keine Aufnahmen gefunden für" msgstr "Keine Aufnahmen gefunden für"
msgid "whole term must appear"
msgstr "vollständiger Ausdruck"
msgid "all terms must exist"
msgstr "alle Worte"
msgid "one term must exist"
msgstr "ein Wort"
msgid "exact match"
msgstr "exakt"
msgid "regular expression"
msgstr "Regulärer Ausdruck"
msgid "General Settings" msgid "General Settings"
msgstr "Allgemeine Einstellungen" msgstr "Allgemeine Einstellungen"
@ -648,6 +720,9 @@ msgstr "Suchen & Aufnehmen Menu Schriftgröße"
msgid "Search & Recording Menu Small Font Size" msgid "Search & Recording Menu Small Font Size"
msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße" msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße"
msgid "Search & Recording Main Menu Font Size"
msgstr "Suchen & Aufnehmen Hauptmenü Schriftgröße"
msgid "Create Log Messages for image loading" msgid "Create Log Messages for image loading"
msgstr "Log Nachrichten für das Laden der Bilder erzeugen" msgstr "Log Nachrichten für das Laden der Bilder erzeugen"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\n" "Project-Id-Version: vdr-tvguide 1.0.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-12-31 14:31+0100\n" "POT-Creation-Date: 2014-01-10 11:54+0100\n"
"PO-Revision-Date: 2013-09-25 17:49+0400\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n"
"Last-Translator: AmiD, ilya\n" "Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@ -78,6 +78,15 @@ msgstr ""
msgid "No Timers active" msgid "No Timers active"
msgstr "" msgstr ""
msgid "inactive"
msgstr ""
msgid "active timers"
msgstr ""
msgid "recordings done"
msgstr ""
msgid "Instant Record" msgid "Instant Record"
msgstr "Записать" msgstr "Записать"
@ -87,12 +96,18 @@ msgstr "Удалить таймер"
msgid "Edit Timer" msgid "Edit Timer"
msgstr "Редактировать таймер" msgstr "Редактировать таймер"
msgid "Create Series Timer" msgid "Timer Timeline"
msgstr "Создать циклический таймер" msgstr ""
msgid "Create Search Timer" msgid "Create Search Timer"
msgstr "Создать поисковый таймер" msgstr "Создать поисковый таймер"
msgid "Manage Search Timers"
msgstr ""
msgid "Create Series Timer"
msgstr "Создать циклический таймер"
msgid "Create Switch Timer" msgid "Create Switch Timer"
msgstr "Создать таймер переключения" msgstr "Создать таймер переключения"
@ -102,9 +117,6 @@ msgstr "Удалить таймер переключения"
msgid "Search" msgid "Search"
msgstr "Поиск" msgstr "Поиск"
msgid "Timer Timeline"
msgstr ""
msgid "Check for Timer Conflicts" msgid "Check for Timer Conflicts"
msgstr "Поиск таймер-конфликтов" msgstr "Поиск таймер-конфликтов"
@ -258,38 +270,23 @@ msgstr "Ручная настройка параметров"
msgid "Use Template" msgid "Use Template"
msgstr "Использовать шаблоны" msgstr "Использовать шаблоны"
msgid "Creating Search Timer" msgid "Manage EPGSearch Search Timers"
msgstr "Создается поисковый таймер" msgstr ""
msgid "Search Term" msgid "No Search Timers Configured"
msgstr "Ключевое слово" msgstr ""
msgid "Using Template" msgid "Configure Search Timer Options"
msgstr "Использовать шаблон" msgstr ""
msgid "Display Results for Search Timer" msgid "Save Search Timer"
msgstr "Тест" msgstr ""
msgid "Use other Template" msgid "Search String"
msgstr "Использовать другие шаблоны" msgstr ""
msgid "Configure Search Timer Options for Search String" msgid "Active"
msgstr "Настроить параметры таймера" msgstr ""
msgid "whole term must appear"
msgstr "фраза"
msgid "all terms must exist"
msgstr "все слова"
msgid "one term must exist"
msgstr "хотя бы одно слово"
msgid "exact match"
msgstr "точное совпадение"
msgid "regular expression"
msgstr "регулярные выражения"
msgid "Search Mode" msgid "Search Mode"
msgstr "Режим поиска" msgstr "Режим поиска"
@ -306,29 +303,68 @@ msgstr "Искать в описаниях"
msgid "Limit Channels" msgid "Limit Channels"
msgstr "Ограничить список каналов" msgstr "Ограничить список каналов"
msgid "Use Time"
msgstr "Время"
msgid "Display advanced Options"
msgstr ""
msgid "Limit Days of the Week"
msgstr ""
msgid "Time margin for start in minutes"
msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Use VPS"
msgstr ""
msgid "Avoid Repeats"
msgstr ""
msgid "Hide advanced Options"
msgstr ""
msgid "Display Results for Search Timer"
msgstr "Тест"
msgid "Start Channel" msgid "Start Channel"
msgstr "С канала" msgstr "С канала"
msgid "Stop Channel" msgid "Stop Channel"
msgstr "По канал" msgstr "По канал"
msgid "Use Time"
msgstr "Время"
msgid "Start after" msgid "Start after"
msgstr "С" msgstr "С"
msgid "Start before" msgid "Start before"
msgstr "До" msgstr "До"
msgid "search results for Search Timer" msgid "Select Days"
msgstr "Совпадений найдено" msgstr ""
msgid "search result for Search Timer" msgid "Number of allowed repeats"
msgstr "Совпадение найдено" msgstr ""
msgid "Nothing found for Search String" msgid "Compare Title"
msgstr "Совпадений НЕ найдено" msgstr ""
msgid "Compare Subtitle"
msgstr ""
msgid "Compare Description"
msgstr ""
msgid "Really delete Search Timer"
msgstr ""
msgid "Delete only Search Timer"
msgstr ""
msgid "Delete Search Timer and created Timers"
msgstr ""
msgid "Search Timer sucessfully created." msgid "Search Timer sucessfully created."
msgstr "Поисковый таймер создан" msgstr "Поисковый таймер создан"
@ -339,6 +375,27 @@ msgstr "Поисковый таймер обновляется"
msgid "Search Timer NOT sucessfully created" msgid "Search Timer NOT sucessfully created"
msgstr "Поисковый таймер НЕ создан" msgstr "Поисковый таймер НЕ создан"
msgid "Creating Search Timer"
msgstr "Создается поисковый таймер"
msgid "Search Term"
msgstr "Ключевое слово"
msgid "Using Template"
msgstr "Использовать шаблон"
msgid "Use other Template"
msgstr "Использовать другие шаблоны"
msgid "search results for Search Timer"
msgstr "Совпадений найдено"
msgid "search result for Search Timer"
msgstr "Совпадение найдено"
msgid "Nothing found for Search String"
msgstr "Совпадений НЕ найдено"
msgid "Configure Options for Switchtimer" msgid "Configure Options for Switchtimer"
msgstr "Настройка таймера переключения" msgstr "Настройка таймера переключения"
@ -369,12 +426,6 @@ msgstr "Таймер переключения НЕ был создан!"
msgid "Switch Timer deleted" msgid "Switch Timer deleted"
msgstr "Таймер переключения удален" msgstr "Таймер переключения удален"
msgid "Show Search Options"
msgstr "Показать параметры поиска"
msgid "Perform Search"
msgstr "Найти"
msgid "Channel to Search" msgid "Channel to Search"
msgstr "Канал для поиска" msgstr "Канал для поиска"
@ -387,6 +438,12 @@ msgstr "Искать в эпизодах"
msgid "Search in Description" msgid "Search in Description"
msgstr "Искать в описаниях" msgstr "Искать в описаниях"
msgid "Show Search Options"
msgstr "Показать параметры поиска"
msgid "Perform Search"
msgstr "Найти"
msgid "search results for" msgid "search results for"
msgstr "Найдено по запросу" msgstr "Найдено по запросу"
@ -411,6 +468,21 @@ msgstr "для"
msgid "No recordings found for" msgid "No recordings found for"
msgstr "Не найдено записей:" msgstr "Не найдено записей:"
msgid "whole term must appear"
msgstr "фраза"
msgid "all terms must exist"
msgstr "все слова"
msgid "one term must exist"
msgstr "хотя бы одно слово"
msgid "exact match"
msgstr "точное совпадение"
msgid "regular expression"
msgstr "регулярные выражения"
msgid "General Settings" msgid "General Settings"
msgstr "Основные настройки" msgstr "Основные настройки"
@ -648,6 +720,9 @@ msgstr "Размер шрифта меню Поиск & Запись"
msgid "Search & Recording Menu Small Font Size" msgid "Search & Recording Menu Small Font Size"
msgstr "Размер маленького шрифта меню Поиск & Запись" msgstr "Размер маленького шрифта меню Поиск & Запись"
msgid "Search & Recording Main Menu Font Size"
msgstr ""
msgid "Create Log Messages for image loading" msgid "Create Log Messages for image loading"
msgstr "" msgstr ""
@ -677,3 +752,6 @@ msgstr ""
msgid "Recording Menus Icon Cache" msgid "Recording Menus Icon Cache"
msgstr "" msgstr ""
#~ msgid "Configure Search Timer Options for Search String"
#~ msgstr "Настроить параметры таймера"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n" "Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-12-31 14:31+0100\n" "POT-Creation-Date: 2014-01-10 11:54+0100\n"
"PO-Revision-Date: 2013-09-15 00:12+0100\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -78,6 +78,15 @@ msgstr ""
msgid "No Timers active" msgid "No Timers active"
msgstr "" msgstr ""
msgid "inactive"
msgstr ""
msgid "active timers"
msgstr ""
msgid "recordings done"
msgstr ""
msgid "Instant Record" msgid "Instant Record"
msgstr "Okam¾ite nahra»" msgstr "Okam¾ite nahra»"
@ -87,12 +96,18 @@ msgstr "Vymaza
msgid "Edit Timer" msgid "Edit Timer"
msgstr "Upravi» plán nahrávania" msgstr "Upravi» plán nahrávania"
msgid "Create Series Timer" msgid "Timer Timeline"
msgstr "Vytvori» sériový plán nahrávania" msgstr ""
msgid "Create Search Timer" msgid "Create Search Timer"
msgstr "Vytvori» vyhµadávaè plánov nahrávania" msgstr "Vytvori» vyhµadávaè plánov nahrávania"
msgid "Manage Search Timers"
msgstr ""
msgid "Create Series Timer"
msgstr "Vytvori» sériový plán nahrávania"
msgid "Create Switch Timer" msgid "Create Switch Timer"
msgstr "Vytvori» prepínací plán" msgstr "Vytvori» prepínací plán"
@ -102,9 +117,6 @@ msgstr "Vymaza
msgid "Search" msgid "Search"
msgstr "Hµada»" msgstr "Hµada»"
msgid "Timer Timeline"
msgstr ""
msgid "Check for Timer Conflicts" msgid "Check for Timer Conflicts"
msgstr "Skontrolova» konflikty plánu" msgstr "Skontrolova» konflikty plánu"
@ -258,38 +270,23 @@ msgstr "Ru
msgid "Use Template" msgid "Use Template"
msgstr "pou¾itie ¹ablóny" msgstr "pou¾itie ¹ablóny"
msgid "Creating Search Timer" msgid "Manage EPGSearch Search Timers"
msgstr "Vytvorenie vyhµadávacieho plánu" msgstr ""
msgid "Search Term" msgid "No Search Timers Configured"
msgstr "kµúèové slovo" msgstr ""
msgid "Using Template" msgid "Configure Search Timer Options"
msgstr "¹ablóna" msgstr ""
msgid "Display Results for Search Timer" msgid "Save Search Timer"
msgstr "Pozrie» výsledky pre vyhµadávanie plánov" msgstr ""
msgid "Use other Template" msgid "Search String"
msgstr "Pou¾i» inú ¹ablónu" msgstr ""
msgid "Configure Search Timer Options for Search String" msgid "Active"
msgstr "Konfigurova» mo¾nosti plánov pre vyhµadávanie kµúèových slov" msgstr ""
msgid "whole term must appear"
msgstr "kompletný výraz"
msgid "all terms must exist"
msgstr "v¹etky slová"
msgid "one term must exist"
msgstr "jeden pojem musí existova»"
msgid "exact match"
msgstr "presná zhoda"
msgid "regular expression"
msgstr "regulárny výraz"
msgid "Search Mode" msgid "Search Mode"
msgstr "Re¾im vyhµadávania" msgstr "Re¾im vyhµadávania"
@ -306,29 +303,68 @@ msgstr "Pou
msgid "Limit Channels" msgid "Limit Channels"
msgstr "Obmedzi» kanály" msgstr "Obmedzi» kanály"
msgid "Use Time"
msgstr "Pou¾i» èas"
msgid "Display advanced Options"
msgstr ""
msgid "Limit Days of the Week"
msgstr ""
msgid "Time margin for start in minutes"
msgstr ""
msgid "Time margin for stop in minutes"
msgstr ""
msgid "Use VPS"
msgstr ""
msgid "Avoid Repeats"
msgstr ""
msgid "Hide advanced Options"
msgstr ""
msgid "Display Results for Search Timer"
msgstr "Pozrie» výsledky pre vyhµadávanie plánov"
msgid "Start Channel" msgid "Start Channel"
msgstr "Od kanálu" msgstr "Od kanálu"
msgid "Stop Channel" msgid "Stop Channel"
msgstr "Po kanál" msgstr "Po kanál"
msgid "Use Time"
msgstr "Pou¾i» èas"
msgid "Start after" msgid "Start after"
msgstr "Zaèiatok po" msgstr "Zaèiatok po"
msgid "Start before" msgid "Start before"
msgstr "Zaèiatok pred" msgstr "Zaèiatok pred"
msgid "search results for Search Timer" msgid "Select Days"
msgstr "nájdené výsledky vyhµadávania plánu" msgstr ""
msgid "search result for Search Timer" msgid "Number of allowed repeats"
msgstr "nájdený výsledok vyhµadávania plánu" msgstr ""
msgid "Nothing found for Search String" msgid "Compare Title"
msgstr "Hµadaný výraz sa nena¹iel" msgstr ""
msgid "Compare Subtitle"
msgstr ""
msgid "Compare Description"
msgstr ""
msgid "Really delete Search Timer"
msgstr ""
msgid "Delete only Search Timer"
msgstr ""
msgid "Delete Search Timer and created Timers"
msgstr ""
msgid "Search Timer sucessfully created." msgid "Search Timer sucessfully created."
msgstr "Vyhµadávaè plánu vytvorený." msgstr "Vyhµadávaè plánu vytvorený."
@ -339,6 +375,27 @@ msgstr "Vyhlad
msgid "Search Timer NOT sucessfully created" msgid "Search Timer NOT sucessfully created"
msgstr "Vyhµadávaè plánu nie je kompletne vytvorený" msgstr "Vyhµadávaè plánu nie je kompletne vytvorený"
msgid "Creating Search Timer"
msgstr "Vytvorenie vyhµadávacieho plánu"
msgid "Search Term"
msgstr "kµúèové slovo"
msgid "Using Template"
msgstr "¹ablóna"
msgid "Use other Template"
msgstr "Pou¾i» inú ¹ablónu"
msgid "search results for Search Timer"
msgstr "nájdené výsledky vyhµadávania plánu"
msgid "search result for Search Timer"
msgstr "nájdený výsledok vyhµadávania plánu"
msgid "Nothing found for Search String"
msgstr "Hµadaný výraz sa nena¹iel"
msgid "Configure Options for Switchtimer" msgid "Configure Options for Switchtimer"
msgstr "Konfigurova» mo¾nosti pre prepínací plán" msgstr "Konfigurova» mo¾nosti pre prepínací plán"
@ -369,12 +426,6 @@ msgstr "Pl
msgid "Switch Timer deleted" msgid "Switch Timer deleted"
msgstr "Plán prepnutia vymazaný" msgstr "Plán prepnutia vymazaný"
msgid "Show Search Options"
msgstr "Zobrazi» mo¾nosti vyhµadávania"
msgid "Perform Search"
msgstr "Vykona» vyhµadávanie"
msgid "Channel to Search" msgid "Channel to Search"
msgstr "Hµada» na kanále" msgstr "Hµada» na kanále"
@ -387,6 +438,12 @@ msgstr "H
msgid "Search in Description" msgid "Search in Description"
msgstr "Hµada» v popise" msgstr "Hµada» v popise"
msgid "Show Search Options"
msgstr "Zobrazi» mo¾nosti vyhµadávania"
msgid "Perform Search"
msgstr "Vykona» vyhµadávanie"
msgid "search results for" msgid "search results for"
msgstr "vyhµadané výsledky pre" msgstr "vyhµadané výsledky pre"
@ -411,6 +468,21 @@ msgstr "pre"
msgid "No recordings found for" msgid "No recordings found for"
msgstr "Nena¹li sa nahrávky s názvom " msgstr "Nena¹li sa nahrávky s názvom "
msgid "whole term must appear"
msgstr "kompletný výraz"
msgid "all terms must exist"
msgstr "v¹etky slová"
msgid "one term must exist"
msgstr "jeden pojem musí existova»"
msgid "exact match"
msgstr "presná zhoda"
msgid "regular expression"
msgstr "regulárny výraz"
msgid "General Settings" msgid "General Settings"
msgstr "V¹eobecné nastavenia" msgstr "V¹eobecné nastavenia"
@ -648,6 +720,9 @@ msgstr "H
msgid "Search & Recording Menu Small Font Size" msgid "Search & Recording Menu Small Font Size"
msgstr "Hµada» & Nahra» menu malé písmo" msgstr "Hµada» & Nahra» menu malé písmo"
msgid "Search & Recording Main Menu Font Size"
msgstr ""
msgid "Create Log Messages for image loading" msgid "Create Log Messages for image loading"
msgstr "" msgstr ""
@ -677,3 +752,6 @@ msgstr ""
msgid "Recording Menus Icon Cache" msgid "Recording Menus Icon Cache"
msgstr "" msgstr ""
#~ msgid "Configure Search Timer Options for Search String"
#~ msgstr "Konfigurova» mo¾nosti plánov pre vyhµadávanie kµúèových slov"

View File

@ -4,7 +4,6 @@
#include <algorithm> #include <algorithm>
#include <vdr/menu.h> #include <vdr/menu.h>
#include "services/epgsearch.h"
#include "services/remotetimers.h" #include "services/remotetimers.h"
#include "services/tvscraper.h" #include "services/tvscraper.h"
#include "tools.h" #include "tools.h"
@ -137,6 +136,8 @@ void cRecManager::DeleteTimer(int timerID) {
} }
void cRecManager::DeleteTimer(const cEvent *event) { void cRecManager::DeleteTimer(const cEvent *event) {
if (!event)
return;
if (tvguideConfig.useRemoteTimers && pRemoteTimers) { if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
DeleteRemoteTimer(event); DeleteRemoteTimer(event);
} else { } else {
@ -176,16 +177,16 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) {
} }
} }
void cRecManager::SaveTimer(cTimer *timer, cRecMenu *menu) { void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
if (!timer) if (!timer)
return; return;
bool active = menu->GetBoolValue(1); bool active = newTimerSettings.HasFlags(tfActive);
int prio = menu->GetIntValue(2); int prio = newTimerSettings.Priority();
int lifetime = menu->GetIntValue(3); int lifetime = newTimerSettings.Lifetime();
time_t day = menu->GetTimeValue(4); time_t day = newTimerSettings.Day();
int start = menu->GetIntValue(5); int start = newTimerSettings.Start();
int stop = menu->GetIntValue(6); int stop = newTimerSettings.Stop();
timer->SetDay(day); timer->SetDay(day);
timer->SetStart(start); timer->SetStart(start);
@ -210,6 +211,7 @@ void cRecManager::SaveTimer(cTimer *timer, cRecMenu *menu) {
} }
} }
bool cRecManager::IsRecorded(const cEvent *event) { bool cRecManager::IsRecorded(const cEvent *event) {
cTimer *timer = Timers.GetMatch(event); cTimer *timer = Timers.GetMatch(event);
if (!timer) if (!timer)
@ -236,57 +238,25 @@ cTVGuideTimerConflicts *cRecManager::CheckTimerConflict(void) {
return conflictList; return conflictList;
} }
cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu, std::string path) { void cRecManager::CreateSeriesTimer(cTimer *seriesTimer) {
bool active = menu->GetBoolValue(1);
int channelNumber = menu->GetIntValue(2);
int start = menu->GetIntValue(3);
int stop = menu->GetIntValue(4);
int weekdays = menu->GetIntValue(5);
time_t tday = menu->GetTimeValue(6);
int prio = menu->GetIntValue(7);
int lifetime = menu->GetIntValue(8);
cChannel *channel = Channels.GetByNumber(channelNumber);
cTimer *seriesTimer = new cTimer(false, false, channel);
cString fileName = "TITLE EPISODE";
if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~');
fileName = cString::sprintf("%s~%s", path.c_str(), *fileName);
}
seriesTimer->SetDay(tday);
seriesTimer->SetStart(start);
seriesTimer->SetStop(stop);
seriesTimer->SetPriority(prio);
seriesTimer->SetLifetime(lifetime);
seriesTimer->SetWeekDays(weekdays);
seriesTimer->SetFile(*fileName);
if (active)
seriesTimer->SetFlags(tfActive);
else
seriesTimer->SetFlags(tfNone);
seriesTimer->SetEventFromSchedule(); seriesTimer->SetEventFromSchedule();
if (tvguideConfig.useRemoteTimers && pRemoteTimers) { if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
RemoteTimers_Timer_v1_0 rt; RemoteTimers_Timer_v1_0 rt;
rt.timer = seriesTimer; rt.timer = seriesTimer;
if (!pRemoteTimers->Service("RemoteTimers::NewTimer-v1.0", &rt)) if (!pRemoteTimers->Service("RemoteTimers::NewTimer-v1.0", &rt))
isyslog("%s", *rt.errorMsg); isyslog("%s", *rt.errorMsg);
RefreshRemoteTimers(); RefreshRemoteTimers();
seriesTimer = NULL;
} else { } else {
Timers.Add(seriesTimer); Timers.Add(seriesTimer);
Timers.SetModified(); Timers.SetModified();
} }
return seriesTimer;
} }
std::vector<TVGuideEPGSearchTemplate> cRecManager::ReadEPGSearchTemplates(void) {
void cRecManager::ReadEPGSearchTemplates(std::vector<TVGuideEPGSearchTemplate> *epgTemplates) {
cString ConfigDir = cPlugin::ConfigDirectory("epgsearch"); cString ConfigDir = cPlugin::ConfigDirectory("epgsearch");
cString epgsearchConf = "epgsearchtemplates.conf"; cString epgsearchConf = "epgsearchtemplates.conf";
cString fileName = AddDirectory(*ConfigDir, *epgsearchConf); cString fileName = AddDirectory(*ConfigDir, *epgsearchConf);
std::vector<TVGuideEPGSearchTemplate> epgTemplates;
if (access(fileName, F_OK) == 0) { if (access(fileName, F_OK) == 0) {
FILE *f = fopen(fileName, "r"); FILE *f = fopen(fileName, "r");
if (f) { if (f) {
@ -307,175 +277,12 @@ std::vector<TVGuideEPGSearchTemplate> cRecManager::ReadEPGSearchTemplates(void)
TVGuideEPGSearchTemplate tmp; TVGuideEPGSearchTemplate tmp;
tmp.name = name; tmp.name = name;
tmp.templValue = templValue; tmp.templValue = templValue;
epgTemplates.push_back(tmp); epgTemplates->push_back(tmp);
} }
} catch (...){} } catch (...){}
} }
} }
} }
return epgTemplates;
}
std::string cRecManager::BuildEPGSearchString(cString searchString, std::string templValue) {
std::string strSearchString = *searchString;
std::replace(strSearchString.begin(), strSearchString.end(), ':', '|');
std::stringstream searchTimerString;
searchTimerString << "0:";
searchTimerString << strSearchString;
searchTimerString << templValue;
return searchTimerString.str();
}
std::string cRecManager::BuildEPGSearchString(cString searchString, cRecMenu *menu) {
std::string strSearchString = *searchString;
std::replace(strSearchString.begin(), strSearchString.end(), ':', '|');
int searchMode = menu->GetIntValue(0);
bool useTitle = menu->GetBoolValue(1);
bool useSubTitle = menu->GetBoolValue(2);
bool useDescription = menu->GetBoolValue(3);
bool limitChannels = menu->GetBoolValue(4);
int startChannel = -1;
int stopChannel = -1;
if (limitChannels) {
startChannel = menu->GetIntValue(5);
stopChannel = menu->GetIntValue(6);
}
int after = 0;
int before = 0;
bool limitTime = (limitChannels)?menu->GetBoolValue(7):menu->GetBoolValue(5);
if (limitTime) {
after = (limitChannels)?menu->GetIntValue(8):menu->GetIntValue(6);
before = (limitChannels)?menu->GetIntValue(9):menu->GetIntValue(7);
}
std::stringstream searchTimerString;
//1 - unique search timer id
searchTimerString << "0:";
//2 - the search term
searchTimerString << strSearchString;
//3 - use time? 0/1
//4 - start time in HHMM
//5 - stop time in HHMM
if (limitTime) {
searchTimerString << ":1:" << after << ":" << before << ":";
} else {
searchTimerString << ":0:::";
}
//6 - use channel? 0 = no, 1 = Interval, 2 = Channel group, 3 = FTA only
//7 - if 'use channel' = 1 then channel id[|channel id] in VDR format,
// one entry or min/max entry separated with |, if 'use channel' = 2
// then the channel group name
if (limitChannels) {
searchTimerString << "1:";
cChannel *startChan = Channels.GetByNumber(startChannel);
cChannel *stopChan = Channels.GetByNumber(stopChannel);
searchTimerString << *(startChan->GetChannelID().ToString());
searchTimerString << "|";
searchTimerString << *(stopChan->GetChannelID().ToString()) << ":";
} else {
searchTimerString << "0::";
}
//8 - match case? 0/1
searchTimerString << ":0";
/*9 - search mode:
0 - the whole term must appear as substring
1 - all single terms (delimiters are blank,',', ';', '|' or '~')
must exist as substrings.
2 - at least one term (delimiters are blank, ',', ';', '|' or '~')
must exist as substring.
3 - matches exactly
4 - regular expression */
searchTimerString << searchMode << ":";
//10 - use title? 0/1
if (useTitle)
searchTimerString << "1:";
else
searchTimerString << "0:";
//11 - use subtitle? 0/1
if (useSubTitle)
searchTimerString << "1:";
else
searchTimerString << "0:";
// 12 - use description? 0/1
if (useDescription)
searchTimerString << "1:";
else
searchTimerString << "0:";
//13 - use duration? 0/1
//14 - min duration in hhmm
//15 - max duration in hhmm
searchTimerString << "0:::";
//16 - use as search timer? 0/1
searchTimerString << "1:";
//17 - use day of week? 0/1
//18 - day of week (0 = Sunday, 1 = Monday...;
// -1 Sunday, -2 Monday, -4 Tuesday, ...; -7 Sun, Mon, Tue)
searchTimerString << "0::";
//19 - use series recording? 0/1
searchTimerString << "1:";
//20 - directory for recording
searchTimerString << ":";
//21 - priority of recording
//22 - lifetime of recording
searchTimerString << "99:99:";
//23 - time margin for start in minutes
//24 - time margin for stop in minutes
searchTimerString << "5:5:";
//25 - use VPS? 0/1
searchTimerString << "0:";
/*26 - action:
0 = create a timer
1 = announce only via OSD (no timer)
2 = switch only (no timer)
3 = announce via OSD and switch (no timer)
4 = announce via mail*/
searchTimerString << "0:";
/*27 - use extended EPG info? 0/1
28 - extended EPG info values. This entry has the following format
(delimiter is '|' for each category, '#' separates id and value):
1 - the id of the extended EPG info category as specified in
epgsearchcats.conf
2 - the value of the extended EPG info category
(a ':' will be translated to "!^colon^!", e.g. in "16:9") */
searchTimerString << "0::";
/*29 - avoid repeats? 0/1
30 - allowed repeats
31 - compare title when testing for a repeat? 0/1
32 - compare subtitle when testing for a repeat? 0/1/2
0 - no
1 - yes
2 - yes, if present
33 - compare description when testing for a repeat? 0/1
34 - compare extended EPG info when testing for a repeat?
This entry is a bit field of the category IDs.
35 - accepts repeats only within x days */
searchTimerString << "1:1:1:2:1:::";
/*36 - delete a recording automatically after x days
37 - but keep this number of recordings anyway
38 - minutes before switch (if action = 2)
39 - pause if x recordings already exist
40 - blacklist usage mode (0 none, 1 selection, 2 all)
41 - selected blacklist IDs separated with '|'
42 - fuzzy tolerance value for fuzzy searching
43 - use this search in favorites menu (0 no, 1 yes)
44 - id of a menu search template
45 - auto deletion mode (0 don't delete search timer, 1 delete after given
count of recordings, 2 delete after given days after first recording)
46 - count of recordings after which to delete the search timer
47 - count of days after the first recording after which to delete the search
timer
48 - first day where the search timer is active (see parameter 16)
49 - last day where the search timer is active (see parameter 16)
50 - ignore missing EPG categories? 0/1
51 - unmute sound if off when used as switch timer
52 - percentage of match when comparing the summary of two events (with 'avoid repeats')
53 - HEX representation of the content descriptors, each descriptor ID is represented with 2 chars
54 - compare date when testing for a repeat? (0=no, 1=same day, 2=same week, 3=same month) */
searchTimerString << "0::::0:::0::0:::::::::0";
//esyslog("tvguide: epgsearch String: %s", searchTimerString.str().c_str());
return searchTimerString.str();
} }
const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString, int &numResults) { const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString, int &numResults) {
@ -519,29 +326,8 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString
return searchResults; return searchResults;
} }
const cEvent **cRecManager::PerformSearch(cRecMenu *menu, bool withOptions, int &numResults) { const cEvent **cRecManager::PerformSearch(Epgsearch_searchresults_v1_0 data, int &numResults) {
if (epgSearchAvailable) { if (epgSearchAvailable) {
cString searchString = menu->GetStringValue(1);
Epgsearch_searchresults_v1_0 data;
data.query = (char *)*searchString;
int mode = 0;
int channelNr = 0;
bool useTitle = true;
bool useSubTitle = true;
bool useDescription = false;
if (withOptions) {
mode = menu->GetIntValue(2);
channelNr = menu->GetIntValue(3);
useTitle = menu->GetBoolValue(4);
useSubTitle = menu->GetBoolValue(5);
useDescription = menu->GetBoolValue(6);
}
data.mode = mode;
data.channelNr = channelNr;
data.useTitle = useTitle;
data.useSubTitle = useSubTitle;
data.useDescription = useDescription;
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) { if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *list = data.pResultList; cList<Epgsearch_searchresults_v1_0::cServiceSearchResult> *list = data.pResultList;
if (!list) if (!list)
@ -564,6 +350,23 @@ const cEvent **cRecManager::PerformSearch(cRecMenu *menu, bool withOptions, int
return NULL; return NULL;
} }
void cRecManager::GetSearchTimers(std::vector<cTVGuideSearchTimer> *searchTimer) {
if (!epgSearchAvailable) {
return;
}
Epgsearch_services_v1_1 *epgSearch = new Epgsearch_services_v1_1;
if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) {
std::list<std::string> searchTimerList;
searchTimerList = epgSearch->handler->SearchTimerList();
for(std::list<std::string>::iterator it = searchTimerList.begin(); it != searchTimerList.end(); it++) {
cTVGuideSearchTimer timer;
timer.SetEPGSearchString(it->c_str());
if (timer.Parse())
searchTimer->push_back(timer);
}
}
}
int cRecManager::CreateSearchTimer(std::string epgSearchString) { int cRecManager::CreateSearchTimer(std::string epgSearchString) {
int timerID = -1; int timerID = -1;
if (!epgSearchAvailable) if (!epgSearchAvailable)
@ -575,6 +378,73 @@ int cRecManager::CreateSearchTimer(std::string epgSearchString) {
return timerID; return timerID;
} }
bool cRecManager::SaveSearchTimer(cTVGuideSearchTimer *searchTimer) {
if (!epgSearchAvailable)
return false;
Epgsearch_services_v1_1 *epgSearch = new Epgsearch_services_v1_1;
if (searchTimer->GetID() > -1) {
if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) {
bool success = epgSearch->handler->ModSearchTimer(searchTimer->BuildSearchString());
if (success) {
esyslog("tvguide: search timer with id %d sucessfully modified", searchTimer->GetID());
return true;
} else {
esyslog("tvguide: error modifying search timer with id %d, build string %s", searchTimer->GetID(), searchTimer->BuildSearchString().c_str());
return false;
}
}
} else {
if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) {
int timerID = epgSearch->handler->AddSearchTimer(searchTimer->BuildSearchString());
if (timerID >=0) {
esyslog("tvguide: search timer with id %d sucessfully created", timerID);
return true;
} else {
esyslog("tvguide: error creating search timer, build string %s", searchTimer->BuildSearchString().c_str());
return false;
}
}
}
return false;
}
void cRecManager::DeleteSearchTimer(cTVGuideSearchTimer *searchTimer, bool delTimers) {
if (!epgSearchAvailable)
return;
int searchTimerID = searchTimer->GetID();
if (delTimers) {
cTimer *timer = Timers.First();
while(timer) {
if (!timer->Recording()) {
char* searchID = GetAuxValue(timer, "s-id");
if (searchID) {
if (searchTimerID == atoi(searchID)) {
cTimer* timerNext = Timers.Next(timer);
DeleteTimer(timer);
timer = timerNext;
} else {
timer = Timers.Next(timer);
}
free(searchID);
} else {
timer = Timers.Next(timer);
}
} else {
timer = Timers.Next(timer);
}
}
}
Epgsearch_services_v1_1 *epgSearch = new Epgsearch_services_v1_1;
if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) {
bool success = epgSearch->handler->DelSearchTimer(searchTimerID);
if (success) {
esyslog("tvguide: search timer \"%s\" sucessfully deleted", searchTimer->SearchString().c_str());
} else {
esyslog("tvguide: error deleting search timer \"%s\"", searchTimer->SearchString().c_str());
}
}
}
void cRecManager::UpdateSearchTimers(void) { void cRecManager::UpdateSearchTimers(void) {
if (epgSearchAvailable) { if (epgSearchAvailable) {
Epgsearch_updatesearchtimers_v1_0 data; Epgsearch_updatesearchtimers_v1_0 data;
@ -584,15 +454,13 @@ void cRecManager::UpdateSearchTimers(void) {
} }
// announceOnly: 0 = switch, 1 = announce only, 2 = ask for switch // announceOnly: 0 = switch, 1 = announce only, 2 = ask for switch
bool cRecManager::CreateSwitchTimer(const cEvent *event, cRecMenu *menu) { bool cRecManager::CreateSwitchTimer(const cEvent *event, cSwitchTimer switchTimer) {
int switchMinsBefore = menu->GetIntValue(1); if (epgSearchAvailable && event) {
int announceOnly = menu->GetIntValue(2);
if (epgSearchAvailable) {
Epgsearch_switchtimer_v1_0 data; Epgsearch_switchtimer_v1_0 data;
data.event = event; data.event = event;
data.mode = 1; data.mode = 1;
data.switchMinsBefore = switchMinsBefore; data.switchMinsBefore = switchTimer.switchMinsBefore;
data.announceOnly = announceOnly; data.announceOnly = switchTimer.switchMinsBefore;
data.success = false; data.success = false;
epgSearchPlugin->Service("Epgsearch-switchtimer-v1.0", &data); epgSearchPlugin->Service("Epgsearch-switchtimer-v1.0", &data);
cSwitchTimer *t = new cSwitchTimer(event); cSwitchTimer *t = new cSwitchTimer(event);
@ -615,7 +483,7 @@ void cRecManager::DeleteSwitchTimer(const cEvent *event) {
} }
} }
cRecording **cRecManager::SearchForRecordings(cString searchString, int &numResults) { cRecording **cRecManager::SearchForRecordings(std::string searchString, int &numResults) {
cRecording **matchingRecordings = NULL; cRecording **matchingRecordings = NULL;
int num = 0; int num = 0;
@ -623,7 +491,7 @@ cRecording **cRecManager::SearchForRecordings(cString searchString, int &numResu
for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) { for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
std::string s1 = recording->Name(); std::string s1 = recording->Name();
std::string s2 = *searchString; std::string s2 = searchString;
if (s1.empty() || s2.empty()) continue; if (s1.empty() || s2.empty()) continue;
// tolerance for fuzzy searching: 90% of the shorter text length, but at least 1 // tolerance for fuzzy searching: 90% of the shorter text length, but at least 1

View File

@ -4,8 +4,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include "services/epgsearch.h"
#include "detailview.h" #include "detailview.h"
#include "recmenu.h" #include "recmenu.h"
#include "searchtimer.h"
#include "switchtimer.h"
#include "timerconflict.h" #include "timerconflict.h"
struct TVGuideEPGSearchTemplate { struct TVGuideEPGSearchTemplate {
@ -19,36 +22,37 @@ class cRecManager {
private: private:
cPlugin *epgSearchPlugin; cPlugin *epgSearchPlugin;
bool epgSearchAvailable; bool epgSearchAvailable;
void DeleteTimer(cTimer *timer);
public: public:
cRecManager (void); cRecManager(void);
void SetEPGSearchPlugin(void); void SetEPGSearchPlugin(void);
bool EpgSearchAvailable(void) {return epgSearchAvailable;}; bool EpgSearchAvailable(void) {return epgSearchAvailable;};
bool RefreshRemoteTimers(void); bool RefreshRemoteTimers(void);
bool CheckEventForTimer(const cEvent *event); bool CheckEventForTimer(const cEvent *event);
cTimer *GetTimerForEvent(const cEvent *event); cTimer *GetTimerForEvent(const cEvent *event);
cTimer *createTimer(const cEvent *event, std::string path); cTimer *createTimer(const cEvent *event, std::string path = "");
cTimer *createLocalTimer(const cEvent *event, std::string path); cTimer *createLocalTimer(const cEvent *event, std::string path);
cTimer *createRemoteTimer(const cEvent *event, std::string path); cTimer *createRemoteTimer(const cEvent *event, std::string path);
void SetTimerPath(cTimer *timer, const cEvent *event, std::string path); void SetTimerPath(cTimer *timer, const cEvent *event, std::string path);
void DeleteTimer(cTimer *timer);
void DeleteTimer(int timerID); void DeleteTimer(int timerID);
void DeleteTimer(const cEvent *event); void DeleteTimer(const cEvent *event);
void DeleteLocalTimer(const cEvent *event); void DeleteLocalTimer(const cEvent *event);
void DeleteRemoteTimer(const cEvent *event); void DeleteRemoteTimer(const cEvent *event);
void SaveTimer(cTimer *timer, cRecMenu *menu); void SaveTimer(cTimer *timer, cTimer newTimerSettings);
bool IsRecorded(const cEvent *event); bool IsRecorded(const cEvent *event);
cTVGuideTimerConflicts *CheckTimerConflict(void); cTVGuideTimerConflicts *CheckTimerConflict(void);
cTimer *CreateSeriesTimer(cRecMenu *menu, std::string path); void CreateSeriesTimer(cTimer *seriesTimer);
std::string BuildEPGSearchString(cString searchString, cRecMenu *menu);
std::string BuildEPGSearchString(cString searchString, std::string templValue);
const cEvent **PerformSearchTimerSearch(std::string epgSearchString, int &numResults); const cEvent **PerformSearchTimerSearch(std::string epgSearchString, int &numResults);
const cEvent **PerformSearch(cRecMenu *menu, bool withOptions, int &numResults); const cEvent **PerformSearch(Epgsearch_searchresults_v1_0 data, int &numResults);
std::vector<TVGuideEPGSearchTemplate> ReadEPGSearchTemplates(void); void ReadEPGSearchTemplates(std::vector<TVGuideEPGSearchTemplate> *epgTemplates);
void GetSearchTimers(std::vector<cTVGuideSearchTimer> *timers);
int CreateSearchTimer(std::string epgSearchString); int CreateSearchTimer(std::string epgSearchString);
bool SaveSearchTimer(cTVGuideSearchTimer *searchTimer);
void DeleteSearchTimer(cTVGuideSearchTimer *searchTimer, bool delTimers);
void UpdateSearchTimers(void); void UpdateSearchTimers(void);
bool CreateSwitchTimer(const cEvent *event, cRecMenu *menu); bool CreateSwitchTimer(const cEvent *event, cSwitchTimer switchTimer);
void DeleteSwitchTimer(const cEvent *event); void DeleteSwitchTimer(const cEvent *event);
cRecording **SearchForRecordings(cString searchString, int &numResults); cRecording **SearchForRecordings(std::string searchString, int &numResults);
const cEvent **LoadReruns(const cEvent *event, int &numResults); const cEvent **LoadReruns(const cEvent *event, int &numResults);
virtual ~cRecManager (void); virtual ~cRecManager (void);
}; };

412
recmenu.c
View File

@ -1,3 +1,4 @@
#include <list>
#include "recmenu.h" #include "recmenu.h"
// --- cRecMenu ------------------------------------------------------------- // --- cRecMenu -------------------------------------------------------------
@ -7,8 +8,8 @@ cRecMenu::cRecMenu(void) {
height = 2*border; height = 2*border;
headerHeight = 0; headerHeight = 0;
footerHeight = 0; footerHeight = 0;
scrollHeight = 0; currentHeight = 0;
scrollItemHeight = 0; deleteMenuItems = true;
scrollable = false; scrollable = false;
scrollbarWidth = 3 * border; scrollbarWidth = 3 * border;
pixmapScrollBar = NULL; pixmapScrollBar = NULL;
@ -23,7 +24,7 @@ cRecMenu::cRecMenu(void) {
cRecMenu::~cRecMenu(void) { cRecMenu::~cRecMenu(void) {
if (header) if (header)
delete header; delete header;
menuItems.Clear(); ClearMenuItems();
if (footer) if (footer)
delete footer; delete footer;
if (pixmapScrollBar) if (pixmapScrollBar)
@ -44,70 +45,49 @@ void cRecMenu::SetWidthPixel(int pixel) {
int cRecMenu::CalculateOptimalWidth(void) { int cRecMenu::CalculateOptimalWidth(void) {
int optWidth = 0; int optWidth = 0;
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
int itemWidth = item->GetWidth(); int itemWidth = (*item)->GetWidth();
if (itemWidth > optWidth) if (itemWidth > optWidth)
optWidth = itemWidth; optWidth = itemWidth;
} }
return optWidth; return optWidth;
} }
bool cRecMenu::CalculateHeight(bool reDraw) {
void cRecMenu::AddMenuItem(cRecMenuItem *item, cRecMenuItem *before) { int newHeight = 2*border;
if (!before)
menuItems.Add(item);
else
menuItems.Ins(item, before);
}
void cRecMenu::AddMenuItemScroll(cRecMenuItem *item) {
scrollHeight += item->GetHeight();
stopIndex++;
numItems++;
if (scrollItemHeight == 0)
scrollItemHeight = item->GetHeight();
menuItems.Add(item);
}
bool cRecMenu::CheckHeight(void) {
int nextHeight = headerHeight + footerHeight + scrollHeight + 2*border + 150;
if (nextHeight > geoManager.osdHeight) {
scrollable = true;
return false;
}
return true;
}
void cRecMenu::CalculateHeight(void) {
height = 2*border;
if (header) if (header)
height += headerHeight; newHeight += headerHeight;
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
height += item->GetHeight(); newHeight += (*item)->GetHeight();
} }
if (footer) if (footer)
height += footerHeight; newHeight += footerHeight;
y = (geoManager.osdHeight - height) / 2;
if (scrollable) { y = (geoManager.osdHeight - newHeight) / 2;
width += scrollbarWidth + border;
if (newHeight != height) {
height = newHeight;
if (scrollable && !reDraw) {
width += scrollbarWidth + border;
}
return true;
} }
return false;
} }
void cRecMenu::CreatePixmap(void) { void cRecMenu::CreatePixmap(void) {
if (pixmap)
osdManager.releasePixmap(pixmap);
pixmap = osdManager.requestPixmap(3, cRect(x, y, width, height)); pixmap = osdManager.requestPixmap(3, cRect(x, y, width, height));
if (scrollable) { if (scrollable) {
int scrollBarX = x + width - scrollbarWidth - border; int scrollBarX = x + width - scrollbarWidth - border;
int scrollBarY = y + border + headerHeight; int scrollBarY = y + border + headerHeight;
int scrollBarHeight = height - headerHeight - footerHeight - 2 * border; int scrollBarHeight = height - headerHeight - footerHeight - 2 * border;
if (pixmapScrollBar)
osdManager.releasePixmap(pixmapScrollBar);
pixmapScrollBar = osdManager.requestPixmap(4, cRect(scrollBarX, scrollBarY, scrollbarWidth, scrollBarHeight)); pixmapScrollBar = osdManager.requestPixmap(4, cRect(scrollBarX, scrollBarY, scrollbarWidth, scrollBarHeight));
} } else
} pixmapScrollBar = NULL;
void cRecMenu::SetFooter(cRecMenuItem *footer) {
this->footer = footer;
footerHeight = footer->GetHeight();
height += footerHeight;
} }
void cRecMenu::SetHeader(cRecMenuItem *header) { void cRecMenu::SetHeader(cRecMenuItem *header) {
@ -116,39 +96,105 @@ void cRecMenu::SetHeader(cRecMenuItem *header) {
height += headerHeight; height += headerHeight;
} }
cRecMenuItem *cRecMenu::GetActiveMenuItem(void) { void cRecMenu::SetFooter(cRecMenuItem *footer) {
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { this->footer = footer;
if (item->isActive()) footerHeight = footer->GetHeight();
return item; height += footerHeight;
}
if (footer && footer->isActive())
return footer;
return NULL;
} }
int cRecMenu::GetActive(bool withOffset) { void cRecMenu::ClearMenuItems(void) {
int numActive = withOffset?startIndex:0; if (deleteMenuItems) {
int i = 0; for (std::list<cRecMenuItem*>::iterator it = menuItems.begin(); it != menuItems.end(); it++) {
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { delete *it;
if (item->isActive()) {
numActive += i;
break;
} }
i++;
} }
return numActive; menuItems.clear();
};
void cRecMenu::InitMenu(bool complete) {
currentHeight = 0;
numItems = 0;
if (scrollable) {
width -= scrollbarWidth + border;
osdManager.releasePixmap(pixmapScrollBar);
pixmapScrollBar = NULL;
delete imgScrollBar;
imgScrollBar = NULL;
}
osdManager.releasePixmap(pixmap);
pixmap = NULL;
for (std::list<cRecMenuItem*>::iterator it = menuItems.begin(); it != menuItems.end(); it++) {
if (deleteMenuItems)
delete *it;
else
(*it)->Hide();
}
menuItems.clear();
if (complete) {
startIndex = 0;
stopIndex = 0;
scrollable = false;
} else {
stopIndex = startIndex;
}
}
void cRecMenu::AddMenuItem(cRecMenuItem *item, bool inFront) {
if (!inFront)
menuItems.push_back(item);
else
menuItems.push_front(item);
}
bool cRecMenu::AddMenuItemInitial(cRecMenuItem *item) {
currentHeight += item->GetHeight();
int totalHeight = headerHeight + footerHeight + currentHeight + 2*border;
if (totalHeight >= geoManager.osdHeight) {
scrollable = true;
currentHeight -= item->GetHeight();
if (deleteMenuItems) {
delete item;
}
return false;
}
stopIndex++;
numItems++;
menuItems.push_back(item);
return true;
}
void cRecMenu::Activate(cRecMenuItem *itemOld, cRecMenuItem *item) {
itemOld->setInactive();
itemOld->setBackground();
itemOld->Draw();
item->setActive();
item->setBackground();
item->Draw();
} }
bool cRecMenu::ActivatePrev(void) { bool cRecMenu::ActivatePrev(void) {
cRecMenuItem *activeItem = GetActiveMenuItem(); cRecMenuItem *activeItem = GetActiveMenuItem();
if (!scrollable && footer && footer->isActive()) { if (!scrollable && footer && footer->isActive()) {
Activate(footer, menuItems.Last()); if (menuItems.size() > 0) {
return true; cRecMenuItem *itemLast = menuItems.back();
Activate(footer, itemLast);
return true;
}
} else if (activeItem) { } else if (activeItem) {
cRecMenuItem *prev = NULL; cRecMenuItem *prev = NULL;
for (cRecMenuItem *item = menuItems.Prev(activeItem); item; item = menuItems.Prev(item)) { bool foundActive = false;
if (item->isSelectable()) { for (std::list<cRecMenuItem*>::iterator item = menuItems.end(); item != menuItems.begin(); ) {
prev = item; item--;
if (*item == activeItem) {
foundActive = true;
continue;
}
if (!foundActive)
continue;
if ((*item)->isSelectable()) {
prev = *item;
break; break;
} }
} }
@ -160,13 +206,56 @@ bool cRecMenu::ActivatePrev(void) {
return false; return false;
} }
void cRecMenu::ScrollUp(void) {
if (footer && footer->isActive()) {
if (menuItems.size() > 0)
Activate(footer, menuItems.back());
} else {
//get perv x items
int numNewItems = numItems / 2;
int numAdded = 0;
cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(startIndex-1)) {
AddMenuItem(newItem, true);
cRecMenuItem *last = menuItems.back();
if (deleteMenuItems) {
delete last;
} else {
last->setInactive();
last->Hide();
}
menuItems.pop_back();
stopIndex--;
startIndex--;
numAdded++;
if (numAdded >= numNewItems)
break;
}
if (numAdded != 0) {
scrollable = true;
if (CalculateHeight(true))
CreatePixmap();
Arrange(deleteMenuItems);
Display(deleteMenuItems);
ActivatePrev();
}
}
}
bool cRecMenu::ActivateNext(void) { bool cRecMenu::ActivateNext(void) {
cRecMenuItem *activeItem = GetActiveMenuItem(); cRecMenuItem *activeItem = GetActiveMenuItem();
if (activeItem) { if (activeItem) {
cRecMenuItem *next = NULL; cRecMenuItem *next = NULL;
for (cRecMenuItem *item = menuItems.Next(activeItem); item; item = menuItems.Next(item)) { bool foundActive = false;
if (item->isSelectable()) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
next = item; if (*item == activeItem) {
foundActive = true;
continue;
}
if (!foundActive)
continue;
if ((*item)->isSelectable()) {
next = *item;
break; break;
} }
} }
@ -181,57 +270,33 @@ bool cRecMenu::ActivateNext(void) {
return false; return false;
} }
void cRecMenu::Activate(cRecMenuItem *itemOld, cRecMenuItem *item) {
itemOld->setInactive();
itemOld->setBackground();
itemOld->Draw();
item->setActive();
item->setBackground();
item->Draw();
}
void cRecMenu::ScrollUp(void) {
if (footer && footer->isActive()) {
Activate(footer, menuItems.Last());
} else {
//get perv x items
int numNewItems = numItems / 2;
int numAdded = 0;
cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(startIndex-1)) {
AddMenuItem(newItem, menuItems.First());
menuItems.Del(menuItems.Last(), true);
stopIndex--;
startIndex--;
numAdded++;
if (numAdded >= numNewItems)
break;
}
if (numAdded != 0) {
Arrange(true);
Display(true);
ActivatePrev();
}
}
}
void cRecMenu::ScrollDown(void) { void cRecMenu::ScrollDown(void) {
//get next x items //get next x items
int numNewItems = numItems / 2; int numNewItems = numItems / 2;
int numAdded = 0; int numAdded = 0;
cRecMenuItem *newItem = NULL; cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(stopIndex)) { while (newItem = GetMenuItem(stopIndex)) {
menuItems.Add(newItem); menuItems.push_back(newItem);
menuItems.Del(menuItems.First(), true); cRecMenuItem *first = menuItems.front();
stopIndex++; if (deleteMenuItems) {
delete first;
} else {
first->setInactive();
first->Hide();
}
menuItems.pop_front();
startIndex++; startIndex++;
stopIndex++;
numAdded++; numAdded++;
if (numAdded >= numNewItems) if (numAdded >= numNewItems)
break; break;
} }
if (numAdded != 0) { if (numAdded != 0) {
Arrange(true); scrollable = true;
Display(true); if (CalculateHeight(true))
CreatePixmap();
Arrange(deleteMenuItems);
Display(deleteMenuItems);
ActivateNext(); ActivateNext();
} else { } else {
//last item reached, activate footer //last item reached, activate footer
@ -246,9 +311,9 @@ void cRecMenu::JumpBegin(void) {
cRecMenuItem *activeItem = GetActiveMenuItem(); cRecMenuItem *activeItem = GetActiveMenuItem();
if (!scrollable) { if (!scrollable) {
cRecMenuItem *firstSelectable= NULL; cRecMenuItem *firstSelectable= NULL;
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
if (item->isSelectable()) { if ((*item)->isSelectable()) {
firstSelectable = item; firstSelectable = *item;
break; break;
} }
} }
@ -260,7 +325,7 @@ void cRecMenu::JumpBegin(void) {
activeItem->setBackground(); activeItem->setBackground();
if (footer) if (footer)
footer->Draw(); footer->Draw();
menuItems.Clear(); ClearMenuItems();
int currentItem = 0; int currentItem = 0;
cRecMenuItem *newItem = NULL; cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(currentItem)) { while (newItem = GetMenuItem(currentItem)) {
@ -272,9 +337,10 @@ void cRecMenu::JumpBegin(void) {
Arrange(true); Arrange(true);
startIndex = 0; startIndex = 0;
stopIndex = numItems-1; stopIndex = numItems-1;
menuItems.First()->setActive(); cRecMenuItem *first = menuItems.front();
menuItems.First()->setBackground(); first->setActive();
menuItems.First()->Draw(); first->setBackground();
first->Draw();
Display(true); Display(true);
} }
} }
@ -288,9 +354,10 @@ void cRecMenu::JumpEnd(void) {
if (footer && footer->isSelectable()) { if (footer && footer->isSelectable()) {
lastSelectable = footer; lastSelectable = footer;
} else { } else {
for (cRecMenuItem *item = menuItems.Last(); item; item = menuItems.Prev(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.end(); item != menuItems.begin(); ) {
if (item->isSelectable()) { item--;
lastSelectable = item; if ((*item)->isSelectable()) {
lastSelectable = *item;
break; break;
} }
} }
@ -301,13 +368,13 @@ void cRecMenu::JumpEnd(void) {
} else { } else {
activeItem->setInactive(); activeItem->setInactive();
activeItem->setBackground(); activeItem->setBackground();
menuItems.Clear(); ClearMenuItems();
int totalNumItems = GetTotalNumMenuItems(); int totalNumItems = GetTotalNumMenuItems();
int currentItem = totalNumItems-1; int currentItem = totalNumItems-1;
int itemsAdded = 0; int itemsAdded = 0;
cRecMenuItem *newItem = NULL; cRecMenuItem *newItem = NULL;
while (newItem = GetMenuItem(currentItem)) { while (newItem = GetMenuItem(currentItem)) {
AddMenuItem(newItem, menuItems.First()); AddMenuItem(newItem, true);
currentItem--; currentItem--;
itemsAdded++; itemsAdded++;
if (itemsAdded >= numItems) if (itemsAdded >= numItems)
@ -321,9 +388,10 @@ void cRecMenu::JumpEnd(void) {
footer->setBackground(); footer->setBackground();
footer->Draw(); footer->Draw();
} else { } else {
menuItems.Last()->setActive(); cRecMenuItem *last = menuItems.back();
menuItems.Last()->setBackground(); last->setActive();
menuItems.Last()->Draw(); last->setBackground();
last->Draw();
} }
Display(true); Display(true);
} }
@ -344,10 +412,10 @@ void cRecMenu::Arrange(bool scroll) {
} }
yElement += header->GetHeight(); yElement += header->GetHeight();
} }
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
item->SetGeometry(xElement, yElement, widthElement); (*item)->SetGeometry(xElement, yElement, widthElement);
item->SetPixmaps(); (*item)->SetPixmaps();
yElement += item->GetHeight(); yElement += (*item)->GetHeight();
} }
if (footer && !scroll) { if (footer && !scroll) {
footer->SetGeometry(xElement, yElement, widthElement); footer->SetGeometry(xElement, yElement, widthElement);
@ -367,9 +435,10 @@ void cRecMenu::Display(bool scroll) {
header->setBackground(); header->setBackground();
header->Draw(); header->Draw();
} }
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
item->setBackground(); (*item)->setBackground();
item->Draw(); (*item)->Show();
(*item)->Draw();
} }
if (footer && !scroll) { if (footer && !scroll) {
footer->setBackground(); footer->setBackground();
@ -387,8 +456,8 @@ void cRecMenu::Hide(void) {
header->Hide(); header->Hide();
if (footer) if (footer)
footer->Hide(); footer->Hide();
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
item->Hide(); (*item)->Hide();
} }
} }
@ -400,8 +469,8 @@ void cRecMenu::Show(void) {
header->Show(); header->Show();
if (footer) if (footer)
footer->Show(); footer->Show();
for (cRecMenuItem *item = menuItems.First(); item; item = menuItems.Next(item)) { for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
item->Show(); (*item)->Show();
} }
} }
@ -418,58 +487,35 @@ void cRecMenu::DrawScrollBar(void) {
pixmapScrollBar->DrawImage(cPoint(4, 2 + offset), *imgScrollBar); pixmapScrollBar->DrawImage(cPoint(4, 2 + offset), *imgScrollBar);
} }
int cRecMenu::GetIntValue(int itemNumber) { cRecMenuItem *cRecMenu::GetActiveMenuItem(void) {
cRecMenuItem *item = NULL; for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
item = menuItems.Get(itemNumber); if ((*item)->isActive())
if (item) { return *item;
return item->GetIntValue();
} }
return -1; if (footer && footer->isActive())
return footer;
return NULL;
} }
time_t cRecMenu::GetTimeValue(int itemNumber) { cRecMenuItem *cRecMenu::GetMenuItemAt(int num) {
cRecMenuItem *item = NULL; int current = 0;
item = menuItems.Get(itemNumber); for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
if (item) { if (current == num)
return item->GetTimeValue(); return *item;
} current++;
return 0;
}
bool cRecMenu::GetBoolValue(int itemNumber) {
cRecMenuItem *item = NULL;
item = menuItems.Get(itemNumber);
if (item) {
return item->GetBoolValue();
}
return false;
}
cString cRecMenu::GetStringValue(int itemNumber) {
cRecMenuItem *item = NULL;
item = menuItems.Get(itemNumber);
if (item) {
return item->GetStringValue();
}
return cString("");
}
const cEvent *cRecMenu::GetEventValue(int itemNumber) {
cRecMenuItem *item = NULL;
item = menuItems.Get(itemNumber);
if (item) {
return item->GetEventValue();
} }
return NULL; return NULL;
} }
cTimer *cRecMenu::GetTimerValue(int itemNumber) { int cRecMenu::GetActive(void) {
cRecMenuItem *item = NULL; int numActive = startIndex;
item = menuItems.Get(itemNumber); for (std::list<cRecMenuItem*>::iterator item = menuItems.begin(); item != menuItems.end(); item++) {
if (item) { if ((*item)->isActive()) {
return item->GetTimerValue(); break;
}
numActive++;
} }
return NULL; return numActive;
} }
eRecMenuState cRecMenu::ProcessKey(eKeys Key) { eRecMenuState cRecMenu::ProcessKey(eKeys Key) {
@ -485,12 +531,12 @@ eRecMenuState cRecMenu::ProcessKey(eKeys Key) {
} else if (state == rmsNotConsumed) { } else if (state == rmsNotConsumed) {
switch (Key & ~k_Repeat) { switch (Key & ~k_Repeat) {
case kUp: case kUp:
if (!ActivatePrev() && scrollable) if (!ActivatePrev())
ScrollUp(); ScrollUp();
state = rmsConsumed; state = rmsConsumed;
break; break;
case kDown: case kDown:
if (!ActivateNext() && scrollable) if (!ActivateNext())
ScrollDown(); ScrollDown();
state = rmsConsumed; state = rmsConsumed;
break; break;

View File

@ -6,59 +6,58 @@
// --- cRecMenu ------------------------------------------------------------- // --- cRecMenu -------------------------------------------------------------
class cRecMenu : public cStyledPixmap { class cRecMenu : public cStyledPixmap {
protected: private:
int x, y; std::list<cRecMenuItem*> menuItems;
int width, height;
int headerHeight, footerHeight;
int scrollHeight;
int scrollItemHeight;
int scrollbarWidth; int scrollbarWidth;
cPixmap *pixmapScrollBar;
cImage *imgScrollBar;
int border;
bool scrollable;
int numItems; int numItems;
int startIndex, stopIndex; int startIndex, stopIndex;
cRecMenuItem *header; void Activate(cRecMenuItem *itemOld, cRecMenuItem *item);
cRecMenuItem *footer;
cList<cRecMenuItem> menuItems;
void SetWidthPercent(int percentOSDWidth);
void SetWidthPixel(int pixel);
int CalculateOptimalWidth(void);
bool CheckHeight(void);
void CalculateHeight(void);
void CreatePixmap(void);
void SetHeader(cRecMenuItem *header);
void SetFooter(cRecMenuItem *footer);
void AddMenuItemScroll(cRecMenuItem *item);
void AddMenuItem(cRecMenuItem *item, cRecMenuItem *before = NULL);
cRecMenuItem *GetActiveMenuItem(void);
bool ActivateNext(void); bool ActivateNext(void);
bool ActivatePrev(void); bool ActivatePrev(void);
void Activate(cRecMenuItem *itemOld, cRecMenuItem *item);
void ScrollUp(void); void ScrollUp(void);
void ScrollDown(void); void ScrollDown(void);
void JumpBegin(void); void JumpBegin(void);
void JumpEnd(void); void JumpEnd(void);
protected:
int x, y;
int width, height;
int headerHeight, footerHeight;
int currentHeight;
bool deleteMenuItems;
cPixmap *pixmapScrollBar;
cImage *imgScrollBar;
int border;
bool scrollable;
cRecMenuItem *header;
cRecMenuItem *footer;
void SetWidthPercent(int percentOSDWidth);
void SetWidthPixel(int pixel);
int CalculateOptimalWidth(void);
bool CalculateHeight(bool reDraw = false);
void CreatePixmap(void);
void SetHeader(cRecMenuItem *header);
void SetFooter(cRecMenuItem *footer);
void ClearMenuItems(void);
void InitMenu(bool complete);
bool AddMenuItemInitial(cRecMenuItem *item);
void AddMenuItem(cRecMenuItem *item, bool inFront = false);
void DrawScrollBar(void); void DrawScrollBar(void);
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);
void Arrange(bool scroll = false); void Arrange(bool scroll = false);
virtual cRecMenuItem *GetMenuItem(int number) { return NULL; }; virtual cRecMenuItem *GetMenuItem(int number) { return NULL; };
cRecMenuItem *GetActiveMenuItem(void);
cRecMenuItem *GetMenuItemAt(int num);
int GetCurrentNumMenuItems(void) { return menuItems.size(); };
virtual int GetTotalNumMenuItems(void) { return 0; }; virtual int GetTotalNumMenuItems(void) { return 0; };
virtual void CreateMenuItems(void) {}; virtual void CreateMenuItems(void) {};
int GetStartIndex(void) { return startIndex; };
int GetActive(void);
public: public:
cRecMenu(void); cRecMenu(void);
virtual ~cRecMenu(void); virtual ~cRecMenu(void);
void Display(bool scroll = false); void Display(bool scroll = false);
void Hide(void); void Hide(void);
void Show(void); void Show(void);
int GetActive(bool withOffset);
int GetIntValue(int itemNumber);
time_t GetTimeValue(int itemNumber);
bool GetBoolValue(int itemNumber);
cString GetStringValue(int itemNumber);
const cEvent *GetEventValue(int itemNumber);
cTimer *GetTimerValue(int itemNumber);
virtual eRecMenuState ProcessKey(eKeys Key); virtual eRecMenuState ProcessKey(eKeys Key);
}; };
#endif //__TVGUIDE_RECMENU_H #endif //__TVGUIDE_RECMENU_H

View File

@ -3,6 +3,7 @@
#include "imageloader.h" #include "imageloader.h"
#include "imagecache.h" #include "imagecache.h"
#include "tools.h" #include "tools.h"
#include "recmenus.h"
#include "recmenuitem.h" #include "recmenuitem.h"
// --- cRecMenuItem ------------------------------------------------------------- // --- cRecMenuItem -------------------------------------------------------------
@ -14,6 +15,7 @@ cRecMenuItem::cRecMenuItem(void) {
drawn = false; drawn = false;
font = fontManager.FontRecMenuItem; font = fontManager.FontRecMenuItem;
fontSmall = fontManager.FontRecMenuItemSmall; fontSmall = fontManager.FontRecMenuItemSmall;
fontLarge = fontManager.FontRecMenuItemLarge;
} }
cRecMenuItem::~cRecMenuItem(void) { cRecMenuItem::~cRecMenuItem(void) {
@ -60,12 +62,13 @@ void cRecMenuItem::setBackground(void) {
// --- cRecMenuItemButton ------------------------------------------------------- // --- cRecMenuItemButton -------------------------------------------------------
cRecMenuItemButton::cRecMenuItemButton(const char *text, eRecMenuState action, bool active, bool halfWidth, bool alignLeft) { cRecMenuItemButton::cRecMenuItemButton(const char *text, eRecMenuState action, bool active, bool halfWidth, bool alignLeft, bool largeFont) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->action = action; this->action = action;
this->active = active; this->active = active;
height = 3 * font->Height() / 2; fontButtons = (largeFont)?fontLarge:font;
height = 3 * fontButtons->Height() / 2;
this->halfWidth = halfWidth; this->halfWidth = halfWidth;
this->alignLeft = alignLeft; this->alignLeft = alignLeft;
} }
@ -74,7 +77,7 @@ cRecMenuItemButton::~cRecMenuItemButton(void) {
} }
int cRecMenuItemButton::GetWidth(void) { int cRecMenuItemButton::GetWidth(void) {
return font->Width(*text); return fontButtons->Width(*text);
} }
void cRecMenuItemButton::SetPixmaps(void) { void cRecMenuItemButton::SetPixmaps(void) {
@ -89,13 +92,13 @@ void cRecMenuItemButton::SetPixmaps(void) {
} }
void cRecMenuItemButton::Draw(void) { void cRecMenuItemButton::Draw(void) {
int y = (height - font->Height()) / 2; int y = (height - fontButtons->Height()) / 2;
int x; int x;
if (!alignLeft) if (!alignLeft)
x = (width - font->Width(*text)) / 2; x = (width - fontButtons->Width(*text)) / 2;
else else
x = 10; x = 10;
pixmap->DrawText(cPoint(x, y), *text, colorText, colorTextBack, font); pixmap->DrawText(cPoint(x, y), *text, colorText, colorTextBack, fontButtons);
} }
eRecMenuState cRecMenuItemButton::ProcessKey(eKeys Key) { eRecMenuState cRecMenuItemButton::ProcessKey(eKeys Key) {
@ -141,8 +144,8 @@ void cRecMenuItemButtonYesNo::SetPixmaps(void) {
pixmap = osdManager.requestPixmap(4, cRect(yesX, yPixmaps, buttonWidth, height)); pixmap = osdManager.requestPixmap(4, cRect(yesX, yPixmaps, buttonWidth, height));
pixmapNo = new cStyledPixmap(osdManager.requestPixmap(4, cRect(noX, yPixmaps, buttonWidth, height))); pixmapNo = new cStyledPixmap(osdManager.requestPixmap(4, cRect(noX, yPixmaps, buttonWidth, height)));
} else { } else {
pixmap->SetViewPort(cRect(x, yPixmaps, width, height)); pixmap->SetViewPort(cRect(yesX, yPixmaps, buttonWidth, height));
pixmapNo->SetViewPort(cRect(x, yPixmaps, width, height)); pixmapNo->SetViewPort(cRect(noX, yPixmaps, buttonWidth, height));
} }
} }
@ -279,13 +282,17 @@ cRecMenuItemInt::cRecMenuItemInt(cString text,
int initialVal, int initialVal,
int minVal, int minVal,
int maxVal, int maxVal,
bool active) { bool active,
int *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->currentVal = initialVal; this->currentVal = initialVal;
this->minVal = minVal; this->minVal = minVal;
this->maxVal = maxVal; this->maxVal = maxVal;
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
fresh = true; fresh = true;
@ -342,6 +349,8 @@ eRecMenuState cRecMenuItemInt::ProcessKey(eKeys Key) {
fresh = true; fresh = true;
if (currentVal > minVal) { if (currentVal > minVal) {
currentVal--; currentVal--;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
} }
return rmsConsumed; return rmsConsumed;
@ -350,6 +359,8 @@ eRecMenuState cRecMenuItemInt::ProcessKey(eKeys Key) {
fresh = true; fresh = true;
if (currentVal < maxVal) { if (currentVal < maxVal) {
currentVal++; currentVal++;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
} }
return rmsConsumed; return rmsConsumed;
@ -362,9 +373,13 @@ eRecMenuState cRecMenuItemInt::ProcessKey(eKeys Key) {
currentVal = currentVal * 10 + (Key - k0); currentVal = currentVal * 10 + (Key - k0);
if (!((currentVal >= minVal) && (currentVal <= maxVal))) if (!((currentVal >= minVal) && (currentVal <= maxVal)))
currentVal = oldValue; currentVal = oldValue;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; break;
case kOk:
return action;
default: default:
break; break;
} }
@ -375,12 +390,16 @@ eRecMenuState cRecMenuItemInt::ProcessKey(eKeys Key) {
cRecMenuItemBool::cRecMenuItemBool(cString text, cRecMenuItemBool::cRecMenuItemBool(cString text,
bool initialVal, bool initialVal,
bool refresh, bool refresh,
bool active) { bool active,
bool *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->yes = initialVal; this->yes = initialVal;
this->refresh = refresh; this->refresh = refresh;
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
} }
@ -434,12 +453,16 @@ eRecMenuState cRecMenuItemBool::ProcessKey(eKeys Key) {
case kLeft: case kLeft:
case kRight: case kRight:
yes = !yes; yes = !yes;
if (callback)
*callback = yes;
DrawValue(); DrawValue();
if (refresh) if (refresh)
return rmsRefresh; return rmsRefresh;
else else
return rmsConsumed; return rmsConsumed;
break; break;
case kOk:
return action;
default: default:
break; break;
} }
@ -448,19 +471,22 @@ eRecMenuState cRecMenuItemBool::ProcessKey(eKeys Key) {
// --- cRecMenuItemSelect ------------------------------------------------------- // --- cRecMenuItemSelect -------------------------------------------------------
cRecMenuItemSelect::cRecMenuItemSelect(cString text, cRecMenuItemSelect::cRecMenuItemSelect(cString text,
const char * const *Strings, std::vector<std::string> Strings,
int initialVal, int initialVal,
int numValues, bool active,
bool active) { int *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
strings = Strings; strings = Strings;
this->numValues = numValues; numValues = Strings.size();
if ((initialVal < 0) || (initialVal > numValues-1)) if ((initialVal < 0) || (initialVal > numValues-1))
this->currentVal = 0; this->currentVal = 0;
else else
this->currentVal = initialVal; this->currentVal = initialVal;
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
} }
@ -498,11 +524,11 @@ void cRecMenuItemSelect::Draw(void) {
void cRecMenuItemSelect::DrawValue(void) { void cRecMenuItemSelect::DrawValue(void) {
pixmapVal->Fill(clrTransparent); pixmapVal->Fill(clrTransparent);
const char *textVal = strings[currentVal]; std::string textVal = strings[currentVal];
int iconSize = min(128, height); int iconSize = min(128, height);
int textX = width - font->Width(textVal) - iconSize; int textX = width - font->Width(textVal.c_str()) - iconSize;
int textY = (height - font->Height()) / 2; int textY = (height - font->Height()) / 2;
pixmapVal->DrawText(cPoint(textX, textY), textVal, colorText, clrTransparent, font); pixmapVal->DrawText(cPoint(textX, textY), textVal.c_str(), colorText, clrTransparent, font);
int iconLeftX = textX - iconSize; int iconLeftX = textX - iconSize;
int iconRightX = width - iconSize; int iconRightX = width - iconSize;
int iconY = (height - iconSize) / 2; int iconY = (height - iconSize) / 2;
@ -524,14 +550,20 @@ eRecMenuState cRecMenuItemSelect::ProcessKey(eKeys Key) {
currentVal--; currentVal--;
if (currentVal<0) if (currentVal<0)
currentVal = numValues - 1; currentVal = numValues - 1;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; break;
case kRight: case kRight:
currentVal = (currentVal+1)%numValues; currentVal = (currentVal+1)%numValues;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; break;
case kOk:
return action;
default: default:
break; break;
} }
@ -542,11 +574,13 @@ eRecMenuState cRecMenuItemSelect::ProcessKey(eKeys Key) {
cRecMenuItemText::cRecMenuItemText(cString title, cRecMenuItemText::cRecMenuItemText(cString title,
char *initialVal, char *initialVal,
int length, int length,
bool active) { bool active,
char *callback) {
selectable = true; selectable = true;
this->title = title; this->title = title;
value = initialVal; value = initialVal;
this->active = active; this->active = active;
this->callback = callback;
height = 3 * font->Height(); height = 3 * font->Height();
pixmapVal = NULL; pixmapVal = NULL;
pixmapKeyboard = NULL; pixmapKeyboard = NULL;
@ -800,6 +834,9 @@ void cRecMenuItemText::LeaveEditMode(bool SaveValue) {
if (SaveValue) { if (SaveValue) {
Utf8FromArray(valueUtf8, value, length); Utf8FromArray(valueUtf8, value, length);
stripspace(value); stripspace(value);
if (callback) {
strncpy(callback, value, TEXTINPUTLENGTH);
}
} }
lengthUtf8 = 0; lengthUtf8 = 0;
delete[] valueUtf8; delete[] valueUtf8;
@ -1109,7 +1146,9 @@ eRecMenuState cRecMenuItemText::ProcessKey(eKeys Key) {
// --- cRecMenuItemTime ------------------------------------------------------- // --- cRecMenuItemTime -------------------------------------------------------
cRecMenuItemTime::cRecMenuItemTime(cString text, cRecMenuItemTime::cRecMenuItemTime(cString text,
int initialVal, int initialVal,
bool active) { bool active,
int *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->value = initialVal; this->value = initialVal;
@ -1118,6 +1157,8 @@ cRecMenuItemTime::cRecMenuItemTime(cString text,
pos = 0; pos = 0;
fresh = true; fresh = true;
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
} }
@ -1178,6 +1219,8 @@ eRecMenuState cRecMenuItemTime::ProcessKey(eKeys Key) {
} }
fresh = true; fresh = true;
value = hh * 100 + mm; value = hh * 100 + mm;
if (callback)
*callback = value;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; } break; }
@ -1191,6 +1234,8 @@ eRecMenuState cRecMenuItemTime::ProcessKey(eKeys Key) {
fresh = true; fresh = true;
value = hh * 100 + mm; value = hh * 100 + mm;
DrawValue(); DrawValue();
if (callback)
*callback = value;
return rmsConsumed; return rmsConsumed;
break; } break; }
case k0|k_Repeat ... k9|k_Repeat: case k0|k_Repeat ... k9|k_Repeat:
@ -1229,9 +1274,13 @@ eRecMenuState cRecMenuItemTime::ProcessKey(eKeys Key) {
default: ; default: ;
} }
value = hh * 100 + mm; value = hh * 100 + mm;
if (callback)
*callback = value;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; } break; }
case kOk:
return action;
default: default:
break; break;
} }
@ -1241,11 +1290,15 @@ eRecMenuState cRecMenuItemTime::ProcessKey(eKeys Key) {
// --- cRecMenuItemDay ------------------------------------------------------- // --- cRecMenuItemDay -------------------------------------------------------
cRecMenuItemDay::cRecMenuItemDay(cString text, cRecMenuItemDay::cRecMenuItemDay(cString text,
time_t initialVal, time_t initialVal,
bool active) { bool active,
time_t *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->currentVal = cTimer::SetTime(initialVal, 0); this->currentVal = cTimer::SetTime(initialVal, 0);
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 3 * font->Height() / 2; height = 3 * font->Height() / 2;
pixmapVal = NULL; pixmapVal = NULL;
} }
@ -1293,14 +1346,20 @@ eRecMenuState cRecMenuItemDay::ProcessKey(eKeys Key) {
switch (Key & ~k_Repeat) { switch (Key & ~k_Repeat) {
case kLeft: case kLeft:
currentVal -= 60*60*24; currentVal -= 60*60*24;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; break;
case kRight: case kRight:
currentVal += 60*60*24; currentVal += 60*60*24;
if (callback)
*callback = currentVal;
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; break;
case kOk:
return action;
default: default:
break; break;
} }
@ -1646,6 +1705,15 @@ void cRecMenuItemEvent::Draw(void) {
pixmapText->DrawText(cPoint(textX, textHeightLine1), *info, colorText, clrTransparent, fontSmall); pixmapText->DrawText(cPoint(textX, textHeightLine1), *info, colorText, clrTransparent, fontSmall);
pixmapText->DrawText(cPoint(textX, textHeightLine2), *title, colorText, clrTransparent, font); pixmapText->DrawText(cPoint(textX, textHeightLine2), *title, colorText, clrTransparent, font);
pixmapText->DrawText(cPoint(textX, textHeightLine3), *desc, colorText, clrTransparent, fontSmall); pixmapText->DrawText(cPoint(textX, textHeightLine3), *desc, colorText, clrTransparent, fontSmall);
if (event->HasTimer()) {
int iconSize = height / 2;
int iconY = (height - iconSize) / 2;
cImage *imgHasTimer = imgCache.GetIcon("activetimer", iconSize, iconSize);
if (imgHasTimer) {
pixmapIcons->DrawImage(cPoint(width - iconSize - 10, iconY), *imgHasTimer);
}
}
} }
int cRecMenuItemEvent::DrawIcons(void) { int cRecMenuItemEvent::DrawIcons(void) {
@ -1734,7 +1802,9 @@ eRecMenuState cRecMenuItemEvent::ProcessKey(eKeys Key) {
// --- cRecMenuItemChannelChooser ------------------------------------------------------- // --- cRecMenuItemChannelChooser -------------------------------------------------------
cRecMenuItemChannelChooser::cRecMenuItemChannelChooser(cString text, cRecMenuItemChannelChooser::cRecMenuItemChannelChooser(cString text,
cChannel *initialChannel, cChannel *initialChannel,
bool active) { bool active,
int *callback,
eRecMenuState action) {
selectable = true; selectable = true;
this->text = text; this->text = text;
this->channel = initialChannel; this->channel = initialChannel;
@ -1745,6 +1815,8 @@ cRecMenuItemChannelChooser::cRecMenuItemChannelChooser(cString text,
channelNumber = 0; channelNumber = 0;
fresh = true; fresh = true;
this->active = active; this->active = active;
this->callback = callback;
this->action = action;
height = 2 * font->Height(); height = 2 * font->Height();
pixmapChannel = NULL; pixmapChannel = NULL;
} }
@ -1829,6 +1901,12 @@ eRecMenuState cRecMenuItemChannelChooser::ProcessKey(eKeys Key) {
} }
} }
} }
if (callback) {
if (channel)
*callback = channel->Number();
else
*callback = 0;
}
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; } break; }
@ -1847,6 +1925,12 @@ eRecMenuState cRecMenuItemChannelChooser::ProcessKey(eKeys Key) {
} }
} }
} }
if (callback) {
if (channel)
*callback = channel->Number();
else
*callback = 0;
}
DrawValue(); DrawValue();
return rmsConsumed; return rmsConsumed;
break; } break; }
@ -1860,9 +1944,13 @@ eRecMenuState cRecMenuItemChannelChooser::ProcessKey(eKeys Key) {
if (chanNew) { if (chanNew) {
channel = chanNew; channel = chanNew;
DrawValue(); DrawValue();
if (callback)
*callback = channel->Number();
} }
return rmsConsumed; return rmsConsumed;
break; } break; }
case kOk:
return action;
default: default:
break; break;
} }
@ -1872,11 +1960,15 @@ eRecMenuState cRecMenuItemChannelChooser::ProcessKey(eKeys Key) {
// --- cRecMenuItemDayChooser ------------------------------------------------------- // --- cRecMenuItemDayChooser -------------------------------------------------------
cRecMenuItemDayChooser::cRecMenuItemDayChooser(cString text, cRecMenuItemDayChooser::cRecMenuItemDayChooser(cString text,
int weekdays, int weekdays,
bool active) { bool active,
int *callback) {
selectable = true; selectable = true;
this->text = text; this->text = text;
if (weekdays < 1)
weekdays *= -1;
this->weekdays = weekdays; this->weekdays = weekdays;
this->active = active; this->active = active;
this->callback = callback;
height = 2 * font->Height(); height = 2 * font->Height();
selectedDay = 0; selectedDay = 0;
pixmapWeekdays = NULL; pixmapWeekdays = NULL;
@ -1979,6 +2071,9 @@ void cRecMenuItemDayChooser::ToggleDay(void) {
} else { } else {
weekdays += dayBit; weekdays += dayBit;
} }
if (callback) {
*callback = weekdays;
}
} }
eRecMenuState cRecMenuItemDayChooser::ProcessKey(eKeys Key) { eRecMenuState cRecMenuItemDayChooser::ProcessKey(eKeys Key) {
@ -2414,3 +2509,134 @@ eRecMenuState cRecMenuItemTimelineTimer::ProcessKey(eKeys Key) {
} }
return rmsNotConsumed; return rmsNotConsumed;
} }
// --- cRecMenuItemSearchTimer -------------------------------------------------------
cRecMenuItemSearchTimer::cRecMenuItemSearchTimer(cTVGuideSearchTimer timer,
eRecMenuState action1,
eRecMenuState action2,
bool active) {
this->timer = timer;
this->action = action1;
this->action2 = action2;
pixmapText = NULL;
pixmapIcons = NULL;
selectable = true;
this->active = active;
iconActive = 0;
height = 2 * font->Height();;
}
cRecMenuItemSearchTimer::~cRecMenuItemSearchTimer(void) {
if (pixmapText)
osdManager.releasePixmap(pixmapText);
if (pixmapIcons)
osdManager.releasePixmap(pixmapIcons);
}
void cRecMenuItemSearchTimer::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 cRecMenuItemSearchTimer::Draw(void) {
int textX = DrawIcons();
if (!drawn) {
pixmapText->Fill(clrTransparent);
textX += 20;
cString label;
if (timer.Active()) {
label = cString::sprintf("\"%s\"", timer.SearchString().c_str());
} else {
label = cString::sprintf("\"%s\" (%s)", timer.SearchString().c_str(), tr("inactive"));
}
int numTimersActive = timer.GetNumTimers();
int numRecordings = timer.GetNumRecordings();
cString info = cString::sprintf("%s: %d, %s: %d", tr("active timers"), numTimersActive, tr("recordings done"), numRecordings);
pixmapText->DrawText(cPoint(textX, 5 + (height/2 - font->Height())/2), *label, colorText, clrTransparent, font);
pixmapText->DrawText(cPoint(textX, height/2 + (height/2 - fontSmall->Height())/2), *info, colorText, clrTransparent, fontSmall);
drawn = true;
}
}
void cRecMenuItemSearchTimer::Hide(void) {
pixmap->SetLayer(-1);
pixmapText->SetLayer(-1);
pixmapIcons->SetLayer(-1);
}
void cRecMenuItemSearchTimer::Show(void) {
pixmap->SetLayer(4);
pixmapText->SetLayer(5);
pixmapIcons->SetLayer(6);
}
int cRecMenuItemSearchTimer::DrawIcons(void) {
pixmapIcons->Fill(clrTransparent);
int iconsX = 10;
int iconSize = height / 2;
int iconY = (height - iconSize) / 2;
std::string iconEdit, iconDelete;
if (active) {
iconEdit = (iconActive==0)?"edit_active":"edit_inactive";
iconDelete = (iconActive==1)?"delete_active":"delete_inactive";
} else {
iconEdit = "edit_inactive";
iconDelete = "delete_inactive";
}
cImage *imgEdit = imgCache.GetIcon(iconEdit, iconSize, iconSize);
if (imgEdit) {
pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgEdit);
iconsX += iconSize + 10;
}
cImage *imgDel = imgCache.GetIcon(iconDelete, iconSize, iconSize);
if (imgDel) {
pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgDel);
iconsX += iconSize + 10;
}
return iconsX;
}
eRecMenuState cRecMenuItemSearchTimer::ProcessKey(eKeys Key) {
bool consumed = false;
switch (Key & ~k_Repeat) {
case kLeft:
if (iconActive == 1) {
iconActive = 0;
consumed = true;
}
DrawIcons();
if (consumed)
return rmsConsumed;
else
return rmsNotConsumed;
break;
case kRight: {
if (iconActive == 0) {
iconActive = 1;
consumed = true;
}
DrawIcons();
if (consumed)
return rmsConsumed;
else
return rmsNotConsumed;
break; }
case kOk:
if (iconActive == 0)
return action;
else if (iconActive == 1)
return action2;
break;
default:
break;
}
return rmsNotConsumed;
}

View File

@ -7,6 +7,7 @@
#include <vdr/tools.h> #include <vdr/tools.h>
#include "styledpixmap.h" #include "styledpixmap.h"
#include "timerconflict.h" #include "timerconflict.h"
#include "searchtimer.h"
enum eRecMenuState { enum eRecMenuState {
rmsConsumed, rmsConsumed,
@ -14,6 +15,7 @@ enum eRecMenuState {
rmsRefresh, rmsRefresh,
rmsContinue, rmsContinue,
rmsClose, rmsClose,
//INSTANT TIMER
rmsInstantRecord, rmsInstantRecord,
rmsInstantRecordFolder, rmsInstantRecordFolder,
rmsIgnoreTimerConflict, rmsIgnoreTimerConflict,
@ -26,6 +28,7 @@ enum eRecMenuState {
rmsDeleteTimerConfirmation, rmsDeleteTimerConfirmation,
rmsEditTimer, rmsEditTimer,
rmsSaveTimer, rmsSaveTimer,
//SEARCH
rmsSearch, rmsSearch,
rmsSearchWithOptions, rmsSearchWithOptions,
rmsSearchPerform, rmsSearchPerform,
@ -33,28 +36,35 @@ enum eRecMenuState {
rmsSearchRecord, rmsSearchRecord,
rmsSearchRecordConfirm, rmsSearchRecordConfirm,
rmsSearchNothingFoundConfirm, rmsSearchNothingFoundConfirm,
//SERIES TIMER
rmsSeriesTimer, rmsSeriesTimer,
rmsSeriesTimerFolder, rmsSeriesTimerFolder,
rmsSeriesTimerCreate, rmsSeriesTimerCreate,
//SEARCHTIMER
rmsSearchTimer, rmsSearchTimer,
rmsSearchTimerOptions, rmsSearchTimerOptions,
rmsSearchTimerOptionsReload, rmsSearchTimers,
rmsSearchTimerUseTemplate, rmsSearchTimerEdit,
rmsSearchTimerOptionsManually, rmsSearchTimerEditAdvanced,
rmsSearchTimerTestManually, rmsSearchTimerTest,
rmsSearchTimerTestTemplate, rmsSearchTimerSave,
rmsSearchTimerNothingFoundConfirm, rmsSearchTimerCreateWithTemplate,
rmsSearchTimerCreateManually, rmsSearchTimerDeleteConfirm,
rmsSearchTimerCreateTemplate, rmsSearchTimerDelete,
rmsSearchTimerDeleteWithTimers,
//SWITCHTIMER
rmsSwitchTimer, rmsSwitchTimer,
rmsSwitchTimerCreate, rmsSwitchTimerCreate,
rmsSwitchTimerDelete, rmsSwitchTimerDelete,
//RECORDINGS SEARCH
rmsRecordingSearch, rmsRecordingSearch,
rmsRecordingSearchResult, rmsRecordingSearchResult,
//TIMER CONFLICTS
rmsTimerConflict, rmsTimerConflict,
rmsTimerConflicts, rmsTimerConflicts,
rmsTimerConflictIgnoreReruns, rmsTimerConflictIgnoreReruns,
rmsTimerConflictRecordRerun, rmsTimerConflictRecordRerun,
//TIMELINE
rmsTimeline, rmsTimeline,
rmsTimelineTimerEdit, rmsTimelineTimerEdit,
rmsTimelineTimerSave, rmsTimelineTimerSave,
@ -66,6 +76,7 @@ enum eDependend {
eGreater, eGreater,
eLower, eLower,
}; };
// --- cRecMenuItem ------------------------------------------------------------- // --- cRecMenuItem -------------------------------------------------------------
class cRecMenuItem : public cListObject, public cStyledPixmap { class cRecMenuItem : public cListObject, public cStyledPixmap {
protected: protected:
@ -80,6 +91,7 @@ protected:
tColor colorTextBack; tColor colorTextBack;
const cFont *font; const cFont *font;
const cFont *fontSmall; const cFont *fontSmall;
const cFont *fontLarge;
public: public:
cRecMenuItem(void); cRecMenuItem(void);
virtual ~cRecMenuItem(void); virtual ~cRecMenuItem(void);
@ -103,7 +115,6 @@ public:
virtual const cEvent *GetEventValue(void) { return NULL; }; virtual const cEvent *GetEventValue(void) { return NULL; };
virtual cTimer *GetTimerValue(void) { return NULL; }; virtual cTimer *GetTimerValue(void) { return NULL; };
virtual eRecMenuState ProcessKey(eKeys Key) { return rmsNotConsumed; }; virtual eRecMenuState ProcessKey(eKeys Key) { return rmsNotConsumed; };
}; };
// --- cRecMenuItemButton ------------------------------------------------------- // --- cRecMenuItemButton -------------------------------------------------------
@ -112,8 +123,9 @@ private:
cString text; cString text;
bool halfWidth; bool halfWidth;
bool alignLeft; bool alignLeft;
const cFont *fontButtons;
public: public:
cRecMenuItemButton(const char *text, eRecMenuState action, bool active, bool halfWidth = false, bool alignLeft = false); cRecMenuItemButton(const char *text, eRecMenuState action, bool active, bool halfWidth = false, bool alignLeft = false, bool largeFont = false);
virtual ~cRecMenuItemButton(void); virtual ~cRecMenuItemButton(void);
int GetWidth(void); int GetWidth(void);
void SetPixmaps(void); void SetPixmaps(void);
@ -166,6 +178,7 @@ class cRecMenuItemInt : public cRecMenuItem {
private: private:
cString text; cString text;
int currentVal; int currentVal;
int *callback;
int minVal; int minVal;
int maxVal; int maxVal;
cPixmap *pixmapVal; cPixmap *pixmapVal;
@ -176,7 +189,9 @@ public:
int initialVal, int initialVal,
int minVal, int minVal,
int maxVal, int maxVal,
bool active); bool active = false,
int *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemInt(void); virtual ~cRecMenuItemInt(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -192,14 +207,17 @@ class cRecMenuItemBool : public cRecMenuItem {
private: private:
cString text; cString text;
bool yes; bool yes;
bool *callback;
cPixmap *pixmapVal; cPixmap *pixmapVal;
bool refresh; bool refresh;
void DrawValue(void); void DrawValue(void);
public: public:
cRecMenuItemBool(cString text, cRecMenuItemBool(cString text,
bool initialVal, bool initialVal,
bool refresh, bool refresh = false,
bool active); bool active = false,
bool *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemBool(void); virtual ~cRecMenuItemBool(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -214,16 +232,18 @@ class cRecMenuItemSelect : public cRecMenuItem {
private: private:
cString text; cString text;
int currentVal; int currentVal;
const char * const *strings; int *callback;
std::vector<std::string> strings;
int numValues; int numValues;
cPixmap *pixmapVal; cPixmap *pixmapVal;
void DrawValue(void); void DrawValue(void);
public: public:
cRecMenuItemSelect(cString text, cRecMenuItemSelect(cString text,
const char * const *Strings, std::vector<std::string> Strings,
int initialVal, int initialVal,
int numValues, bool active = false,
bool active); int *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemSelect(void); virtual ~cRecMenuItemSelect(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -231,7 +251,7 @@ public:
eRecMenuState ProcessKey(eKeys Key); eRecMenuState ProcessKey(eKeys Key);
void Draw(void); void Draw(void);
int GetIntValue(void) { return currentVal; }; int GetIntValue(void) { return currentVal; };
cString GetStringValue(void) { return strings[currentVal]; }; cString GetStringValue(void) { return strings[currentVal].c_str(); };
}; };
// --- cRecMenuItemText ------------------------------------------------------- // --- cRecMenuItemText -------------------------------------------------------
@ -239,6 +259,7 @@ class cRecMenuItemText : public cRecMenuItem {
private: private:
cString title; cString title;
char *value; char *value;
char *callback;
int length; int length;
const char *allowed; const char *allowed;
int pos, offset; int pos, offset;
@ -279,7 +300,8 @@ public:
cRecMenuItemText(cString title, cRecMenuItemText(cString title,
char *initialVal, char *initialVal,
int length, int length,
bool active); bool active = false,
char *callback = NULL);
virtual ~cRecMenuItemText(void); virtual ~cRecMenuItemText(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -296,6 +318,7 @@ class cRecMenuItemTime : public cRecMenuItem {
private: private:
cString text; cString text;
int value; int value;
int *callback;
int mm; int mm;
int hh; int hh;
int pos; int pos;
@ -305,7 +328,9 @@ private:
public: public:
cRecMenuItemTime(cString text, cRecMenuItemTime(cString text,
int initialVal, int initialVal,
bool active); bool active = false,
int *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemTime(void); virtual ~cRecMenuItemTime(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -320,12 +345,15 @@ class cRecMenuItemDay : public cRecMenuItem {
private: private:
cString text; cString text;
time_t currentVal; time_t currentVal;
time_t *callback;
cPixmap *pixmapVal; cPixmap *pixmapVal;
void DrawValue(void); void DrawValue(void);
public: public:
cRecMenuItemDay(cString text, cRecMenuItemDay(cString text,
time_t initialVal, time_t initialVal,
bool active); bool active = false,
time_t *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemDay(void); virtual ~cRecMenuItemDay(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -421,6 +449,7 @@ private:
cString text; cString text;
cChannel *channel; cChannel *channel;
int channelNumber; int channelNumber;
int *callback;
bool initialChannelSet; bool initialChannelSet;
bool fresh; bool fresh;
cPixmap *pixmapChannel; cPixmap *pixmapChannel;
@ -428,7 +457,9 @@ private:
public: public:
cRecMenuItemChannelChooser (cString text, cRecMenuItemChannelChooser (cString text,
cChannel *initialChannel, cChannel *initialChannel,
bool active); bool active = false,
int *callback = NULL,
eRecMenuState action = rmsNotConsumed);
virtual ~cRecMenuItemChannelChooser(void); virtual ~cRecMenuItemChannelChooser(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -443,6 +474,8 @@ class cRecMenuItemDayChooser : public cRecMenuItem {
private: private:
cString text; cString text;
int weekdays; int weekdays;
int *callback;
bool epgsearchMode;
std::string days; std::string days;
int daysX; int daysX;
int daysY; int daysY;
@ -458,7 +491,8 @@ private:
public: public:
cRecMenuItemDayChooser (cString text, cRecMenuItemDayChooser (cString text,
int weekdays, int weekdays,
bool active); bool active = false,
int *callback = NULL);
virtual ~cRecMenuItemDayChooser(void); virtual ~cRecMenuItemDayChooser(void);
void SetPixmaps(void); void SetPixmaps(void);
void Hide(void); void Hide(void);
@ -541,4 +575,28 @@ public:
eRecMenuState ProcessKey(eKeys Key); eRecMenuState ProcessKey(eKeys Key);
}; };
// --- cRecMenuItemSearchTimer -------------------------------------------------------
class cRecMenuItemSearchTimer : public cRecMenuItem {
private:
cTVGuideSearchTimer timer;
eRecMenuState action1;
eRecMenuState action2;
int iconActive;
cPixmap *pixmapText;
cPixmap *pixmapIcons;
int DrawIcons(void);
public:
cRecMenuItemSearchTimer(cTVGuideSearchTimer timer,
eRecMenuState action1,
eRecMenuState action2,
bool active);
virtual ~cRecMenuItemSearchTimer(void);
void SetPixmaps(void);
void Hide(void);
void Show(void);
void Draw(void);
cTVGuideSearchTimer GetTimer(void) { return timer; };
eRecMenuState ProcessKey(eKeys Key);
};
#endif //__TVGUIDE_RECMENUITEM_H #endif //__TVGUIDE_RECMENUITEM_H

View File

@ -10,14 +10,7 @@ cRecMenuManager::cRecMenuManager(void) {
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
recManager = new cRecManager(); recManager = new cRecManager();
recManager->SetEPGSearchPlugin(); recManager->SetEPGSearchPlugin();
instantRecord = false;
folderChoosen = false;
timerConflicts = NULL; timerConflicts = NULL;
templateID = -1;
timer = NULL;
recFolderSeriesTimer = "";
recFolderInstantTimer = "";
searchWithOptions = false;
detailViewActive = false; detailViewActive = false;
} }
@ -37,14 +30,6 @@ cRecMenuManager::~cRecMenuManager(void) {
void cRecMenuManager::Start(const cEvent *event) { void cRecMenuManager::Start(const cEvent *event) {
active = true; active = true;
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
instantRecord = false;
folderChoosen = false;
timerConflicts = NULL;
templateID = -1;
timer = NULL;
recFolderSeriesTimer = "";
recFolderInstantTimer = "";
searchWithOptions = false;
detailViewActive = false; detailViewActive = false;
SetBackground(); SetBackground();
this->event = event; this->event = event;
@ -87,46 +72,43 @@ void cRecMenuManager::DeleteBackground(void) {
eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
eOSState state = osContinue; eOSState state = osContinue;
switch (nextState) { switch (nextState) {
/* /***************************************************************************************
* --------- INSTANT RECORDING --------------------------- * INSTANT RECORDING
*/ ****************************************************************************************/
case rmsInstantRecord: { case rmsInstantRecord: {
//Creating timer for active Event //caller: main menu or folder chooser
//if no conflict, confirm and exit //Creating timer for active Event, if no conflict, confirm and exit
instantRecord = true; std::string recFolder = "";
recFolderInstantTimer = ""; if (cRecMenuAskFolder *menu = dynamic_cast<cRecMenuAskFolder*>(activeMenu)) {
if (folderChoosen) { recFolder = menu->GetFolder();
int activeItem = activeMenu->GetActive(false);
if (activeItem > 0)
recFolderInstantTimer = activeMenu->GetStringValue(activeItem);
} }
delete activeMenu; delete activeMenu;
cTimer *timer = recManager->createTimer(event, *recFolderInstantTimer); cTimer *timer = recManager->createTimer(event, recFolder);
if (!displayTimerConflict(timer)) { if (!DisplayTimerConflict(timer)) {
activeMenu = new cRecMenuConfirmTimer(event); activeMenu = new cRecMenuConfirmTimer(event);
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsInstantRecordFolder: case rmsInstantRecordFolder:
//caller: main menu
//Asking for Folder //Asking for Folder
folderChoosen = true;
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord); activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord);
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsIgnoreTimerConflict: case rmsIgnoreTimerConflict:
//caller: cRecMenuTimerConflict
//Confirming created Timer //Confirming created Timer
if (instantRecord) { delete activeMenu;
delete activeMenu; activeMenu = new cRecMenuConfirmTimer(event);
activeMenu = new cRecMenuConfirmTimer(event); activeMenu->Display();
activeMenu->Display();
} else {
state = osEnd;
Close();
}
break; break;
case rmsTimerConflictShowInfo: { case rmsTimerConflictShowInfo: {
int timerIndex = activeMenu->GetActive(true); //caller: cRecMenuTimerConflict
int timerIndex;
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
timerIndex = menu->GetTimerConflictIndex();
} else break;
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
cTimer *t = Timers.Get(timerID); cTimer *t = Timers.Get(timerID);
if (t) { if (t) {
@ -144,23 +126,29 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
break;} break;}
case rmsDeleteTimerConflictMenu: { case rmsDeleteTimerConflictMenu: {
//delete timer out of current timer conflict //caller: cRecMenuTimerConflict
//active menu: cRecMenuTimerConflict //delete timer out of current timer conflict
int timerIndex = activeMenu->GetActive(true); int timerIndex;
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
timerIndex = menu->GetTimerConflictIndex();
} else break;
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
recManager->DeleteTimer(timerID); recManager->DeleteTimer(timerID);
delete activeMenu; delete activeMenu;
if (!displayTimerConflict(timerID)) { if (!DisplayTimerConflict(timerID)) {
activeMenu = new cRecMenuConfirmTimer(event); activeMenu = new cRecMenuConfirmTimer(event);
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsEditTimerConflictMenu: { case rmsEditTimerConflictMenu: {
//edit timer out of current timer conflict //caller: cRecMenuTimerConflict
//active menu: cRecMenuTimerConflict //edit timer out of current timer conflict
int timerIndex = activeMenu->GetActive(true); int timerIndex;
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
timerIndex = menu->GetTimerConflictIndex();
} else break;
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
timer = Timers.Get(timerID); cTimer *timer = Timers.Get(timerID);
if (timer) { if (timer) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimerConflictMenu); activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimerConflictMenu);
@ -168,16 +156,24 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
break; } break; }
case rmsSaveTimerConflictMenu: { case rmsSaveTimerConflictMenu: {
//save timer from current timer conflict //caller: cRecMenuEditTimer
recManager->SaveTimer(timer, activeMenu); //save timer from current timer conflict
cTimer timerModified;
cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();
originalTimer = menu->GetOriginalTimer();
} else break;
recManager->SaveTimer(originalTimer, timerModified);
delete activeMenu; delete activeMenu;
if (!displayTimerConflict(timer)) { if (!DisplayTimerConflict(originalTimer)) {
activeMenu = new cRecMenuConfirmTimer(event); activeMenu = new cRecMenuConfirmTimer(event);
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsDeleteTimer: case rmsDeleteTimer:
//delete timer for active event //caller: main menu
//delete timer for active event
delete activeMenu; delete activeMenu;
if (recManager->IsRecorded(event)) { if (recManager->IsRecorded(event)) {
activeMenu = new cRecMenuAskDeleteTimer(event); activeMenu = new cRecMenuAskDeleteTimer(event);
@ -188,15 +184,15 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsDeleteTimerConfirmation: case rmsDeleteTimerConfirmation:
//delete running timer for active event //delete running timer for active event
recManager->DeleteTimer(event); recManager->DeleteTimer(event);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuConfirmDeleteTimer(event); activeMenu = new cRecMenuConfirmDeleteTimer(event);
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsEditTimer: { case rmsEditTimer: {
//edit timer for active event //edit timer for active event
timer = recManager->GetTimerForEvent(event); cTimer *timer = recManager->GetTimerForEvent(event);
if (timer) { if (timer) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimer); activeMenu = new cRecMenuEditTimer(timer, rmsSaveTimer);
@ -204,141 +200,214 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
break; } break; }
case rmsSaveTimer: { case rmsSaveTimer: {
//save timer for active event //caller: cRecMenuEditTimer
recManager->SaveTimer(timer, activeMenu); //save timer for active event
cTimer timerModified;
cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();
originalTimer = menu->GetOriginalTimer();
} else break;
recManager->SaveTimer(originalTimer, timerModified);
state = osEnd; state = osEnd;
Close(); Close();
break; } break; }
/* /***************************************************************************************
* --------- SERIES TIMER --------------------------------- * SERIES TIMER
*/ ****************************************************************************************/
case rmsSeriesTimer: { case rmsSeriesTimer: {
recFolderSeriesTimer = ""; //caller: main menu oder folder chooser
if (folderChoosen) { std::string recFolder = "";
int activeItem = activeMenu->GetActive(false); if (cRecMenuAskFolder *menu = dynamic_cast<cRecMenuAskFolder*>(activeMenu)) {
if (activeItem > 0) recFolder = menu->GetFolder();
recFolderSeriesTimer = activeMenu->GetStringValue(activeItem);
} }
delete activeMenu; delete activeMenu;
cChannel *channel = Channels.GetByChannelID(event->ChannelID()); cChannel *channel = Channels.GetByChannelID(event->ChannelID());
activeMenu = new cRecMenuSeriesTimer(channel, event); activeMenu = new cRecMenuSeriesTimer(channel, event, recFolder);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSeriesTimerFolder: case rmsSeriesTimerFolder:
//Asking for Folder //caller: main menu
folderChoosen = true; //Asking for Folder
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuAskFolder(event, rmsSeriesTimer); activeMenu = new cRecMenuAskFolder(event, rmsSeriesTimer);
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsSeriesTimerCreate: { case rmsSeriesTimerCreate: {
cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu, *recFolderSeriesTimer); //caller: cRecMenuSeriesTimer
cTimer *seriesTimer;
if (cRecMenuSeriesTimer *menu = dynamic_cast<cRecMenuSeriesTimer*>(activeMenu)) {
seriesTimer = menu->GetTimer();
} else break;
recManager->CreateSeriesTimer(seriesTimer);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer); activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/* /**********************************************************************************************
* --------- SEARCH TIMER --------------------------------- * SEARCH TIMER
*/ ***********************************************************************************************/
case rmsSearchTimer: case rmsSearchTimer:
//Caller: main menu
//set search String for search timer
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSearchTimer(event); activeMenu = new cRecMenuSearchTimer(event);
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsSearchTimerOptions: { case rmsSearchTimerOptions: {
searchString = *activeMenu->GetStringValue(1); //Caller: cRecMenuSearchTimer, cRecMenuSearchTimerTemplates
//Choose to set options manually or by template
std::string searchString;
cTVGuideSearchTimer searchTimer;
bool reload = false;
if (cRecMenuSearchTimer *menu = dynamic_cast<cRecMenuSearchTimer*>(activeMenu)) {
searchString = menu->GetSearchString();
} else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
reload = true;
} else break;
delete activeMenu; delete activeMenu;
if (isempty(*searchString)) { if (searchString.size() < 4) {
activeMenu = new cRecMenuSearchTimer(event); activeMenu = new cRecMenuSearchTimer(event);
} else { } else {
epgSearchTemplates = recManager->ReadEPGSearchTemplates(); if (!reload) {
int numTemplates = epgSearchTemplates.size(); searchTimer.SetSearchString(searchString);
if (numTemplates > 0) { }
activeMenu = new cRecMenuSearchTimerTemplates(searchString, epgSearchTemplates); std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates;
recManager->ReadEPGSearchTemplates(&epgSearchTemplates);
if (epgSearchTemplates.size() > 0) {
activeMenu = new cRecMenuSearchTimerTemplates(searchTimer, epgSearchTemplates);
} else { } else {
activeMenu = new cRecMenuSearchTimerOptions(searchString); activeMenu = new cRecMenuSearchTimerEdit(searchTimer, false);
} }
} }
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSearchTimerOptionsReload: { case rmsSearchTimers: {
int numTemplates = epgSearchTemplates.size(); //caller: main menu
DisplaySearchTimerList();
break; }
case rmsSearchTimerEdit:
case rmsSearchTimerEditAdvanced: {
//caller: cRecMenuSearchTimers, cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplates
cTVGuideSearchTimer searchTimer;
bool advancedOptions = false;
if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
} else if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
advancedOptions = (nextState == rmsSearchTimerEditAdvanced)?true:false;
} else if (cRecMenuSearchTimerTemplates *menu = dynamic_cast<cRecMenuSearchTimerTemplates*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
} else break;
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSearchTimerTemplates(searchString, epgSearchTemplates); activeMenu = new cRecMenuSearchTimerEdit(searchTimer, advancedOptions);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSearchTimerUseTemplate: { case rmsSearchTimerTest: {
templateID = activeMenu->GetActive(true) - 1; //caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate
delete activeMenu; //show results of currently choosen search timer
activeMenu = new cRecMenuSearchTimerTemplatesCreate(searchString, epgSearchTemplates[templateID].name.c_str()); cTVGuideSearchTimer searchTimer;
activeMenu->Display(); if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
break; } searchTimer = menu->GetSearchTimer();
case rmsSearchTimerOptionsManually: } else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
delete activeMenu; searchTimer = menu->GetSearchTimer();
activeMenu = new cRecMenuSearchTimerOptions(searchString); TVGuideEPGSearchTemplate tmpl = menu->GetTemplate();
activeMenu->Display(); searchTimer.SetTemplate(tmpl.templValue);
break; searchTimer.Parse(true);
case rmsSearchTimerTestTemplate: { } else break;
std::string epgSearchString = recManager->BuildEPGSearchString(searchString, epgSearchTemplates[templateID].templValue);
int numSearchResults = 0; int numSearchResults = 0;
const cEvent **searchResult = recManager->PerformSearchTimerSearch(epgSearchString, numSearchResults); std::string searchString = searchTimer.BuildSearchString();
if (searchResult) { const cEvent **searchResult = recManager->PerformSearchTimerSearch(searchString, numSearchResults);
if (numSearchResults) {
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerResults(searchString, searchResult, numSearchResults, epgSearchTemplates[templateID].name); activeMenu = new cRecMenuSearchTimerResults(searchTimer.SearchString(), searchResult, numSearchResults);
activeMenu->Display(); activeMenu->Display();
} else { } else {
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerNothingFound(searchString, epgSearchTemplates[templateID].name); activeMenu = new cRecMenuSearchTimerNothingFound(searchTimer.SearchString());
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsSearchTimerTestManually: { case rmsSearchTimerSave: {
std::string epgSearchString = recManager->BuildEPGSearchString(searchString, activeMenu); //caller: cRecMenuSearchTimerEdit, cRecMenuSearchTimerTemplatesCreate
int numSearchResults = 0; //create new or modify existing search timer
const cEvent **searchResult = recManager->PerformSearchTimerSearch(epgSearchString, numSearchResults); cTVGuideSearchTimer searchTimer;
if (searchResult) { if (cRecMenuSearchTimerEdit *menu = dynamic_cast<cRecMenuSearchTimerEdit*>(activeMenu)) {
activeMenuBuffer = activeMenu; searchTimer = menu->GetSearchTimer();
activeMenuBuffer->Hide(); } else if (cRecMenuSearchTimerTemplatesCreate *menu = dynamic_cast<cRecMenuSearchTimerTemplatesCreate*>(activeMenu)) {
activeMenu = new cRecMenuSearchTimerResults(searchString, searchResult, numSearchResults, ""); searchTimer = menu->GetSearchTimer();
activeMenu->Display(); TVGuideEPGSearchTemplate tmpl = menu->GetTemplate();
searchTimer.SetTemplate(tmpl.templValue);
searchTimer.Parse(true);
} else break;
bool success = recManager->SaveSearchTimer(&searchTimer);
recManager->UpdateSearchTimers();
if (searchTimer.GetID() >= 0) {
//Timer modified, show list
DisplaySearchTimerList();
} else { } else {
activeMenuBuffer = activeMenu; //new timer, confirm
activeMenuBuffer->Hide(); delete activeMenu;
activeMenu = new cRecMenuSearchTimerNothingFound(searchString, ""); activeMenu = new cRecMenuSearchTimerCreateConfirm(success);
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
case rmsSearchTimerNothingFoundConfirm: case rmsSearchTimerCreateWithTemplate: {
//caller: cRecMenuSearchTimerTemplates
//create new search timer from template
TVGuideEPGSearchTemplate templ;
cTVGuideSearchTimer searchTimer;
if (cRecMenuSearchTimerTemplates *menu = dynamic_cast<cRecMenuSearchTimerTemplates*>(activeMenu)) {
templ = menu->GetTemplate();
searchTimer = menu->GetSearchTimer();
} else break;
delete activeMenu; delete activeMenu;
activeMenu = activeMenuBuffer; activeMenu = new cRecMenuSearchTimerTemplatesCreate(templ, searchTimer);
activeMenu->Display();
break; }
case rmsSearchTimerDeleteConfirm: {
//caller: cRecMenuSearchTimers
//Ask for confirmation and if timers created by this search timer should alo be deleted
cTVGuideSearchTimer searchTimer;
if (cRecMenuSearchTimers *menu = dynamic_cast<cRecMenuSearchTimers*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
} else break;
activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchTimerDeleteConfirm(searchTimer);
activeMenu->Display();
break; }
case rmsSearchTimerDelete:
case rmsSearchTimerDeleteWithTimers: {
//caller: cRecMenuSearchTimerDeleteConfirm
//actually delete searchtimer
cTVGuideSearchTimer searchTimer;
if (cRecMenuSearchTimerDeleteConfirm *menu = dynamic_cast<cRecMenuSearchTimerDeleteConfirm*>(activeMenu)) {
searchTimer = menu->GetSearchTimer();
} else break;
bool delTimers = (nextState==rmsSearchTimerDeleteWithTimers)?true:false;
recManager->DeleteSearchTimer(&searchTimer, delTimers);
delete activeMenuBuffer;
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
activeMenu->Show(); DisplaySearchTimerList();
break;
case rmsSearchTimerCreateManually:
case rmsSearchTimerCreateTemplate: {
std::string epgSearchString;
if (nextState == rmsSearchTimerCreateManually) {
epgSearchString = recManager->BuildEPGSearchString(searchString, activeMenu);
} else if (nextState = rmsSearchTimerCreateTemplate) {
epgSearchString = recManager->BuildEPGSearchString(searchString, epgSearchTemplates[templateID].templValue);
}
bool success = createSearchTimer(epgSearchString);
delete activeMenu;
activeMenu = new cRecMenuSearchTimerCreateConfirm(success);
activeMenu->Display();
break; } break; }
/* /**********************************************************************************************
* --------- SWITCH TIMER --------------------------------- * SWITCH TIMER
*/ ***********************************************************************************************/
case rmsSwitchTimer: case rmsSwitchTimer:
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSwitchTimer(); activeMenu = new cRecMenuSwitchTimer();
activeMenu->Display(); activeMenu->Display();
break; break;
case rmsSwitchTimerCreate: { case rmsSwitchTimerCreate: {
bool success = recManager->CreateSwitchTimer(event, activeMenu); cSwitchTimer switchTimer;
if (cRecMenuSwitchTimer *menu = dynamic_cast<cRecMenuSwitchTimer*>(activeMenu)) {
switchTimer = menu->GetSwitchTimer();
} else break;
bool success = recManager->CreateSwitchTimer(event, switchTimer);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSwitchTimerConfirm(success); activeMenu = new cRecMenuSwitchTimerConfirm(success);
activeMenu->Display(); activeMenu->Display();
@ -349,19 +418,28 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuSwitchTimerDelete(); activeMenu = new cRecMenuSwitchTimerDelete();
activeMenu->Display(); activeMenu->Display();
break; break;
/* /**********************************************************************************************
* --------- RECORDINGS SEARCH --------------------------------- * RECORDINGS SEARCH
*/ ***********************************************************************************************/
case rmsRecordingSearch: case rmsRecordingSearch: {
//caller: main menu or rmsRecordingSearchResult
std::string searchString = event->Title();
if (cRecMenuRecordingSearchResults *menu = dynamic_cast<cRecMenuRecordingSearchResults*>(activeMenu)) {
searchString = menu->GetSearchString();
};
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuRecordingSearch(event); activeMenu = new cRecMenuRecordingSearch(searchString);
activeMenu->Display(); activeMenu->Display();
break; break; }
case rmsRecordingSearchResult: { case rmsRecordingSearchResult: {
searchString = activeMenu->GetStringValue(1); //caller: cRecMenuRecordingSearch
std::string searchString;
if (cRecMenuRecordingSearch *menu = dynamic_cast<cRecMenuRecordingSearch*>(activeMenu)) {
searchString = menu->GetSearchString();
} else break;
delete activeMenu; delete activeMenu;
if (isempty(*searchString)) { if (searchString.size() < 4) {
activeMenu = new cRecMenuRecordingSearch(event); activeMenu = new cRecMenuRecordingSearch(searchString);
} else { } else {
int numSearchResults = 0; int numSearchResults = 0;
cRecording **searchResult = recManager->SearchForRecordings(searchString, numSearchResults); cRecording **searchResult = recManager->SearchForRecordings(searchString, numSearchResults);
@ -373,34 +451,35 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
activeMenu->Display(); activeMenu->Display();
break; } break; }
/* /**********************************************************************************************
* --------- SEARCH --------------------------------- * SEARCH
*/ ***********************************************************************************************/
case rmsSearch: case rmsSearch:
delete activeMenu;
activeMenu = new cRecMenuSearch(event);
activeMenu->Display();
searchWithOptions = false;
break;
case rmsSearchWithOptions: { case rmsSearchWithOptions: {
cString searchString = activeMenu->GetStringValue(1); //caller: main menu, cRecMenuSearch
delete activeMenu; bool withOptions = false;
if (isempty(*searchString)) { std::string searchString = event->Title();
activeMenu = new cRecMenuSearch(event); if (cRecMenuSearch *menu = dynamic_cast<cRecMenuSearch*>(activeMenu)) {
} else { withOptions = true;
activeMenu = new cRecMenuSearch(event, *searchString); searchString = menu->GetSearchString();
searchWithOptions = true;
} }
delete activeMenu;
activeMenu = new cRecMenuSearch(searchString, withOptions);
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSearchPerform: { case rmsSearchPerform: {
cString searchString = activeMenu->GetStringValue(1); //caller: cRecMenuSearch
if (isempty(*searchString)) { Epgsearch_searchresults_v1_0 epgSearchData;
if (cRecMenuSearch *menu = dynamic_cast<cRecMenuSearch*>(activeMenu)) {
epgSearchData = menu->GetEPGSearchStruct();
} else break;
std::string searchString = epgSearchData.query;
if (searchString.size() < 4) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSearch(event); activeMenu = new cRecMenuSearch(event->Title(), false);
} else { } else {
int numSearchResults = 0; int numSearchResults = 0;
const cEvent **searchResult = recManager->PerformSearch(activeMenu, searchWithOptions, numSearchResults); const cEvent **searchResult = recManager->PerformSearch(epgSearchData, numSearchResults);
if (searchResult) { if (searchResult) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuSearchResults(searchString, searchResult, numSearchResults); activeMenu = new cRecMenuSearchResults(searchString, searchResult, numSearchResults);
@ -419,7 +498,13 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Show(); activeMenu->Show();
break; break;
case rmsSearchShowInfo: { case rmsSearchShowInfo: {
const cEvent *ev = activeMenu->GetEventValue(activeMenu->GetActive(false)); //caller: cRecMenuSearchResults, cRecMenuSearchTimerResults
const cEvent *ev = NULL;
if (cRecMenuSearchResults *menu = dynamic_cast<cRecMenuSearchResults*>(activeMenu)) {
ev = menu->GetEvent();
} else if (cRecMenuSearchTimerResults *menu = dynamic_cast<cRecMenuSearchTimerResults*>(activeMenu)) {
ev = menu->GetEvent();
} else break;
if (ev) { if (ev) {
activeMenu->Hide(); activeMenu->Hide();
detailView = new cDetailView(ev); detailView = new cDetailView(ev);
@ -432,7 +517,13 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
break;} break;}
case rmsSearchRecord: { case rmsSearchRecord: {
const cEvent *ev = activeMenu->GetEventValue(activeMenu->GetActive(false)); //caller: cRecMenuSearchResults
const cEvent *ev = NULL;
if (cRecMenuSearchResults *menu = dynamic_cast<cRecMenuSearchResults*>(activeMenu)) {
ev = menu->GetEvent();
} else break;
if (!ev)
break;
cTimer *timer = recManager->createTimer(ev, ""); cTimer *timer = recManager->createTimer(ev, "");
activeMenuBuffer = activeMenu; activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide(); activeMenuBuffer->Hide();
@ -445,12 +536,12 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenuBuffer = NULL; activeMenuBuffer = NULL;
activeMenu->Show(); activeMenu->Show();
break; break;
/* /**********************************************************************************************
* --------- CHECK FOR TIMER CONFLICTS --------------------------------- * CHECK FOR TIMER CONFLICTS
*/ ***********************************************************************************************/
case rmsTimerConflicts: { case rmsTimerConflicts: {
//Show timer conflict //caller: main menu
//active menu: cRecMenuTimerConflicts //Show timer conflict
if (timerConflicts) { if (timerConflicts) {
delete timerConflicts; delete timerConflicts;
} }
@ -465,23 +556,30 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsTimerConflict: { case rmsTimerConflict: {
//Show timer conflict //caller: cRecMenuTimerConflicts
//active menu: cRecMenuTimerConflicts //Show timer conflict
if (!timerConflicts) if (!timerConflicts)
break; break;
timerConflicts->SetCurrentConflict(activeMenu->GetActive(true)); int timerConflict;
if (cRecMenuTimerConflicts *menu = dynamic_cast<cRecMenuTimerConflicts*>(activeMenu)) {
timerConflict = menu->GetTimerConflict();
} else break;
timerConflicts->SetCurrentConflict(timerConflict);
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuTimerConflict(timerConflicts->GetCurrentConflict()); activeMenu = new cRecMenuTimerConflict(timerConflicts->GetCurrentConflict());
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsSearchRerunsTimerConflictMenu: { case rmsSearchRerunsTimerConflictMenu: {
//Show reruns for timer from timer conflict //caller: cRecMenuTimerConflict
//active menu: cRecMenuTimerConflict //Show reruns for timer from timer conflict
if (!timerConflicts) if (!timerConflicts)
break; break;
int activeItem = activeMenu->GetActive(true); int timerConflict;
int timerID = timerConflicts->GetCurrentConflictTimerID(activeItem); if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
timer = Timers.Get(timerID); timerConflict = menu->GetTimerConflictIndex();
} else break;
int timerID = timerConflicts->GetCurrentConflictTimerID(timerConflict);
cTimer *timer = Timers.Get(timerID);
if (timer) { if (timer) {
const cEvent *event = timer->Event(); const cEvent *event = timer->Event();
if (event) { if (event) {
@ -508,13 +606,25 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Show(); activeMenu->Show();
break; } break; }
case rmsTimerConflictRecordRerun: { case rmsTimerConflictRecordRerun: {
const cEvent *replace = activeMenu->GetEventValue(activeMenu->GetActive(false)); //caller: cRecMenuRerunResults
int originalConflictIndex = activeMenuBuffer->GetActive(false); //buffer: cRecMenuTimerConflict
if (!activeMenuBuffer)
break;
if (!timerConflicts)
break;
const cEvent *replace;
int originalConflictIndex;
if (cRecMenuRerunResults *menu = dynamic_cast<cRecMenuRerunResults*>(activeMenu)) {
replace = menu->GetRerunEvent();
} else break;
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenuBuffer)) {
originalConflictIndex = menu->GetTimerConflictIndex();
} else break;
int originalTimerID = timerConflicts->GetCurrentConflictTimerID(originalConflictIndex); int originalTimerID = timerConflicts->GetCurrentConflictTimerID(originalConflictIndex);
cTimer *timerOriginal = Timers.Get(originalTimerID); cTimer *timerOriginal = Timers.Get(originalTimerID);
if (replace && timerOriginal) { if (replace && timerOriginal) {
recManager->DeleteTimer(timerOriginal->Event()); recManager->DeleteTimer(timerOriginal->Event());
recManager->createTimer(replace, *recFolderInstantTimer); recManager->createTimer(replace);
delete activeMenu; delete activeMenu;
if (activeMenuBuffer) { if (activeMenuBuffer) {
delete activeMenuBuffer; delete activeMenuBuffer;
@ -524,10 +634,10 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
} }
break; } break; }
/* /**********************************************************************************************
* --------- TIMELINE --------------------------------- * TIMELINE
*/ ***********************************************************************************************/
case rmsTimeline: { case rmsTimeline: {
if (timerConflicts) { if (timerConflicts) {
delete timerConflicts; delete timerConflicts;
} }
@ -537,7 +647,10 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsTimelineTimerEdit: { case rmsTimelineTimerEdit: {
timer = activeMenu->GetTimerValue(activeMenu->GetActive(true)); cTimer *timer;
if (cRecMenuTimeline *menu = dynamic_cast<cRecMenuTimeline*>(activeMenu)) {
timer = menu->GetTimer();
} else break;
if (timer) { if (timer) {
delete activeMenu; delete activeMenu;
activeMenu = new cRecMenuEditTimer(timer, rmsTimelineTimerSave); activeMenu = new cRecMenuEditTimer(timer, rmsTimelineTimerSave);
@ -545,7 +658,13 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
} }
break;} break;}
case rmsTimelineTimerSave: { case rmsTimelineTimerSave: {
recManager->SaveTimer(timer, activeMenu); cTimer timerModified;
cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();
originalTimer = menu->GetOriginalTimer();
} else break;
recManager->SaveTimer(originalTimer, timerModified);
delete activeMenu; delete activeMenu;
if (timerConflicts) { if (timerConflicts) {
delete timerConflicts; delete timerConflicts;
@ -555,7 +674,11 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu->Display(); activeMenu->Display();
break; } break; }
case rmsTimelineTimerDelete: { case rmsTimelineTimerDelete: {
recManager->DeleteTimer(timer->Event()); cTimer *timer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timer = menu->GetOriginalTimer();
} else break;
recManager->DeleteTimer(timer);
delete activeMenu; delete activeMenu;
if (timerConflicts) { if (timerConflicts) {
delete timerConflicts; delete timerConflicts;
@ -564,9 +687,9 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
activeMenu = new cRecMenuTimeline(timerConflicts); activeMenu = new cRecMenuTimeline(timerConflicts);
activeMenu->Display(); activeMenu->Display();
break; } break; }
/* /**********************************************************************************************
* --------- COMMON --------------------------------- * COMMON
*/ *********************************************************************************************/
case rmsClose: { case rmsClose: {
if (activeMenuBuffer == NULL) { if (activeMenuBuffer == NULL) {
state = osEnd; state = osEnd;
@ -585,17 +708,25 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
return state; return state;
} }
bool cRecMenuManager::displayTimerConflict(cTimer *timer) { void cRecMenuManager::DisplaySearchTimerList(void) {
delete activeMenu;
std::vector<cTVGuideSearchTimer> searchTimers;
recManager->GetSearchTimers(&searchTimers);
activeMenu = new cRecMenuSearchTimers(searchTimers);
activeMenu->Display();
}
bool cRecMenuManager::DisplayTimerConflict(cTimer *timer) {
int timerID = 0; int timerID = 0;
for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) { for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
if (t == timer) if (t == timer)
return displayTimerConflict(timerID); return DisplayTimerConflict(timerID);
timerID++; timerID++;
} }
return false; return false;
} }
bool cRecMenuManager::displayTimerConflict(int timerID) { bool cRecMenuManager::DisplayTimerConflict(int timerID) {
if (timerConflicts) if (timerConflicts)
delete timerConflicts; delete timerConflicts;
timerConflicts = recManager->CheckTimerConflict(); timerConflicts = recManager->CheckTimerConflict();
@ -614,16 +745,6 @@ bool cRecMenuManager::displayTimerConflict(int timerID) {
return false; return false;
} }
bool cRecMenuManager::createSearchTimer(std::string epgSearchString) {
int newTimerID = recManager->CreateSearchTimer(epgSearchString);
bool success = false;
if (newTimerID > -1) {
recManager->UpdateSearchTimers();
success = true;
}
return success;
}
eOSState cRecMenuManager::ProcessKey(eKeys Key) { eOSState cRecMenuManager::ProcessKey(eKeys Key) {
eOSState state = osContinue; eOSState state = osContinue;
eRecMenuState nextState = rmsContinue; eRecMenuState nextState = rmsContinue;

View File

@ -14,23 +14,14 @@ private:
const cEvent *event; const cEvent *event;
cRecManager *recManager; cRecManager *recManager;
cTVGuideTimerConflicts *timerConflicts; cTVGuideTimerConflicts *timerConflicts;
std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates;
bool instantRecord;
bool folderChoosen;
cString recFolderInstantTimer;
int templateID;
bool searchWithOptions;
cTimer *timer;
cString recFolderSeriesTimer;
cString searchString;
cDetailView *detailView; cDetailView *detailView;
cPixmap *pixmapBackground; cPixmap *pixmapBackground;
bool detailViewActive; bool detailViewActive;
void SetBackground(void); void SetBackground(void);
void DeleteBackground(void); void DeleteBackground(void);
bool displayTimerConflict(cTimer *timer); void DisplaySearchTimerList(void);
bool displayTimerConflict(int timerID); bool DisplayTimerConflict(cTimer *timer);
bool createSearchTimer(std::string epgSearchString); bool DisplayTimerConflict(int timerID);
public: public:
cRecMenuManager(void); cRecMenuManager(void);
virtual ~cRecMenuManager(void); virtual ~cRecMenuManager(void);

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,13 @@
#ifndef __TVGUIDE_RECMENUS_H #ifndef __TVGUIDE_RECMENUS_H
#define __TVGUIDE_RECMENUS_H #define __TVGUIDE_RECMENUS_H
#define TEXTINPUTLENGTH 80 #define TEXTINPUTLENGTH 256
#include <vector> #include <vector>
#include <functional>
#include <vdr/epg.h> #include <vdr/epg.h>
#include "services/epgsearch.h"
#include "switchtimer.h"
#include "recmanager.h" #include "recmanager.h"
// --- cRecMenuMain --------------------------------------------------------- // --- cRecMenuMain ---------------------------------------------------------
@ -14,6 +17,11 @@ public:
virtual ~cRecMenuMain(void) {}; virtual ~cRecMenuMain(void) {};
}; };
/******************************************************************************************
* Instant Timer Menus
******************************************************************************************/
// --- cRecMenuAskFolder --------------------------------------------------------- // --- cRecMenuAskFolder ---------------------------------------------------------
class cRecMenuAskFolder: public cRecMenu { class cRecMenuAskFolder: public cRecMenu {
private: private:
@ -25,6 +33,7 @@ public:
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuAskFolder(void) {}; virtual ~cRecMenuAskFolder(void) {};
std::string GetFolder(void);
}; };
// --- cRecMenuConfirmTimer --------------------------------------------------------- // --- cRecMenuConfirmTimer ---------------------------------------------------------
@ -53,6 +62,7 @@ class cRecMenuTimerConflicts: public cRecMenu {
public: public:
cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts); cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts);
virtual ~cRecMenuTimerConflicts(void) {}; virtual ~cRecMenuTimerConflicts(void) {};
int GetTimerConflict(void);
}; };
// --- cRecMenuTimerConflict --------------------------------------------------------- // --- cRecMenuTimerConflict ---------------------------------------------------------
@ -64,6 +74,7 @@ public:
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuTimerConflict(void) {}; virtual ~cRecMenuTimerConflict(void) {};
int GetTimerConflictIndex(void);
}; };
// --- cRecMenuNoTimerConflict --------------------------------------------------------- // --- cRecMenuNoTimerConflict ---------------------------------------------------------
@ -85,6 +96,7 @@ public:
virtual ~cRecMenuRerunResults(void) { virtual ~cRecMenuRerunResults(void) {
delete[] reruns; delete[] reruns;
}; };
const cEvent *GetRerunEvent(void);
}; };
// --- cRecMenuNoRerunsFound --------------------------------------------------------- // --- cRecMenuNoRerunsFound ---------------------------------------------------------
@ -103,17 +115,42 @@ public:
// --- cRecMenuEditTimer --------------------------------------------------------- // --- cRecMenuEditTimer ---------------------------------------------------------
class cRecMenuEditTimer: public cRecMenu { class cRecMenuEditTimer: public cRecMenu {
private:
cTimer *originalTimer;
bool timerActive;
time_t day;
int start;
int stop;
int prio;
int lifetime;
public: public:
cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState); cRecMenuEditTimer(cTimer *timer, eRecMenuState nextState);
virtual ~cRecMenuEditTimer(void) {}; virtual ~cRecMenuEditTimer(void) {};
cTimer GetTimer(void);
cTimer *GetOriginalTimer(void);
}; };
/******************************************************************************************
* Series Timer Menus
******************************************************************************************/
// --- cRecMenuSeriesTimer --------------------------------------------------------- // --- cRecMenuSeriesTimer ---------------------------------------------------------
class cRecMenuSeriesTimer: public cRecMenu { class cRecMenuSeriesTimer: public cRecMenu {
std::string folder;
bool timerActive;
int channel;
time_t tstart;
int start;
int stop;
int dayOfWeek;
int priority;
int lifetime;
void CalculateTimes(const cEvent *event);
public: public:
cRecMenuSeriesTimer(cChannel *initialChannel, const cEvent *event); cRecMenuSeriesTimer(cChannel *initialChannel, const cEvent *event, std::string folder);
virtual ~cRecMenuSeriesTimer(void) {}; virtual ~cRecMenuSeriesTimer(void) {};
cTimer *GetTimer(void);
}; };
// --- cRecMenuConfirmSeriesTimer --------------------------------------------------------- // --- cRecMenuConfirmSeriesTimer ---------------------------------------------------------
@ -123,65 +160,109 @@ public:
virtual ~cRecMenuConfirmSeriesTimer(void) {}; virtual ~cRecMenuConfirmSeriesTimer(void) {};
}; };
/******************************************************************************************
* SearchTimer Menus
******************************************************************************************/
// --- cRecMenuSearchTimer --------------------------------------------------------- // --- cRecMenuSearchTimer ---------------------------------------------------------
class cRecMenuSearchTimer: public cRecMenu { class cRecMenuSearchTimer: public cRecMenu {
private: private:
char initialText[TEXTINPUTLENGTH]; char searchString[TEXTINPUTLENGTH];
public: public:
cRecMenuSearchTimer(const cEvent *event); cRecMenuSearchTimer(const cEvent *event);
virtual ~cRecMenuSearchTimer(void) {}; virtual ~cRecMenuSearchTimer(void) {};
std::string GetSearchString(void) { return searchString; };
}; };
// --- cRecMenuSearchTimerTemplates --------------------------------------------------------- // --- cRecMenuSearchTimerTemplates ---------------------------------------------------------
class cRecMenuSearchTimerTemplates: public cRecMenu { class cRecMenuSearchTimerTemplates: public cRecMenu {
private: private:
int numTemplates; int numTemplates;
cTVGuideSearchTimer searchTimer;
std::vector<TVGuideEPGSearchTemplate> templates; std::vector<TVGuideEPGSearchTemplate> templates;
public: public:
cRecMenuSearchTimerTemplates(cString searchString, std::vector<TVGuideEPGSearchTemplate> templates); cRecMenuSearchTimerTemplates(cTVGuideSearchTimer searchTimer, std::vector<TVGuideEPGSearchTemplate> templates);
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuSearchTimerTemplates(void) {}; virtual ~cRecMenuSearchTimerTemplates(void) {};
cTVGuideSearchTimer GetSearchTimer(void) { return searchTimer; };
TVGuideEPGSearchTemplate GetTemplate(void);
}; };
// --- cRecMenuSearchTimerTemplatesCreate ---------------------------------------------------------
class cRecMenuSearchTimerTemplatesCreate: public cRecMenu {
private:
public:
cRecMenuSearchTimerTemplatesCreate(cString searchString, cString tmplName);
virtual ~cRecMenuSearchTimerTemplatesCreate(void) {};
};
// --- cRecMenuSearchTimerOptions --------------------------------------------------------- // --- cRecMenuSearchTimers ---------------------------------------------------------
class cRecMenuSearchTimerOptions: public cRecMenu { class cRecMenuSearchTimers: public cRecMenu {
private: private:
const char * searchModes[5]; int numSearchTimers;
cString searchString; std::vector<cTVGuideSearchTimer> searchTimers;
void SetMenuItems(void);
public: public:
cRecMenuSearchTimerOptions(cString searchString); cRecMenuSearchTimers(std::vector<cTVGuideSearchTimer> searchTimers);
void CreateMenuItems(void);
virtual ~cRecMenuSearchTimerOptions(void) {};
};
// --- cRecMenuSearchTimerResults ---------------------------------------------------------
class cRecMenuSearchTimerResults: public cRecMenu {
private:
const cEvent **searchResults;
int numResults;
public:
cRecMenuSearchTimerResults(cString searchString, const cEvent **searchResults, int numResults, std::string templateName);
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuSearchTimerResults(void) { cTVGuideSearchTimer GetSearchTimer(void);
delete[] searchResults; virtual ~cRecMenuSearchTimers(void);
};
}; };
// --- cRecMenuSearchTimerNothingFound --------------------------------------------------------- // --- cRecMenuSearchTimerEdit ---------------------------------------------------------
class cRecMenuSearchTimerNothingFound: public cRecMenu { class cRecMenuSearchTimerEdit: public cRecMenu {
private:
bool advancedOptions;
cTVGuideSearchTimer searchTimer;
std::vector<cRecMenuItem*> mainMenuItems;
std::vector<cRecMenuItem*> useChannelSubMenu;
std::vector<cRecMenuItem*> useTimeSubMenu;
std::vector<cRecMenuItem*> useDayOfWeekSubMenu;
std::vector<cRecMenuItem*> avoidRepeatSubMenu;
std::vector<cRecMenuItem*> currentMenuItems;
int numMenuItems;
int useChannelPos;
int useTimePos;
int useDayOfWeekPos;
int avoidRepeatsPos;
char searchString[TEXTINPUTLENGTH];
bool timerActive;
int mode;
bool useTitle;
bool useSubtitle;
bool useDescription;
bool useChannel;
int startChannel;
int stopChannel;
bool useTime;
int startTime;
int stopTime;
bool useDayOfWeek;
int dayOfWeek;
int priority;
int lifetime;
int marginStart;
int marginStop;
bool useVPS;
bool avoidRepeats;
int allowedRepeats;
bool compareTitle;
bool compareSubtitle;
bool compareSummary;
void InitMenuItems(void);
void AddSubMenu(std::vector<cRecMenuItem*> *subMenu);
public: public:
cRecMenuSearchTimerNothingFound(cString searchString, std::string templateName); cRecMenuSearchTimerEdit(cTVGuideSearchTimer searchTimer, bool advancedOptions);
virtual ~cRecMenuSearchTimerNothingFound(void) {}; void CreateMenuItems(void);
virtual ~cRecMenuSearchTimerEdit(void);
cTVGuideSearchTimer GetSearchTimer(void);
cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void);
};
// --- cRecMenuSearchTimerDeleteConfirm ---------------------------------------------
class cRecMenuSearchTimerDeleteConfirm: public cRecMenu {
private:
cTVGuideSearchTimer searchTimer;
public:
cRecMenuSearchTimerDeleteConfirm(cTVGuideSearchTimer searchTimer);
virtual ~cRecMenuSearchTimerDeleteConfirm(void);
cTVGuideSearchTimer GetSearchTimer(void);
}; };
// --- cRecMenuSearchTimerCreateConfirm --------------------------------------------------------- // --- cRecMenuSearchTimerCreateConfirm ---------------------------------------------------------
@ -192,13 +273,53 @@ public:
virtual ~cRecMenuSearchTimerCreateConfirm(void) {}; virtual ~cRecMenuSearchTimerCreateConfirm(void) {};
}; };
// --- cRecMenuSearchTimerTemplatesCreate ---------------------------------------------------------
class cRecMenuSearchTimerTemplatesCreate: public cRecMenu {
private:
TVGuideEPGSearchTemplate templ;
cTVGuideSearchTimer searchTimer;
public:
cRecMenuSearchTimerTemplatesCreate(TVGuideEPGSearchTemplate templ, cTVGuideSearchTimer searchTimer);
virtual ~cRecMenuSearchTimerTemplatesCreate(void) {};
cTVGuideSearchTimer GetSearchTimer(void) { return searchTimer; };
TVGuideEPGSearchTemplate GetTemplate(void) { return templ; };
};
// --- cRecMenuSearchTimerResults ---------------------------------------------------------
class cRecMenuSearchTimerResults: public cRecMenu {
private:
const cEvent **searchResults;
int numResults;
public:
cRecMenuSearchTimerResults(std::string searchString, const cEvent **searchResults, int numResults, std::string templateName = "");
cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void);
virtual ~cRecMenuSearchTimerResults(void) {
delete[] searchResults;
};
const cEvent *GetEvent(void);
};
// --- cRecMenuSearchTimerNothingFound ---------------------------------------------------------
class cRecMenuSearchTimerNothingFound: public cRecMenu {
public:
cRecMenuSearchTimerNothingFound(std::string searchString);
virtual ~cRecMenuSearchTimerNothingFound(void) {};
};
/******************************************************************************************
* SwitchTimer Menus
******************************************************************************************/
// --- cRecMenuSwitchTimer --------------------------------------------------------- // --- cRecMenuSwitchTimer ---------------------------------------------------------
class cRecMenuSwitchTimer: public cRecMenu { class cRecMenuSwitchTimer: public cRecMenu {
private: private:
const char *switchModes[3]; int switchMinsBefore;
int announceOnly;
public: public:
cRecMenuSwitchTimer(void); cRecMenuSwitchTimer(void);
virtual ~cRecMenuSwitchTimer(void) {}; virtual ~cRecMenuSwitchTimer(void) {};
cSwitchTimer GetSwitchTimer(void);
}; };
// --- cRecMenuSwitchTimerConfirm --------------------------------------------------------- // --- cRecMenuSwitchTimerConfirm ---------------------------------------------------------
@ -217,16 +338,24 @@ public:
virtual ~cRecMenuSwitchTimerDelete(void) {}; virtual ~cRecMenuSwitchTimerDelete(void) {};
}; };
/******************************************************************************************
* Search Menus
******************************************************************************************/
// --- cRecMenuSearch --------------------------------------------------------- // --- cRecMenuSearch ---------------------------------------------------------
class cRecMenuSearch: public cRecMenu { class cRecMenuSearch: public cRecMenu {
private: private:
char initialText[TEXTINPUTLENGTH]; char searchString[TEXTINPUTLENGTH];
const char * searchModes[5]; int mode;
int channelNr;
bool useTitle;
bool useSubTitle;
bool useDescription;
public: public:
cRecMenuSearch(const cEvent *event); cRecMenuSearch(std::string searchString, bool withOptions);
cRecMenuSearch(const cEvent *event, const char *searchString);
virtual ~cRecMenuSearch(void) {}; virtual ~cRecMenuSearch(void) {};
Epgsearch_searchresults_v1_0 GetEPGSearchStruct(void);
std::string GetSearchString(void) { return searchString; };
}; };
// --- cRecMenuSearchResults --------------------------------------------------------- // --- cRecMenuSearchResults ---------------------------------------------------------
@ -235,12 +364,13 @@ private:
const cEvent **searchResults; const cEvent **searchResults;
int numResults; int numResults;
public: public:
cRecMenuSearchResults(cString searchString, const cEvent **searchResults, int numResults); cRecMenuSearchResults(std::string searchString, const cEvent **searchResults, int numResults);
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuSearchResults(void) { virtual ~cRecMenuSearchResults(void) {
delete[] searchResults; delete[] searchResults;
}; };
const cEvent *GetEvent(void);
}; };
// --- cRecMenuSearchConfirmTimer --------------------------------------------------------- // --- cRecMenuSearchConfirmTimer ---------------------------------------------------------
@ -253,40 +383,52 @@ public:
// --- cRecMenuSearchNothingFound --------------------------------------------------------- // --- cRecMenuSearchNothingFound ---------------------------------------------------------
class cRecMenuSearchNothingFound: public cRecMenu { class cRecMenuSearchNothingFound: public cRecMenu {
public: public:
cRecMenuSearchNothingFound(cString searchString); cRecMenuSearchNothingFound(std::string searchString);
virtual ~cRecMenuSearchNothingFound(void) {}; virtual ~cRecMenuSearchNothingFound(void) {};
}; };
/******************************************************************************************
* Recording Search Menus
******************************************************************************************/
// --- cRecMenuRecordingSearch --------------------------------------------------------- // --- cRecMenuRecordingSearch ---------------------------------------------------------
class cRecMenuRecordingSearch: public cRecMenu { class cRecMenuRecordingSearch: public cRecMenu {
private: private:
char initialText[TEXTINPUTLENGTH]; char searchString[TEXTINPUTLENGTH];
public: public:
cRecMenuRecordingSearch(const cEvent *event); cRecMenuRecordingSearch(std::string search);
virtual ~cRecMenuRecordingSearch(void) {}; virtual ~cRecMenuRecordingSearch(void) {};
std::string GetSearchString(void) { return searchString; };
}; };
// --- cRecMenuRecordingSearchResults --------------------------------------------------------- // --- cRecMenuRecordingSearchResults ---------------------------------------------------------
class cRecMenuRecordingSearchResults: public cRecMenu { class cRecMenuRecordingSearchResults: public cRecMenu {
private: private:
std::string searchString;
cRecording **searchResults; cRecording **searchResults;
int numResults; int numResults;
public: public:
cRecMenuRecordingSearchResults(cString searchString, cRecording **searchResults, int numResults); cRecMenuRecordingSearchResults(std::string searchString, cRecording **searchResults, int numResults);
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
int GetTotalNumMenuItems(void); int GetTotalNumMenuItems(void);
virtual ~cRecMenuRecordingSearchResults(void) { virtual ~cRecMenuRecordingSearchResults(void) {
delete[] searchResults; delete[] searchResults;
}; };
std::string GetSearchString(void) { return searchString; };
}; };
// --- cRecMenuRecordingSearchNotFound --------------------------------------------------------- // --- cRecMenuRecordingSearchNotFound ---------------------------------------------------------
class cRecMenuRecordingSearchNotFound: public cRecMenu { class cRecMenuRecordingSearchNotFound: public cRecMenu {
public: public:
cRecMenuRecordingSearchNotFound(cString searchString); cRecMenuRecordingSearchNotFound(std::string searchString);
virtual ~cRecMenuRecordingSearchNotFound(void) {}; virtual ~cRecMenuRecordingSearchNotFound(void) {};
}; };
/******************************************************************************************
* Timeline
******************************************************************************************/
// --- cRecMenuTimeline --------------------------------------------------------- // --- cRecMenuTimeline ---------------------------------------------------------
class cRecMenuTimeline: public cRecMenu { class cRecMenuTimeline: public cRecMenu {
private: private:
@ -303,7 +445,7 @@ private:
void SetTimers(void); void SetTimers(void);
void PrevDay(void); void PrevDay(void);
void NextDay(void); void NextDay(void);
void ClearMenuItems(void); void ClearMenu(void);
public: public:
cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts); cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts);
cRecMenuItem *GetMenuItem(int number); cRecMenuItem *GetMenuItem(int number);
@ -311,6 +453,7 @@ public:
virtual ~cRecMenuTimeline(void) { virtual ~cRecMenuTimeline(void) {
}; };
eRecMenuState ProcessKey(eKeys Key); eRecMenuState ProcessKey(eKeys Key);
cTimer *GetTimer(void);
}; };
#endif //__TVGUIDE_RECMENUS_H #endif //__TVGUIDE_RECMENUS_H

556
searchtimer.c Normal file
View File

@ -0,0 +1,556 @@
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <vdr/channels.h>
#include <vdr/device.h>
#include "tools.h"
#include "searchtimer.h"
// -- cTVGuideSearchTimer -----------------------------------------------------------------
cTVGuideSearchTimer::cTVGuideSearchTimer(void) {
strTimer = "";
ID = -1;
searchString = "";
useTime = false;
startTime = 0000;
stopTime = 2359;
useChannel = false;
channelMin = Channels.GetByNumber(cDevice::CurrentChannel());
channelMax = Channels.GetByNumber(cDevice::CurrentChannel());
channelGroup = "";
useCase = false;
mode = 0;
useTitle = true;
useSubtitle = true;
useDescription = true;
useDuration = false;
minDuration = 0;
maxDuration = 2359;
useAsSearchTimer = true;
useDayOfWeek = false;
dayOfWeek = 0;
directory = "";
useEpisode = 0;
priority = 99;
lifetime = 99;
marginStart = 5;
marginStop = 5;
useVPS = false;
action = 0;
useExtEPGInfo = 0;
extEPGInfoValues = "";
avoidRepeats = 1;
allowedRepeats = 1;
compareTitle = 1;
compareSubtitle = 2;
compareSummary = 1;
catvaluesAvoidRepeat = 0;
repeatsWithinDays = 0;
delAfterDays = 0;
recordingsKeep = 0;
switchMinsBefore = 0;
pauseOnNrRecordings = 0;
blacklistMode = 0;
blacklists = "";
fuzzyTolerance = 0;
useInFavorites = 0;
menuTemplate = 0;
delMode = 0;
delAfterCountRecs = 0;
delAfterDaysOfFirstRec = 0;
useAsSearchTimerFrom = 0;
useAsSearchTimerTil = 0;
ignoreMissingEPGCats = 0;
unmuteSoundOnSwitch = 0;
compareSummaryMatchInPercent = 0;
contentsFilter = "";
compareDate = 0;
}
cTVGuideSearchTimer::~cTVGuideSearchTimer(void) {
}
void cTVGuideSearchTimer::SetTemplate(std::string tmpl) {
std::stringstream searchTimerString;
searchTimerString << "0:";
searchTimerString << tmpl;
strTimer = searchTimerString.str();
}
int cTVGuideSearchTimer::DayOfWeek(void) {
int vdrDayOfWeek = 0;
if (dayOfWeek >= 0) {
vdrDayOfWeek = pow(2, (dayOfWeek+6)%7);
} else if (dayOfWeek < 0) {
int absDayOfWeek = abs(dayOfWeek);
for (int i=0; i < 7; i++) {
if (absDayOfWeek & (1 << i)) {
vdrDayOfWeek += pow(2, (i+6)%7);
}
}
}
return vdrDayOfWeek;
}
void cTVGuideSearchTimer::SetDayOfWeek(int VDRDayOfWeek) {
int epgSearchDayOfWeek = 0;
for (int i=0; i < 7; i++) {
if (VDRDayOfWeek & (1 << i)) {
epgSearchDayOfWeek += pow(2, (i+1)%7);
}
}
this->dayOfWeek = epgSearchDayOfWeek * (-1);
}
/*
0 - unique search timer id
1 - the search term
2 - use time? 0/1
3 - start time in HHMM
4 - stop time in HHMM
5 - use channel? 0 = no, 1 = Interval, 2 = Channel group, 3 = FTA only
6 - if 'use channel' = 1 then channel id[|channel id] in VDR format,
one entry or min/max entry separated with |, if 'use channel' = 2
then the channel group name
7 - match case? 0/1
8 - search mode:
0 - the whole term must appear as substring
1 - all single terms (delimiters are blank,',', ';', '|' or '~')
must exist as substrings.
2 - at least one term (delimiters are blank, ',', ';', '|' or '~')
must exist as substring.
3 - matches exactly
4 - regular expression
9 - use title? 0/1
10 - use subtitle? 0/1
11 - use description? 0/1
12 - use duration? 0/1
13 - min duration in hhmm
14 - max duration in hhmm
15 - use as search timer? 0/1
16 - use day of week? 0/1
17 - day of week (0 = Sunday, 1 = Monday...;
-1 Sunday, -2 Monday, -4 Tuesday, ...; -7 Sun, Mon, Tue)
18 - use series recording? 0/1
19 - directory for recording
20 - priority of recording
21 - lifetime of recording
22 - time margin for start in minutes
23 - time margin for stop in minutes
24 - use VPS? 0/1
25 - action:
0 = create a timer
1 = announce only via OSD (no timer)
2 = switch only (no timer)
3 = announce via OSD and switch (no timer)
4 = announce via mail
26 - use extended EPG info? 0/1
27 - extended EPG info values. This entry has the following format
(delimiter is '|' for each category, '#' separates id and value):
1 - the id of the extended EPG info category as specified in
epgsearchcats.conf
2 - the value of the extended EPG info category
(a ':' will be translated to "!^colon^!", e.g. in "16:9")
28 - avoid repeats? 0/1
29 - allowed repeats
30 - compare title when testing for a repeat? 0/1
31 - compare subtitle when testing for a repeat? 0/1/2
0 - no
1 - yes
2 - yes, if present
32 - compare description when testing for a repeat? 0/1
33 - compare extended EPG info when testing for a repeat?
This entry is a bit field of the category IDs.
34 - accepts repeats only within x days
35 - delete a recording automatically after x days
36 - but keep this number of recordings anyway
37 - minutes before switch (if action = 2)
38 - pause if x recordings already exist
39 - blacklist usage mode (0 none, 1 selection, 2 all)
40 - selected blacklist IDs separated with '|'
41 - fuzzy tolerance value for fuzzy searching
42 - use this search in favorites menu (0 no, 1 yes)
43 - id of a menu search template
44 - auto deletion mode (0 don't delete search timer, 1 delete after given
count of recordings, 2 delete after given days after first recording)
45 - count of recordings after which to delete the search timer
46 - count of days after the first recording after which to delete the search
timer
47 - first day where the search timer is active (see parameter 16)
48 - last day where the search timer is active (see parameter 16)
49 - ignore missing EPG categories? 0/1
50 - unmute sound if off when used as switch timer
51 - percentage of match when comparing the summary of two events (with 'avoid repeats')
52 - HEX representation of the content descriptors, each descriptor ID is represented with 2 chars
53 - compare date when testing for a repeat? (0=no, 1=same day, 2=same week, 3=same month)
*/
bool cTVGuideSearchTimer::Parse(bool readTemplate) {
splitstring s(strTimer.c_str());
std::vector<std::string> values = s.split(':', 1);
int numValues = values.size();
if (numValues < 12)
return false;
for (int value = 0; value < numValues; value++) {
switch (value) {
case 0:
if (!readTemplate)
ID = atoi(values[value].c_str());
break;
case 1:
if (!readTemplate)
searchString = values[value];
break;
case 2:
useTime = atoi(values[value].c_str());
break;
case 3:
if (useTime) {
startTime = atoi(values[value].c_str());
}
break;
case 4:
if (useTime) {
stopTime = atoi(values[value].c_str());
}
break;
case 5:
useChannel = atoi(values[value].c_str());
break;
case 6:
if (useChannel == 0) {
channelMin = NULL;
channelMax = NULL;
} else if (useChannel == 1) {
char *channelMinbuffer = NULL;
char *channelMaxbuffer = NULL;
int channels = sscanf(values[value].c_str(), "%a[^|]|%a[^|]", &channelMinbuffer, &channelMaxbuffer);
channelMin = Channels.GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
if (!channelMin) {
channelMin = channelMax = NULL;
useChannel = 0;
}
if (channels == 1)
channelMax = channelMin;
else {
channelMax = Channels.GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
if (!channelMax) {
channelMin = channelMax = NULL;
useChannel = 0;
}
}
free(channelMinbuffer);
free(channelMaxbuffer);
} else if (useChannel == 2) {
channelGroup = values[value];
}
break;
case 7:
useCase = atoi(values[value].c_str());
break;
case 8:
mode = atoi(values[value].c_str());
break;
case 9:
useTitle = atoi(values[value].c_str());
break;
case 10:
useSubtitle = atoi(values[value].c_str());
break;
case 11:
useDescription = atoi(values[value].c_str());
break;
case 12:
useDuration = atoi(values[value].c_str());
break;
case 13:
minDuration = atoi(values[value].c_str());
break;
case 14:
maxDuration = atoi(values[value].c_str());
break;
case 15:
useAsSearchTimer = atoi(values[value].c_str());
break;
case 16:
useDayOfWeek = atoi(values[value].c_str());
break;
case 17:
dayOfWeek = atoi(values[value].c_str());
break;
case 18:
useEpisode = atoi(values[value].c_str());
break;
case 19:
directory = values[value];
break;
case 20:
priority = atoi(values[value].c_str());
break;
case 21:
lifetime = atoi(values[value].c_str());
break;
case 22:
marginStart = atoi(values[value].c_str());
break;
case 23:
marginStop = atoi(values[value].c_str());
break;
case 24:
useVPS = atoi(values[value].c_str());
break;
case 25:
action = atoi(values[value].c_str());
break;
case 26:
useExtEPGInfo = atoi(values[value].c_str());
break;
case 27:
extEPGInfoValues = values[value];
break;
case 28:
avoidRepeats = atoi(values[value].c_str());
break;
case 29:
allowedRepeats = atoi(values[value].c_str());
break;
case 30:
compareTitle = atoi(values[value].c_str());
break;
case 31:
compareSubtitle = atoi(values[value].c_str());
break;
case 32:
compareSummary = atoi(values[value].c_str());
break;
case 33:
catvaluesAvoidRepeat = atol(values[value].c_str());
break;
case 34:
repeatsWithinDays = atoi(values[value].c_str());
break;
case 35:
delAfterDays = atoi(values[value].c_str());
break;
case 36:
recordingsKeep = atoi(values[value].c_str());
break;
case 37:
switchMinsBefore = atoi(values[value].c_str());
break;
case 38:
pauseOnNrRecordings = atoi(values[value].c_str());
break;
case 39:
blacklistMode = atoi(values[value].c_str());
break;
case 40:
blacklists = values[value];
break;
case 41:
fuzzyTolerance = atoi(values[value].c_str());
break;
case 42:
useInFavorites = atoi(values[value].c_str());
break;
case 43:
menuTemplate = atoi(values[value].c_str());
break;
case 44:
delMode = atoi(values[value].c_str());
break;
case 45:
delAfterCountRecs = atoi(values[value].c_str());
break;
case 46:
delAfterDaysOfFirstRec = atoi(values[value].c_str());
break;
case 47:
useAsSearchTimerFrom = atol(values[value].c_str());
break;
case 48:
useAsSearchTimerTil = atol(values[value].c_str());
break;
case 49:
ignoreMissingEPGCats = atoi(values[value].c_str());
break;
case 50:
unmuteSoundOnSwitch = atoi(values[value].c_str());
break;
case 51:
compareSummaryMatchInPercent = atoi(values[value].c_str());
break;
case 52:
contentsFilter = values[value];
break;
case 53:
compareDate = atoi(values[value].c_str());
break;
default:
break;
}
}
return true;
}
std::string cTVGuideSearchTimer::BuildSearchString(void) {
std::stringstream search;
// 0 - 2
if (ID > -1)
search << ID << ":";
else
search << ":";
std::string searchStringMasked = searchString;
std::replace(searchStringMasked.begin(), searchStringMasked.end(), ':', '|');
search << searchStringMasked << ":";
search << useTime << ":";
// 3 - 6
if (useTime) {
search << *cString::sprintf("%04d", startTime) << ":";
search << *cString::sprintf("%04d", stopTime) << ":";
} else {
search << "::";
}
search << useChannel << ":";
if (useChannel == 1) {
if (channelMin && channelMax) {
if (channelMin->Number() < channelMax->Number())
search << std::string(channelMin->GetChannelID().ToString()) << "|" << std::string(channelMax->GetChannelID().ToString()) << ":";
else
search << std::string(channelMin->GetChannelID().ToString()) << ":";
} else {
search << "0:";
}
} else if (useChannel == 2) {
search << channelGroup << ":";
} else {
search << "0:";
}
// 7 - 14
search << useCase << ":";
search << mode << ":";
search << useTitle << ":";
search << useSubtitle << ":";
search << useDescription << ":";
search << useDuration << ":";
if (useDuration) {
search << *cString::sprintf("%04d", minDuration) << ":";
search << *cString::sprintf("%04d", maxDuration) << ":";
} else {
search << "::";
}
//15 - 53
search << useAsSearchTimer << ":";
search << useDayOfWeek << ":";
search << dayOfWeek << ":";
search << useEpisode << ":";
search << directory << ":";
search << priority << ":";
search << lifetime << ":";
search << marginStart << ":";
search << marginStop << ":";
search << useVPS << ":";
search << action << ":";
search << useExtEPGInfo << ":";
search << extEPGInfoValues << ":";
search << avoidRepeats << ":";
search << allowedRepeats << ":";
search << compareTitle << ":";
search << compareSubtitle << ":";
search << compareSummary << ":";
search << catvaluesAvoidRepeat << ":";
search << repeatsWithinDays << ":";
search << delAfterDays << ":";
search << recordingsKeep << ":";
search << switchMinsBefore << ":";
search << pauseOnNrRecordings << ":";
search << blacklistMode << ":";
search << blacklists << ":";
search << fuzzyTolerance << ":";
search << useInFavorites << ":";
search << menuTemplate << ":";
search << delMode << ":";
search << delAfterCountRecs << ":";
search << delAfterDaysOfFirstRec << ":";
search << useAsSearchTimerFrom << ":";
search << useAsSearchTimerTil << ":";
search << ignoreMissingEPGCats << ":";
search << unmuteSoundOnSwitch << ":";
search << compareSummaryMatchInPercent << ":";
search << contentsFilter << ":";
search << compareDate;
strTimer = search.str();
return strTimer;
}
bool cTVGuideSearchTimer::Active(void) {
if (useAsSearchTimer)
return true;
return false;
}
int cTVGuideSearchTimer::GetNumTimers(void) {
int numTimers = 0;
if (ID < 0)
return numTimers;
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
char* searchID = GetAuxValue(timer, "s-id");
if (!searchID) continue;
if (ID == atoi(searchID))
numTimers++;
free(searchID);
}
return numTimers;
}
int cTVGuideSearchTimer::GetNumRecordings(void) {
int numRecordings = 0;
if (ID < 0)
return numRecordings;
for (cRecording *recording = Recordings.First(); recording; recording = Recordings.Next(recording)) {
if (recording->IsEdited())
continue;
if (!recording->Info())
continue;
char* searchID = GetAuxValue(recording, "s-id");
if (!searchID) continue;
if (ID == atoi(searchID))
numRecordings++;
free(searchID);
}
return numRecordings;
}
void cTVGuideSearchTimer::GetSearchModes(std::vector<std::string> *searchModes) {
searchModes->push_back(tr("whole term must appear"));
searchModes->push_back(tr("all terms must exist"));
searchModes->push_back(tr("one term must exist"));
searchModes->push_back(tr("exact match"));
searchModes->push_back(tr("regular expression"));
}
void cTVGuideSearchTimer::Dump(void) {
esyslog("tvguide searchtimer: strTimer: %s", strTimer.c_str());
esyslog("tvguide searchtimer: ID: %d", ID);
esyslog("tvguide searchtimer: searchString: %s", searchString.c_str());
esyslog("tvguide searchtimer: useTime: %d", useTime);
esyslog("tvguide searchtimer: startTime: %d", startTime);
esyslog("tvguide searchtimer: stopTime: %d", stopTime);
esyslog("tvguide searchtimer: useChannel: %d", useChannel);
if (channelMin)
esyslog("tvguide searchtimer: channelMin: %s", channelMin->Name());
if (channelMax)
esyslog("tvguide searchtimer: channelMax: %s", channelMax->Name());
esyslog("tvguide searchtimer: channelGroup: %s", channelGroup.c_str());
esyslog("tvguide searchtimer: useCase: %d", useCase);
esyslog("tvguide searchtimer: mode: %d", mode);
esyslog("tvguide searchtimer: useTitle: %d", useTitle);
esyslog("tvguide searchtimer: useSubtitle: %d", useSubtitle);
esyslog("tvguide searchtimer: useDescription: %d", useDescription);
}

130
searchtimer.h Normal file
View File

@ -0,0 +1,130 @@
#ifndef __TVGUIDE_SEARCHTIMER_H
#define __TVGUIDE_SEARCHTIMER_H
class cTVGuideSearchTimer {
private:
std::string strTimer;
int ID;
std::string searchString;
int useTime;
int startTime;
int stopTime;
int useChannel;
cChannel *channelMin;
cChannel *channelMax;
std::string channelGroup;
int useCase;
int mode;
int useTitle;
int useSubtitle;
int useDescription;
int useDuration;
int minDuration;
int maxDuration;
int useAsSearchTimer;
int useDayOfWeek;
int dayOfWeek;
int useEpisode;
std::string directory;
int priority;
int lifetime;
int marginStart;
int marginStop;
int useVPS;
int action;
int useExtEPGInfo;
std::string extEPGInfoValues;
int avoidRepeats;
int allowedRepeats;
int compareTitle;
int compareSubtitle;
int compareSummary;
unsigned long catvaluesAvoidRepeat;
int repeatsWithinDays;
int delAfterDays;
int recordingsKeep;
int switchMinsBefore;
int pauseOnNrRecordings;
int blacklistMode;
std::string blacklists;
int fuzzyTolerance;
int useInFavorites;
int menuTemplate;
int delMode;
int delAfterCountRecs;
int delAfterDaysOfFirstRec;
int useAsSearchTimerFrom;
int useAsSearchTimerTil;
int ignoreMissingEPGCats;
int unmuteSoundOnSwitch;
int compareSummaryMatchInPercent;
std::string contentsFilter;
int compareDate;
public:
cTVGuideSearchTimer(void);
virtual ~cTVGuideSearchTimer(void);
void SetEPGSearchString(std::string strTimer) { this->strTimer = strTimer; };
void SetTemplate(std::string tmpl);
bool Parse(bool readTemplate = false);
std::string BuildSearchString(void);
int GetID(void) { return ID; };
//GETTER
std::string SearchString(void) { return searchString; };
bool Active(void);
bool UseTitle(void) { return useTitle; };
bool UseSubtitle(void) { return useSubtitle; };
bool UseDescription(void) { return useDescription; };
int SearchMode(void) { return mode; };
bool UseChannel(void) { return useChannel; };
int StartChannel(void) { return (channelMin)?channelMin->Number():0; };
int StopChannel(void) { return (channelMax)?channelMax->Number():0; };
bool UseTime(void) { return useTime; };
int StartTime(void) { return startTime; };
int StopTime(void) { return stopTime; };
bool UseDayOfWeek(void) { return useDayOfWeek; };
int DayOfWeek(void);
int UseEpisode(void) { return useEpisode; };
int Priority(void) { return priority; };
int Lifetime(void) { return lifetime; };
int MarginStart(void) { return marginStart; };
int MarginStop(void) { return marginStop; };
bool UseVPS(void) { return useVPS; };
bool AvoidRepeats(void) { return avoidRepeats; };
int AllowedRepeats(void) { return allowedRepeats; };
bool CompareTitle(void) { return compareTitle; };
bool CompareSubtitle(void) { return compareSubtitle; };
bool CompareSummary(void) { return compareSummary; };
//SETTER
void SetSearchString(std::string searchString) { this->searchString = searchString; };
void SetActive(bool active) { useAsSearchTimer = active; };
void SetSearchMode(int searchMode) { mode = searchMode; };
void SetUseTitle(bool useTitle) { this->useTitle = useTitle; };
void SetUseSubtitle(bool useSubtitle) { this->useSubtitle = useSubtitle; };
void SetUseDesription(bool useDescription) { this->useDescription = useDescription; };
void SetUseChannel(bool useChannel) { this->useChannel = useChannel; };
void SetStartChannel(int startChannel) { channelMin = Channels.GetByNumber(startChannel); };
void SetStopChannel(int stopChannel) { channelMax = Channels.GetByNumber(stopChannel); };
void SetUseTime(bool useTime) { this->useTime = useTime; };
void SetStartTime(int startTime) { this->startTime = startTime; };
void SetStopTime(int stopTime) { this->stopTime = stopTime; };
void SetUseDayOfWeek(bool useDayOfWeek) { this->useDayOfWeek = useDayOfWeek; };
void SetDayOfWeek(int VDRDayOfWeek);
void SetPriority(int priority) { this->priority = priority; };
void SetLifetime(int lifetime) { this->lifetime = lifetime; };
void SetMarginStart(int marginStart) { this->marginStart = marginStart; };
void SetMarginStop(int marginStop) { this->marginStop = marginStop; };
void SetUseVPS(bool useVPS) { this->useVPS = useVPS; };
void SetAvoidRepeats(bool avoidRepeats) { this->avoidRepeats = avoidRepeats; };
void SetAllowedRepeats(int allowedRepeats) { this->allowedRepeats = allowedRepeats; };
void SetCompareTitle(bool compareTitle) { this->compareTitle = compareTitle; };
void SetCompareSubtitle(bool compareSubtitle) { this->compareSubtitle = compareSubtitle; };
void SetCompareSummary(bool compareSummary) { this->compareSummary = compareSummary; };
//COMMON
int GetNumTimers(void);
int GetNumRecordings(void);
void GetSearchModes(std::vector<std::string> *searchModes);
void Dump(void);
};
#endif //__TVGUIDE_SEARCHTIMER_H

View File

@ -122,6 +122,7 @@ void cTvguideSetup::Store(void) {
SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta); SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta);
SetupStore("FontRecMenuItemDelta", tvguideConfig.FontRecMenuItemDelta); SetupStore("FontRecMenuItemDelta", tvguideConfig.FontRecMenuItemDelta);
SetupStore("FontRecMenuItemSmallDelta", tvguideConfig.FontRecMenuItemSmallDelta); SetupStore("FontRecMenuItemSmallDelta", tvguideConfig.FontRecMenuItemSmallDelta);
SetupStore("FontRecMenuItemLargeDelta", tvguideConfig.FontRecMenuItemLargeDelta);
SetupStore("displayRerunsDetailEPGView", tvguideConfig.displayRerunsDetailEPGView); SetupStore("displayRerunsDetailEPGView", tvguideConfig.displayRerunsDetailEPGView);
SetupStore("numReruns", tvguideConfig.numReruns); SetupStore("numReruns", tvguideConfig.numReruns);
SetupStore("useSubtitleRerun", tvguideConfig.useSubtitleRerun); SetupStore("useSubtitleRerun", tvguideConfig.useSubtitleRerun);
@ -339,6 +340,7 @@ void cMenuSetupFont::Set(void) {
Add(new cMenuEditIntItem(tr("Search & Recording Menu Font Size"), &tmpTvguideConfig->FontRecMenuItemDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Search & Recording Menu Font Size"), &tmpTvguideConfig->FontRecMenuItemDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Search & Recording Menu Small Font Size"), &tmpTvguideConfig->FontRecMenuItemSmallDelta, -30, 30)); Add(new cMenuEditIntItem(tr("Search & Recording Menu Small Font Size"), &tmpTvguideConfig->FontRecMenuItemSmallDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Search & Recording Main Menu Font Size"), &tmpTvguideConfig->FontRecMenuItemLargeDelta, -30, 30));
SetCurrent(Get(currentItem)); SetCurrent(Get(currentItem));
Display(); Display();

View File

@ -4,6 +4,10 @@ cSwitchTimers SwitchTimers;
// -- cSwitchTimer ----------------------------------------------------------------- // -- cSwitchTimer -----------------------------------------------------------------
cSwitchTimer::cSwitchTimer(void) { cSwitchTimer::cSwitchTimer(void) {
eventID = 0;
startTime = 0;
switchMinsBefore = 2;
announceOnly = 0;
} }
cSwitchTimer::cSwitchTimer(const cEvent* Event) { cSwitchTimer::cSwitchTimer(const cEvent* Event) {

View File

@ -3,20 +3,21 @@
#include <vdr/plugin.h> #include <vdr/plugin.h>
class cSwitchTimer : public cListObject class cSwitchTimer : public cListObject {
{
public: public:
tEventID eventID; tEventID eventID;
time_t startTime; time_t startTime;
tChannelID channelID; tChannelID channelID;
int switchMinsBefore;
int announceOnly;
cSwitchTimer(void); cSwitchTimer(void);
cSwitchTimer(const cEvent* Event); cSwitchTimer(const cEvent* Event);
bool Parse(const char *s); bool Parse(const char *s);
void SetEventID(tEventID eventID) { this->eventID = eventID; };
void SetStartTime(time_t startTime) { this->startTime = startTime; };
}; };
class cSwitchTimers : public cConfig<cSwitchTimer>, public cMutex class cSwitchTimers : public cConfig<cSwitchTimer>, public cMutex {
{
public: public:
cSwitchTimers(void) {} cSwitchTimers(void) {}
~cSwitchTimers(void) {} ~cSwitchTimers(void) {}

67
tools.c
View File

@ -52,6 +52,9 @@ std::string StrToLowerCase(std::string str) {
return lowerCase; return lowerCase;
} }
/****************************************************************************************
* DrawRoundedCorners
****************************************************************************************/
void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor) { void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor) {
if( height > 2*radius) { if( height > 2*radius) {
p->DrawEllipse(cRect(posX, posY, radius, radius), borderColor, -2); p->DrawEllipse(cRect(posX, posY, radius, radius), borderColor, -2);
@ -109,6 +112,70 @@ int FindIgnoreCase(const std::string& expr, const std::string& query)
return r - p; return r - p;
} }
/****************************************************************************************
* GetAuxValue
****************************************************************************************/
char* GetAuxValue(const char* aux, const char* name) {
if (isempty(aux))
return NULL;
char* descr = strdup(aux);
char* beginaux = strstr(descr, "<epgsearch>");
char* endaux = strstr(descr, "</epgsearch>");
if (!beginaux || !endaux) {
free(descr);
return NULL;
}
beginaux += 11; // strlen("<epgsearch>");
endaux[0] = 0;
memmove(descr, beginaux, endaux - beginaux + 1);
if (strcmp(name, "epgsearch") == 0)
return descr; // full aux
int namelen = strlen(name);
char catname[100] = "";
catname[0] = '<';
memcpy(catname + 1, name, namelen);
catname[1 + namelen] = '>';
catname[2 + namelen] = 0;
char* cat = strcasestr(descr, catname);
if (!cat) {
free(descr);
return NULL;
}
cat += namelen + 2;
char* end = strstr(cat, "</");
if (!end) {
free(descr);
return NULL;
}
end[0] = 0;
int catlen = end - cat + 1;
char* value = (char *) malloc(catlen);
memcpy(value, cat, catlen);
free(descr);
return value;
}
char* GetAuxValue(const cRecording *recording, const char* name) {
if (!recording || !recording->Info())
return NULL;
return GetAuxValue(recording->Info()->Aux(), name);
}
char* GetAuxValue(const cTimer *timer, const char* name) {
if (!timer || !timer->Aux())
return NULL;
return GetAuxValue(timer->Aux(), name);
}
/**************************************************************************************** /****************************************************************************************
* FUZZYSEARCH * FUZZYSEARCH
****************************************************************************************/ ****************************************************************************************/

View File

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vdr/font.h> #include <vdr/font.h>
#include <vdr/recording.h>
std::string CutText(std::string text, int width, const cFont *font); std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str); std::string StrToLowerCase(std::string str);
@ -18,6 +19,10 @@ public:
int FindIgnoreCase(const std::string& expr, const std::string& query); int FindIgnoreCase(const std::string& expr, const std::string& query);
char* GetAuxValue(const char* aux, const char* name);
char* GetAuxValue(const cRecording *recording, const char* name);
char* GetAuxValue(const cTimer* timer, const char* name);
#ifndef _AFUZZY_H #ifndef _AFUZZY_H
#define _AFUZZY_H #define _AFUZZY_H