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 #ifndef GRADIENT_DRAWING
113 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
118 struct tm* tms = localtime(&t);
119 strftime(timeString, 19, "%H:%M", tms);
120 drawTextRJ(timeString, 450, 5, DrawStyle::LIGHTTEXT);
122 time_t dt = 60 - (t % 60); // seconds to the next minute
123 if (dt == 0) dt = 60; // advance a whole minute if necessary
124 dt += t; // get a time_t value for it rather than using duration
125 // (so it will occur at the actual second and not second and a half)
127 Timers::getInstance()->setTimerT(this, 1, dt);
130 void VWelcome::timercall(int clientReference)
132 #ifndef GRADIENT_DRAWING
137 boxstack->update(this, &clockRegion);
140 int VWelcome::handleCommand(int command)
149 boxstack->update(this);
152 case Remote::DF_DOWN:
157 boxstack->update(this);
182 #ifdef VOMP_PLATTFORM_MVP
194 Command::getInstance()->doReboot();
199 ULONG option = sl.getCurrentOptionData();
205 else if (option == 2)
210 else if (option == 3)
215 else if (option == 4)
220 else if (option == 5)
225 else if (option == 6)
230 else if (option == 7)
232 Command::getInstance()->doReboot();
235 return 2; // never gets here
240 VScreensaver* vscreensaver = new VScreensaver();
241 boxstack->add(vscreensaver);
242 vscreensaver->draw();
243 // boxstack->update(vscreensaver);
250 // case Remote::BACK:
259 void VWelcome::doChannelsList()
261 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
265 VChannelList* vchan = new VChannelList(VDR::VIDEO);
266 vchan->setList(chanList);
269 boxstack->add(vchan);
270 boxstack->update(vchan);
274 Command::getInstance()->connectionLost();
278 void VWelcome::doRadioList()
280 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
284 VChannelList* vchan = new VChannelList(VDR::RADIO);
285 vchan->setList(chanList);
288 boxstack->add(vchan);
289 boxstack->update(vchan);
293 Command::getInstance()->connectionLost();
297 void VWelcome::doRecordingsList()
299 VRecordingList* vrec;
300 if (Command::getInstance()->advMenues()) {
301 vrec = new VRecordingListAdvanced();
303 vrec = new VRecordingListClassic();
307 boxstack->update(vrec);
311 Command::getInstance()->connectionLost();
315 void VWelcome::doMediaList()
317 #ifdef VOMP_MEDIAPLAYER
318 VMediaList::createList();
322 void VWelcome::doTimersList()
324 VTimerList* vtl = new VTimerList();
328 Command::getInstance()->connectionLost();
334 boxstack->update(vtl);
337 void VWelcome::doOptions()
339 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
340 // voptionsmenu->draw();
341 // boxstack->add(voptionsmenu);
342 // boxstack->updateView(voptionsmenu);
344 VOpts* vopts = new VOpts();
346 boxstack->add(vopts);
347 boxstack->update(vopts);
350 void VWelcome::processMessage(Message* m)
352 if (m->message == Message::MOUSE_MOVE)
354 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
357 boxstack->update(this);
360 else if (m->message == Message::MOUSE_LBDOWN)
362 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
364 boxstack->handleCommand(Remote::OK); //simulate OK press