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
23 VWelcome* VWelcome::instance = NULL;
30 if (Video::getInstance()->getFormat() == Video::PAL)
32 setScreenPos(140, 170);
36 setScreenPos(130, 140);
39 setBackgroundColour(Colour::VIEWBACKGROUND);
41 setTitleBarColour(Colour::TITLEBARBACKGROUND);
43 sl.setSurface(surface);
44 sl.setSurfaceOffset(20, 40);
45 sl.setDimensions(170, 140);
47 jpeg.setSurface(surface);
48 jpeg.setSurfaceOffset(240, 60);
58 VWelcome* VWelcome::getInstance()
63 void VWelcome::setup()
66 setTitleText(tr("Welcome"));
67 sl.addOption(tr("1. Live TV"), 1);
68 sl.addOption(tr("2. Radio"), 0);
69 sl.addOption(tr("3. Recordings"), 0);
70 sl.addOption(tr("4. Options"), 0);
71 sl.addOption(tr("5. Stand by"), 0);
72 sl.addOption(tr("6. Reboot"), 0);
83 struct tm* tms = localtime(&t);
84 strftime(timeString, 19, "%H:%M", tms);
86 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
88 jpeg.init("/vdr.jpg");
92 int VWelcome::handleCommand(int command)
104 case Remote::DF_DOWN:
134 Message* m = new Message();
135 m->message = Message::STANDBY;
136 Command::getInstance()->postMessage(m);
141 Command::getInstance()->doReboot();
145 int option = sl.getCurrentOption();
151 else if (option == 1)
156 else if (option == 2)
161 else if (option == 3)
166 else if (option == 4)
168 Message* m = new Message();
169 m->message = Message::STANDBY;
170 Command::getInstance()->postMessage(m);
173 else if (option == 5)
175 Command::getInstance()->doReboot();
178 return 2; // never gets here
186 void VWelcome::doChannelsList()
188 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
192 VChannelList* vchan = new VChannelList(VDR::VIDEO);
193 vchan->setList(chanList);
195 ViewMan::getInstance()->addNoLock(vchan);
200 // Message* m = new Message();
202 // m->to = ViewMan::getInstance();
203 // m->message = Message::SWAP_ME_FOR;
204 // m->parameter = (ULONG)vchan;
205 // ViewMan::getInstance()->postMessage(m);
209 void VWelcome::doRadioList()
211 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
215 VChannelList* vchan = new VChannelList(VDR::RADIO);
216 vchan->setList(chanList);
218 ViewMan::getInstance()->addNoLock(vchan);
224 void VWelcome::doRecordingsList()
226 ViewMan* viewman = ViewMan::getInstance();
228 VInfo* viewWait = new VInfo();
229 viewWait->create(460, 190);
230 if (Video::getInstance()->getFormat() == Video::PAL)
232 viewWait->setScreenPos(140, 170);
236 viewWait->setScreenPos(130, 140);
238 viewWait->setOneLiner(tr("Downloading recordings list"));
241 viewman->addNoLock(viewWait);
244 VDR* vdr = VDR::getInstance();
245 Directory* recDir = vdr->getRecordingsList();
249 VRecordingList* vrec = new VRecordingList(NULL);
250 vrec->setDir(recDir);
252 ViewMan::getInstance()->addNoLock(vrec);
258 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay start");
259 viewman->removeView(viewWait, 1);
260 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
263 void VWelcome::doOptions()
265 VOptions* voptions = new VOptions();
266 ViewMan::getInstance()->addNoLock(voptions);
271 void VWelcome::processMessage(Message* m)
273 if (m->message == Message::REDRAW_LANG)
275 Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message");
278 show(); // careful, this only works properly because the only place
279 // this is called from is voptions and that disappears before
280 // this message is delivered