]> git.vomp.tv Git - vompclient.git/blob - vepgsummary.cc
Add first support for TVScraper in VVideolive also some optimization for raspberry...
[vompclient.git] / vepgsummary.cc
1 /*
2     Copyright 2004-2008 Chris Tallon
3
4     This file is part of VOMP.
5
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.
10
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.
15
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.
19 */
20
21 #include "vepgsummary.h"
22
23 #include "remote.h"
24 #include "vquestion.h"
25 #include "vinfo.h"
26 #include "vdr.h"
27 #include "colour.h"
28 #include "video.h"
29 #include "i18n.h"
30 #include "command.h"
31 #include "boxstack.h"
32 #include "event.h"
33 #include "message.h"
34 #include "log.h"
35 #include "wmovieview.h"
36 #include "wseriesview.h"
37 #include "wpictureview.h"
38
39 #include <string>
40
41 VEpgSummary::VEpgSummary(Event *tevent)
42 {
43   event = tevent;
44   
45
46   if (Video::getInstance()->getFormat() == Video::PAL)
47   {
48     setSize(640, 500);
49         createBuffer();
50   }
51   else
52   {
53         setSize(560, 400);
54         createBuffer();
55   }
56   setPosition(40, 40);
57
58   setTitleBarOn(1);
59   setBorderOn(1);
60   setTitleText(event->title);
61
62   setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
63
64   tabbar.setPosition(10+10, 30 + 5);
65   tabbar.setSize(area.w - 20-10, area.h - 30 - 10);
66   add(&tabbar);
67
68
69   WTextbox * summary=new WTextbox();
70   summary->setParaMode(true);
71
72   std::string summary_text = std::string(event->subtitle)+ "\n" +std::string(event->description);
73
74   summary->setText(summary_text.c_str());
75   OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
76
77   tabbar.addTab(tr("EPG"), summary);
78   if (event->movieInfo) {
79           WMovieView *movieview = new WMovieView(event->movieInfo);
80           movieview->setParaMode(true);
81           tabbar.addTab(tr("TheTVDB Info"), movieview);
82           if (osdv) {
83                   if (event->movieInfo->actors.size() > 0 && osdv)
84                   {
85                           WActorGallery *gallery= new WActorGallery(event->movieInfo->actors);
86                           tabbar.addTab(tr("Cast"),gallery);
87                   }
88                   WArtworkGallery *artgallery= new WArtworkGallery(*event->movieInfo);
89                   tabbar.addTab(tr("Gallery"),artgallery);
90           }
91   } else if (event->seriesInfo) {
92           WSeriesView *seriesview = new WSeriesView(event->seriesInfo);
93           seriesview->setParaMode(true);
94           tabbar.addTab(tr("TheTVDB Info"), seriesview);
95           if (osdv) {
96                   if (event->seriesInfo->actors.size() > 0 && osdv)
97                   {
98                           WActorGallery *gallery= new WActorGallery(event->seriesInfo->actors);
99                           tabbar.addTab(tr("Cast"),gallery);
100                   }
101                   WArtworkGallery *artgallery= new WArtworkGallery(*event->seriesInfo);
102                   tabbar.addTab(tr("Gallery"),artgallery);
103           }
104
105   }
106
107   epgTVmedia.setPosition(summary->getRegionR().w-130-10,0);
108   epgTVmedia.setSize(130,195/Osd::getInstance()->getPixelAspect());
109   summary->add(&epgTVmedia);
110   TVMedia poster;
111   poster.height=0;
112   if (event->movieInfo) {
113           poster=event->movieInfo->poster;
114   }
115   if (event->seriesInfo) {
116           if (event->seriesInfo->seasonposter.height) {
117                   poster=event->seriesInfo->seasonposter;
118           }
119           else
120                   if (event->seriesInfo->posters.size()) {
121                           poster=event->seriesInfo->posters[0];
122                   }
123   }
124   if (poster.height) {
125           epgTVmedia.setTVMedia(poster.info, WTVMedia::ZoomHorizontal);
126           epgTVmedia.setVisible(true);
127   } else {
128           epgTVmedia.setVisible(false);
129   }
130
131
132   /*
133   int sfh = getFontHeight();
134   buttonRegion.x = 10;
135   buttonRegion.y = 10+30;
136   buttonRegion.w = 130;
137   buttonRegion.h = sfh*2*last;
138
139   button[PLAY].setText(tr("Play"));
140   button[RESUME].setText(tr("Resume"));
141   button[MOVE].setText(tr("Move"));
142   button[A_DELETE].setText(tr("Delete"));
143   
144   for (int i=PLAY, ver=10+30; i<last; i++, ver+= sfh*2)
145   {
146     button[i].setPosition(10, ver);
147     button[i].setSize(130, sfh);
148     add(&button[i]);
149   }
150   
151   selected = RESUME;
152   button[selected].setActive(1);*/
153   tabbar.activateFocus(true);
154 }
155
156 VEpgSummary::~VEpgSummary()
157 {
158 }
159
160
161
162
163 int VEpgSummary::handleCommand(int command)
164 {
165         if (command==Remote::BACK) {
166                 return 4;
167         }
168
169         // Pass to tabbar
170         int retval = tabbar.handleCommand(command);
171         if (retval == 1)
172         {
173                 BoxStack::getInstance()->update(this);
174                 return 2;
175         }
176         else if (retval == 2)
177         {
178
179                 return 2;
180         }
181
182
183
184         // stop command getting to any more views
185         return 1;
186 }
187
188
189
190 void VEpgSummary::processMessage(Message* m)
191 {
192   if (m->message == Message::MOUSE_MOVE)
193   {
194     // todo
195   }
196   else if (m->message == Message::MOUSE_LBDOWN)
197   {
198     int cancel = true;
199     if (cancel)
200     {
201       //check if press is outside this view! then simulate cancel
202       int x=(m->parameter>>16)-getScreenX();
203       int y=(m->parameter&0xFFFF)-getScreenY();
204       if (x<0 || y <0 || x>(int)getWidth() || y>(int)getHeight())
205       {
206         BoxStack::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
207       }
208     }
209   }
210 }
211
212