2 Copyright 2004-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 viewman = ViewMan::getInstance();
33 if (Video::getInstance()->getFormat() == Video::PAL)
35 setScreenPos(140, 170);
39 setScreenPos(130, 140);
42 setBackgroundColour(Colour::VIEWBACKGROUND);
44 setTitleBarColour(Colour::TITLEBARBACKGROUND);
46 sl.setSurface(surface);
47 sl.setSurfaceOffset(20, 40);
48 sl.setDimensions(170, 140);
50 jpeg.setSurface(surface);
51 jpeg.setSurfaceOffset(240, 60);
58 Timers::getInstance()->cancelTimer(this, 1);
61 void VWelcome::setup()
64 setTitleText(tr("Welcome"));
65 sl.addOption(tr("1. Live TV"), 1);
66 sl.addOption(tr("2. Radio"), 0);
67 sl.addOption(tr("3. Recordings"), 0);
68 sl.addOption(tr("4. Options"), 0);
69 sl.addOption(tr("5. Stand by"), 0);
70 sl.addOption(tr("6. Reboot"), 0);
77 jpeg.init("/vdr.jpg");
82 void VWelcome::drawClock()
84 // Blank the area first
85 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
90 struct tm* tms = localtime(&t);
91 strftime(timeString, 19, "%H:%M", tms);
92 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
94 time_t dt = 60 - (t % 60); // seconds to the next minute
95 if (dt == 0) dt = 60; // advance a whole minute if necessary
96 dt += t; // get a time_t value for it rather than using duration
97 // (so it will occur at the actual second and not second and a half)
99 Timers::getInstance()->setTimer(this, 1, dt);
102 void VWelcome::timercall(int clientReference)
105 viewman->updateView(this, &clockRegion);
108 int VWelcome::handleCommand(int command)
117 viewman->updateView(this);
120 case Remote::DF_DOWN:
125 viewman->updateView(this);
150 Message* m = new Message(); // Must be done after this view deleted
151 m->message = Message::STANDBY;
152 Command::getInstance()->postMessageNoLock(m);
157 Command::getInstance()->doReboot();
161 int option = sl.getCurrentOption();
167 else if (option == 1)
172 else if (option == 2)
177 else if (option == 3)
182 else if (option == 4)
184 Message* m = new Message(); // Must be done after this view deleted
185 m->message = Message::STANDBY;
186 Command::getInstance()->postMessageNoLock(m);
189 else if (option == 5)
191 Command::getInstance()->doReboot();
194 return 2; // never gets here
201 void VWelcome::doChannelsList()
203 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
207 VChannelList* vchan = new VChannelList(VDR::VIDEO);
208 vchan->setList(chanList);
212 viewman->updateView(vchan);
216 void VWelcome::doRadioList()
218 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
222 VChannelList* vchan = new VChannelList(VDR::RADIO);
223 vchan->setList(chanList);
227 viewman->updateView(vchan);
231 void VWelcome::doRecordingsList()
233 VInfo* viewWait = new VInfo();
234 viewWait->create(460, 190);
235 if (Video::getInstance()->getFormat() == Video::PAL)
237 viewWait->setScreenPos(140, 170);
241 viewWait->setScreenPos(130, 140);
243 viewWait->setOneLiner(tr("Downloading recordings list"));
245 viewman->add(viewWait);
246 viewman->updateView(viewWait);
248 VDR* vdr = VDR::getInstance();
249 Directory* recDir = vdr->getRecordingsList();
253 VRecordingList* vrec = new VRecordingList(NULL, recDir);
257 viewman->updateView(vrec);
260 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay start");
261 viewman->removeView(viewWait);
262 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
265 void VWelcome::doOptions()
267 VOptions* voptions = new VOptions(this);
269 viewman->add(voptions);
270 viewman->updateView(voptions);
273 void VWelcome::redrawLang()
275 Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message");