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
23 VWelcome* VWelcome::instance = NULL;
29 viewman = ViewMan::getInstance();
37 if (Video::getInstance()->getFormat() == Video::PAL)
39 setScreenPos(140, 170);
43 setScreenPos(130, 140);
46 setBackgroundColour(Colour::VIEWBACKGROUND);
48 setTitleBarColour(Colour::TITLEBARBACKGROUND);
50 sl.setSurface(surface);
51 sl.setSurfaceOffset(20, 40);
52 sl.setDimensions(170, 140);
54 jpeg.setSurface(surface);
55 jpeg.setSurfaceOffset(240, 60);
63 Timers::getInstance()->cancelTimer(this, 1);
66 VWelcome* VWelcome::getInstance()
71 void VWelcome::setup()
74 setTitleText(tr("Welcome"));
75 sl.addOption(tr("1. Live TV"), 1);
76 sl.addOption(tr("2. Radio"), 0);
77 sl.addOption(tr("3. Recordings"), 0);
78 sl.addOption(tr("4. Timers"), 0);
79 sl.addOption(tr("5. Options"), 0);
80 sl.addOption(tr("6. Reboot"), 0);
87 jpeg.init("/vdr.jpg");
92 void VWelcome::drawClock()
94 // Blank the area first
95 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
100 struct tm* tms = localtime(&t);
101 strftime(timeString, 19, "%H:%M", tms);
102 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
104 time_t dt = 60 - (t % 60); // seconds to the next minute
105 if (dt == 0) dt = 60; // advance a whole minute if necessary
106 dt += t; // get a time_t value for it rather than using duration
107 // (so it will occur at the actual second and not second and a half)
109 Timers::getInstance()->setTimer(this, 1, dt);
112 void VWelcome::timercall(int clientReference)
115 viewman->updateView(this, &clockRegion);
118 int VWelcome::handleCommand(int command)
127 viewman->updateView(this);
130 case Remote::DF_DOWN:
135 viewman->updateView(this);
165 Command::getInstance()->doReboot();
169 int option = sl.getCurrentOption();
175 else if (option == 1)
180 else if (option == 2)
185 else if (option == 3)
190 else if (option == 4)
195 else if (option == 5)
197 Command::getInstance()->doReboot();
200 return 2; // never gets here
213 void VWelcome::doChannelsList()
215 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
219 VChannelList* vchan = new VChannelList(VDR::VIDEO);
220 vchan->setList(chanList);
224 viewman->updateView(vchan);
228 void VWelcome::doRadioList()
230 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
234 VChannelList* vchan = new VChannelList(VDR::RADIO);
235 vchan->setList(chanList);
239 viewman->updateView(vchan);
243 void VWelcome::doRecordingsList()
245 VInfo* viewWait = new VInfo();
246 viewWait->create(460, 190);
247 if (Video::getInstance()->getFormat() == Video::PAL)
249 viewWait->setScreenPos(140, 170);
253 viewWait->setScreenPos(130, 140);
255 viewWait->setOneLiner(tr("Downloading recordings list"));
257 viewman->add(viewWait);
258 viewman->updateView(viewWait);
260 VDR* vdr = VDR::getInstance();
261 Directory* recDir = vdr->getRecordingsList();
265 VRecordingList* vrec = new VRecordingList(NULL, recDir);
269 viewman->updateView(vrec);
272 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay start");
273 viewman->removeView(viewWait);
274 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
277 void VWelcome::doTimersList()
279 RecTimerList* recTimerList = VDR::getInstance()->getRecTimersList();
283 VTimerList* vtl = new VTimerList(recTimerList);
286 viewman->updateView(vtl);
290 void VWelcome::doOptions()
292 VOptionsMenu* voptionsmenu = new VOptionsMenu();
293 voptionsmenu->draw();
294 viewman->add(voptionsmenu);
295 viewman->updateView(voptionsmenu);
298 void VWelcome::redrawLang()
300 Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message");