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, 1);
76 sl.addOption(tr("2. Radio"), 2, 0);
77 sl.addOption(tr("3. Recordings"), 3, 0);
78 sl.addOption(tr("4. Timers"), 4, 0);
79 sl.addOption(tr("5. Options"), 5, 0);
80 sl.addOption(tr("6. Reboot"), 6, 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()->setTimerT(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 ULONG option = sl.getCurrentOptionData();
175 else if (option == 2)
180 else if (option == 3)
185 else if (option == 4)
190 else if (option == 5)
195 else if (option == 6)
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 Command::getInstance()->connectionLost();
232 void VWelcome::doRadioList()
234 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
238 VChannelList* vchan = new VChannelList(VDR::RADIO);
239 vchan->setList(chanList);
243 viewman->updateView(vchan);
247 Command::getInstance()->connectionLost();
251 void VWelcome::doRecordingsList()
253 VRecordingList* vrec = new VRecordingList();
256 viewman->updateView(vrec);
260 Command::getInstance()->connectionLost();
264 void VWelcome::doTimersList()
266 RecTimerList* recTimerList = VDR::getInstance()->getRecTimersList();
270 VTimerList* vtl = new VTimerList(recTimerList);
273 viewman->updateView(vtl);
277 Command::getInstance()->connectionLost();
281 void VWelcome::doOptions()
283 VOptionsMenu* voptionsmenu = new VOptionsMenu();
284 voptionsmenu->draw();
285 viewman->add(voptionsmenu);
286 viewman->updateView(voptionsmenu);
289 void VWelcome::redrawLang()
291 Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message");