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
25 setDimensions(460, 190);
27 if (Video::getInstance()->getFormat() == Video::PAL)
29 setScreenPos(140, 170);
33 setScreenPos(130, 140);
36 setBackgroundColour(Colour::VIEWBACKGROUND);
38 setTitleBarColour(Colour::TITLEBARBACKGROUND);
39 setTitleText("Options");
41 int fontHeight = surface->getFontHeight();
43 optionBox[0].setScreenPos(screenX + 290, screenY + 45);
44 optionBox[0].setDimensions(150, fontHeight);
45 optionBox[0].addOption("Old");
46 optionBox[0].addOption("New");
48 optionBox[1].setScreenPos(screenX + 290, screenY + 75);
49 optionBox[1].setDimensions(150, fontHeight);
50 optionBox[1].addOption("RGB+composite");
51 optionBox[1].addOption("S-Video");
53 optionBox[2].setScreenPos(screenX + 290, screenY + 105);
54 optionBox[2].setDimensions(150, fontHeight);
55 optionBox[2].addOption("On");
56 optionBox[2].addOption("Off");
57 optionBox[2].addOption("Last state");
61 vdr = VDR::getInstance();
64 config = vdr->configLoad("General", "Remote type");
67 optionBox[0].setSelected("Old");
69 else if (!strcasecmp(config, "New"))
71 optionBox[0].setSelected("New");
75 optionBox[0].setSelected("Old");
79 config = vdr->configLoad("TV", "S-Video");
82 optionBox[1].setSelected("RGB+composite");
84 else if (!strcasecmp(config, "Yes"))
86 optionBox[1].setSelected("S-Video");
90 optionBox[1].setSelected("RGB+composite");
94 config = vdr->configLoad("General", "Power After Boot");
97 optionBox[2].setSelected("On");
99 else if (!strcasecmp(config, "On")) // just for completeness
101 optionBox[2].setSelected("On");
103 else if (!strcasecmp(config, "Off"))
105 optionBox[2].setSelected("Off");
107 else if (!strcasecmp(config, "Last state"))
109 optionBox[2].setSelected("Last state");
113 optionBox[2].setSelected("On");
118 optionBox[0].setActive(1);
121 VOptions::~VOptions()
125 void VOptions::draw()
132 drawText("Remote control type", 10, 45, Colour::LIGHTTEXT);
133 drawText("TV connection type", 10, 75, Colour::LIGHTTEXT);
134 drawText("Power state after bootup", 10, 105, Colour::LIGHTTEXT);
136 drawText("Press back to exit, <, > or [ok] to change", 10, 160, Colour::LIGHTTEXT);
138 for (UINT i = 0; i < numOptions; i++)
140 if (i == selectedOption) cl = Colour::SELECTHIGHLIGHT;
141 else cl = Colour::BUTTONBACKGROUND;
143 ws.nextSymbol = WSymbol::LEFTARROW;
146 ws.setScreenPos(screenX + 272, screenY + 47 + (i * 30));
148 ws.nextSymbol = WSymbol::RIGHTARROW;
149 ws.setScreenPos(screenX + 442, screenY + 47 + (i * 30));
157 int VOptions::handleCommand(int command)
164 if (selectedOption > 0)
166 optionBox[selectedOption].setActive(0);
168 optionBox[selectedOption].setActive(1);
174 case Remote::DF_DOWN:
177 if (selectedOption < (numOptions - 1))
179 optionBox[selectedOption].setActive(0);
181 optionBox[selectedOption].setActive(1);
187 case Remote::DF_LEFT:
190 optionBox[selectedOption].left();
195 case Remote::DF_RIGHT:
198 optionBox[selectedOption].right();
210 optionBox[selectedOption].cycle();
219 void VOptions::doSave()
221 char* remoteType = optionBox[0].getSelected();
222 vdr->configSave("General", "Remote type", remoteType);
223 if (!strcmp(remoteType, "New"))
225 Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
229 Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
232 char* tvconnection = optionBox[1].getSelected();
233 if (!strcmp(tvconnection, "S-Video"))
235 vdr->configSave("TV", "S-Video", "Yes");
236 Video::getInstance()->setConnection(Video::SVIDEO);
240 vdr->configSave("TV", "S-Video", "No");
241 Video::getInstance()->setConnection(Video::COMPOSITERGB);
244 char* powerState = optionBox[2].getSelected();
245 vdr->configSave("General", "Power After Boot", powerState);