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
26 if (Video::getInstance()->getFormat() == Video::PAL)
28 setScreenPos(140, 170);
32 setScreenPos(130, 140);
35 sl.setSurface(surface);
36 jpeg.setSurface(surface);
38 setBackgroundColour(Colour::VIEWBACKGROUND);
40 setTitleBarColour(Colour::TITLEBARBACKGROUND);
41 setTitleText("Welcome");
43 sl.setSurfaceOffset(20, 40);
44 sl.setDimensions(170, 140);
46 sl.addOption("1. Live TV", 1);
47 sl.addOption("2. Radio", 0);
48 sl.addOption("3. Recordings", 0);
49 sl.addOption("4. Options", 0);
50 sl.addOption("5. Stand by", 0);
51 sl.addOption("6. Reboot", 0);
53 jpeg.setSurfaceOffset(240, 60);
69 struct tm* tms = localtime(&t);
70 strftime(timeString, 19, "%H:%M", tms);
72 drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
74 jpeg.init("/vdr.jpg");
78 int VWelcome::handleCommand(int command)
120 Message* m = new Message();
121 m->message = Message::STANDBY;
122 Command::getInstance()->postMessage(m);
127 Command::getInstance()->doReboot();
131 int option = sl.getCurrentOption();
137 else if (option == 1)
142 else if (option == 2)
147 else if (option == 3)
152 else if (option == 4)
154 Message* m = new Message();
155 m->message = Message::STANDBY;
156 Command::getInstance()->postMessage(m);
159 else if (option == 5)
161 Command::getInstance()->doReboot();
164 return 2; // never gets here
172 void VWelcome::doChannelsList()
174 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::VIDEO);
178 VChannelList* vchan = new VChannelList(VDR::VIDEO);
179 vchan->setList(chanList);
181 ViewMan::getInstance()->addNoLock(vchan);
186 // Message* m = new Message();
188 // m->to = ViewMan::getInstance();
189 // m->message = Message::SWAP_ME_FOR;
190 // m->parameter = (ULONG)vchan;
191 // ViewMan::getInstance()->postMessage(m);
195 void VWelcome::doRadioList()
197 ChannelList* chanList = VDR::getInstance()->getChannelsList(VDR::RADIO);
201 VChannelList* vchan = new VChannelList(VDR::RADIO);
202 vchan->setList(chanList);
204 ViewMan::getInstance()->addNoLock(vchan);
210 void VWelcome::doRecordingsList()
212 ViewMan* viewman = ViewMan::getInstance();
214 VInfo* viewWait = new VInfo();
215 viewWait->create(460, 190);
216 if (Video::getInstance()->getFormat() == Video::PAL)
218 viewWait->setScreenPos(140, 170);
222 viewWait->setScreenPos(130, 140);
224 viewWait->setMainText("\n Downloading recordings list");
227 viewman->addNoLock(viewWait);
230 VDR* vdr = VDR::getInstance();
231 Directory* recDir = vdr->getRecordingsList();
235 VRecordingList* vrec = new VRecordingList(NULL);
236 vrec->setDir(recDir);
238 ViewMan::getInstance()->addNoLock(vrec);
244 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay start");
245 viewman->removeView(viewWait, 1, 1);
246 Log::getInstance()->log("VWelcome", Log::DEBUG, "possible delay end");
249 void VWelcome::doOptions()
251 VOptions* voptions = new VOptions();
252 ViewMan::getInstance()->addNoLock(voptions);