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"
40 #include "vepgsummary.h"
42 VEpgSummary::VEpgSummary(Event *tevent, Channel* tchannel)
48 if (Video::getInstance()->getFormat() == Video::PAL)
50 setSize(640+40, 500+40);
62 setTitleText(event->title.c_str());
64 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
66 tabbar.setPosition(10+10, 30 + 5);
67 tabbar.setSize(area.w - 20-10, area.h - 30 - 10-30);
70 boxRed.setBackgroundColour(DrawStyle::RED);
71 boxRed.setPosition(20 /*54*/, tabbar.getY2()+8);
72 boxRed.setSize(18, 16);
75 textRed.setPosition(boxRed.getX2(), tabbar.getY2()+4);
76 textRed.setSize(166, 30);
77 textRed.setText(tr("Record"));
81 WTextbox * summary=new WTextbox();
82 summary->setParaMode(true);
84 std::string summary_text = event->subtitle + "\n" + event->description;
86 summary->setText(summary_text.c_str());
87 OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
88 summary->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
90 tabbar.addTab(tr("EPG"), summary);
91 summary->setVideoBackground();
92 WMovieView *movieview=NULL;
93 WSeriesView *seriesview=NULL;
94 if (event->movieInfo) {
95 movieview = new WMovieView(event->movieInfo);
96 movieview->setParaMode(true);
97 movieview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
98 tabbar.addTab(tr("TheTVDB Info"), movieview);
100 if (event->movieInfo->actors.size() > 0 && osdv)
102 WActorGallery *gallery= new WActorGallery(event->movieInfo->actors);
103 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
104 tabbar.addTab(tr("Cast"),gallery);
106 WArtworkGallery *artgallery= new WArtworkGallery(*event->movieInfo);
107 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
108 tabbar.addTab(tr("Gallery"),artgallery);
110 } else if (event->seriesInfo) {
111 seriesview = new WSeriesView(event->seriesInfo);
112 seriesview->setParaMode(true);
113 seriesview->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
114 tabbar.addTab(tr("TheTVDB Info"), seriesview);
116 if (event->seriesInfo->actors.size() > 0 && osdv)
118 WActorGallery *gallery= new WActorGallery(event->seriesInfo->actors);
119 gallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
120 tabbar.addTab(tr("Cast"),gallery);
122 WArtworkGallery *artgallery= new WArtworkGallery(*event->seriesInfo);
123 artgallery->setBackgroundColour(DrawStyle::VIEWTRANSPARENTBACKGROUND);
124 tabbar.addTab(tr("Gallery"),artgallery);
129 epgTVmedia.setPosition(summary->getRegionR().w-130-10,0);
130 epgTVmedia.setSize(130, static_cast<UINT>(195 / Osd::getInstance()->getPixelAspect()));
131 summary->add(&epgTVmedia);
132 if (movieview) movieview->add(&epgTVmedia);
133 if (seriesview) seriesview->add(&epgTVmedia);
136 if (event->movieInfo) {
137 poster=event->movieInfo->poster;
139 if (event->seriesInfo) {
140 if (event->seriesInfo->seasonposter.height) {
141 poster=event->seriesInfo->seasonposter;
144 if (event->seriesInfo->posters.size()) {
145 poster=event->seriesInfo->posters[0];
149 epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
150 epgTVmedia.setVisible(true);
152 epgTVmedia.setVisible(false);
155 tabbar.activateFocus(true);
157 MessageQueue::getInstance()->addReceiver(this);
160 VEpgSummary::~VEpgSummary()
162 MessageQueue::getInstance()->removeReceiver(this);
168 int VEpgSummary::handleCommand(int command)
170 if (command==Input::BACK) {
171 return BoxStack::DELETE_ME;
173 if (command==Input::RED)
175 if (!channel) return BoxStack::COMMAND_HANDLED;
176 LogNT::getInstance()->debug("VEpgSummary", "ID {} TIME {} DURATION {} TITLE {}", event->id, event->time, event->duration, event->title);
177 VEpgSetTimer* vs = new VEpgSetTimer(event, channel);
179 BoxStack *boxstack=BoxStack::getInstance();
181 boxstack->update(vs);
182 return BoxStack::COMMAND_HANDLED;
186 int retval = tabbar.handleCommand(command);
189 BoxStack::getInstance()->update(this);
190 return BoxStack::COMMAND_HANDLED;
192 else if (retval == 2)
194 return BoxStack::COMMAND_HANDLED;
199 // stop command getting to any more views
200 return BoxStack::ABANDON_COMMAND;
205 void VEpgSummary::processMessage(Message* m)
207 if (m->message == Message::MOUSE_MOVE)
209 if (tabbar.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
211 BoxStack::getInstance()->update(this);
214 else if (m->message == Message::MOUSE_LBDOWN)
217 int x = m->parameter - getScreenX();
218 int y = m->tag - getScreenY();
220 if ((boxRed.getX() <= x) && (boxRed.getX() + static_cast<int>(boxRed.getWidth()) >= x) &&
221 (boxRed.getY() <= y) && (boxRed.getY() + static_cast<int>(boxRed.getHeight()) >= y)) {
222 BoxStack::getInstance()->handleCommand(Input::RED);
227 if (cancel && tabbar.mouseLBDOWN(x, y))
229 BoxStack::getInstance()->update(this);
234 if (coordsOutsideBox(m))
236 Input::sendInputKey(Input::BACK);
240 else if (m->message == Message::MOUSE_SCROLL)
242 if (tabbar.mouseAndroidScroll(m->parameter - getScreenX(), m->tag - getScreenY(), 0, reinterpret_cast<ULONG>(m->data)))
244 BoxStack::getInstance()->update(this);