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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include "vchannellist.h"
26 #include "vrecordinglistclassic.h"
27 #include "vrecordinglistadvanced.h"
28 #include "vtimerlist.h"
35 #include "vscreensaver.h"
36 #include "vmedialist.h"
44 boxstack = BoxStack::getInstance();
53 if (Video::getInstance()->getFormat() == Video::PAL)
55 setPosition(140, 170);
59 setPosition(130, 140);
63 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
65 sl.setPosition(20, 40);
69 setTitleText(tr("Welcome"));
70 sl.addOption(tr("1. Live TV"), 1, 1);
71 sl.addOption(tr("2. Radio"), 2, 0);
72 sl.addOption(tr("3. Recordings"), 3, 0);
73 sl.addOption(tr("4. Timers"), 4, 0);
74 #ifdef VOMP_PLATTFORM_MVP
75 sl.addOption(tr("5. MediaPlayer"), 5, 0);
78 sl.addOption(tr("6. Options"), 6, 0);
80 sl.addOption(tr("7. Reboot"), 7, 0);
82 sl.addOption(tr("7. Exit"), 7, 0);
85 jpeg.setPosition(240, 60);
87 jpeg.init("/vdr.jpg");
94 void VWelcome::preDelete()
96 Timers::getInstance()->cancelTimer(this, 1);
103 void VWelcome::draw()
109 void VWelcome::drawClock()
111 // Blank the area first
112 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
117 struct tm* tms = localtime(&t);
118 strftime(timeString, 19, "%H:%M", tms);
119 drawTextRJ(timeString, 450, 5, DrawStyle::LIGHTTEXT);
121 time_t dt = 60 - (t % 60); // seconds to the next minute
122 if (dt == 0) dt = 60; // advance a whole minute if necessary
123 dt += t; // get a time_t value for it rather than using duration
124 // (so it will occur at the actual second and not second and a half)
126 Timers::getInstance()->setTimerT(this, 1, dt);
129 void VWelcome::timercall(int clientReference)
132 boxstack->update(this, &clockRegion);
135 int VWelcome::handleCommand(int command)
144 boxstack->update(this);
147 case Remote::DF_DOWN:
152 boxstack->update(this);
177 #ifdef VOMP_PLATTFORM_MVP
189 Command::getInstance()->doReboot();
194 ULONG option = sl.getCurrentOptionData();
200 else if (option == 2)
205 else if (option == 3)
210 else if (option == 4)
215 else if (option == 5)
220 else if (option == 6)
225 else if (option == 7)
227 Command::getInstance()->doReboot();
230 return 2; // never gets here
235 VScreensaver* vscreensaver = new VScreensaver();
236 boxstack->add(vscreensaver);
237 vscreensaver->draw();
238 // boxstack->update(vscreensaver);
245 // case Remote::BACK:
254 void VWelcome::doChannelsList()
256 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
260 VChannelList* vchan = new VChannelList(VDR::VIDEO);
261 vchan->setList(chanList);
264 boxstack->add(vchan);
265 boxstack->update(vchan);
269 Command::getInstance()->connectionLost();
273 void VWelcome::doRadioList()
275 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
279 VChannelList* vchan = new VChannelList(VDR::RADIO);
280 vchan->setList(chanList);
283 boxstack->add(vchan);
284 boxstack->update(vchan);
288 Command::getInstance()->connectionLost();
292 void VWelcome::doRecordingsList()
294 VRecordingList* vrec;
295 if (Command::getInstance()->advMenues()) {
296 vrec = new VRecordingListAdvanced();
298 vrec = new VRecordingListClassic();
302 boxstack->update(vrec);
306 Command::getInstance()->connectionLost();
310 void VWelcome::doMediaList()
312 #ifdef VOMP_MEDIAPLAYER
313 VMediaList::createList();
317 void VWelcome::doTimersList()
319 VTimerList* vtl = new VTimerList();
323 Command::getInstance()->connectionLost();
329 boxstack->update(vtl);
332 void VWelcome::doOptions()
334 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
335 // voptionsmenu->draw();
336 // boxstack->add(voptionsmenu);
337 // boxstack->updateView(voptionsmenu);
339 VOpts* vopts = new VOpts();
341 boxstack->add(vopts);
342 boxstack->update(vopts);
345 void VWelcome::processMessage(Message* m)
347 if (m->message == Message::MOUSE_MOVE)
349 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
352 boxstack->update(this);
355 else if (m->message == Message::MOUSE_LBDOWN)
357 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
359 boxstack->handleCommand(Remote::OK); //simulate OK press