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 OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
89 summary->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
91 tabbar.addTab(tr("EPG"), summary);
92 summary->setVideoBackground();
93 WMovieView *movieview=NULL;
94 WSeriesView *seriesview=NULL;
95 if (event->movieInfo) {
96 movieview = new WMovieView(event->movieInfo);
97 movieview->setParaMode(true);
98 movieview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
99 tabbar.addTab(tr("TheTVDB Info"), movieview);
101 if (event->movieInfo->actors.size() > 0 && osdv)
103 WActorGallery *gallery= new WActorGallery(event->movieInfo->actors);
104 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
105 tabbar.addTab(tr("Cast"),gallery);
107 WArtworkGallery *artgallery= new WArtworkGallery(*event->movieInfo);
108 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
109 tabbar.addTab(tr("Gallery"),artgallery);
111 } else if (event->seriesInfo) {
112 seriesview = new WSeriesView(event->seriesInfo);
113 seriesview->setParaMode(true);
114 seriesview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
115 tabbar.addTab(tr("TheTVDB Info"), seriesview);
117 if (event->seriesInfo->actors.size() > 0 && osdv)
119 WActorGallery *gallery= new WActorGallery(event->seriesInfo->actors);
120 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
121 tabbar.addTab(tr("Cast"),gallery);
123 WArtworkGallery *artgallery= new WArtworkGallery(*event->seriesInfo);
124 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
125 tabbar.addTab(tr("Gallery"),artgallery);
130 epgTVmedia.setPosition(summary->getRegionR().w-130-10,0);
131 epgTVmedia.setSize(130,(UINT)(195/Osd::getInstance()->getPixelAspect()));
132 summary->add(&epgTVmedia);
133 if (movieview) movieview->add(&epgTVmedia);
134 if (seriesview) seriesview->add(&epgTVmedia);
137 if (event->movieInfo) {
138 poster=event->movieInfo->poster;
140 if (event->seriesInfo) {
141 if (event->seriesInfo->seasonposter.height) {
142 poster=event->seriesInfo->seasonposter;
145 if (event->seriesInfo->posters.size()) {
146 poster=event->seriesInfo->posters[0];
150 epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
151 epgTVmedia.setVisible(true);
153 epgTVmedia.setVisible(false);
158 tabbar.activateFocus(true);
161 VEpgSummary::~VEpgSummary()
168 int VEpgSummary::handleCommand(int command)
170 if (command==Remote::BACK) {
173 if (command==Remote::RED)
175 if (!channel) return 2;
176 Log::getInstance()->log("VEpgSummary", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", event->id, event->time, event->duration, event->title);
177 VEpgSetTimer* vs = new VEpgSetTimer(event, channel);
179 BoxStack *boxstack=BoxStack::getInstance();
181 boxstack->update(vs);
186 int retval = tabbar.handleCommand(command);
189 BoxStack::getInstance()->update(this);
192 else if (retval == 2)
200 // stop command getting to any more views
206 void VEpgSummary::processMessage(Message* m)
208 if (m->message == Message::MOUSE_MOVE)
210 if (tabbar.mouseMove((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY()))
212 BoxStack::getInstance()->update(this);
215 else if (m->message == Message::MOUSE_LBDOWN)
218 int x = (m->parameter.num >> 16) - getScreenX();
219 int y = (m->parameter.num & 0xFFFF) - getScreenY();
221 if ((boxRed.getX() <= x) && (boxRed.getX() + (int)boxRed.getWidth() >= x) &&
222 (boxRed.getY() <= y) && (boxRed.getY() + (int)boxRed.getHeight() >= y)) {
223 BoxStack::getInstance()->handleCommand(Remote::RED);
228 if (cancel && tabbar.mouseLBDOWN((m->parameter.num >> 16) - getScreenX(), (m->parameter.num & 0xFFFF) - getScreenY()))
230 BoxStack::getInstance()->update(this);
235 //check if press is outside this view! then simulate cancel
236 int checkX=(m->parameter.num>>16)-getScreenX();
237 int checkY=(m->parameter.num&0xFFFF)-getScreenY();
238 if (checkX<0 || checkY <0 || checkX>(int)getWidth() || checkY>(int)getHeight())
240 BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
243 } else if (m->message == Message::MOUSE_SCROLL)
245 if (tabbar.mouseAndroidScroll((m->tag >> 16) - getScreenX(), (m->tag & 0xFFFF) - getScreenY(),
246 (short)(m->parameter.num >> 16), (short)(m->parameter.num & 0xFFFF)))
248 BoxStack::getInstance()->update(this);