diff --git a/HISTORY b/HISTORY index c6efb1a..12d6c28 100644 --- a/HISTORY +++ b/HISTORY @@ -96,3 +96,4 @@ Version 1.1.0 - Rounded Corners for color buttons (Closes Ticket 1475) - Fixed some issues with text backgrounds in flat themes (closes Tickets 1480 and 1486) +- Added possibility to search for reruns in case of a timer conflict diff --git a/Makefile b/Makefile index 54b9e18..dbd598a 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ endif ### 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 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 setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o timerconflict.o tools.o tvguideosd.o ### The main target: diff --git a/icons/arrow_left.png b/icons/arrow_left.png deleted file mode 100644 index a65e47d..0000000 Binary files a/icons/arrow_left.png and /dev/null differ diff --git a/icons/arrow_right.png b/icons/arrow_right.png deleted file mode 100644 index 97fa123..0000000 Binary files a/icons/arrow_right.png and /dev/null differ diff --git a/icons/darkredNG/recmenuicons/arrow_left.png b/icons/darkredNG/recmenuicons/arrow_left.png new file mode 100644 index 0000000..57800c7 Binary files /dev/null and b/icons/darkredNG/recmenuicons/arrow_left.png differ diff --git a/icons/darkredNG/recmenuicons/arrow_right.png b/icons/darkredNG/recmenuicons/arrow_right.png new file mode 100644 index 0000000..ea45f3a Binary files /dev/null and b/icons/darkredNG/recmenuicons/arrow_right.png differ diff --git a/icons/darkredNG/recmenuicons/delete_active.png b/icons/darkredNG/recmenuicons/delete_active.png new file mode 100644 index 0000000..f473717 Binary files /dev/null and b/icons/darkredNG/recmenuicons/delete_active.png differ diff --git a/icons/darkredNG/recmenuicons/delete_inactive.png b/icons/darkredNG/recmenuicons/delete_inactive.png new file mode 100644 index 0000000..21b0a88 Binary files /dev/null and b/icons/darkredNG/recmenuicons/delete_inactive.png differ diff --git a/icons/darkredNG/recmenuicons/edit_active.png b/icons/darkredNG/recmenuicons/edit_active.png new file mode 100644 index 0000000..ec39699 Binary files /dev/null and b/icons/darkredNG/recmenuicons/edit_active.png differ diff --git a/icons/darkredNG/recmenuicons/edit_inactive.png b/icons/darkredNG/recmenuicons/edit_inactive.png new file mode 100644 index 0000000..71f016c Binary files /dev/null and b/icons/darkredNG/recmenuicons/edit_inactive.png differ diff --git a/icons/darkredNG/recmenuicons/icon_backspace.png b/icons/darkredNG/recmenuicons/icon_backspace.png new file mode 100644 index 0000000..6065fa3 Binary files /dev/null and b/icons/darkredNG/recmenuicons/icon_backspace.png differ diff --git a/icons/darkredNG/recmenuicons/icon_del_ins.png b/icons/darkredNG/recmenuicons/icon_del_ins.png new file mode 100644 index 0000000..f05a96b Binary files /dev/null and b/icons/darkredNG/recmenuicons/icon_del_ins.png differ diff --git a/icons/darkredNG/recmenuicons/icon_shift.png b/icons/darkredNG/recmenuicons/icon_shift.png new file mode 100644 index 0000000..15ae851 Binary files /dev/null and b/icons/darkredNG/recmenuicons/icon_shift.png differ diff --git a/icons/darkredNG/recmenuicons/info_active.png b/icons/darkredNG/recmenuicons/info_active.png new file mode 100644 index 0000000..c88f76d Binary files /dev/null and b/icons/darkredNG/recmenuicons/info_active.png differ diff --git a/icons/darkredNG/recmenuicons/info_inactive.png b/icons/darkredNG/recmenuicons/info_inactive.png new file mode 100644 index 0000000..37eeed2 Binary files /dev/null and b/icons/darkredNG/recmenuicons/info_inactive.png differ diff --git a/icons/darkredNG/recmenuicons/no.png b/icons/darkredNG/recmenuicons/no.png new file mode 100644 index 0000000..47cdba0 Binary files /dev/null and b/icons/darkredNG/recmenuicons/no.png differ diff --git a/icons/darkredNG/recmenuicons/record_active.png b/icons/darkredNG/recmenuicons/record_active.png new file mode 100644 index 0000000..476da99 Binary files /dev/null and b/icons/darkredNG/recmenuicons/record_active.png differ diff --git a/icons/darkredNG/recmenuicons/record_inactive.png b/icons/darkredNG/recmenuicons/record_inactive.png new file mode 100644 index 0000000..2a91da3 Binary files /dev/null and b/icons/darkredNG/recmenuicons/record_inactive.png differ diff --git a/icons/darkredNG/recmenuicons/search_active.png b/icons/darkredNG/recmenuicons/search_active.png new file mode 100644 index 0000000..7bf7bc7 Binary files /dev/null and b/icons/darkredNG/recmenuicons/search_active.png differ diff --git a/icons/darkredNG/recmenuicons/search_inactive.png b/icons/darkredNG/recmenuicons/search_inactive.png new file mode 100644 index 0000000..4a210bb Binary files /dev/null and b/icons/darkredNG/recmenuicons/search_inactive.png differ diff --git a/icons/darkredNG/recmenuicons/yes.png b/icons/darkredNG/recmenuicons/yes.png new file mode 100644 index 0000000..2f1af98 Binary files /dev/null and b/icons/darkredNG/recmenuicons/yes.png differ diff --git a/icons/default/icons/arrow_left.png b/icons/default/icons/arrow_left.png deleted file mode 100644 index a65e47d..0000000 Binary files a/icons/default/icons/arrow_left.png and /dev/null differ diff --git a/icons/default/icons/arrow_right.png b/icons/default/icons/arrow_right.png deleted file mode 100644 index 97fa123..0000000 Binary files a/icons/default/icons/arrow_right.png and /dev/null differ diff --git a/icons/default/icons/delete_active.png b/icons/default/icons/delete_active.png deleted file mode 100644 index b01dc5c..0000000 Binary files a/icons/default/icons/delete_active.png and /dev/null differ diff --git a/icons/default/icons/delete_inactive.png b/icons/default/icons/delete_inactive.png deleted file mode 100644 index b327f07..0000000 Binary files a/icons/default/icons/delete_inactive.png and /dev/null differ diff --git a/icons/default/icons/edit_active.png b/icons/default/icons/edit_active.png deleted file mode 100644 index 5b3b667..0000000 Binary files a/icons/default/icons/edit_active.png and /dev/null differ diff --git a/icons/default/icons/edit_inactive.png b/icons/default/icons/edit_inactive.png deleted file mode 100644 index d4f59a1..0000000 Binary files a/icons/default/icons/edit_inactive.png and /dev/null differ diff --git a/icons/default/icons/icon_backspace.png b/icons/default/icons/icon_backspace.png deleted file mode 100644 index e20b7bd..0000000 Binary files a/icons/default/icons/icon_backspace.png and /dev/null differ diff --git a/icons/default/icons/icon_del_ins.png b/icons/default/icons/icon_del_ins.png deleted file mode 100644 index 3d06162..0000000 Binary files a/icons/default/icons/icon_del_ins.png and /dev/null differ diff --git a/icons/default/icons/icon_shift.png b/icons/default/icons/icon_shift.png deleted file mode 100644 index 998d7fa..0000000 Binary files a/icons/default/icons/icon_shift.png and /dev/null differ diff --git a/icons/default/icons/info_active.png b/icons/default/icons/info_active.png deleted file mode 100644 index 7f1ccf7..0000000 Binary files a/icons/default/icons/info_active.png and /dev/null differ diff --git a/icons/default/icons/info_inactive.png b/icons/default/icons/info_inactive.png deleted file mode 100644 index 9a79e95..0000000 Binary files a/icons/default/icons/info_inactive.png and /dev/null differ diff --git a/icons/default/icons/no.png b/icons/default/icons/no.png deleted file mode 100644 index c4b1860..0000000 Binary files a/icons/default/icons/no.png and /dev/null differ diff --git a/icons/default/icons/record_active.png b/icons/default/icons/record_active.png deleted file mode 100644 index 8c42156..0000000 Binary files a/icons/default/icons/record_active.png and /dev/null differ diff --git a/icons/default/icons/record_inactive.png b/icons/default/icons/record_inactive.png deleted file mode 100644 index 6720a6f..0000000 Binary files a/icons/default/icons/record_inactive.png and /dev/null differ diff --git a/icons/default/icons/yes.png b/icons/default/icons/yes.png deleted file mode 100644 index 28c2f81..0000000 Binary files a/icons/default/icons/yes.png and /dev/null differ diff --git a/icons/default/recmenuicons/arrow_left.png b/icons/default/recmenuicons/arrow_left.png new file mode 100644 index 0000000..57800c7 Binary files /dev/null and b/icons/default/recmenuicons/arrow_left.png differ diff --git a/icons/default/recmenuicons/arrow_right.png b/icons/default/recmenuicons/arrow_right.png new file mode 100644 index 0000000..ea45f3a Binary files /dev/null and b/icons/default/recmenuicons/arrow_right.png differ diff --git a/icons/default/recmenuicons/delete_active.png b/icons/default/recmenuicons/delete_active.png new file mode 100644 index 0000000..f473717 Binary files /dev/null and b/icons/default/recmenuicons/delete_active.png differ diff --git a/icons/default/recmenuicons/delete_inactive.png b/icons/default/recmenuicons/delete_inactive.png new file mode 100644 index 0000000..21b0a88 Binary files /dev/null and b/icons/default/recmenuicons/delete_inactive.png differ diff --git a/icons/default/recmenuicons/edit_active.png b/icons/default/recmenuicons/edit_active.png new file mode 100644 index 0000000..ec39699 Binary files /dev/null and b/icons/default/recmenuicons/edit_active.png differ diff --git a/icons/default/recmenuicons/edit_inactive.png b/icons/default/recmenuicons/edit_inactive.png new file mode 100644 index 0000000..71f016c Binary files /dev/null and b/icons/default/recmenuicons/edit_inactive.png differ diff --git a/icons/default/recmenuicons/icon_backspace.png b/icons/default/recmenuicons/icon_backspace.png new file mode 100644 index 0000000..6065fa3 Binary files /dev/null and b/icons/default/recmenuicons/icon_backspace.png differ diff --git a/icons/default/recmenuicons/icon_del_ins.png b/icons/default/recmenuicons/icon_del_ins.png new file mode 100644 index 0000000..f05a96b Binary files /dev/null and b/icons/default/recmenuicons/icon_del_ins.png differ diff --git a/icons/default/recmenuicons/icon_shift.png b/icons/default/recmenuicons/icon_shift.png new file mode 100644 index 0000000..15ae851 Binary files /dev/null and b/icons/default/recmenuicons/icon_shift.png differ diff --git a/icons/default/recmenuicons/info_active.png b/icons/default/recmenuicons/info_active.png new file mode 100644 index 0000000..c88f76d Binary files /dev/null and b/icons/default/recmenuicons/info_active.png differ diff --git a/icons/default/recmenuicons/info_inactive.png b/icons/default/recmenuicons/info_inactive.png new file mode 100644 index 0000000..37eeed2 Binary files /dev/null and b/icons/default/recmenuicons/info_inactive.png differ diff --git a/icons/default/recmenuicons/no.png b/icons/default/recmenuicons/no.png new file mode 100644 index 0000000..47cdba0 Binary files /dev/null and b/icons/default/recmenuicons/no.png differ diff --git a/icons/default/recmenuicons/record_active.png b/icons/default/recmenuicons/record_active.png new file mode 100644 index 0000000..476da99 Binary files /dev/null and b/icons/default/recmenuicons/record_active.png differ diff --git a/icons/default/recmenuicons/record_inactive.png b/icons/default/recmenuicons/record_inactive.png new file mode 100644 index 0000000..2a91da3 Binary files /dev/null and b/icons/default/recmenuicons/record_inactive.png differ diff --git a/icons/default/recmenuicons/search_active.png b/icons/default/recmenuicons/search_active.png new file mode 100644 index 0000000..7bf7bc7 Binary files /dev/null and b/icons/default/recmenuicons/search_active.png differ diff --git a/icons/default/recmenuicons/search_inactive.png b/icons/default/recmenuicons/search_inactive.png new file mode 100644 index 0000000..4a210bb Binary files /dev/null and b/icons/default/recmenuicons/search_inactive.png differ diff --git a/icons/default/recmenuicons/yes.png b/icons/default/recmenuicons/yes.png new file mode 100644 index 0000000..2f1af98 Binary files /dev/null and b/icons/default/recmenuicons/yes.png differ diff --git a/icons/delete_active.png b/icons/delete_active.png deleted file mode 100644 index b01dc5c..0000000 Binary files a/icons/delete_active.png and /dev/null differ diff --git a/icons/delete_inactive.png b/icons/delete_inactive.png deleted file mode 100644 index b327f07..0000000 Binary files a/icons/delete_inactive.png and /dev/null differ diff --git a/icons/edit_active.png b/icons/edit_active.png deleted file mode 100644 index 5b3b667..0000000 Binary files a/icons/edit_active.png and /dev/null differ diff --git a/icons/edit_inactive.png b/icons/edit_inactive.png deleted file mode 100644 index d4f59a1..0000000 Binary files a/icons/edit_inactive.png and /dev/null differ diff --git a/icons/icon_backspace.png b/icons/icon_backspace.png deleted file mode 100644 index e20b7bd..0000000 Binary files a/icons/icon_backspace.png and /dev/null differ diff --git a/icons/icon_del_ins.png b/icons/icon_del_ins.png deleted file mode 100644 index 3d06162..0000000 Binary files a/icons/icon_del_ins.png and /dev/null differ diff --git a/icons/icon_shift.png b/icons/icon_shift.png deleted file mode 100644 index 998d7fa..0000000 Binary files a/icons/icon_shift.png and /dev/null differ diff --git a/icons/info_active.png b/icons/info_active.png deleted file mode 100644 index 7f1ccf7..0000000 Binary files a/icons/info_active.png and /dev/null differ diff --git a/icons/info_inactive.png b/icons/info_inactive.png deleted file mode 100644 index 9a79e95..0000000 Binary files a/icons/info_inactive.png and /dev/null differ diff --git a/icons/no.png b/icons/no.png deleted file mode 100644 index 3630d29..0000000 Binary files a/icons/no.png and /dev/null differ diff --git a/icons/recmenuicons/arrow_left.png b/icons/recmenuicons/arrow_left.png new file mode 100644 index 0000000..57800c7 Binary files /dev/null and b/icons/recmenuicons/arrow_left.png differ diff --git a/icons/recmenuicons/arrow_right.png b/icons/recmenuicons/arrow_right.png new file mode 100644 index 0000000..ea45f3a Binary files /dev/null and b/icons/recmenuicons/arrow_right.png differ diff --git a/icons/recmenuicons/delete_active.png b/icons/recmenuicons/delete_active.png new file mode 100644 index 0000000..f473717 Binary files /dev/null and b/icons/recmenuicons/delete_active.png differ diff --git a/icons/recmenuicons/delete_inactive.png b/icons/recmenuicons/delete_inactive.png new file mode 100644 index 0000000..21b0a88 Binary files /dev/null and b/icons/recmenuicons/delete_inactive.png differ diff --git a/icons/recmenuicons/edit_active.png b/icons/recmenuicons/edit_active.png new file mode 100644 index 0000000..ec39699 Binary files /dev/null and b/icons/recmenuicons/edit_active.png differ diff --git a/icons/recmenuicons/edit_inactive.png b/icons/recmenuicons/edit_inactive.png new file mode 100644 index 0000000..71f016c Binary files /dev/null and b/icons/recmenuicons/edit_inactive.png differ diff --git a/icons/recmenuicons/icon_backspace.png b/icons/recmenuicons/icon_backspace.png new file mode 100644 index 0000000..6065fa3 Binary files /dev/null and b/icons/recmenuicons/icon_backspace.png differ diff --git a/icons/recmenuicons/icon_del_ins.png b/icons/recmenuicons/icon_del_ins.png new file mode 100644 index 0000000..f05a96b Binary files /dev/null and b/icons/recmenuicons/icon_del_ins.png differ diff --git a/icons/recmenuicons/icon_shift.png b/icons/recmenuicons/icon_shift.png new file mode 100644 index 0000000..15ae851 Binary files /dev/null and b/icons/recmenuicons/icon_shift.png differ diff --git a/icons/recmenuicons/info_active.png b/icons/recmenuicons/info_active.png new file mode 100644 index 0000000..c88f76d Binary files /dev/null and b/icons/recmenuicons/info_active.png differ diff --git a/icons/recmenuicons/info_inactive.png b/icons/recmenuicons/info_inactive.png new file mode 100644 index 0000000..37eeed2 Binary files /dev/null and b/icons/recmenuicons/info_inactive.png differ diff --git a/icons/recmenuicons/no.png b/icons/recmenuicons/no.png new file mode 100644 index 0000000..47cdba0 Binary files /dev/null and b/icons/recmenuicons/no.png differ diff --git a/icons/recmenuicons/record_active.png b/icons/recmenuicons/record_active.png new file mode 100644 index 0000000..476da99 Binary files /dev/null and b/icons/recmenuicons/record_active.png differ diff --git a/icons/recmenuicons/record_inactive.png b/icons/recmenuicons/record_inactive.png new file mode 100644 index 0000000..2a91da3 Binary files /dev/null and b/icons/recmenuicons/record_inactive.png differ diff --git a/icons/recmenuicons/search_active.png b/icons/recmenuicons/search_active.png new file mode 100644 index 0000000..7bf7bc7 Binary files /dev/null and b/icons/recmenuicons/search_active.png differ diff --git a/icons/recmenuicons/search_inactive.png b/icons/recmenuicons/search_inactive.png new file mode 100644 index 0000000..4a210bb Binary files /dev/null and b/icons/recmenuicons/search_inactive.png differ diff --git a/icons/recmenuicons/yes.png b/icons/recmenuicons/yes.png new file mode 100644 index 0000000..2f1af98 Binary files /dev/null and b/icons/recmenuicons/yes.png differ diff --git a/icons/record_active.png b/icons/record_active.png deleted file mode 100644 index 8c42156..0000000 Binary files a/icons/record_active.png and /dev/null differ diff --git a/icons/record_inactive.png b/icons/record_inactive.png deleted file mode 100644 index 6720a6f..0000000 Binary files a/icons/record_inactive.png and /dev/null differ diff --git a/icons/yes.png b/icons/yes.png deleted file mode 100644 index ec30010..0000000 Binary files a/icons/yes.png and /dev/null differ diff --git a/imagecache.c b/imagecache.c index 3b897b9..90af108 100644 --- a/imagecache.c +++ b/imagecache.c @@ -2,10 +2,10 @@ #include #include #include -#include "imagecache.h" #include "config.h" #include "imagescaler.h" #include "tools.h" +#include "imagecache.h" cImageCache::cImageCache() : cImageMagickWrapper() { tempStaticLogo = NULL; @@ -372,6 +372,27 @@ cImage *cImageCache::GetLogo(const cChannel *channel) { return NULL; } +cImage *cImageCache::GetIcon(std::string name, int width, int height) { + std::stringstream iconName; + iconName << name << width << "x" << height; + std::map::iterator hit = iconCache.find(iconName.str()); + if (hit != iconCache.end()) { + return (cImage*)hit->second; + } else { + std::stringstream iconPath; + iconPath << "recmenuicons/" << name; + bool success = LoadIcon(iconPath.str()); + if (success) { + cImage *image = CreateImage(width, height); + iconCache.insert(std::pair(iconName.str(), image)); + hit = iconCache.find(iconName.str()); + if (hit != iconCache.end()) { + return (cImage*)hit->second; + } + } + } + return NULL; +} void cImageCache::InsertIntoOsdElementCache(eOsdElementType type, int width, int height) { cImage *image = CreateImage(width, height, false); @@ -578,7 +599,7 @@ std::string cImageCache::GetCacheSize(eCacheType type) { sizeByte += img->Width() * img->Height() * sizeof(tColor); } numImages = osdElementCache.size(); - } else if ((type == ctGrid) || (type == ctLogo) || (type == ctChannelGroup)) { + } else if ((type == ctGrid) || (type == ctLogo) || (type == ctChannelGroup) || (type == ctIcon)) { std::map *cache; if (type == ctGrid) cache = &gridCache; @@ -586,6 +607,8 @@ std::string cImageCache::GetCacheSize(eCacheType type) { cache = &logoCache; else if (type == ctChannelGroup) cache = &groupsCache; + else if (type == ctIcon) + cache = &iconCache; for(std::map::const_iterator it = cache->begin(); it != cache->end(); it++) { cImage *img = (cImage*)it->second; @@ -622,6 +645,12 @@ void cImageCache::Clear(void) { delete img; } logoCache.clear(); + + for(std::map::const_iterator it = iconCache.begin(); it != iconCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + iconCache.clear(); if (tempStaticLogo) delete tempStaticLogo; diff --git a/imagecache.h b/imagecache.h index efe41f3..f8aeac5 100644 --- a/imagecache.h +++ b/imagecache.h @@ -12,6 +12,7 @@ enum eCacheType { ctGrid, ctLogo, ctChannelGroup, + ctIcon, }; enum eOsdElementType { @@ -41,6 +42,7 @@ public: cImage *GetGrid(int width, int height, bool active); cImage *GetChannelGroup(int width, int height); cImage *GetLogo(const cChannel *channel); + cImage *GetIcon(std::string name, int width, int height); std::string GetCacheSize(eCacheType type); void Clear(void); private: @@ -68,6 +70,7 @@ private: std::map gridCache; std::map groupsCache; std::map logoCache; + std::map iconCache; void CreateOsdIconCache(void); void PrepareGridIconCache(void); void CreateGridIconCache(void); diff --git a/imageloader.c b/imageloader.c index d194295..8b913ea 100644 --- a/imageloader.c +++ b/imageloader.c @@ -77,8 +77,13 @@ bool cImageLoader::LoadPoster(const char *poster, int width, int height) { bool cImageLoader::LoadIcon(const char *cIcon, int size) { if (size==0) return false; + cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName); bool success = false; - success = LoadImage(cIcon, *tvguideConfig.iconPath, "png"); + success = LoadImage(cIcon, *iconPathTheme, "png"); + if (!success) { + cString iconPathdefault = cString::sprintf("%s/recmenuicons/", *tvguideConfig.iconPath); + success = LoadImage(cIcon, *iconPathdefault, "png"); + } if (!success) return false; buffer.sample(Geometry(size, size)); diff --git a/po/ca_ES.po b/po/ca_ES.po index eaa45da..2de7d06 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-24 11:13+0100\n" +"POT-Creation-Date: 2013-12-29 17:53+0100\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n" "Last-Translator: My friend Thanks David \n" "Language-Team: \n" @@ -159,6 +159,27 @@ msgstr "No s'han trobat conflictes" msgid "Close" msgstr "Tanca" +msgid "reruns for" +msgstr "" + +msgid "rerun for" +msgstr "" + +msgid "found" +msgstr "" + +msgid "Ignore reruns" +msgstr "" + +msgid "No reruns found for Event" +msgstr "" + +msgid "Timer for" +msgstr "" + +msgid "replaced by rerun" +msgstr "" + msgid "Timer Active" msgstr "Temporitzador actiu" @@ -644,3 +665,6 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" + +msgid "Recording Menus Icon Cache" +msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index 5de6868..b8b9128 100755 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-24 11:13+0100\n" +"POT-Creation-Date: 2013-12-29 17:53+0100\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -156,6 +156,27 @@ msgstr "Keine Timerkonflikte gefunden" msgid "Close" msgstr "Schließen" +msgid "reruns for" +msgstr "" + +msgid "rerun for" +msgstr "" + +msgid "found" +msgstr "" + +msgid "Ignore reruns" +msgstr "" + +msgid "No reruns found for Event" +msgstr "" + +msgid "Timer for" +msgstr "" + +msgid "replaced by rerun" +msgstr "" + msgid "Timer Active" msgstr "Timer aktiv" @@ -641,3 +662,6 @@ msgstr "EPG Grid Cache" msgid "Channel Groups Cache" msgstr "Kanalgruppen Cache" + +msgid "Recording Menus Icon Cache" +msgstr "" diff --git a/po/ru_RU.po b/po/ru_RU.po index e8de1eb..b8cdeb5 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-24 11:13+0100\n" +"POT-Creation-Date: 2013-12-29 17:53+0100\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n" "Last-Translator: AmiD, ilya\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" @@ -156,6 +156,27 @@ msgstr "Таймер-конфликты не найдены" msgid "Close" msgstr "Закрыть" +msgid "reruns for" +msgstr "" + +msgid "rerun for" +msgstr "" + +msgid "found" +msgstr "" + +msgid "Ignore reruns" +msgstr "" + +msgid "No reruns found for Event" +msgstr "" + +msgid "Timer for" +msgstr "" + +msgid "replaced by rerun" +msgstr "" + msgid "Timer Active" msgstr "Таймер активен" @@ -641,3 +662,6 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" + +msgid "Recording Menus Icon Cache" +msgstr "" diff --git a/po/sk_SK.po b/po/sk_SK.po index e5e7cd9..8699ef7 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-24 11:13+0100\n" +"POT-Creation-Date: 2013-12-29 17:53+0100\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n" "Last-Translator: Milan Hrala \n" "Language-Team: \n" @@ -156,6 +156,27 @@ msgstr "Nena msgid "Close" msgstr "Zavrie»" +msgid "reruns for" +msgstr "" + +msgid "rerun for" +msgstr "" + +msgid "found" +msgstr "" + +msgid "Ignore reruns" +msgstr "" + +msgid "No reruns found for Event" +msgstr "" + +msgid "Timer for" +msgstr "" + +msgid "replaced by rerun" +msgstr "" + msgid "Timer Active" msgstr "Plán aktívny" @@ -641,3 +662,6 @@ msgstr "" msgid "Channel Groups Cache" msgstr "" + +msgid "Recording Menus Icon Cache" +msgstr "" diff --git a/recmanager.c b/recmanager.c index 32bff2a..8816c40 100644 --- a/recmanager.c +++ b/recmanager.c @@ -9,21 +9,13 @@ #include "services/tvscraper.h" #include "tools.h" #include "switchtimer.h" +#include "timerconflict.h" #include "recmanager.h" static int CompareRecording(const void *p1, const void *p2) { return (int)((*(cRecording **)p1)->Start() - (*(cRecording **)p2)->Start()); } -bool TVGuideTimerConflict::timerInvolved(int involvedID) { - int numConflicts = timerIDs.size(); - for (int i=0; iRecording(); } -std::vector cRecManager::CheckTimerConflict(void) { - /* TIMERCONFLICT FORMAT: - The result list looks like this for example when we have 2 timer conflicts at one time: - 1190232780:152|30|50#152#45:45|10|50#152#45 - '1190232780' is the time of the conflict in seconds since 1970-01-01. - It's followed by list of timers that have a conflict at this time: - '152|30|50#1 int editTimer(cTimer *timer, bool active, int prio, int start, int stop); - 52#45' is the description of the first conflicting timer. Here: - '152' is VDR's timer id of this timer as returned from VDR's LSTT command - '30' is the percentage of recording that would be done (0...100) - '50#152#45' is the list of concurrent timers at this conflict - '45|10|50#152#45' describes the next conflict - */ - std::vector results; +cTVGuideTimerConflicts *cRecManager::CheckTimerConflict(void) { + cTVGuideTimerConflicts *conflictList = new cTVGuideTimerConflicts(); if (!epgSearchAvailable) - return results; + return conflictList; Epgsearch_services_v1_1 *epgSearch = new Epgsearch_services_v1_1; if (epgSearchPlugin->Service("Epgsearch-services-v1.1", epgSearch)) { std::list conflicts = epgSearch->handler->TimerConflictList(); int numConflicts = conflicts.size(); - if (numConflicts > 0) { - for (std::list::iterator it=conflicts.begin(); it != conflicts.end(); ++it) { - TVGuideTimerConflict sConflict; - splitstring s(it->c_str()); - std::vector flds = s.split(':'); - if (flds.size() < 2) - continue; - sConflict.time = atoi(flds[0].c_str()); - splitstring s2(flds[1].c_str()); - std::vector flds2 = s2.split('|'); - if (flds2.size() < 3) - continue; - sConflict.timerID = atoi(flds2[0].c_str()); - sConflict.percentPossible = atoi(flds2[1].c_str()); - splitstring s3(flds2[2].c_str()); - std::vector flds3 = s3.split('#'); - std::vector timerIDs; - for (int k = 0; k < flds3.size(); k++) { - timerIDs.push_back(atoi(flds3[k].c_str()) - 1); - } - sConflict.timerIDs = timerIDs; - results.push_back(sConflict); - } + if (numConflicts == 0) + return conflictList; + for (std::list::iterator it=conflicts.begin(); it != conflicts.end(); ++it) { + conflictList->AddConflict(*it); } } delete epgSearch; - - int numConflicts = results.size(); - time_t startTime = 0; - time_t endTime = 0; - for (int i=0; i < numConflicts; i++) { - cTimeInterval *unionSet = NULL; - int numTimers = results[i].timerIDs.size(); - for (int j=0; j < numTimers; j++) { - const cTimer *timer = Timers.Get(results[i].timerIDs[j]); - if (timer) { - if (!unionSet) { - unionSet = new cTimeInterval(timer->StartTime(), timer->StopTime()); - } else { - cTimeInterval *timerInterval = new cTimeInterval(timer->StartTime(), timer->StopTime()); - cTimeInterval *newUnion = unionSet->Union(timerInterval); - delete unionSet; - delete timerInterval; - unionSet = newUnion; - } - } - } - results[i].timeStart = unionSet->Start(); - results[i].timeStop = unionSet->Stop(); - delete unionSet; - - cTimeInterval *intersect = NULL; - for (int j=0; j < numTimers; j++) { - const cTimer *timer = Timers.Get(results[i].timerIDs[j]); - if (timer) { - if (!intersect) { - intersect = new cTimeInterval(timer->StartTime(), timer->StopTime()); - } else { - cTimeInterval *timerInterval = new cTimeInterval(timer->StartTime(), timer->StopTime()); - cTimeInterval *newIntersect = intersect->Intersect(timerInterval); - if (newIntersect) { - delete intersect; - intersect = newIntersect; - } - delete timerInterval; - } - } - } - results[i].overlapStart = intersect->Start(); - results[i].overlapStop = intersect->Stop(); - delete intersect; - } - - return results; + conflictList->CalculateConflicts(); + return conflictList; } cTimer *cRecManager::CreateSeriesTimer(cRecMenu *menu, std::string path) { @@ -747,4 +662,47 @@ cRecording **cRecManager::SearchForRecordings(cString searchString, int &numResu return matchingRecordings; } return NULL; +} + +const cEvent **cRecManager::LoadReruns(const cEvent *event, int &numResults) { + if (epgSearchAvailable && !isempty(event->Title())) { + Epgsearch_searchresults_v1_0 data; + std::string strQuery = event->Title(); + if (tvguideConfig.useSubtitleRerun > 0) { + if (tvguideConfig.useSubtitleRerun == 2 || !isempty(event->ShortText())) + strQuery += "~"; + if (!isempty(event->ShortText())) + strQuery += event->ShortText(); + data.useSubTitle = true; + } else { + data.useSubTitle = false; + } + data.query = (char *)strQuery.c_str(); + data.mode = 0; + data.channelNr = 0; + data.useTitle = true; + data.useDescription = false; + + if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) { + cList* list = data.pResultList; + if (!list) + return NULL; + const cEvent **searchResults = NULL; + int numElements = list->Count(); + if (numElements > 0) { + searchResults = new const cEvent *[numElements]; + int index = 0; + for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r; r = list->Next(r)) { + if ((event->ChannelID() == r->event->ChannelID()) && (event->StartTime() == r->event->StartTime())) + continue; + searchResults[index] = r->event; + index++; + } + delete list; + numResults = index; + return searchResults; + } + } + } + return NULL; } \ No newline at end of file diff --git a/recmanager.h b/recmanager.h index ec18225..7701cc6 100644 --- a/recmanager.h +++ b/recmanager.h @@ -6,19 +6,7 @@ #include #include "detailview.h" #include "recmenu.h" - -class TVGuideTimerConflict { -public: - time_t time; - time_t timeStart; - time_t timeStop; - time_t overlapStart; - time_t overlapStop; - int percentPossible; - int timerID; - std::vector timerIDs; - bool timerInvolved(int involvedID); -}; +#include "timerconflict.h" struct TVGuideEPGSearchTemplate { public: @@ -49,7 +37,7 @@ public: void DeleteRemoteTimer(const cEvent *event); void SaveTimer(cTimer *timer, cRecMenu *menu); bool IsRecorded(const cEvent *event); - std::vector CheckTimerConflict(void); + cTVGuideTimerConflicts *CheckTimerConflict(void); cTimer *CreateSeriesTimer(cRecMenu *menu, std::string path); std::string BuildEPGSearchString(cString searchString, cRecMenu *menu); std::string BuildEPGSearchString(cString searchString, std::string templValue); @@ -61,6 +49,7 @@ public: bool CreateSwitchTimer(const cEvent *event, cRecMenu *menu); void DeleteSwitchTimer(const cEvent *event); cRecording **SearchForRecordings(cString searchString, int &numResults); + const cEvent **LoadReruns(const cEvent *event, int &numResults); virtual ~cRecManager (void); }; diff --git a/recmenu.c b/recmenu.c index 985406f..c279bc7 100644 --- a/recmenu.c +++ b/recmenu.c @@ -340,6 +340,7 @@ void cRecMenu::Arrange(bool scroll) { if (!scroll) { header->SetGeometry(xElement, yElement, widthElement); header->SetPixmaps(); + header->setBackground(); } yElement += header->GetHeight(); } @@ -351,6 +352,7 @@ void cRecMenu::Arrange(bool scroll) { if (footer && !scroll) { footer->SetGeometry(xElement, yElement, widthElement); footer->SetPixmaps(); + footer->setBackground(); } } diff --git a/recmenuitem.c b/recmenuitem.c index 1e21a1e..056ac80 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -1,6 +1,7 @@ #include #include #include "imageloader.h" +#include "imagecache.h" #include "tools.h" #include "recmenuitem.h" @@ -253,6 +254,7 @@ void cRecMenuItemInfo::CalculateHeight(int textWidth) { void cRecMenuItemInfo::setBackground(void) { pixmap->Fill(clrTransparent); + cRecMenuItem::setBackground(); } void cRecMenuItemInfo::Draw(void) { @@ -411,14 +413,14 @@ void cRecMenuItemBool::Draw(void) { void cRecMenuItemBool::DrawValue(void) { pixmapVal->Fill(clrTransparent); - cString strIcon = yes?"yes":"no"; + std::string strIcon = yes?"yes":"no"; int iconSize = height - 8; int iconX = width - iconSize - 10; int iconY = (height - iconSize) / 2; - cImageLoader imgLoader; - if (imgLoader.LoadIcon(strIcon, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapVal->DrawImage(cPoint(iconX, iconY), icon); + + cImage *imgYesNo = imgCache.GetIcon(strIcon, iconSize, iconSize); + if (imgYesNo) { + pixmapVal->DrawImage(cPoint(iconX, iconY), *imgYesNo); } } @@ -499,14 +501,14 @@ void cRecMenuItemSelect::DrawValue(void) { int iconLeftX = textX - iconSize; int iconRightX = width - iconSize; int iconY = (height - iconSize) / 2; - cImageLoader imgLoader; - if (imgLoader.LoadIcon("arrow_left", iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapVal->DrawImage(cPoint(iconLeftX, iconY), icon); + + cImage *imgLeft = imgCache.GetIcon("arrow_left", iconSize, iconSize); + if (imgLeft) { + pixmapVal->DrawImage(cPoint(iconLeftX, iconY), *imgLeft); } - if (imgLoader.LoadIcon("arrow_right", iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapVal->DrawImage(cPoint(iconRightX, iconY), icon); + cImage *imgRight = imgCache.GetIcon("arrow_right", iconSize, iconSize); + if (imgRight) { + pixmapVal->DrawImage(cPoint(iconRightX, iconY), *imgRight); } } @@ -671,8 +673,7 @@ void cRecMenuItemText::ActivateKeyboard(void) { bool draw = false; bool drawIcon = false; cString strNum; - cString strIcon; - cImageLoader imgLoader; + std::string strIcon; if (num<10) { strNum = *cString::sprintf("%d", num); draw = true; @@ -701,10 +702,10 @@ void cRecMenuItemText::ActivateKeyboard(void) { } if (drawIcon) { int iconSize = gridHeight - 10; - if (imgLoader.LoadIcon(strIcon, iconSize)) { - cImage icon = imgLoader.GetImage(); + cImage *imgIcon = imgCache.GetIcon(strIcon, iconSize, iconSize); + if (imgIcon) { int iconX = X + (gridWidth - iconSize) / 2; - pixmapKeyboardIcons->DrawImage(cPoint(iconX, Y + 5), icon); + pixmapKeyboardIcons->DrawImage(cPoint(iconX, Y + 5), *imgIcon); } } num++; @@ -1306,6 +1307,7 @@ cRecMenuItemTimer::cRecMenuItemTimer(const cTimer *timer, eRecMenuState action1, eRecMenuState action2, eRecMenuState action3, + eRecMenuState action4, time_t conflictStart, time_t conflictStop, time_t overlapStart, @@ -1316,6 +1318,7 @@ cRecMenuItemTimer::cRecMenuItemTimer(const cTimer *timer, this->action = action1; this->action2 = action2; this->action3 = action3; + this->action4 = action4; iconActive = 0; this->conflictStart = conflictStart; this->conflictStop = conflictStop; @@ -1382,48 +1385,57 @@ void cRecMenuItemTimer::Draw(void) { int textHeightLine2 = height/2 - 5 + (height/4 - fontSmall->Height()) / 2; int textHeightLine3 = 3*height/4 - 5 + (height/4 - fontSmall->Height()) / 2; const cEvent *event = timer->Event(); - cString timerTitle(""); - if (event) + std::string timerTitle = ""; + if (event) { timerTitle = event->Title(); + timerTitle = CutText(timerTitle, (70 * width / 100) - textX, font); + } cString timeStart = DayDateTime(timer->StartTime()); cString timeEnd = TimeString(timer->StopTime()); cString timerTime = cString::sprintf("%s - %s", *timeStart, *timeEnd); cString channelInfo = cString::sprintf("%s, %s %d", *channelName, tr("Transp."), channelTransponder); - pixmap->DrawText(cPoint(textX, textHeightLine1), *timerTitle, theme.Color(clrFont), colorTextBack, font); - pixmap->DrawText(cPoint(textX, textHeightLine2), *timerTime, theme.Color(clrFont), colorTextBack, fontSmall); - pixmap->DrawText(cPoint(textX, textHeightLine3), *channelInfo, theme.Color(clrFont), colorTextBack, fontSmall); + pixmapIcons->DrawText(cPoint(textX, textHeightLine1), timerTitle.c_str(), colorText, colorTextBack, font); + pixmapIcons->DrawText(cPoint(textX, textHeightLine2), *timerTime, colorText, colorTextBack, fontSmall); + pixmapIcons->DrawText(cPoint(textX, textHeightLine3), *channelInfo, colorText, colorTextBack, fontSmall); DrawTimerConflict(); } int cRecMenuItemTimer::DrawIcons(void) { int iconsX = 10; - int iconSize = 64; + int iconSize = height/2; int iconY = (height - iconSize) / 2; - cString iconInfo, iconDelete, iconEdit; + std::string iconInfo, iconDelete, iconEdit, iconSearch; if (active) { iconInfo = (iconActive==0)?"info_active":"info_inactive"; iconDelete = (iconActive==1)?"delete_active":"delete_inactive"; iconEdit = (iconActive==2)?"edit_active":"edit_inactive"; + iconSearch = (iconActive==3)?"search_active":"search_inactive"; } else { iconInfo = "info_inactive"; iconDelete = "delete_inactive"; iconEdit = "edit_inactive"; + iconSearch = "search_inactive"; } - cImageLoader imgLoader; - if (imgLoader.LoadIcon(iconInfo, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapIcons->DrawImage(cPoint(iconsX, iconY), icon); + + cImage *imgInfo = imgCache.GetIcon(iconInfo, iconSize, iconSize); + if (imgInfo) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgInfo); iconsX += iconSize + 5; } - if (imgLoader.LoadIcon(iconDelete, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapIcons->DrawImage(cPoint(iconsX, iconY), icon); + cImage *imgDelete = imgCache.GetIcon(iconDelete, iconSize, iconSize); + if (imgDelete) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgDelete); iconsX += iconSize + 5; } - if (imgLoader.LoadIcon(iconEdit, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapIcons->DrawImage(cPoint(iconsX, iconY), icon); + cImage *imgEdit = imgCache.GetIcon(iconEdit, iconSize, iconSize); + if (imgEdit) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgEdit); + iconsX += iconSize + 5; + } + cImage *imgSearch = imgCache.GetIcon(iconSearch, iconSize, iconSize); + if (imgSearch) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgSearch); iconsX += iconSize + 5; } return iconsX; @@ -1461,7 +1473,7 @@ eRecMenuState cRecMenuItemTimer::ProcessKey(eKeys Key) { return rmsNotConsumed; break; case kRight: - if (iconActive < 2) { + if (iconActive < 3) { iconActive++; DrawIcons(); return rmsConsumed; @@ -1475,6 +1487,8 @@ eRecMenuState cRecMenuItemTimer::ProcessKey(eKeys Key) { return action2; else if (iconActive == 2) return action3; + else if (iconActive == 3) + return action4; break; default: break; @@ -1521,6 +1535,7 @@ void cRecMenuItemTimerConflictHeader::Show(void) { void cRecMenuItemTimerConflictHeader::setBackground(void) { pixmap->Fill(clrTransparent); + cRecMenuItem::setBackground(); } void cRecMenuItemTimerConflictHeader::Draw(void) { @@ -1550,10 +1565,10 @@ void cRecMenuItemTimerConflictHeader::Draw(void) { int xConflStop = width - fontSmall->Width(*strConflStop) - 2; int xOverlapStart = xOverlap - fontSmall->Width(*strOverlapStart) - 2; int xOverlapStop = xOverlap + widthOverlap + 2; - pixmap->DrawText(cPoint(xConflStart, y1), *strConflStart, theme.Color(clrRecMenuTimerConflictBar), colorTextBack, fontSmall); - pixmap->DrawText(cPoint(xConflStop, y1), *strConflStop, theme.Color(clrRecMenuTimerConflictBar), colorTextBack, fontSmall); - pixmap->DrawText(cPoint(xOverlapStart, y2), *strOverlapStart, theme.Color(clrRecMenuTimerConflictOverlap), colorTextBack, fontSmall); - pixmap->DrawText(cPoint(xOverlapStop, y2), *strOverlapStop, theme.Color(clrRecMenuTimerConflictOverlap), colorTextBack, fontSmall); + pixmap->DrawText(cPoint(xConflStart, y1), *strConflStart, theme.Color(clrRecMenuTimerConflictBar), theme.Color(clrRecMenuTimerConflictBackground), fontSmall); + pixmap->DrawText(cPoint(xConflStop, y1), *strConflStop, theme.Color(clrRecMenuTimerConflictBar), theme.Color(clrRecMenuTimerConflictBackground), fontSmall); + pixmap->DrawText(cPoint(xOverlapStart, y2), *strOverlapStart, theme.Color(clrRecMenuTimerConflictOverlap), theme.Color(clrRecMenuTimerConflictBackground), fontSmall); + pixmap->DrawText(cPoint(xOverlapStop, y2), *strOverlapStop, theme.Color(clrRecMenuTimerConflictOverlap), theme.Color(clrRecMenuTimerConflictBackground), fontSmall); } // --- cRecMenuItemEvent ------------------------------------------------------- @@ -1631,9 +1646,9 @@ void cRecMenuItemEvent::Draw(void) { int cRecMenuItemEvent::DrawIcons(void) { pixmapIcons->Fill(clrTransparent); int iconsX = 10; - int iconSize = 64; + int iconSize = height / 2; int iconY = (height - iconSize) / 2; - cString iconInfo, iconRecord; + std::string iconInfo, iconRecord; if (active) { iconInfo = (iconActive==0)?"info_active":"info_inactive"; if (action2 != rmsDisabled) @@ -1643,17 +1658,18 @@ int cRecMenuItemEvent::DrawIcons(void) { if (action2 != rmsDisabled) iconRecord = "record_inactive"; } - cImageLoader imgLoader; - if (imgLoader.LoadIcon(iconInfo, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapIcons->DrawImage(cPoint(iconsX, iconY), icon); - iconsX += iconSize + 5; - } - if ((action2 != rmsDisabled) && imgLoader.LoadIcon(iconRecord, iconSize)) { - cImage icon = imgLoader.GetImage(); - pixmapIcons->DrawImage(cPoint(iconsX, iconY), icon); + cImage *imgInfo = imgCache.GetIcon(iconInfo, iconSize, iconSize); + if (imgInfo) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgInfo); iconsX += iconSize + 5; } + if (action2 != rmsDisabled) { + cImage *imgRec = imgCache.GetIcon(iconRecord, iconSize, iconSize); + if (imgRec) { + pixmapIcons->DrawImage(cPoint(iconsX, iconY), *imgRec); + iconsX += iconSize + 5; + } + } return iconsX; } diff --git a/recmenuitem.h b/recmenuitem.h index 99022d5..8d8ad95 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -18,6 +18,7 @@ enum eRecMenuState { rmsIgnoreTimerConflict, rmsDeleteTimerConflictMenu, rmsEditTimerConflictMenu, + rmsSearchRerunsTimerConflictMenu, rmsSaveTimerConflictMenu, rmsTimerConflictShowInfo, rmsDeleteTimer, @@ -51,6 +52,8 @@ enum eRecMenuState { rmsRecordingSearchResult, rmsTimerConflict, rmsTimerConflicts, + rmsTimerConflictIgnoreReruns, + rmsTimerConflictRecordRerun, rmsDisabled, }; @@ -331,6 +334,7 @@ private: const cTimer *timer; eRecMenuState action2; eRecMenuState action3; + eRecMenuState action4; int iconActive; cPixmap *pixmapIcons; cPixmap *pixmapStatus; @@ -345,6 +349,7 @@ public: eRecMenuState action1, eRecMenuState action2, eRecMenuState action3, + eRecMenuState action4, time_t conflictStart, time_t conflictStop, time_t overlapStart, diff --git a/recmenumanager.c b/recmenumanager.c index 20b7ee8..5162478 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -1,6 +1,7 @@ #include "recmenu.h" #include "recmenus.h" #include "switchtimer.h" +#include "timerconflict.h" #include "recmenumanager.h" cRecMenuManager::cRecMenuManager(void) { @@ -11,10 +12,11 @@ cRecMenuManager::cRecMenuManager(void) { recManager->SetEPGSearchPlugin(); instantRecord = false; folderChoosen = false; - currentConflict = -1; + timerConflicts = NULL; templateID = -1; timer = NULL; - recFolder = ""; + recFolderSeriesTimer = ""; + recFolderInstantTimer = ""; searchWithOptions = false; detailViewActive = false; } @@ -25,6 +27,10 @@ cRecMenuManager::~cRecMenuManager(void) { delete activeMenu; activeMenu = NULL; } + if (timerConflicts) { + delete timerConflicts; + timerConflicts = NULL; + } delete recManager; } @@ -33,10 +39,11 @@ void cRecMenuManager::Start(const cEvent *event) { activeMenuBuffer = NULL; instantRecord = false; folderChoosen = false; - currentConflict = -1; + timerConflicts = NULL; templateID = -1; timer = NULL; - recFolder = ""; + recFolderSeriesTimer = ""; + recFolderInstantTimer = ""; searchWithOptions = false; detailViewActive = false; SetBackground(); @@ -53,6 +60,10 @@ void cRecMenuManager::Close(void) { delete activeMenu; activeMenu = NULL; } + if (timerConflicts) { + delete timerConflicts; + timerConflicts = NULL; + } DeleteBackground(); } @@ -83,14 +94,14 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { //Creating timer for active Event //if no conflict, confirm and exit instantRecord = true; - cString folder = ""; + recFolderInstantTimer = ""; if (folderChoosen) { int activeItem = activeMenu->GetActive(false); if (activeItem > 0) - folder = activeMenu->GetStringValue(activeItem); + recFolderInstantTimer = activeMenu->GetStringValue(activeItem); } delete activeMenu; - cTimer *timer = recManager->createTimer(event, *folder); + cTimer *timer = recManager->createTimer(event, *recFolderInstantTimer); if (!displayTimerConflict(timer)) { activeMenu = new cRecMenuConfirmTimer(event); activeMenu->Display(); @@ -116,7 +127,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { break; case rmsTimerConflictShowInfo: { int timerIndex = activeMenu->GetActive(true); - int timerID = conflictList[currentConflict].timerIDs[timerIndex]; + int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); cTimer *t = Timers.Get(timerID); if (t) { const cEvent *ev = t->Event(); @@ -135,7 +146,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { //delete timer out of current timer conflict //active menu: cRecMenuTimerConflict int timerIndex = activeMenu->GetActive(true); - int timerID = conflictList[currentConflict].timerIDs[timerIndex]; + int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); recManager->DeleteTimer(timerID); delete activeMenu; if (!displayTimerConflict(timerID)) { @@ -146,8 +157,8 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { case rmsEditTimerConflictMenu: { //edit timer out of current timer conflict //active menu: cRecMenuTimerConflict - int activeItem = activeMenu->GetActive(true); - int timerID = conflictList[currentConflict].timerIDs[activeItem]; + int timerIndex = activeMenu->GetActive(true); + int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex); timer = Timers.Get(timerID); if (timer) { delete activeMenu; @@ -201,11 +212,11 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { * --------- SERIES TIMER --------------------------------- */ case rmsSeriesTimer: { - recFolder = ""; + recFolderSeriesTimer = ""; if (folderChoosen) { int activeItem = activeMenu->GetActive(false); if (activeItem > 0) - recFolder = activeMenu->GetStringValue(activeItem); + recFolderSeriesTimer = activeMenu->GetStringValue(activeItem); } delete activeMenu; cChannel *channel = Channels.GetByChannelID(event->ChannelID()); @@ -220,7 +231,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { activeMenu->Display(); break; case rmsSeriesTimerCreate: { - cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu, *recFolder); + cTimer *seriesTimer = recManager->CreateSeriesTimer(activeMenu, *recFolderSeriesTimer); delete activeMenu; activeMenu = new cRecMenuConfirmSeriesTimer(seriesTimer); activeMenu->Display(); @@ -438,25 +449,79 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) { case rmsTimerConflicts: { //Show timer conflict //active menu: cRecMenuTimerConflicts - conflictList = recManager->CheckTimerConflict(); + if (timerConflicts) { + delete timerConflicts; + } + timerConflicts = recManager->CheckTimerConflict(); delete activeMenu; - int numConflicts = conflictList.size(); + int numConflicts = timerConflicts->NumConflicts(); if (numConflicts > 0) { - activeMenu = new cRecMenuTimerConflicts(conflictList); + activeMenu = new cRecMenuTimerConflicts(timerConflicts); } else { activeMenu = new cRecMenuNoTimerConflict(); } activeMenu->Display(); break; } - case rmsTimerConflict: + case rmsTimerConflict: { //Show timer conflict //active menu: cRecMenuTimerConflicts - currentConflict = activeMenu->GetActive(true); + if (!timerConflicts) + break; + timerConflicts->SetCurrentConflict(activeMenu->GetActive(true)); delete activeMenu; - activeMenu = new cRecMenuTimerConflict(conflictList[currentConflict]); + activeMenu = new cRecMenuTimerConflict(timerConflicts->GetCurrentConflict()); activeMenu->Display(); - break; - + break; } + case rmsSearchRerunsTimerConflictMenu: { + //Show reruns for timer from timer conflict + //active menu: cRecMenuTimerConflict + if (!timerConflicts) + break; + int activeItem = activeMenu->GetActive(true); + int timerID = timerConflicts->GetCurrentConflictTimerID(activeItem); + timer = Timers.Get(timerID); + if (timer) { + const cEvent *event = timer->Event(); + if (event) { + int numReruns = 0; + const cEvent **reruns = recManager->LoadReruns(event, numReruns); + if (reruns && (numReruns > 0)) { + activeMenuBuffer = activeMenu; + activeMenuBuffer->Hide(); + activeMenu = new cRecMenuRerunResults(event, reruns, numReruns); + activeMenu->Display(); + } else { + activeMenuBuffer = activeMenu; + activeMenuBuffer->Hide(); + activeMenu = new cRecMenuNoRerunsFound((event->Title())?event->Title():""); + activeMenu->Display(); + } + } + } + break; } + case rmsTimerConflictIgnoreReruns: { + delete activeMenu; + activeMenu = activeMenuBuffer; + activeMenuBuffer = NULL; + activeMenu->Show(); + break; } + case rmsTimerConflictRecordRerun: { + const cEvent *replace = activeMenu->GetEventValue(activeMenu->GetActive(false)); + int originalConflictIndex = activeMenuBuffer->GetActive(false); + int originalTimerID = timerConflicts->GetCurrentConflictTimerID(originalConflictIndex); + cTimer *timerOriginal = Timers.Get(originalTimerID); + if (replace && timerOriginal) { + recManager->DeleteTimer(timerOriginal->Event()); + recManager->createTimer(replace, *recFolderInstantTimer); + delete activeMenu; + if (activeMenuBuffer) { + delete activeMenuBuffer; + activeMenuBuffer = NULL; + } + activeMenu = new cRecMenuConfirmRerunUsed(timerOriginal->Event(), replace); + activeMenu->Display(); + } + break; } /* * --------- COMMON --------------------------------- */ @@ -489,20 +554,18 @@ bool cRecMenuManager::displayTimerConflict(cTimer *timer) { } bool cRecMenuManager::displayTimerConflict(int timerID) { - conflictList = recManager->CheckTimerConflict(); - int numConflicts = conflictList.size(); - int showTimerConflict = -1; - if (numConflicts > 0) { - for (int i=0; iCheckTimerConflict(); + if (!timerConflicts) + return false; + int showTimerConflict = timerConflicts->GetCorrespondingConflict(timerID); if (showTimerConflict > -1) { - currentConflict = showTimerConflict; - activeMenu = new cRecMenuTimerConflict(conflictList[currentConflict]); + timerConflicts->SetCurrentConflict(showTimerConflict); + cTVGuideTimerConflict *conflict = timerConflicts->GetCurrentConflict(); + if (!conflict) + return false; + activeMenu = new cRecMenuTimerConflict(conflict); activeMenu->Display(); return true; } diff --git a/recmenumanager.h b/recmenumanager.h index c000686..36a94ad 100644 --- a/recmenumanager.h +++ b/recmenumanager.h @@ -13,15 +13,15 @@ private: cRecMenu *activeMenuBuffer; const cEvent *event; cRecManager *recManager; - std::vector conflictList; + cTVGuideTimerConflicts *timerConflicts; std::vector epgSearchTemplates; bool instantRecord; bool folderChoosen; - int currentConflict; + cString recFolderInstantTimer; int templateID; bool searchWithOptions; cTimer *timer; - cString recFolder; + cString recFolderSeriesTimer; cString searchString; cDetailView *detailView; cPixmap *pixmapBackground; diff --git a/recmenus.c b/recmenus.c index f3eff0d..9ac7c59 100644 --- a/recmenus.c +++ b/recmenus.c @@ -177,20 +177,23 @@ cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) { } // --- cRecMenuTimerConflicts --------------------------------------------------------- -cRecMenuTimerConflicts::cRecMenuTimerConflicts(std::vector conflicts) { - int numConflicts = conflicts.size(); +cRecMenuTimerConflicts::cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts) { + int numConflicts = conflicts->NumConflicts(); cString text; if (numConflicts == 1) { text = cString::sprintf("%s %s %s", tr("One"), tr("Timer Conflict"), tr("detected")); } else { - text = cString::sprintf("%d %s %s", (int)conflicts.size(), tr("Timer Conflicts"), tr("detected")); + text = cString::sprintf("%d %s %s", conflicts->NumConflicts(), tr("Timer Conflicts"), tr("detected")); } cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); for (int i=0; iGetConflict(i); + if (!conflict) + continue; + cString dateTime = DayDateTime(conflict->time); + int numTimers = conflict->timerIDs.size(); cString textConflict = cString::sprintf("%s: %s (%d %s)", tr("Show conflict"), *dateTime, numTimers, tr("timers involved")); bool isActive = (i==0)?true:false; AddMenuItem(new cRecMenuItemButton(*textConflict, rmsTimerConflict, isActive)); @@ -207,26 +210,27 @@ cRecMenuTimerConflicts::cRecMenuTimerConflicts(std::vector } // --- cRecMenuTimerConflict --------------------------------------------------------- -cRecMenuTimerConflict::cRecMenuTimerConflict(TVGuideTimerConflict conflict) { - SetWidthPercent(80); +cRecMenuTimerConflict::cRecMenuTimerConflict(cTVGuideTimerConflict *conflict) { + SetWidthPercent(95); this->conflict = conflict; - SetHeader(new cRecMenuItemTimerConflictHeader(conflict.timeStart, - conflict.timeStop, - conflict.overlapStart, - conflict.overlapStop)); + SetHeader(new cRecMenuItemTimerConflictHeader(conflict->timeStart, + conflict->timeStop, + conflict->overlapStart, + conflict->overlapStop)); SetFooter(new cRecMenuItemButton(tr("Ignore Conflict"), rmsIgnoreTimerConflict, false, true)); int i=0; - for(std::vector::iterator it = conflict.timerIDs.begin(); it != conflict.timerIDs.end(); it++) { + for(std::vector::iterator it = conflict->timerIDs.begin(); it != conflict->timerIDs.end(); it++) { const cTimer *timer = Timers.Get(*it); if (timer) { AddMenuItemScroll(new cRecMenuItemTimer( timer, rmsTimerConflictShowInfo, rmsDeleteTimerConflictMenu, - rmsEditTimerConflictMenu, - conflict.timeStart, - conflict.timeStop, - conflict.overlapStart, - conflict.overlapStop, + rmsEditTimerConflictMenu, + rmsSearchRerunsTimerConflictMenu, + conflict->timeStart, + conflict->timeStop, + conflict->overlapStart, + conflict->overlapStop, (!i)?true:false) ); i++; @@ -240,16 +244,17 @@ cRecMenuTimerConflict::cRecMenuTimerConflict(TVGuideTimerConflict conflict) { } cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) { - if ((number >= 0) && (number < conflict.timerIDs.size())) { - const cTimer *timer = Timers.Get(conflict.timerIDs[number]); + if ((number >= 0) && (number < conflict->timerIDs.size())) { + const cTimer *timer = Timers.Get(conflict->timerIDs[number]); cRecMenuItem *result = new cRecMenuItemTimer( timer, rmsTimerConflictShowInfo, rmsDeleteTimerConflictMenu, - rmsEditTimerConflictMenu, - conflict.timeStart, - conflict.timeStop, - conflict.overlapStart, - conflict.overlapStop, + rmsEditTimerConflictMenu, + rmsSearchRerunsTimerConflictMenu, + conflict->timeStart, + conflict->timeStop, + conflict->overlapStart, + conflict->overlapStop, false); return result; } @@ -257,7 +262,7 @@ cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) { } int cRecMenuTimerConflict::GetTotalNumMenuItems(void) { - return conflict.timerIDs.size(); + return conflict->timerIDs.size(); } // --- cRecMenuNoTimerConflict --------------------------------------------------------- @@ -273,6 +278,90 @@ cRecMenuNoTimerConflict::cRecMenuNoTimerConflict(void) { Arrange(); } +// --- cRecMenuRerunResults --------------------------------------------------------- +cRecMenuRerunResults::cRecMenuRerunResults(const cEvent *original, const cEvent **reruns, int numReruns) { + this->reruns = reruns; + this->numReruns = numReruns; + SetWidthPercent(70); + this->numReruns = numReruns; + cString message1 = tr("reruns for"); + cString message2 = tr("rerun for"); + cString message3 = tr("found"); + cString infoText = cString::sprintf("%d %s:\n\"%s\" %s", numReruns, (numReruns>1)?(*message1):(*message2), original->Title(), *message3); + cRecMenuItem *infoItem = new cRecMenuItemInfo(*infoText); + infoItem->CalculateHeight(width - 2 * border); + SetHeader(infoItem); + + cRecMenuItem *button = new cRecMenuItemButton(tr("Ignore reruns"), rmsTimerConflictIgnoreReruns, false); + SetFooter(button); + + if (reruns && (numReruns > 0)) { + for (int i=0; i= 0) && (number < numReruns)) { + cRecMenuItem *result = new cRecMenuItemEvent(reruns[number], rmsSearchShowInfo, rmsTimerConflictRecordRerun, false); + return result; + } + return NULL; +} + +int cRecMenuRerunResults::GetTotalNumMenuItems(void) { + return numReruns; +} + +// --- cRecMenuNoRerunsFound --------------------------------------------------------- +cRecMenuNoRerunsFound::cRecMenuNoRerunsFound(cString searchString) { + SetWidthPercent(50); + cString message = tr("No reruns found for Event"); + cString text = cString::sprintf("%s\n\"%s\"", + *message, + *searchString); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsTimerConflictIgnoreReruns, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} + +// --- cRecMenuConfirmRerunUsed --------------------------------------------------------- +cRecMenuConfirmRerunUsed::cRecMenuConfirmRerunUsed(const cEvent *original, const cEvent *replace) { + SetWidthPercent(70); + cString channelOrig = Channels.GetByChannelID(original->ChannelID())->Name(); + cString channelReplace = Channels.GetByChannelID(replace->ChannelID())->Name(); + cString message1 = tr("Timer for"); + cString message2 = tr("replaced by rerun"); + cString text = cString::sprintf("%s\n\"%s\", %s %s, %s\n%s\n\"%s\", %s %s, %s", + *message1, + original->Title(), + *original->GetDateString(), + *original->GetTimeString(), + *channelOrig, + *message2, + replace->Title(), + *replace->GetDateString(), + *replace->GetTimeString(), + *channelReplace); + cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*text); + infoItem->CalculateHeight(width - 2 * border); + AddMenuItem(infoItem); + AddMenuItem(new cRecMenuItemButton(tr("OK"), rmsTimerConflicts, true, true)); + CalculateHeight(); + CreatePixmap(); + Arrange(); +} + // --- cRecMenuEditTimer --------------------------------------------------------- cRecMenuEditTimer::cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState) { SetWidthPercent(60); diff --git a/recmenus.h b/recmenus.h index def944d..5b7c485 100644 --- a/recmenus.h +++ b/recmenus.h @@ -51,16 +51,16 @@ public: // --- cRecMenuTimerConflicts --------------------------------------------------------- class cRecMenuTimerConflicts: public cRecMenu { public: - cRecMenuTimerConflicts(std::vector conflicts); + cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts); virtual ~cRecMenuTimerConflicts(void) {}; }; // --- cRecMenuTimerConflict --------------------------------------------------------- class cRecMenuTimerConflict: public cRecMenu { private: - TVGuideTimerConflict conflict; + cTVGuideTimerConflict *conflict; public: - cRecMenuTimerConflict(TVGuideTimerConflict conflict); + cRecMenuTimerConflict(cTVGuideTimerConflict *conflict); cRecMenuItem *GetMenuItem(int number); int GetTotalNumMenuItems(void); virtual ~cRecMenuTimerConflict(void) {}; @@ -73,6 +73,34 @@ public: virtual ~cRecMenuNoTimerConflict(void) {}; }; +// --- cRecMenuRerunResults --------------------------------------------------------- +class cRecMenuRerunResults: public cRecMenu { +private: + const cEvent **reruns; + int numReruns; +public: + cRecMenuRerunResults(const cEvent *original, const cEvent **reruns, int numReruns); + cRecMenuItem *GetMenuItem(int number); + int GetTotalNumMenuItems(void); + virtual ~cRecMenuRerunResults(void) { + delete[] reruns; + }; +}; + +// --- cRecMenuNoRerunsFound --------------------------------------------------------- +class cRecMenuNoRerunsFound: public cRecMenu { +public: + cRecMenuNoRerunsFound(cString searchString); + virtual ~cRecMenuNoRerunsFound(void) {}; +}; + +// --- cRecMenuConfirmRerunUsed --------------------------------------------------------- +class cRecMenuConfirmRerunUsed: public cRecMenu { +public: + cRecMenuConfirmRerunUsed(const cEvent *original, const cEvent *replace); + virtual ~cRecMenuConfirmRerunUsed(void) {}; +}; + // --- cRecMenuEditTimer --------------------------------------------------------- class cRecMenuEditTimer: public cRecMenu { public: @@ -229,8 +257,6 @@ public: virtual ~cRecMenuSearchNothingFound(void) {}; }; - - // --- cRecMenuRecordingSearch --------------------------------------------------------- class cRecMenuRecordingSearch: public cRecMenu { private: diff --git a/setup.c b/setup.c index 6463fd3..b0c9a1f 100644 --- a/setup.c +++ b/setup.c @@ -364,6 +364,7 @@ void cMenuSetupImageCache::Set(void) { Add(InfoItem(tr("Logo cache"), (imgCache.GetCacheSize(ctLogo)).c_str())); Add(InfoItem(tr("EPG Grid Cache"), (imgCache.GetCacheSize(ctGrid)).c_str())); Add(InfoItem(tr("Channel Groups Cache"), (imgCache.GetCacheSize(ctChannelGroup)).c_str())); + Add(InfoItem(tr("Recording Menus Icon Cache"), (imgCache.GetCacheSize(ctIcon)).c_str())); SetCurrent(Get(currentItem)); Display(); diff --git a/timerconflict.c b/timerconflict.c new file mode 100644 index 0000000..3488487 --- /dev/null +++ b/timerconflict.c @@ -0,0 +1,167 @@ +#include +#include +#include +#include "tools.h" +#include "timer.h" +#include "timerconflict.h" + +cTVGuideTimerConflict::cTVGuideTimerConflict(void) { + time = 0; + timeStart = 0; + timeStop = 0; + overlapStart = 0; + overlapStop = 0; + percentPossible = 0; + timerID = 0; +} + +cTVGuideTimerConflict::~cTVGuideTimerConflict(void) { + +} + +bool cTVGuideTimerConflict::timerInvolved(int involvedID) { + int numConflicts = timerIDs.size(); + for (int i=0; i::const_iterator it = conflicts.begin(); it != conflicts.end(); it++) { + cTVGuideTimerConflict *conf = *it; + delete conf; + } + conflicts.clear(); +} + +void cTVGuideTimerConflicts::AddConflict(std::string epgSearchConflictLine) { + /* TIMERCONFLICT FORMAT: + The result list looks like this for example when we have 2 timer conflicts at one time: + 1190232780:152|30|50#152#45:45|10|50#152#45 + '1190232780' is the time of the conflict in seconds since 1970-01-01. + It's followed by list of timers that have a conflict at this time: + '152|30|50#1 int editTimer(cTimer *timer, bool active, int prio, int start, int stop); + 52#45' is the description of the first conflicting timer. Here: + '152' is VDR's timer id of this timer as returned from VDR's LSTT command + '30' is the percentage of recording that would be done (0...100) + '50#152#45' is the list of concurrent timers at this conflict + '45|10|50#152#45' describes the next conflict + */ + cTVGuideTimerConflict *conflict = new cTVGuideTimerConflict(); + splitstring s(epgSearchConflictLine.c_str()); + std::vector flds = s.split(':'); + if (flds.size() < 2) + return; + conflict->time = atoi(flds[0].c_str()); + splitstring s2(flds[1].c_str()); + std::vector flds2 = s2.split('|'); + if (flds2.size() < 3) + return; + conflict->timerID = atoi(flds2[0].c_str()); + conflict->percentPossible = atoi(flds2[1].c_str()); + splitstring s3(flds2[2].c_str()); + std::vector flds3 = s3.split('#'); + std::vector timerIDs; + for (int k = 0; k < flds3.size(); k++) { + timerIDs.push_back(atoi(flds3[k].c_str()) - 1); + } + conflict->timerIDs = timerIDs; + conflicts.push_back(conflict); +} + +void cTVGuideTimerConflicts::CalculateConflicts(void) { + numConflicts = conflicts.size(); + time_t startTime = 0; + time_t endTime = 0; + for (int i=0; i < numConflicts; i++) { + cTimeInterval *unionSet = NULL; + int numTimers = conflicts[i]->timerIDs.size(); + for (int j=0; j < numTimers; j++) { + const cTimer *timer = Timers.Get(conflicts[i]->timerIDs[j]); + if (timer) { + if (!unionSet) { + unionSet = new cTimeInterval(timer->StartTime(), timer->StopTime()); + } else { + cTimeInterval *timerInterval = new cTimeInterval(timer->StartTime(), timer->StopTime()); + cTimeInterval *newUnion = unionSet->Union(timerInterval); + delete unionSet; + delete timerInterval; + unionSet = newUnion; + } + } + } + conflicts[i]->timeStart = unionSet->Start(); + conflicts[i]->timeStop = unionSet->Stop(); + delete unionSet; + + cTimeInterval *intersect = NULL; + for (int j=0; j < numTimers; j++) { + const cTimer *timer = Timers.Get(conflicts[i]->timerIDs[j]); + if (timer) { + if (!intersect) { + intersect = new cTimeInterval(timer->StartTime(), timer->StopTime()); + } else { + cTimeInterval *timerInterval = new cTimeInterval(timer->StartTime(), timer->StopTime()); + cTimeInterval *newIntersect = intersect->Intersect(timerInterval); + if (newIntersect) { + delete intersect; + intersect = newIntersect; + } + delete timerInterval; + } + } + } + conflicts[i]->overlapStart = intersect->Start(); + conflicts[i]->overlapStop = intersect->Stop(); + delete intersect; + } +} + +cTVGuideTimerConflict *cTVGuideTimerConflicts::GetCurrentConflict(void) { + if (currentConflict < 0) + return NULL; + if (currentConflict > (numConflicts-1)) + return NULL; + return conflicts[currentConflict]; +} + +int cTVGuideTimerConflicts::GetCurrentConflictTimerID(int timerIndex) { + if (currentConflict < 0) + return -1; + if (currentConflict > (numConflicts-1)) + return -1; + int numTimersInConflict = conflicts[currentConflict]->timerIDs.size(); + if (timerIndex > (numTimersInConflict - 1)) + return -1; + return conflicts[currentConflict]->timerIDs[timerIndex]; +} + +int cTVGuideTimerConflicts::GetCorrespondingConflict(int timerID) { + int conflictIndex = -1; + if (numConflicts > 0) { + for (int i=0; itimerInvolved(timerID)) { + conflictIndex = i; + break; + } + } + } + return conflictIndex; +} + +cTVGuideTimerConflict *cTVGuideTimerConflicts::GetConflict(int conflictIndex) { + if (conflictIndex < 0) + return NULL; + if (conflictIndex > (numConflicts-1)) + return NULL; + return conflicts[conflictIndex]; +} diff --git a/timerconflict.h b/timerconflict.h new file mode 100644 index 0000000..dc7c98f --- /dev/null +++ b/timerconflict.h @@ -0,0 +1,37 @@ +#ifndef __TVGUIDE_TIMERCONFLICT_H +#define __TVGUIDE_TIMERCONFLICT_H + +class cTVGuideTimerConflict { +public: + cTVGuideTimerConflict(void); + virtual ~cTVGuideTimerConflict(void); + time_t time; + time_t timeStart; + time_t timeStop; + time_t overlapStart; + time_t overlapStop; + int percentPossible; + int timerID; + std::vector timerIDs; + bool timerInvolved(int involvedID); +}; + +class cTVGuideTimerConflicts { +private: + std::vector conflicts; + int numConflicts; + int currentConflict; +public: + cTVGuideTimerConflicts(void); + virtual ~cTVGuideTimerConflicts(void); + void AddConflict(std::string epgSearchConflictLine); + void CalculateConflicts(void); + int NumConflicts(void) {return numConflicts; }; + void SetCurrentConflict(int current) { currentConflict = current; }; + cTVGuideTimerConflict *GetCurrentConflict(void); + int GetCurrentConflictTimerID(int timerIndex); + int GetCorrespondingConflict(int timerID); + cTVGuideTimerConflict *GetConflict(int conflictIndex); +}; + +#endif //__TVGUIDE_RECMMANAGER_H \ No newline at end of file