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(200, 160);
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. MediaPlayer"), 5, 0);
56 sl.addOption(tr("6. Options"), 6, 0);
57 sl.addOption(tr("7. Reboot"), 7, 0);
59 jpeg.setSurface(surface);
60 jpeg.setSurfaceOffset(240, 60);
65 Timers::getInstance()->cancelTimer(this, 1);
72 jpeg.init("/vdr.jpg");
77 void VWelcome::drawClock()
79 // Blank the area first
80 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
85 struct tm* tms = localtime(&t);
86 strftime(timeString, 19, "%H:%M", tms);
87 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
89 time_t dt = 60 - (t % 60); // seconds to the next minute
90 if (dt == 0) dt = 60; // advance a whole minute if necessary
91 dt += t; // get a time_t value for it rather than using duration
92 // (so it will occur at the actual second and not second and a half)
94 Timers::getInstance()->setTimerT(this, 1, dt);
97 void VWelcome::timercall(int clientReference)
100 // Put updateView through master mutex since viewman is not mutex protected
101 Message* m = new Message();
102 m->message = Message::REDRAW;
103 m->to = ViewMan::getInstance();
105 m->parameter = (ULONG)&clockRegion;
106 Command::getInstance()->postMessageFromOuterSpace(m);
109 int VWelcome::handleCommand(int command)
118 viewman->updateView(this);
121 case Remote::DF_DOWN:
126 viewman->updateView(this);
161 Command::getInstance()->doReboot();
165 ULONG option = sl.getCurrentOptionData();
171 else if (option == 2)
176 else if (option == 3)
181 else if (option == 4)
186 else if (option == 5)
191 else if (option == 6)
196 else if (option == 7)
198 Command::getInstance()->doReboot();
201 return 2; // never gets here
206 VScreensaver* vscreensaver = new VScreensaver();
207 viewman->add(vscreensaver);
208 vscreensaver->draw();
209 // viewman->updateView(vscreensaver);
216 // case Remote::BACK:
225 void VWelcome::doChannelsList()
227 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
231 VChannelList* vchan = new VChannelList(VDR::VIDEO);
232 vchan->setList(chanList);
236 viewman->updateView(vchan);
240 Command::getInstance()->connectionLost();
244 void VWelcome::doRadioList()
246 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
250 VChannelList* vchan = new VChannelList(VDR::RADIO);
251 vchan->setList(chanList);
255 viewman->updateView(vchan);
259 Command::getInstance()->connectionLost();
263 void VWelcome::doRecordingsList()
265 VRecordingList* vrec = new VRecordingList();
268 viewman->updateView(vrec);
272 Command::getInstance()->connectionLost();
276 void VWelcome::doMediaList()
278 VMediaList::createList();
280 void VWelcome::doTimersList()
282 VTimerList* vtl = new VTimerList();
284 viewman->updateView(vtl);
288 Command::getInstance()->connectionLost();
292 void VWelcome::doOptions()
294 VOptionsMenu* voptionsmenu = new VOptionsMenu();
295 voptionsmenu->draw();
296 viewman->add(voptionsmenu);
297 viewman->updateView(voptionsmenu);
300 void VWelcome::processMessage(Message* m)
302 if (m->message == Message::MOUSE_MOVE)
304 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
307 viewman->updateView(this);
310 else if (m->message == Message::MOUSE_LBDOWN)
312 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
314 ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press