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);
71 sl.addOption(tr("5. MediaPlayer"), 5, 0);
72 sl.addOption(tr("6. Options"), 6, 0);
73 sl.addOption(tr("7. Reboot"), 7, 0);
75 jpeg.setPosition(240, 60);
76 jpeg.init("/vdr.jpg");
82 Timers::getInstance()->cancelTimer(this, 1);
91 void VWelcome::drawClock()
93 // Blank the area first
94 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
99 struct tm* tms = localtime(&t);
100 strftime(timeString, 19, "%H:%M", tms);
101 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
103 time_t dt = 60 - (t % 60); // seconds to the next minute
104 if (dt == 0) dt = 60; // advance a whole minute if necessary
105 dt += t; // get a time_t value for it rather than using duration
106 // (so it will occur at the actual second and not second and a half)
108 Timers::getInstance()->setTimerT(this, 1, dt);
111 void VWelcome::timercall(int clientReference)
114 boxstack->update(this, &clockRegion);
117 int VWelcome::handleCommand(int command)
126 boxstack->update(this);
129 case Remote::DF_DOWN:
134 boxstack->update(this);
169 Command::getInstance()->doReboot();
173 ULONG option = sl.getCurrentOptionData();
179 else if (option == 2)
184 else if (option == 3)
189 else if (option == 4)
194 else if (option == 5)
199 else if (option == 6)
204 else if (option == 7)
206 Command::getInstance()->doReboot();
209 return 2; // never gets here
214 VScreensaver* vscreensaver = new VScreensaver();
215 boxstack->add(vscreensaver);
216 vscreensaver->draw();
217 // boxstack->update(vscreensaver);
224 // case Remote::BACK:
233 void VWelcome::doChannelsList()
235 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
239 VChannelList* vchan = new VChannelList(VDR::VIDEO);
240 vchan->setList(chanList);
243 boxstack->add(vchan);
244 boxstack->update(vchan);
248 Command::getInstance()->connectionLost();
252 void VWelcome::doRadioList()
254 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
258 VChannelList* vchan = new VChannelList(VDR::RADIO);
259 vchan->setList(chanList);
262 boxstack->add(vchan);
263 boxstack->update(vchan);
267 Command::getInstance()->connectionLost();
271 void VWelcome::doRecordingsList()
273 VRecordingList* vrec = new VRecordingList();
276 boxstack->update(vrec);
280 Command::getInstance()->connectionLost();
284 void VWelcome::doMediaList()
286 VMediaList::createList();
289 void VWelcome::doTimersList()
291 VTimerList* vtl = new VTimerList();
295 Command::getInstance()->connectionLost();
301 boxstack->update(vtl);
304 void VWelcome::doOptions()
306 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
307 // voptionsmenu->draw();
308 // boxstack->add(voptionsmenu);
309 // boxstack->updateView(voptionsmenu);
311 VOpts* vopts = new VOpts();
313 boxstack->add(vopts);
314 boxstack->update(vopts);
317 void VWelcome::processMessage(Message* m)
319 if (m->message == Message::MOUSE_MOVE)
321 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
324 boxstack->update(this);
327 else if (m->message == Message::MOUSE_LBDOWN)
329 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
331 boxstack->handleCommand(Remote::OK); //simulate OK press