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 viewman = ViewMan::getInstance();
33 if (Video::getInstance()->getFormat() == Video::PAL)
35 setScreenPos(140, 170);
39 setScreenPos(130, 140);
42 setBackgroundColour(Colour::VIEWBACKGROUND);
44 setTitleBarColour(Colour::TITLEBARBACKGROUND);
46 sl.setSurface(surface);
47 sl.setSurfaceOffset(20, 40);
48 sl.setDimensions(170, 140);
50 setTitleText(tr("Welcome"));
51 sl.addOption(tr("1. Live TV"), 1, 1);
52 sl.addOption(tr("2. Radio"), 2, 0);
53 sl.addOption(tr("3. Recordings"), 3, 0);
54 sl.addOption(tr("4. Timers"), 4, 0);
55 sl.addOption(tr("5. Options"), 5, 0);
56 sl.addOption(tr("6. Reboot"), 6, 0);
58 jpeg.setSurface(surface);
59 jpeg.setSurfaceOffset(240, 60);
64 Timers::getInstance()->cancelTimer(this, 1);
71 jpeg.init("/vdr.jpg");
76 void VWelcome::drawClock()
78 // Blank the area first
79 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
84 struct tm* tms = localtime(&t);
85 strftime(timeString, 19, "%H:%M", tms);
86 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
88 time_t dt = 60 - (t % 60); // seconds to the next minute
89 if (dt == 0) dt = 60; // advance a whole minute if necessary
90 dt += t; // get a time_t value for it rather than using duration
91 // (so it will occur at the actual second and not second and a half)
93 Timers::getInstance()->setTimerT(this, 1, dt);
96 void VWelcome::timercall(int clientReference)
99 // Put updateView through master mutex since viewman is not mutex protected
100 Message* m = new Message();
101 m->message = Message::REDRAW;
102 m->to = ViewMan::getInstance();
104 m->parameter = (ULONG)&clockRegion;
105 Command::getInstance()->postMessageFromOuterSpace(m);
108 int VWelcome::handleCommand(int command)
117 viewman->updateView(this);
120 case Remote::DF_DOWN:
125 viewman->updateView(this);
155 Command::getInstance()->doReboot();
159 ULONG option = sl.getCurrentOptionData();
165 else if (option == 2)
170 else if (option == 3)
175 else if (option == 4)
180 else if (option == 5)
185 else if (option == 6)
187 Command::getInstance()->doReboot();
190 return 2; // never gets here
195 VScreensaver* vscreensaver = new VScreensaver();
196 viewman->add(vscreensaver);
197 vscreensaver->draw();
198 // viewman->updateView(vscreensaver);
205 // case Remote::BACK:
214 void VWelcome::doChannelsList()
216 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
220 VChannelList* vchan = new VChannelList(VDR::VIDEO);
221 vchan->setList(chanList);
225 viewman->updateView(vchan);
229 Command::getInstance()->connectionLost();
233 void VWelcome::doRadioList()
235 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
239 VChannelList* vchan = new VChannelList(VDR::RADIO);
240 vchan->setList(chanList);
244 viewman->updateView(vchan);
248 Command::getInstance()->connectionLost();
252 void VWelcome::doRecordingsList()
254 VRecordingList* vrec = new VRecordingList();
257 viewman->updateView(vrec);
261 Command::getInstance()->connectionLost();
265 void VWelcome::doTimersList()
267 VTimerList* vtl = new VTimerList();
269 viewman->updateView(vtl);
273 Command::getInstance()->connectionLost();
277 void VWelcome::doOptions()
279 VOptionsMenu* voptionsmenu = new VOptionsMenu();
280 voptionsmenu->draw();
281 viewman->add(voptionsmenu);
282 viewman->updateView(voptionsmenu);
285 void VWelcome::processMessage(Message* m)
287 if (m->message == Message::MOUSE_MOVE)
289 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
292 viewman->updateView(this);
295 else if (m->message == Message::MOUSE_LBDOWN)
297 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
299 ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press