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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 // Put updateView through master mutex since boxstack is not mutex protected
115 Message* m = new Message();
116 m->message = Message::REDRAW;
119 m->parameter = (ULONG)&clockRegion;
120 Command::getInstance()->postMessageFromOuterSpace(m);
123 int VWelcome::handleCommand(int command)
132 boxstack->update(this);
135 case Remote::DF_DOWN:
140 boxstack->update(this);
175 Command::getInstance()->doReboot();
179 ULONG option = sl.getCurrentOptionData();
185 else if (option == 2)
190 else if (option == 3)
195 else if (option == 4)
200 else if (option == 5)
205 else if (option == 6)
210 else if (option == 7)
212 Command::getInstance()->doReboot();
215 return 2; // never gets here
220 VScreensaver* vscreensaver = new VScreensaver();
221 boxstack->add(vscreensaver);
222 vscreensaver->draw();
223 // boxstack->update(vscreensaver);
230 // case Remote::BACK:
239 void VWelcome::doChannelsList()
241 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
245 VChannelList* vchan = new VChannelList(VDR::VIDEO);
246 vchan->setList(chanList);
249 boxstack->add(vchan);
250 boxstack->update(vchan);
254 Command::getInstance()->connectionLost();
258 void VWelcome::doRadioList()
260 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
264 VChannelList* vchan = new VChannelList(VDR::RADIO);
265 vchan->setList(chanList);
268 boxstack->add(vchan);
269 boxstack->update(vchan);
273 Command::getInstance()->connectionLost();
277 void VWelcome::doRecordingsList()
279 VRecordingList* vrec = new VRecordingList();
282 boxstack->update(vrec);
286 Command::getInstance()->connectionLost();
290 void VWelcome::doMediaList()
292 VMediaList::createList();
295 void VWelcome::doTimersList()
297 VTimerList* vtl = new VTimerList();
301 Command::getInstance()->connectionLost();
307 boxstack->update(vtl);
310 void VWelcome::doOptions()
312 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
313 // voptionsmenu->draw();
314 // boxstack->add(voptionsmenu);
315 // boxstack->updateView(voptionsmenu);
317 VOpts* vopts = new VOpts();
319 boxstack->add(vopts);
320 boxstack->update(vopts);
323 void VWelcome::processMessage(Message* m)
325 if (m->message == Message::MOUSE_MOVE)
327 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
330 boxstack->update(this);
333 else if (m->message == Message::MOUSE_LBDOWN)
335 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
337 boxstack->handleCommand(Remote::OK); //simulate OK press