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 "vrecordinglist.h"
27 #include "vtimerlist.h"
34 #include "vscreensaver.h"
35 #include "vmedialist.h"
43 boxstack = BoxStack::getInstance();
52 if (Video::getInstance()->getFormat() == Video::PAL)
54 setPosition(140, 170);
58 setPosition(130, 140);
62 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
64 sl.setPosition(20, 40);
68 setTitleText(tr("Welcome"));
69 sl.addOption(tr("1. Live TV"), 1, 1);
70 sl.addOption(tr("2. Radio"), 2, 0);
71 sl.addOption(tr("3. Recordings"), 3, 0);
72 sl.addOption(tr("4. Timers"), 4, 0);
73 #ifdef VOMP_PLATTFORM_MVP
74 sl.addOption(tr("5. MediaPlayer"), 5, 0);
77 sl.addOption(tr("6. Options"), 6, 0);
79 sl.addOption(tr("7. Reboot"), 7, 0);
81 sl.addOption(tr("7. Exit"), 7, 0);
84 jpeg.setPosition(240, 60);
86 jpeg.init("/vdr.jpg");
93 void VWelcome::preDelete()
95 Timers::getInstance()->cancelTimer(this, 1);
102 void VWelcome::draw()
108 void VWelcome::drawClock()
110 // Blank the area first
111 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
116 struct tm* tms = localtime(&t);
117 strftime(timeString, 19, "%H:%M", tms);
118 drawTextRJ(timeString, 450, 5, DrawStyle::LIGHTTEXT);
120 time_t dt = 60 - (t % 60); // seconds to the next minute
121 if (dt == 0) dt = 60; // advance a whole minute if necessary
122 dt += t; // get a time_t value for it rather than using duration
123 // (so it will occur at the actual second and not second and a half)
125 Timers::getInstance()->setTimerT(this, 1, dt);
128 void VWelcome::timercall(int clientReference)
131 boxstack->update(this, &clockRegion);
134 int VWelcome::handleCommand(int command)
143 boxstack->update(this);
146 case Remote::DF_DOWN:
151 boxstack->update(this);
176 #ifdef VOMP_PLATTFORM_MVP
188 Command::getInstance()->doReboot();
193 ULONG option = sl.getCurrentOptionData();
199 else if (option == 2)
204 else if (option == 3)
209 else if (option == 4)
214 else if (option == 5)
219 else if (option == 6)
224 else if (option == 7)
226 Command::getInstance()->doReboot();
229 return 2; // never gets here
234 VScreensaver* vscreensaver = new VScreensaver();
235 boxstack->add(vscreensaver);
236 vscreensaver->draw();
237 // boxstack->update(vscreensaver);
244 // case Remote::BACK:
253 void VWelcome::doChannelsList()
255 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
259 VChannelList* vchan = new VChannelList(VDR::VIDEO);
260 vchan->setList(chanList);
263 boxstack->add(vchan);
264 boxstack->update(vchan);
268 Command::getInstance()->connectionLost();
272 void VWelcome::doRadioList()
274 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
278 VChannelList* vchan = new VChannelList(VDR::RADIO);
279 vchan->setList(chanList);
282 boxstack->add(vchan);
283 boxstack->update(vchan);
287 Command::getInstance()->connectionLost();
291 void VWelcome::doRecordingsList()
293 VRecordingList* vrec = new VRecordingList();
296 boxstack->update(vrec);
300 Command::getInstance()->connectionLost();
304 void VWelcome::doMediaList()
306 #ifdef VOMP_MEDIAPLAYER
307 VMediaList::createList();
311 void VWelcome::doTimersList()
313 VTimerList* vtl = new VTimerList();
317 Command::getInstance()->connectionLost();
323 boxstack->update(vtl);
326 void VWelcome::doOptions()
328 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
329 // voptionsmenu->draw();
330 // boxstack->add(voptionsmenu);
331 // boxstack->updateView(voptionsmenu);
333 VOpts* vopts = new VOpts();
335 boxstack->add(vopts);
336 boxstack->update(vopts);
339 void VWelcome::processMessage(Message* m)
341 if (m->message == Message::MOUSE_MOVE)
343 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
346 boxstack->update(this);
349 else if (m->message == Message::MOUSE_LBDOWN)
351 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
353 boxstack->handleCommand(Remote::OK); //simulate OK press