]> git.vomp.tv Git - vompclient.git/blob - vlivebanner.cc
Channel unavailable detection, minor mod to live banner
[vompclient.git] / vlivebanner.cc
1 /*
2     Copyright 2004-2005 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "vlivebanner.h"
22
23 VLiveBanner::VLiveBanner(Channel* channel)
24 {
25   currentChannel = channel;
26
27   if (Video::getInstance()->getFormat() == Video::PAL)
28   {
29     setScreenPos(130, 370);
30   }
31   else
32   {
33     setScreenPos(120, 320);
34   }
35
36   setDimensions(120, 500);
37
38   setBackgroundColour(Colour::VIEWBACKGROUND);
39   setTitleBarOn(1);
40   setTitleText(currentChannel->name);
41   setTitleBarColour(Colour::TITLEBARBACKGROUND);
42
43   sl.setScreenPos(screenX, screenY + 30);
44   sl.setDimensions(height - 60, width);
45 }
46
47 VLiveBanner::~VLiveBanner()
48 {
49 }
50
51 void VLiveBanner::draw()
52 {
53   int success = VDR::getInstance()->getChannelSchedule(1);
54
55   if (!success)
56   {
57     sl.addOption("No channel data available", 1);
58   }
59   else
60   {
61     sl.addOption("This Programme", 1);
62     sl.addOption("The Next Programme", 0);
63     sl.addOption("The Programme after that", 0);
64   }
65
66   View::draw();
67   sl.draw();
68   rectangle(0, height - 30, width, 30, titleBarColour);
69 }
70
71 int VLiveBanner::handleCommand(int command)
72 {
73   switch (command)
74   {
75     case Remote::OK:
76     case Remote::BACK:
77     {
78       return 4;
79     }
80     case Remote::DF_UP:
81     case Remote::UP:
82     {
83       sl.up();
84       sl.draw();
85
86       show();
87       return 2;
88     }
89     case Remote::DF_DOWN:
90     case Remote::DOWN:
91     {
92       sl.down();
93       sl.draw();
94
95       show();
96       return 2;
97     }
98   }
99
100   return 1;
101 }