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");
80 void VWelcome::preDelete()
82 Timers::getInstance()->cancelTimer(this, 1);
95 void VWelcome::drawClock()
97 // Blank the area first
98 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
103 struct tm* tms = localtime(&t);
104 strftime(timeString, 19, "%H:%M", tms);
105 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
107 time_t dt = 60 - (t % 60); // seconds to the next minute
108 if (dt == 0) dt = 60; // advance a whole minute if necessary
109 dt += t; // get a time_t value for it rather than using duration
110 // (so it will occur at the actual second and not second and a half)
112 Timers::getInstance()->setTimerT(this, 1, dt);
115 void VWelcome::timercall(int clientReference)
118 boxstack->update(this, &clockRegion);
121 int VWelcome::handleCommand(int command)
130 boxstack->update(this);
133 case Remote::DF_DOWN:
138 boxstack->update(this);
173 Command::getInstance()->doReboot();
177 ULONG option = sl.getCurrentOptionData();
183 else if (option == 2)
188 else if (option == 3)
193 else if (option == 4)
198 else if (option == 5)
203 else if (option == 6)
208 else if (option == 7)
210 Command::getInstance()->doReboot();
213 return 2; // never gets here
218 VScreensaver* vscreensaver = new VScreensaver();
219 boxstack->add(vscreensaver);
220 vscreensaver->draw();
221 // boxstack->update(vscreensaver);
228 // case Remote::BACK:
237 void VWelcome::doChannelsList()
239 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
243 VChannelList* vchan = new VChannelList(VDR::VIDEO);
244 vchan->setList(chanList);
247 boxstack->add(vchan);
248 boxstack->update(vchan);
252 Command::getInstance()->connectionLost();
256 void VWelcome::doRadioList()
258 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
262 VChannelList* vchan = new VChannelList(VDR::RADIO);
263 vchan->setList(chanList);
266 boxstack->add(vchan);
267 boxstack->update(vchan);
271 Command::getInstance()->connectionLost();
275 void VWelcome::doRecordingsList()
277 VRecordingList* vrec = new VRecordingList();
280 boxstack->update(vrec);
284 Command::getInstance()->connectionLost();
288 void VWelcome::doMediaList()
290 VMediaList::createList();
293 void VWelcome::doTimersList()
295 VTimerList* vtl = new VTimerList();
299 Command::getInstance()->connectionLost();
305 boxstack->update(vtl);
308 void VWelcome::doOptions()
310 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
311 // voptionsmenu->draw();
312 // boxstack->add(voptionsmenu);
313 // boxstack->updateView(voptionsmenu);
315 VOpts* vopts = new VOpts();
317 boxstack->add(vopts);
318 boxstack->update(vopts);
321 void VWelcome::processMessage(Message* m)
323 if (m->message == Message::MOUSE_MOVE)
325 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
328 boxstack->update(this);
331 else if (m->message == Message::MOUSE_LBDOWN)
333 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
335 boxstack->handleCommand(Remote::OK); //simulate OK press