diff options
author | louis <louis.braun@gmx.de> | 2013-08-21 10:26:50 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-08-21 10:26:50 +0200 |
commit | 9e1fcfc0bff753031617324b5244805080be9430 (patch) | |
tree | f7a574ff7223751f4d2da9b295b90c50530e3dc8 /menuitem.c | |
parent | e99e14c6f02164f53fb5ef01cdc8f091aac1fc4a (diff) | |
download | skin-nopacity-9e1fcfc0bff753031617324b5244805080be9430.tar.gz skin-nopacity-9e1fcfc0bff753031617324b5244805080be9430.tar.bz2 |
Version 0.1.3, Added TVScrapper support
Diffstat (limited to 'menuitem.c')
-rw-r--r-- | menuitem.c | 71 |
1 files changed, 63 insertions, 8 deletions
@@ -480,6 +480,7 @@ void cNopacityScheduleMenuItem::Render() { infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin); infoTextWindow->SetGeometry(textWindow); infoTextWindow->SetText(Event->Description()); + infoTextWindow->SetPoster(Event, false); infoTextWindow->Start(); } } else { @@ -716,7 +717,6 @@ std::string cNopacityChannelMenuItem::readEPG(void) { } void cNopacityChannelMenuItem::Render() { - if (selectable) { //Channels DrawBackground(); int logoWidth = config.menuItemLogoWidth; @@ -933,8 +933,11 @@ void cNopacityRecordingMenuItem::CreatePixmapTextScroller(int totalWidth) { } else { pixmapLeft = left + 10; pixmapWidth = width - 10; + if (hasPoster) { + pixmapLeft += posterWidth+10; + pixmapWidth -= (posterWidth+10); + } } - pixmapTextScroller = osd->CreatePixmap(4, cRect(pixmapLeft, top + index * (height + spaceMenu), pixmapWidth, height), cRect(0, 0, drawPortWidth, height)); pixmapTextScroller->Fill(clrTransparent); } @@ -957,6 +960,35 @@ void cNopacityRecordingMenuItem::CreateText() { } } +void cNopacityRecordingMenuItem::SetPoster(void) { + const cRecordingInfo *info = Recording->Info(); + if (info) { + const cEvent *event = info->GetEvent(); + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper && event) { + poster.event = event; + poster.isRecording = true; + if (pTVScrapper->Service("TVScrapperGetPoster", &poster)) { + hasPoster = true; + int posterWidthOrig = poster.media.width; + int posterHeightOrig = poster.media.height; + if ((posterWidthOrig > 10) && (posterHeightOrig > 10)) { + posterHeight = height - 10; + posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); + } else { + hasPoster = false; + posterHeight = 0; + posterWidth = 0; + } + } else { + hasPoster = false; + posterHeight = 0; + posterWidth = 0; + } + } + } +} + int cNopacityRecordingMenuItem::CheckScrollable(bool hasIcon) { int totalWidth = 0; if (isFolder) @@ -968,6 +1000,8 @@ int cNopacityRecordingMenuItem::CheckScrollable(bool hasIcon) { int cNopacityRecordingMenuItem::CheckScrollableRecording(void) { int spaceLeft = spaceMenu; + if (hasPoster) + spaceLeft += posterWidth + 15; int iconWidth = 0; if (Recording->IsNew()) iconWidth += font->Height() + 10; @@ -1019,7 +1053,10 @@ void cNopacityRecordingMenuItem::DrawBackground(void) { void cNopacityRecordingMenuItem::SetTextFullFolder(void) { tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); pixmapTextScroller->Fill(clrTransparent); - DrawFolderIcon(); + if (hasPoster) + DrawPoster(); + else + DrawFolderIcon(); int heightRecName = (2*height/3 - font->Height())/2 + 10; pixmapTextScroller->DrawText(cPoint(0, heightRecName), strRecNameFull.c_str(), clrFont, clrTransparent, font); } @@ -1049,7 +1086,10 @@ void cNopacityRecordingMenuItem::SetTextShort(void) { void cNopacityRecordingMenuItem::SetTextShortFolder(void) { tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); pixmapTextScroller->Fill(clrTransparent); - DrawFolderIcon(); + if (hasPoster) + DrawPoster(); + else + DrawFolderIcon(); int heightRecName = (2*height/3 - font->Height())/2 + 10; pixmapTextScroller->DrawText(cPoint(0, heightRecName), strRecName.c_str(), clrFont, clrTransparent, font); } @@ -1099,14 +1139,18 @@ void cNopacityRecordingMenuItem::DrawFolderIcon(void) { void cNopacityRecordingMenuItem::DrawRecDateTime(void) { int iconDateTimeSize = config.menuRecFolderSize / 2; int iconHeight = height/2 + (height/2 - iconDateTimeSize)/2; + int left = 10; + if (hasPoster) { + left += posterWidth + 10; + } if (!drawn) { cImageLoader imgLoader; if (imgLoader.LoadIcon("skinIcons/recordingdatetime", iconDateTimeSize)) { - pixmapIcon->DrawImage(cPoint(3, iconHeight), imgLoader.GetImage()); + pixmapIcon->DrawImage(cPoint(left, iconHeight), imgLoader.GetImage()); } drawn = true; } - pixmapIcon->DrawRectangle(cRect(iconHeight, 0, width-iconHeight, height), clrTransparent); + pixmapIcon->DrawRectangle(cRect(iconHeight+left, 0, width-iconHeight, height), clrTransparent); const cEvent *Event = NULL; Event = Recording->Info()->GetEvent(); cString strDateTime(""); @@ -1123,9 +1167,9 @@ void cNopacityRecordingMenuItem::DrawRecDateTime(void) { int textHeight = height/2 + (height/4 - fontSmall->Height())/2; tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10, textHeight), *strDateTime, clrFont, clrTransparent, fontSmall); + pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10 + left, textHeight), *strDateTime, clrFont, clrTransparent, fontSmall); textHeight += height/4; - pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10, textHeight), *strDuration, clrFont, clrTransparent, fontSmall); + pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10 + left, textHeight), *strDuration, clrFont, clrTransparent, fontSmall); } @@ -1136,6 +1180,13 @@ void cNopacityRecordingMenuItem::DrawFolderNewSeen(void) { pixmapIcon->DrawText(cPoint(config.menuRecFolderSize + 10, textHeight), *strTotalNew, clrFont, clrTransparent, fontSmall); } +void cNopacityRecordingMenuItem::DrawPoster(void) { + cImageLoader imgLoader; + if (imgLoader.LoadPoster(poster.media.path.c_str(), posterWidth, posterHeight)) { + pixmapIcon->DrawImage(cPoint(10, 5), imgLoader.GetImage()); + } +} + void cNopacityRecordingMenuItem::Render() { if (selectable) { DrawBackground(); @@ -1143,6 +1194,9 @@ void cNopacityRecordingMenuItem::Render() { DrawFolderNewSeen(); SetTextShort(); } else { + if (hasPoster) { + DrawPoster(); + } DrawRecDateTime(); SetTextShort(); } @@ -1164,6 +1218,7 @@ void cNopacityRecordingMenuItem::Render() { infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin); infoTextWindow->SetGeometry(textWindow); infoTextWindow->SetText(Recording->Info()->Description()); + infoTextWindow->SetPoster(Recording->Info()->GetEvent(), true); infoTextWindow->Start(); } } |