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"
41 boxstack = BoxStack::getInstance();
50 if (Video::getInstance()->getFormat() == Video::PAL)
52 setPosition(140, 170);
56 setPosition(130, 140);
60 setTitleBarColour(Colour::TITLEBARBACKGROUND);
62 sl.setPosition(20, 40);
66 setTitleText(tr("Welcome"));
67 sl.addOption(tr("1. Live TV"), 1, 1);
68 sl.addOption(tr("2. Radio"), 2, 0);
69 sl.addOption(tr("3. Recordings"), 3, 0);
70 sl.addOption(tr("4. Timers"), 4, 0);
73 sl.addOption(tr("5. MediaPlayer"), 5, 0);
76 sl.addOption(tr("6. Options"), 6, 0);
78 sl.addOption(tr("7. Reboot"), 7, 0);
80 sl.addOption(tr("7. Exit to Gaya"), 7, 0);
83 jpeg.setPosition(240, 60);
85 jpeg.init("/vdr.jpg");
92 void VWelcome::preDelete()
94 Timers::getInstance()->cancelTimer(this, 1);
101 void VWelcome::draw()
107 void VWelcome::drawClock()
109 // Blank the area first
110 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
115 struct tm* tms = localtime(&t);
116 strftime(timeString, 19, "%H:%M", tms);
117 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
119 time_t dt = 60 - (t % 60); // seconds to the next minute
120 if (dt == 0) dt = 60; // advance a whole minute if necessary
121 dt += t; // get a time_t value for it rather than using duration
122 // (so it will occur at the actual second and not second and a half)
124 Timers::getInstance()->setTimerT(this, 1, dt);
127 void VWelcome::timercall(int clientReference)
130 boxstack->update(this, &clockRegion);
133 int VWelcome::handleCommand(int command)
142 boxstack->update(this);
145 case Remote::DF_DOWN:
150 boxstack->update(this);
185 Command::getInstance()->doReboot();
189 ULONG option = sl.getCurrentOptionData();
195 else if (option == 2)
200 else if (option == 3)
205 else if (option == 4)
210 else if (option == 5)
215 else if (option == 6)
220 else if (option == 7)
222 Command::getInstance()->doReboot();
225 return 2; // never gets here
230 VScreensaver* vscreensaver = new VScreensaver();
231 boxstack->add(vscreensaver);
232 vscreensaver->draw();
233 // boxstack->update(vscreensaver);
240 // case Remote::BACK:
249 void VWelcome::doChannelsList()
251 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
255 VChannelList* vchan = new VChannelList(VDR::VIDEO);
256 vchan->setList(chanList);
259 boxstack->add(vchan);
260 boxstack->update(vchan);
264 Command::getInstance()->connectionLost();
268 void VWelcome::doRadioList()
270 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
274 VChannelList* vchan = new VChannelList(VDR::RADIO);
275 vchan->setList(chanList);
278 boxstack->add(vchan);
279 boxstack->update(vchan);
283 Command::getInstance()->connectionLost();
287 void VWelcome::doRecordingsList()
289 VRecordingList* vrec = new VRecordingList();
292 boxstack->update(vrec);
296 Command::getInstance()->connectionLost();
300 void VWelcome::doMediaList()
302 VMediaList::createList();
305 void VWelcome::doTimersList()
307 VTimerList* vtl = new VTimerList();
311 Command::getInstance()->connectionLost();
317 boxstack->update(vtl);
320 void VWelcome::doOptions()
322 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
323 // voptionsmenu->draw();
324 // boxstack->add(voptionsmenu);
325 // boxstack->updateView(voptionsmenu);
327 VOpts* vopts = new VOpts();
329 boxstack->add(vopts);
330 boxstack->update(vopts);
333 void VWelcome::processMessage(Message* m)
335 if (m->message == Message::MOUSE_MOVE)
337 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
340 boxstack->update(this);
343 else if (m->message == Message::MOUSE_LBDOWN)
345 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
347 boxstack->handleCommand(Remote::OK); //simulate OK press