display of additional EPG pictures in detailed epg view

This commit is contained in:
louis 2013-06-03 09:52:54 +02:00
parent d2e13f083b
commit e87e589416
11 changed files with 115 additions and 13 deletions

View File

@ -46,3 +46,4 @@ VDR Plugin 'tvguide' Revision History
Version 0.0.6 Version 0.0.6
- added frame around scaled video picture - added frame around scaled video picture
- added theme "keep it simple" (thanks @saman) - added theme "keep it simple" (thanks @saman)
- display of additional EPG pictures in detailed epg view

View File

@ -60,7 +60,7 @@ void cChannelGroupGrid::Draw(void) {
int x = (Width() - textWidth) / 2; int x = (Width() - textWidth) / 2;
pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, tvguideConfig.FontChannelGroups); pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, tvguideConfig.FontChannelGroups);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
std::string nameUpper = name; std::string nameUpper = name;
std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper);
int numChars = nameUpper.length(); int numChars = nameUpper.length();
int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height(); int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height();

View File

@ -56,6 +56,9 @@ cTvguideConfig::cTvguideConfig() {
hideEpgImages = 0; hideEpgImages = 0;
epgImageWidth = 315; epgImageWidth = 315;
epgImageHeight = 240; epgImageHeight = 240;
numAdditionalEPGPictures = 9;
epgImageWidthLarge = 525;
epgImageHeightLarge = 400;
fontIndex = 0; fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book"; fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0; 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, "hideEpgImages") == 0) hideEpgImages = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = 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, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value);
else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value); else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value);
else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value); else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value);

View File

@ -57,6 +57,9 @@ class cTvguideConfig {
int hideEpgImages; int hideEpgImages;
int epgImageWidth; int epgImageWidth;
int epgImageHeight; int epgImageHeight;
int numAdditionalEPGPictures;
int epgImageWidthLarge;
int epgImageHeightLarge;
cString epgImagePath; cString epgImagePath;
int fontIndex; int fontIndex;
const char *fontNameDefault; const char *fontNameDefault;

View File

@ -9,12 +9,14 @@ cDetailView::cDetailView(cGrid *grid) {
FrameTime = 40; // ms FrameTime = 40; // ms
FadeTime = 500; // ms FadeTime = 500; // ms
borderWidth = 100; //px borderWidth = 100; //px
scrollBarWidth = 40;
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines
40 + tvguideConfig.epgImageHeight); 40 + tvguideConfig.epgImageHeight);
description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40); description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
if (tvguideConfig.displayRerunsDetailEPGView) { if (tvguideConfig.displayRerunsDetailEPGView) {
LoadReruns(); loadReruns();
} }
numEPGPics = 0;
contentScrollable = setContentDrawportHeight(); contentScrollable = setContentDrawportHeight();
createPixmaps(); createPixmaps();
} }
@ -35,6 +37,9 @@ bool cDetailView::setContentDrawportHeight() {
linesContent += reruns.Lines() + 1; linesContent += reruns.Lines() + 1;
} }
heightContent = linesContent * tvguideConfig.FontDetailView->Height(); heightContent = linesContent * tvguideConfig.FontDetailView->Height();
if (!tvguideConfig.hideEpgImages) {
heightContent += heightEPGPics();
}
if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight)) if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight))
return true; return true;
else else
@ -42,8 +47,6 @@ bool cDetailView::setContentDrawportHeight() {
} }
void cDetailView::createPixmaps() { void cDetailView::createPixmaps() {
int scrollBarWidth = 50;
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null)); header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null));
header->SetAlpha(0); header->SetAlpha(0);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null); headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
@ -119,7 +122,9 @@ void cDetailView::drawContent() {
i++; i++;
} }
} }
if (!tvguideConfig.hideEpgImages) {
drawEPGPictures((i+1)*textHeight);
}
} }
void cDetailView::drawScrollbar() { void cDetailView::drawScrollbar() {
@ -187,7 +192,7 @@ cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColo
return image; return image;
} }
void cDetailView::LoadReruns(void) { void cDetailView::loadReruns(void) {
cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch"); cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
if (epgSearchPlugin && !isempty(event->Title())) { if (epgSearchPlugin && !isempty(event->Title())) {
std::stringstream sstrReruns; std::stringstream sstrReruns;
@ -235,6 +240,59 @@ void cDetailView::LoadReruns(void) {
reruns.Set("", tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40); 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) { void cDetailView::Action(void) {
drawHeader(); drawHeader();
drawContent(); drawContent();

View File

@ -22,16 +22,20 @@ private:
cTextWrapper reruns; cTextWrapper reruns;
int borderWidth; int borderWidth;
int headerHeight; int headerHeight;
int scrollBarWidth;
bool setContentDrawportHeight(); bool setContentDrawportHeight();
int heightContent; int heightContent;
int heightScrollbar; int heightScrollbar;
int numEPGPics;
bool contentScrollable; bool contentScrollable;
virtual void Action(void); void loadReruns(void);
void LoadReruns(void);
void drawHeader(); void drawHeader();
void drawContent(); void drawContent();
void drawScrollbar(); void drawScrollbar();
int heightEPGPics(void);
void drawEPGPictures(int height);
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);
virtual void Action(void);
public: public:
cDetailView(cGrid *grid); cDetailView(cGrid *grid);
virtual ~cDetailView(void); virtual ~cDetailView(void);

View File

@ -44,6 +44,21 @@ bool cImageLoader::LoadEPGImage(int eventID) {
return true; 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) { bool cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) {
if ((width < 1) || (height < 1)) if ((width < 1) || (height < 1))
return false; return false;

View File

@ -16,6 +16,7 @@ public:
cImage GetImage(); cImage GetImage();
bool LoadLogo(const char *logo, int width, int height); bool LoadLogo(const char *logo, int width, int height);
bool LoadEPGImage(int eventID); bool LoadEPGImage(int eventID);
bool LoadAdditionalEPGImage(cString name);
bool DrawBackground(tColor back, tColor blend, int width, int height); bool DrawBackground(tColor back, tColor blend, int width, int height);
private: private:
Image buffer; Image buffer;

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-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" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -172,7 +172,7 @@ msgid "Show EPG Images"
msgstr "EPG Bilder anzeigen" msgstr "EPG Bilder anzeigen"
msgid "EPG Images Path used" msgid "EPG Images Path used"
msgstr "benutzer EPG Bilder Pfad" msgstr "Benutzer EPG Bilder Pfad"
msgid "EPG Image width" msgid "EPG Image width"
msgstr "Breite der EPG Bilder" msgstr "Breite der EPG Bilder"
@ -180,6 +180,15 @@ msgstr "Breite der EPG Bilder"
msgid "EPG Image height" msgid "EPG Image height"
msgstr "Höhe der EPG Bilder" 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" msgid "Font"
msgstr "Schriftart" msgstr "Schriftart"

View File

@ -72,7 +72,9 @@ void cTvguideSetup::Store(void) {
SetupStore("hideEpgImages", tvguideConfig.hideEpgImages); SetupStore("hideEpgImages", tvguideConfig.hideEpgImages);
SetupStore("epgImageWidth", tvguideConfig.epgImageWidth); SetupStore("epgImageWidth", tvguideConfig.epgImageWidth);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight); 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("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent);
SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent); SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent);
SetupStore("displayChannelName", tvguideConfig.displayChannelName); SetupStore("displayChannelName", tvguideConfig.displayChannelName);
@ -241,6 +243,9 @@ void cMenuSetupScreenLayout::Set(void) {
Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath)); 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 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("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)); SetCurrent(Get(currentItem));