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, see <https://www.gnu.org/licenses/>.
23 #include "vquestion.h"
24 #include "vepgsettimer.h"
36 #include "wmovieview.h"
37 #include "wseriesview.h"
38 #include "wpictureview.h"
39 #include "imageloader.h"
41 #include "vepgsummary.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.c_str());
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 = event->subtitle + "\n" + 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, static_cast<u4>(195 / Osd::getInstance()->getPixelAspect()));
132 summary->add(&epgTVmedia);
133 if (movieview) movieview->add(&epgTVmedia);
134 if (seriesview) seriesview->add(&epgTVmedia);
135 TVMediaStruct poster;
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.setImage(poster.image, WTVMedia::ZoomHorizontal);
151 epgTVmedia.setVisible(true);
153 epgTVmedia.setVisible(false);
156 tabbar.activateFocus(true);
158 MessageQueue::getInstance()->addReceiver(this);
161 VEpgSummary::~VEpgSummary()
163 MessageQueue::getInstance()->removeReceiver(this);
169 int VEpgSummary::handleCommand(int command)
171 if (command==Input::BACK) {
172 return BoxStack::DELETE_ME;
174 if (command==Input::RED)
176 if (!channel) return BoxStack::COMMAND_HANDLED;
177 LogNT::getInstance()->debug("VEpgSummary", "ID {} TIME {} DURATION {} TITLE {}", event->id, event->time, event->duration, event->title);
178 VEpgSetTimer* vs = new VEpgSetTimer(event, channel);
180 BoxStack *boxstack=BoxStack::getInstance();
182 boxstack->update(vs);
183 return BoxStack::COMMAND_HANDLED;
187 int retval = tabbar.handleCommand(command);
190 BoxStack::getInstance()->update(this);
191 return BoxStack::COMMAND_HANDLED;
193 else if (retval == 2)
195 return BoxStack::COMMAND_HANDLED;
200 // stop command getting to any more views
201 return BoxStack::ABANDON_COMMAND;
206 void VEpgSummary::processMessage(Message* m)
208 if (m->message == Message::MOUSE_MOVE)
210 if (tabbar.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
212 BoxStack::getInstance()->update(this);
215 else if (m->message == Message::MOUSE_LBDOWN)
218 int x = m->parameter - getScreenX();
219 int y = m->tag - getScreenY();
221 if ((boxRed.getX() <= x) && (boxRed.getX() + toi4(boxRed.getWidth()) >= x) &&
222 (boxRed.getY() <= y) && (boxRed.getY() + toi4(boxRed.getHeight()) >= y)) {
223 BoxStack::getInstance()->handleCommand(Input::RED);
228 if (cancel && tabbar.mouseLBDOWN(x, y))
230 BoxStack::getInstance()->update(this);
235 if (coordsOutsideBox(m))
237 Input::sendInputKey(Input::BACK);
241 else if (m->message == Message::MOUSE_SCROLL)
243 if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<u4>(m->data)))
245 BoxStack::getInstance()->update(this);