2 Copyright 2004-2008 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "vepgsummary.h"
24 #include "vquestion.h"
25 #include "vepgsettimer.h"
37 #include "wmovieview.h"
38 #include "wseriesview.h"
39 #include "wpictureview.h"
43 VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
49 if (Video::getInstance()->getFormat() == Video::PAL)
51 setSize(640+40, 500+40);
63 setTitleText(event->title);
65 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
67 tabbar.setPosition(10+10, 30 + 5);
68 tabbar.setSize(area.w - 20-10, area.h - 30 - 10-30);
71 boxRed.setBackgroundColour(DrawStyle::RED);
72 boxRed.setPosition(20 /*54*/, tabbar.getY2()+8);
73 boxRed.setSize(18, 16);
76 textRed.setPosition(boxRed.getX2(), tabbar.getY2()+4);
77 textRed.setSize(166, 30);
78 textRed.setText(tr("Record"));
82 WTextbox * summary=new WTextbox();
83 summary->setParaMode(true);
85 std::string summary_text = std::string(event->subtitle)+ "\n" +std::string(event->description);
87 summary->setText(summary_text.c_str());
88 #ifndef VOMP_PLATTFORM_MVP
90 OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
92 summary->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
94 tabbar.addTab(tr("EPG"), summary);
95 summary->setVideoBackground();
96 WMovieView *movieview=NULL;
97 WSeriesView *seriesview=NULL;
98 if (event->movieInfo) {
99 movieview = new WMovieView(event->movieInfo);
100 movieview->setParaMode(true);
101 movieview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
102 tabbar.addTab(tr("TheTVDB Info"), movieview);
103 #ifndef VOMP_PLATTFORM_MVP
106 if (event->movieInfo->actors.size() > 0 && osdv)
108 WActorGallery *gallery= new WActorGallery(event->movieInfo->actors);
109 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
110 tabbar.addTab(tr("Cast"),gallery);
112 WArtworkGallery *artgallery= new WArtworkGallery(*event->movieInfo);
113 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
114 tabbar.addTab(tr("Gallery"),artgallery);
117 } else if (event->seriesInfo) {
118 seriesview = new WSeriesView(event->seriesInfo);
119 seriesview->setParaMode(true);
120 seriesview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
121 tabbar.addTab(tr("TheTVDB Info"), seriesview);
122 #ifndef VOMP_PLATTFORM_MVP
125 if (event->seriesInfo->actors.size() > 0 && osdv)
127 WActorGallery *gallery= new WActorGallery(event->seriesInfo->actors);
128 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
129 tabbar.addTab(tr("Cast"),gallery);
131 WArtworkGallery *artgallery= new WArtworkGallery(*event->seriesInfo);
132 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
133 tabbar.addTab(tr("Gallery"),artgallery);
139 epgTVmedia.setPosition(summary->getRegionR().w-130-10,0);
140 epgTVmedia.setSize(130,195/Osd::getInstance()->getPixelAspect());
141 summary->add(&epgTVmedia);
142 if (movieview) movieview->add(&epgTVmedia);
143 if (seriesview) seriesview->add(&epgTVmedia);
146 if (event->movieInfo) {
147 poster=event->movieInfo->poster;
149 if (event->seriesInfo) {
150 if (event->seriesInfo->seasonposter.height) {
151 poster=event->seriesInfo->seasonposter;
154 if (event->seriesInfo->posters.size()) {
155 poster=event->seriesInfo->posters[0];
159 epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
160 epgTVmedia.setVisible(true);
162 epgTVmedia.setVisible(false);
167 tabbar.activateFocus(true);
170 VEpgSummary::~VEpgSummary()
177 int VEpgSummary::handleCommand(int command)
179 if (command==Remote::BACK) {
182 if (command==Remote::RED)
184 if (!channel) return 2;
185 Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", event->id, event->time, event->duration, event->title);
186 VEpgSetTimer* vs = new VEpgSetTimer(event, channel);
188 BoxStack *boxstack=BoxStack::getInstance();
190 boxstack->update(vs);
195 int retval = tabbar.handleCommand(command);
198 BoxStack::getInstance()->update(this);
201 else if (retval == 2)
209 // stop command getting to any more views
215 void VEpgSummary::processMessage(Message* m)
217 if (m->message == Message::MOUSE_MOVE)
219 if (tabbar.mouseMove((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY()))
221 BoxStack::getInstance()->update(this);
224 else if (m->message == Message::MOUSE_LBDOWN)
227 int x = (m->parameter.num >> 16) - getScreenX();
228 int y = (m->parameter.num & 0xFFFF) - getScreenY();
230 if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) &&
231 (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) {
232 BoxStack::getInstance()->handleCommand(Remote::RED);
237 if (cancel && tabbar.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY()))
239 BoxStack::getInstance()->update(this);
244 //check if press is outside this view! then simulate cancel
245 int x=(m->parameter.num>>16)-getScreenX();
246 int y=(m->parameter.num&0xFFFF)-getScreenY();
247 if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
249 BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
252 } else if (m->message == Message::MOUSE_SCROLL)
254 if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(),
255 (short)(m->parameter.num >> 16), (short)(m->parameter.num & 0xFFFF)))
257 BoxStack::getInstance()->update(this);