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, see <https://www.gnu.org/licenses/>.
24 #include "vchannellist.h"
25 #include "vrecordinglistclassic.h"
26 #include "vrecordinglistadvanced.h"
27 #include "vtimerlist.h"
34 #include "vscreensaver.h"
35 #include "vmedialist.h"
38 #include "staticartwork.h"
44 boxstack = BoxStack::getInstance();
51 #ifndef GRADIENT_DRAWING
54 if (Video::getInstance()->getFormat() == Video::PAL)
56 setPosition(140, 170);
60 setPosition(130, 140);
65 setPosition(140, 150);
69 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
72 #ifndef GRADIENT_DRAWING
73 jpeg.setPosition(240, 60);
75 jpeg.init("/vdr.jpg");
81 vdr.setPosition(250, 65);
82 vdr.setSize(180, 160);
84 sinfo.setStaticArtwork(sa_vdrlogo);
85 vdr.setTVMedia(sinfo, WTVMedia::ZoomHorizontal);
90 sl.setPosition(20, 40);
91 #ifdef GRADIENT_DRAWING
94 sl.setLinesPerOption(1.5f);
101 setTitleText(tr("Welcome"));
104 TVMediaInfo *info= new TVMediaInfo();
105 info->setStaticArtwork(sa_tv);
106 sl.addOption(tr("1. Live TV"), 1, 1,info);
108 info= new TVMediaInfo();
109 info->setStaticArtwork(sa_radio);
110 sl.addOption(tr("2. Radio"), 2, 0,info);
112 info= new TVMediaInfo();
113 info->setStaticArtwork(sa_recordings);
114 sl.addOption(tr("3. Recordings"), 3, 0,info);
116 info= new TVMediaInfo();
117 info->setStaticArtwork(sa_timers);
118 sl.addOption(tr("4. Timers"), 4, 0,info);
119 #ifdef VOMP_PLATTFORM_MVP
120 sl.addOption(tr("5. MediaPlayer"), 5, 0);
123 info= new TVMediaInfo();
124 info->setStaticArtwork(sa_properties);
125 sl.addOption(tr("6. Options"), 6, 0,info);
127 info= new TVMediaInfo();
128 info->setStaticArtwork(sa_restart);
129 #ifndef VOMP_HAS_EXIT
130 sl.addOption(tr("7. Reboot"), 7, 0,info);
132 sl.addOption(tr("7. Exit"), 7, 0,info);
138 void VWelcome::preDelete()
140 Timers::getInstance()->cancelTimer(this, 1);
143 VWelcome::~VWelcome()
147 void VWelcome::draw()
153 void VWelcome::drawClock()
155 // Blank the area first
156 #ifndef GRADIENT_DRAWING
157 rectangle(area.w - 60, 0, 60, 30, titleBarColour);
163 LOCALTIME_R(&t, &tms);
165 strftime(timeString, 19, "%H:%M", &tms);
166 drawTextRJ(timeString, 450, 5, DrawStyle::LIGHTTEXT);
168 time_t dt = 60 - (t % 60); // seconds to the next minute
169 if (dt == 0) dt = 60; // advance a whole minute if necessary
170 dt += t; // get a time_t value for it rather than using duration
171 // (so it will occur at the actual second and not second and a half)
173 Timers::getInstance()->setTimerT(this, 1, dt);
176 void VWelcome::timercall(int /* clientReference */)
178 #ifndef GRADIENT_DRAWING
183 boxstack->update(this, &clockRegion);
186 int VWelcome::handleCommand(int command)
195 boxstack->update(this);
198 case Remote::DF_DOWN:
203 boxstack->update(this);
228 #ifdef VOMP_PLATTFORM_MVP
240 Command::getInstance()->doReboot();
245 ULONG option = sl.getCurrentOptionData();
251 else if (option == 2)
256 else if (option == 3)
261 else if (option == 4)
266 else if (option == 5)
271 else if (option == 6)
276 else if (option == 7)
278 Command::getInstance()->doReboot();
281 return 2; // never gets here
286 VScreensaver* vscreensaver = new VScreensaver();
287 boxstack->add(vscreensaver);
288 vscreensaver->draw();
289 // boxstack->update(vscreensaver);
296 // case Remote::BACK:
305 void VWelcome::doChannelsList()
307 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
311 VChannelList* vchan = new VChannelList(VDR::VIDEO);
312 vchan->setList(chanList);
315 boxstack->add(vchan);
316 boxstack->update(vchan);
320 Command::getInstance()->connectionLost();
324 void VWelcome::doRadioList()
326 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
330 VChannelList* vchan = new VChannelList(VDR::RADIO);
331 vchan->setList(chanList);
334 boxstack->add(vchan);
335 boxstack->update(vchan);
339 Command::getInstance()->connectionLost();
343 void VWelcome::doRecordingsList()
345 VRecordingList* vrec;
346 if (Command::getInstance()->isAdvMenus())
347 vrec = new VRecordingListAdvanced();
349 vrec = new VRecordingListClassic();
353 boxstack->update(vrec);
357 Command::getInstance()->connectionLost();
361 void VWelcome::doMediaList()
363 #ifdef VOMP_MEDIAPLAYER
364 VMediaList::createList();
368 void VWelcome::doTimersList()
370 VTimerList* vtl = new VTimerList();
374 Command::getInstance()->connectionLost();
380 boxstack->update(vtl);
383 void VWelcome::doOptions()
385 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
386 // voptionsmenu->draw();
387 // boxstack->add(voptionsmenu);
388 // boxstack->updateView(voptionsmenu);
390 VOpts* vopts = new VOpts();
392 boxstack->add(vopts);
393 boxstack->update(vopts);
396 void VWelcome::processMessage(Message* m)
398 if (m->message == Message::MOUSE_MOVE)
400 if (sl.mouseMove((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
403 boxstack->update(this);
406 else if (m->message == Message::MOUSE_LBDOWN)
408 if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
410 boxstack->handleCommand(Remote::OK); //simulate OK press