xoreos  0.0.5
autopause.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/common/configman.h"
26 
28 
30 
32 
33 namespace Engines {
34 
35 namespace KotOR {
36 
38  load("optautopause");
39 
41 
42  // Hardcoded, the gui file returns 1.0, 1.0, 1.0, 1.0
43  getCheckBox("CB_ENDROUND", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
44  getCheckBox("CB_ENEMYSIGHTED", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
45  getCheckBox("CB_MINESIGHTED", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
46  getCheckBox("CB_PARTYKILLED", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
47  getCheckBox("CB_ACTIONMENU", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
48  getCheckBox("CB_TRIGGERS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
49 
50  readConfig();
51 }
52 
54 }
55 
57  readConfig();
58  displayConfig();
59 
60  GUI::show();
61 }
62 
64  if (widget.getTag() == "BTN_DEFAULT") {
65  setDefault();
66  displayConfig();
67  }
68 
69  if (widget.getTag() == "BTN_BACK") {
70  adoptChanges();
71  _returnCode = 1;
72  return;
73  }
74 
75  if (widget.getTag() == "CB_ENDROUND") {
76  _endOfCombatRound = getCheckBoxState("CB_ENDROUND");
77  return;
78  }
79 
80  if (widget.getTag() == "CB_ENEMYSIGHTED") {
81  _enemySighted = getCheckBoxState("CB_ENEMYSIGHTED");
82  return;
83  }
84 
85  if (widget.getTag() == "CB_MINESIGHTED") {
86  _mineSighted = getCheckBoxState("CB_MINESIGHTED");
87  return;
88  }
89 
90  if (widget.getTag() == "CB_PARTYKILLED") {
91  _partyMemberDown = getCheckBoxState("CB_PARTYKILLED");
92  return;
93  }
94 
95  if (widget.getTag() == "CB_ACTIONMENU") {
96  _actionMenuUsed = getCheckBoxState("CB_ACTIONMENU");
97  return;
98  }
99 
100  if (widget.getTag() == "CB_TRIGGERS") {
101  _newTargetSelected = getCheckBoxState("CB_TRIGGERS");
102  return;
103  }
104 }
105 
107  _endOfCombatRound = ConfigMan.getDefaultBool("endofcombatround");
108  _enemySighted = ConfigMan.getDefaultBool("enemysighted");
109  _mineSighted = ConfigMan.getDefaultBool("minesighted");
110  _partyMemberDown = ConfigMan.getDefaultBool("partymemberdown");
111  _actionMenuUsed = ConfigMan.getDefaultBool("actionmenuused");
112  _newTargetSelected = ConfigMan.getDefaultBool("newtargetselected");
113 }
114 
116  _endOfCombatRound = ConfigMan.getBool("endofcombatround");
117  _enemySighted = ConfigMan.getBool("enemysighted");
118  _mineSighted = ConfigMan.getBool("minesighted");
119  _partyMemberDown = ConfigMan.getBool("partymemberdown");
120  _actionMenuUsed = ConfigMan.getBool("actionmenuused");
121  _newTargetSelected = ConfigMan.getBool("newtargetselected");
122 }
123 
125  setCheckBoxState("CB_ENDROUND", _endOfCombatRound);
126  setCheckBoxState("CB_ENEMYSIGHTED", _enemySighted);
127  setCheckBoxState("CB_MINESIGHTED", _mineSighted);
128  setCheckBoxState("CB_PARTYKILLED", _partyMemberDown);
129  setCheckBoxState("CB_ACTIONMENU", _actionMenuUsed);
130  setCheckBoxState("CB_TRIGGERS", _newTargetSelected);
131 }
132 
134  ConfigMan.setBool("endofcombatround", _endOfCombatRound, true);
135  ConfigMan.setBool("enemysighted", _enemySighted, true);
136  ConfigMan.setBool("minesighted", _mineSighted, true);
137  ConfigMan.setBool("partymemberdown", _partyMemberDown, true);
138  ConfigMan.setBool("actionmenuused", _actionMenuUsed, true);
139  ConfigMan.setBool("newtargetselected", _newTargetSelected, true);
140 }
141 
142 } // End of namespace KotOR
143 
144 } // End of namespace Engines
OptionsAutoPauseMenu(::Engines::Console *console=0)
Definition: autopause.cpp:37
void load(const Common::UString &resref)
Definition: gui.cpp:103
static const Common::UString & kBackgroundTypeMenu
Definition: guibackground.h:42
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
The global config manager.
virtual void show()
Show the GUI.
Definition: autopause.cpp:56
A checkbox widget for Star Wars: Knights of the Old Repulic and Jade Empire.
bool getCheckBoxState(const Common::UString &tag)
Definition: gui.cpp:312
The auto pause menu.
#define ConfigMan
Shortcut for accessing the config manager.
Definition: configman.h:176
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:300
virtual void show()
Show the GUI.
Definition: gui.cpp:69
A widget in a GUI.
A widget in a GUI.
Definition: widget.h:40
void setColor(float r, float g, float b, float a)
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:240
A KotOR GUI.
Definition: gui.h:57
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: autopause.cpp:63
void setCheckBoxState(const Common::UString &tag, bool state)
Definition: gui.cpp:307