summaryrefslogtreecommitdiff
path: root/menudetailview.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2012-11-28 20:58:39 +0100
committerlouis <louis.braun@gmx.de>2012-11-28 20:58:39 +0100
commit1121def63e1ec3bb56caa974d68c584070e64d68 (patch)
tree65471cbb0c74e3dfd4854f83370ab621b0fdd6a2 /menudetailview.c
parent81741f77745d190629f3d91c290ea7c15e0c75ba (diff)
downloadskin-nopacity-1121def63e1ec3bb56caa974d68c584070e64d68.tar.gz
skin-nopacity-1121def63e1ec3bb56caa974d68c584070e64d68.tar.bz2
Added feature to display reruns in detailed EPG view
Diffstat (limited to 'menudetailview.c')
-rw-r--r--menudetailview.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/menudetailview.c b/menudetailview.c
index 8dc7d6c..03bd32b 100644
--- a/menudetailview.c
+++ b/menudetailview.c
@@ -1,8 +1,12 @@
#include "menudetailview.h"
+#include "services/epgsearch.h"
+#include <sstream>
cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) {
this->osd = osd;
hasScrollbar = false;
+ additionalContent = NULL;
+ additionalContentSet = false;
}
cNopacityMenuDetailView::~cNopacityMenuDetailView(void) {
@@ -23,9 +27,18 @@ void cNopacityMenuDetailView::SetGeometry(int width, int height, int top, int co
}
void cNopacityMenuDetailView::SetContent(const char *textContent) {
- if (textContent)
- content.Set(textContent, font, width - 4 * border);
- else
+ if (textContent) {
+ cString sContent = textContent;
+ if (additionalContentSet) {
+ std::stringstream sstrContent;
+ sstrContent << textContent;
+ sstrContent << std::endl;
+ sstrContent << std::endl;
+ sstrContent << *additionalContent;
+ sContent = sstrContent.str().c_str();
+ }
+ content.Set(*sContent, font, width - 4 * border);
+ } else
content.Set("", font, width - 4 * border);
int textHeight = font->Height();
@@ -46,6 +59,54 @@ void cNopacityMenuDetailView::DrawContent(void) {
pixmapContent->DrawText(cPoint(2*border, (i+1)*textHeight), content.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font);
}
}
+
+void cNopacityMenuDetailView::LoadReruns(const cEvent *event) {
+ cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
+ if (epgSearchPlugin && !isempty(event->Title())) {
+ std::stringstream sstrReruns;
+ Epgsearch_searchresults_v1_0 data;
+ std::string strQuery = event->Title();
+ if (config.useSubtitleRerun > 0) {
+ if (config.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<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
+ if (list && (list->Count() > 1)) {
+ //TODO: current event is shown as rerun
+ sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl;
+ int i = 0;
+ for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < config.numReruns; r = list->Next(r)) {
+ i++;
+ sstrReruns << "- "
+ << *DayDateTime(r->event->StartTime());
+ cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true);
+ if (channel)
+ sstrReruns << " " << channel->ShortName(true);
+ sstrReruns << ": " << r->event->Title();
+ if (!isempty(r->event->ShortText()))
+ sstrReruns << "~" << r->event->ShortText();
+ sstrReruns << std::endl;
+ }
+ delete list;
+ }
+ }
+ additionalContent = sstrReruns.str().c_str();
+ additionalContentSet = true;
+ }
+}
+
double cNopacityMenuDetailView::ScrollbarSize(void) {
double barSize = (double)contentHeight / (double)contentDrawPortHeight;
return barSize;