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"
33 #include "vscreensaver.h"
34 #include "vmedialist.h"
37 #include "staticartwork.h"
43 boxstack = BoxStack::getInstance();
50 #ifndef GRADIENT_DRAWING
53 if (Video::getInstance()->getFormat() == Video::PAL)
55 setPosition(140, 170);
59 setPosition(130, 140);
64 setPosition(140, 150);
68 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
71 #ifndef GRADIENT_DRAWING
72 jpeg.setPosition(240, 60);
74 jpeg.init("/vdr.jpg");
80 vdr.setPosition(250, 65);
81 vdr.setSize(180, 160);
83 sinfo.setStaticArtwork(sa_vdrlogo);
84 vdr.setTVMedia(sinfo, WTVMedia::ZoomHorizontal);
89 sl.setPosition(20, 40);
90 #ifdef GRADIENT_DRAWING
93 sl.setLinesPerOption(1.5f);
100 setTitleText(tr("Welcome"));
103 TVMediaInfo *info= new TVMediaInfo();
104 info->setStaticArtwork(sa_tv);
105 sl.addOption(tr("1. Live TV"), reinterpret_cast<void*>(1), 1, info);
107 info= new TVMediaInfo();
108 info->setStaticArtwork(sa_radio);
109 sl.addOption(tr("2. Radio"), reinterpret_cast<void*>(2), 0, info);
111 info= new TVMediaInfo();
112 info->setStaticArtwork(sa_recordings);
113 sl.addOption(tr("3. Recordings"), reinterpret_cast<void*>(3), 0, info);
115 info= new TVMediaInfo();
116 info->setStaticArtwork(sa_timers);
117 sl.addOption(tr("4. Timers"), reinterpret_cast<void*>(4), 0, info);
118 #ifdef VOMP_PLATTFORM_MVP
119 sl.addOption(tr("5. MediaPlayer"), reinterpret_cast<void*>(5), 0);
122 info= new TVMediaInfo();
123 info->setStaticArtwork(sa_properties);
124 sl.addOption(tr("6. Options"), reinterpret_cast<void*>(6), 0,info);
126 info= new TVMediaInfo();
127 info->setStaticArtwork(sa_restart);
129 #ifndef VOMP_HAS_EXIT
130 sl.addOption(tr("7. Reboot"), reinterpret_cast<void*>(7), 0,info);
132 sl.addOption(tr("7. Exit"), reinterpret_cast<void*>(7), 0,info);
135 MessageQueue::getInstance()->addReceiver(this);
138 void VWelcome::preDelete()
140 Timers::getInstance()->cancelTimer(this, 1);
143 VWelcome::~VWelcome()
145 MessageQueue::getInstance()->removeReceiver(this);
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)
195 boxstack->update(this);
196 return BoxStack::COMMAND_HANDLED;
202 boxstack->update(this);
203 return BoxStack::COMMAND_HANDLED;
208 return BoxStack::COMMAND_HANDLED;
213 return BoxStack::COMMAND_HANDLED;
218 return BoxStack::COMMAND_HANDLED;
223 return BoxStack::COMMAND_HANDLED;
227 #ifdef VOMP_PLATTFORM_MVP
230 return BoxStack::COMMAND_HANDLED;
235 return BoxStack::COMMAND_HANDLED;
239 Control::getInstance()->doReboot();
240 return BoxStack::COMMAND_HANDLED;
244 ULONG option = reinterpret_cast<ULONG>(sl.getCurrentOptionData());
248 return BoxStack::COMMAND_HANDLED;
250 else if (option == 2)
253 return BoxStack::COMMAND_HANDLED;
255 else if (option == 3)
258 return BoxStack::COMMAND_HANDLED;
260 else if (option == 4)
263 return BoxStack::COMMAND_HANDLED;
265 else if (option == 5)
268 return BoxStack::COMMAND_HANDLED;
270 else if (option == 6)
273 return BoxStack::COMMAND_HANDLED;
275 else if (option == 7)
277 Control::getInstance()->doReboot();
278 return BoxStack::COMMAND_HANDLED;
280 return BoxStack::COMMAND_HANDLED; // never gets here
285 VScreensaver* vscreensaver = new VScreensaver();
286 boxstack->add(vscreensaver);
287 vscreensaver->draw();
288 // boxstack->update(vscreensaver);
290 return BoxStack::COMMAND_HANDLED;
297 // return BoxStack::DELETE_ME;
301 return BoxStack::ABANDON_COMMAND;
304 void VWelcome::doChannelsList()
306 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
310 VChannelList* vchan = new VChannelList(VDR::VIDEO);
311 vchan->setList(chanList);
314 boxstack->add(vchan);
315 boxstack->update(vchan);
319 Control::getInstance()->connectionLost();
323 void VWelcome::doRadioList()
325 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
329 VChannelList* vchan = new VChannelList(VDR::RADIO);
330 vchan->setList(chanList);
333 boxstack->add(vchan);
334 boxstack->update(vchan);
338 Control::getInstance()->connectionLost();
342 void VWelcome::doRecordingsList()
344 VRecordingList* vrec;
345 if (Control::getInstance()->isAdvMenus())
346 vrec = new VRecordingListAdvanced();
348 vrec = new VRecordingListClassic();
352 boxstack->update(vrec);
356 Control::getInstance()->connectionLost();
360 void VWelcome::doMediaList()
362 #ifdef VOMP_MEDIAPLAYER
363 VMediaList::createList();
367 void VWelcome::doTimersList()
369 VTimerList* vtl = new VTimerList();
373 Control::getInstance()->connectionLost();
379 boxstack->update(vtl);
382 void VWelcome::doOptions()
384 // VOptionsMenu* voptionsmenu = new VOptionsMenu();
385 // voptionsmenu->draw();
386 // boxstack->add(voptionsmenu);
387 // boxstack->updateView(voptionsmenu);
389 VOpts* vopts = new VOpts();
391 boxstack->add(vopts);
392 boxstack->update(vopts);
395 void VWelcome::processMessage(Message* m)
397 if (m->message == Message::MOUSE_MOVE)
399 if (sl.mouseMove(m->parameter - getScreenX(), m->tag - getScreenY()))
402 boxstack->update(this);
405 else if (m->message == Message::MOUSE_LBDOWN)
407 if (sl.mouseLBDOWN(m->parameter - getScreenX(), m->tag - getScreenY()))
409 Input::sendInputKey(Input::OK);