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 "vrecordinglistclassic.h"
27 #include "vrecordinglistadvanced.h"
28 #include "vtimerlist.h"
35 #include "vscreensaver.h"
36 #include "vmedialist.h"
39 #include "staticartwork.h"
45 boxstack = BoxStack::getInstance();
52 #ifndef GRADIENT_DRAWING
55 if (Video::getInstance()->getFormat() == Video::PAL)
57 setPosition(140, 170);
61 setPosition(130, 140);
66 setPosition(140, 150);
70 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
73 #ifndef GRADIENT_DRAWING
74 jpeg.setPosition(240, 60);
76 jpeg.init("/vdr.jpg");
82 vdr.setPosition(250, 65);
83 vdr.setSize(180, 160);
85 sinfo.setStaticArtwork(sa_vdrlogo);
86 vdr.setTVMedia(sinfo, WTVMedia::ZoomHorizontal);
91 sl.setPosition(20, 40);
92 #ifdef GRADIENT_DRAWING
95 sl.setLinesPerOption(1.5f);
102 setTitleText(tr("Welcome"));
105 TVMediaInfo *info= new TVMediaInfo();
106 info->setStaticArtwork(sa_tv);
107 sl.addOption(tr("1. Live TV"), 1, 1,info);
109 info= new TVMediaInfo();
110 info->setStaticArtwork(sa_radio);
111 sl.addOption(tr("2. Radio"), 2, 0,info);
113 info= new TVMediaInfo();
114 info->setStaticArtwork(sa_recordings);
115 sl.addOption(tr("3. Recordings"), 3, 0,info);
117 info= new TVMediaInfo();
118 info->setStaticArtwork(sa_timers);
119 sl.addOption(tr("4. Timers"), 4, 0,info);
120 #ifdef VOMP_PLATTFORM_MVP
121 sl.addOption(tr("5. MediaPlayer"), 5, 0);
124 info= new TVMediaInfo();
125 info->setStaticArtwork(sa_properties);
126 sl.addOption(tr("6. Options"), 6, 0,info);
128 info= new TVMediaInfo();
129 info->setStaticArtwork(sa_restart);
130 #ifndef VOMP_HAS_EXIT
131 sl.addOption(tr("7. Reboot"), 7, 0,info);
133 sl.addOption(tr("7. Exit"), 7, 0,info);
139 void VWelcome::preDelete()
141 Timers::getInstance()->cancelTimer(this, 1);
144 VWelcome::~VWelcome()
148 void VWelcome::draw()
154 void VWelcome::drawClock()
156 // Blank the area first
157 #ifndef GRADIENT_DRAWING
158 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
164 LOCALTIME_R(&t, &tms);
166 strftime(timeString, 19, "%H:%M", &tms);
167 drawTextRJ(timeString, 450, 5, DrawStyle::LIGHTTEXT);
169 time_t dt = 60 - (t % 60); // seconds to the next minute
170 if (dt == 0) dt = 60; // advance a whole minute if necessary
171 dt += t; // get a time_t value for it rather than using duration
172 // (so it will occur at the actual second and not second and a half)
174 Timers::getInstance()->setTimerT(this, 1, dt);
177 void VWelcome::timercall(int clientReference)
179 #ifndef GRADIENT_DRAWING
184 boxstack->update(this, &clockRegion);
187 int VWelcome::handleCommand(int command)
196 boxstack->update(this);
199 case Remote::DF_DOWN:
204 boxstack->update(this);
229 #ifdef VOMP_PLATTFORM_MVP
241 Command::getInstance()->doReboot();
246 ULONG option = sl.getCurrentOptionData();
252 else if (option == 2)
257 else if (option == 3)
262 else if (option == 4)
267 else if (option == 5)
272 else if (option == 6)
277 else if (option == 7)
279 Command::getInstance()->doReboot();
282 return 2; // never gets here
287 VScreensaver* vscreensaver = new VScreensaver();
288 boxstack->add(vscreensaver);
289 vscreensaver->draw();
290 // boxstack->update(vscreensaver);
297 // case Remote::BACK:
306 void VWelcome::doChannelsList()
308 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
312 VChannelList* vchan = new VChannelList(VDR::VIDEO);
313 vchan->setList(chanList);
316 boxstack->add(vchan);
317 boxstack->update(vchan);
321 Command::getInstance()->connectionLost();
325 void VWelcome::doRadioList()
327 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
331 VChannelList* vchan = new VChannelList(VDR::RADIO);
332 vchan->setList(chanList);
335 boxstack->add(vchan);
336 boxstack->update(vchan);
340 Command::getInstance()->connectionLost();
344 void VWelcome::doRecordingsList()
346 VRecordingList* vrec;
347 if (Command::getInstance()->advMenues()) {
348 vrec = new VRecordingListAdvanced();
350 vrec = new VRecordingListClassic();
354 boxstack->update(vrec);
358 Command::getInstance()->connectionLost();
362 void VWelcome::doMediaList()
364 #ifdef VOMP_MEDIAPLAYER
365 VMediaList::createList();
369 void VWelcome::doTimersList()
371 VTimerList* vtl = new VTimerList();
375 Command::getInstance()->connectionLost();
381 boxstack->update(vtl);
384 void VWelcome::doOptions()
386 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
387 // voptionsmenu->draw();
388 // boxstack->add(voptionsmenu);
389 // boxstack->updateView(voptionsmenu);
391 VOpts* vopts = new VOpts();
393 boxstack->add(vopts);
394 boxstack->update(vopts);
397 void VWelcome::processMessage(Message* m)
399 if (m->message == Message::MOUSE_MOVE)
401 if (sl.mouseMove((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY()))
404 boxstack->update(this);
407 else if (m->message == Message::MOUSE_LBDOWN)
409 if (sl.mouseLBDOWN((m->parameter.num>>16)-getScreenX(),(m->parameter.num&0xFFFF)-getScreenY()))
411 boxstack->handleCommand(Remote::OK); //simulate OK press