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(190, 460);
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(fontHeight, 150);
45 optionBox[0].addOption("Old");
46 optionBox[0].addOption("New");
48 optionBox[1].setScreenPos(screenX + 290, screenY + 75);
49 optionBox[1].setDimensions(fontHeight, 150);
50 optionBox[1].addOption("RGB+composite");
51 optionBox[1].addOption("S-Video");
53 optionBox[2].setScreenPos(screenX + 290, screenY + 105);
54 optionBox[2].setDimensions(fontHeight, 150);
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;
144 ws.setScreenPos(screenX + 272, screenY + 47 + (i * 30));
146 ws.nextSymbol = WSymbol::RIGHTARROW;
147 ws.setScreenPos(screenX + 442, screenY + 47 + (i * 30));
155 int VOptions::handleCommand(int command)
162 if (selectedOption > 0)
164 optionBox[selectedOption].setActive(0);
166 optionBox[selectedOption].setActive(1);
172 case Remote::DF_DOWN:
175 if (selectedOption < (numOptions - 1))
177 optionBox[selectedOption].setActive(0);
179 optionBox[selectedOption].setActive(1);
185 case Remote::DF_LEFT:
188 optionBox[selectedOption].left();
193 case Remote::DF_RIGHT:
196 optionBox[selectedOption].right();
208 optionBox[selectedOption].cycle();
217 void VOptions::doSave()
219 char* remoteType = optionBox[0].getSelected();
220 vdr->configSave("General", "Remote type", remoteType);
221 if (!strcmp(remoteType, "New"))
223 Remote::getInstance()->setRemoteType(Remote::NEWREMOTE);
227 Remote::getInstance()->setRemoteType(Remote::OLDREMOTE);
230 char* tvconnection = optionBox[1].getSelected();
231 if (!strcmp(tvconnection, "S-Video"))
233 vdr->configSave("TV", "S-Video", "Yes");
234 Video::getInstance()->setConnection(Video::SVIDEO);
238 vdr->configSave("TV", "S-Video", "No");
239 Video::getInstance()->setConnection(Video::COMPOSITERGB);
242 char* powerState = optionBox[2].getSelected();
243 vdr->configSave("General", "Power After Boot", powerState);