diff --git a/HISTORY b/HISTORY index 7142c3f..9950b38 100644 --- a/HISTORY +++ b/HISTORY @@ -46,3 +46,4 @@ VDR Plugin 'tvguide' Revision History Version 0.0.6 - added frame around scaled video picture - added theme "keep it simple" (thanks @saman) +- display of additional EPG pictures in detailed epg view diff --git a/channelgroup.c b/channelgroup.c index a089210..889318e 100644 --- a/channelgroup.c +++ b/channelgroup.c @@ -60,7 +60,7 @@ void cChannelGroupGrid::Draw(void) { int x = (Width() - textWidth) / 2; pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, tvguideConfig.FontChannelGroups); } else if (tvguideConfig.displayMode == eHorizontal) { - std::string nameUpper = name; + std::string nameUpper = name; std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); int numChars = nameUpper.length(); int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height(); diff --git a/channelgroup.h b/channelgroup.h index 62589b0..880f24b 100644 --- a/channelgroup.h +++ b/channelgroup.h @@ -35,4 +35,4 @@ public: }; -#endif //__TVGUIDE_CHANNELGROUP_H +#endif //__TVGUIDE_CHANNELGROUP_H \ No newline at end of file diff --git a/config.c b/config.c index 234091a..ac767fa 100644 --- a/config.c +++ b/config.c @@ -56,6 +56,9 @@ cTvguideConfig::cTvguideConfig() { hideEpgImages = 0; epgImageWidth = 315; epgImageHeight = 240; + numAdditionalEPGPictures = 9; + epgImageWidthLarge = 525; + epgImageHeightLarge = 400; fontIndex = 0; fontNameDefault = "VDRSymbols Sans:Book"; FontButtonDelta = 0; @@ -262,6 +265,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value); else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value); + else if (strcmp(Name, "numAdditionalEPGPictures") == 0) numAdditionalEPGPictures = atoi(Value); + else if (strcmp(Name, "epgImageWidthLarge") == 0) epgImageWidthLarge = atoi(Value); + else if (strcmp(Name, "epgImageHeightLarge") == 0) epgImageHeightLarge = atoi(Value); else if (strcmp(Name, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value); else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value); else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value); diff --git a/config.h b/config.h index 39f91fe..3269e50 100644 --- a/config.h +++ b/config.h @@ -57,6 +57,9 @@ class cTvguideConfig { int hideEpgImages; int epgImageWidth; int epgImageHeight; + int numAdditionalEPGPictures; + int epgImageWidthLarge; + int epgImageHeightLarge; cString epgImagePath; int fontIndex; const char *fontNameDefault; diff --git a/detailview.c b/detailview.c index b014b11..f06229f 100644 --- a/detailview.c +++ b/detailview.c @@ -9,12 +9,14 @@ cDetailView::cDetailView(cGrid *grid) { FrameTime = 40; // ms FadeTime = 500; // ms borderWidth = 100; //px + scrollBarWidth = 40; headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines 40 + tvguideConfig.epgImageHeight); description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40); if (tvguideConfig.displayRerunsDetailEPGView) { - LoadReruns(); + loadReruns(); } + numEPGPics = 0; contentScrollable = setContentDrawportHeight(); createPixmaps(); } @@ -35,6 +37,9 @@ bool cDetailView::setContentDrawportHeight() { linesContent += reruns.Lines() + 1; } heightContent = linesContent * tvguideConfig.FontDetailView->Height(); + if (!tvguideConfig.hideEpgImages) { + heightContent += heightEPGPics(); + } if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight)) return true; else @@ -42,8 +47,6 @@ bool cDetailView::setContentDrawportHeight() { } void cDetailView::createPixmaps() { - int scrollBarWidth = 50; - header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null)); header->SetAlpha(0); headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null); @@ -119,7 +122,9 @@ void cDetailView::drawContent() { i++; } } - + if (!tvguideConfig.hideEpgImages) { + drawEPGPictures((i+1)*textHeight); + } } void cDetailView::drawScrollbar() { @@ -187,7 +192,7 @@ cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColo return image; } -void cDetailView::LoadReruns(void) { +void cDetailView::loadReruns(void) { cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch"); if (epgSearchPlugin && !isempty(event->Title())) { std::stringstream sstrReruns; @@ -235,6 +240,59 @@ void cDetailView::LoadReruns(void) { reruns.Set("", tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40); } +int cDetailView::heightEPGPics(void) { + int width = tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth; + int border = 5; + int numPicsAvailable = 0; + for (int i=1; i <= tvguideConfig.numAdditionalEPGPictures; i++) { + cString epgimage = cString::sprintf("%s%d_%d.jpg", *tvguideConfig.epgImagePath, event->EventID(), i); + FILE *fp = fopen(*epgimage, "r"); + if (fp) { + numPicsAvailable = i; + fclose(fp); + } else { + break; + } + } + numEPGPics = numPicsAvailable; + int picsPerLine = width / (tvguideConfig.epgImageWidthLarge + border); + int picLines = numPicsAvailable / picsPerLine; + if (numPicsAvailable%picsPerLine != 0) + picLines++; + return picLines * (tvguideConfig.epgImageHeightLarge + border) + 2*border; +} + +void cDetailView::drawEPGPictures(int height) { + int width = content->ViewPort().Width(); + int border = 5; + int picsPerLine = width / (tvguideConfig.epgImageWidthLarge + border); + int currentX = border; + int currentY = height + border; + int currentPicsPerLine = 1; + cImageLoader imgLoader; + for (int i=1; i <= numEPGPics; i++) { + cString epgimage = cString::sprintf("%d_%d", event->EventID(), i); + if (imgLoader.LoadAdditionalEPGImage(epgimage)) { + content->DrawImage(cPoint(currentX, currentY), imgLoader.GetImage()); + int radius = 10; + content->DrawEllipse(cRect(currentX,currentY,radius,radius), theme.Color(clrBackground), -2); + content->DrawEllipse(cRect(currentX + tvguideConfig.epgImageWidthLarge - radius,currentY,radius,radius), theme.Color(clrBackground), -1); + content->DrawEllipse(cRect(currentX,currentY + tvguideConfig.epgImageHeightLarge - radius,radius,radius), theme.Color(clrBackground), -3); + content->DrawEllipse(cRect(currentX + tvguideConfig.epgImageWidthLarge - radius,currentY + tvguideConfig.epgImageHeightLarge - radius,radius,radius), theme.Color(clrBackground), -4); + if (currentPicsPerLine < picsPerLine) { + currentX += tvguideConfig.epgImageWidthLarge + border; + currentPicsPerLine++; + } else { + currentX = border; + currentY += tvguideConfig.epgImageHeightLarge + border; + currentPicsPerLine = 1; + } + } else { + break; + } + } +} + void cDetailView::Action(void) { drawHeader(); drawContent(); diff --git a/detailview.h b/detailview.h index f0cdcc9..3d72795 100644 --- a/detailview.h +++ b/detailview.h @@ -22,16 +22,20 @@ private: cTextWrapper reruns; int borderWidth; int headerHeight; + int scrollBarWidth; bool setContentDrawportHeight(); int heightContent; int heightScrollbar; + int numEPGPics; bool contentScrollable; - virtual void Action(void); - void LoadReruns(void); + void loadReruns(void); void drawHeader(); void drawContent(); void drawScrollbar(); + int heightEPGPics(void); + void drawEPGPictures(int height); cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend); + virtual void Action(void); public: cDetailView(cGrid *grid); virtual ~cDetailView(void); diff --git a/imageloader.c b/imageloader.c index cde737a..31e0d0c 100644 --- a/imageloader.c +++ b/imageloader.c @@ -44,6 +44,21 @@ bool cImageLoader::LoadEPGImage(int eventID) { return true; } +bool cImageLoader::LoadAdditionalEPGImage(cString name) { + int width = tvguideConfig.epgImageWidthLarge; + int height = tvguideConfig.epgImageHeightLarge; + if ((width == 0)||(height==0)) + return false; + bool success = false; + success = LoadImage(name, tvguideConfig.epgImagePath, "jpg"); + if (!success) + return false; + if (height != 0 || width != 0) { + buffer.sample( Geometry(width, height)); + } + return true; +} + bool cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) { if ((width < 1) || (height < 1)) return false; diff --git a/imageloader.h b/imageloader.h index 23faf65..a38a5a0 100644 --- a/imageloader.h +++ b/imageloader.h @@ -16,6 +16,7 @@ public: cImage GetImage(); bool LoadLogo(const char *logo, int width, int height); bool LoadEPGImage(int eventID); + bool LoadAdditionalEPGImage(cString name); bool DrawBackground(tColor back, tColor blend, int width, int height); private: Image buffer; diff --git a/po/de_DE.po b/po/de_DE.po index 3b74dd3..e075e74 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-06-01 11:12+0200\n" +"POT-Creation-Date: 2013-06-03 09:00+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -172,7 +172,7 @@ msgid "Show EPG Images" msgstr "EPG Bilder anzeigen" msgid "EPG Images Path used" -msgstr "benutzer EPG Bilder Pfad" +msgstr "Benutzer EPG Bilder Pfad" msgid "EPG Image width" msgstr "Breite der EPG Bilder" @@ -180,6 +180,15 @@ msgstr "Breite der EPG Bilder" msgid "EPG Image height" msgstr "Höhe der EPG Bilder" +msgid "Number of additional EPG Images" +msgstr "Anzahl zusätzlicher EPG Bilder" + +msgid "Additional EPG Image width" +msgstr "Breite der zus. EPG Bilder" + +msgid "Additional EPG Image height" +msgstr "Höhe der zus. EPG Bilder" + msgid "Font" msgstr "Schriftart" diff --git a/setup.c b/setup.c index eb1db1c..a49106e 100644 --- a/setup.c +++ b/setup.c @@ -72,7 +72,9 @@ void cTvguideSetup::Store(void) { SetupStore("hideEpgImages", tvguideConfig.hideEpgImages); SetupStore("epgImageWidth", tvguideConfig.epgImageWidth); SetupStore("epgImageHeight", tvguideConfig.epgImageHeight); - SetupStore("epgImageHeight", tvguideConfig.epgImageHeight); + SetupStore("numAdditionalEPGPictures", tvguideConfig.numAdditionalEPGPictures); + SetupStore("epgImageWidthLarge", tvguideConfig.epgImageWidthLarge); + SetupStore("epgImageHeightLarge", tvguideConfig.epgImageHeightLarge); SetupStore("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent); SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent); SetupStore("displayChannelName", tvguideConfig.displayChannelName); @@ -161,7 +163,7 @@ void cMenuSetupGeneral::Set(void) { Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12)); Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48)); Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems)); - + Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView)); if (tmpTvguideConfig->displayRerunsDetailEPGView) { Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10)); @@ -241,6 +243,9 @@ void cMenuSetupScreenLayout::Set(void) { Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of additional EPG Images")), &tmpTvguideConfig->numAdditionalEPGPictures, 0, 20)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Additional EPG Image width")), &tmpTvguideConfig->epgImageWidthLarge, 1, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Additional EPG Image height")), &tmpTvguideConfig->epgImageHeightLarge, 0, 800)); } SetCurrent(Get(currentItem));