xoreos  0.0.5
soundadv.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 
27 #include "src/aurora/talkman.h"
28 
30 
32 
35 
36 namespace Engines {
37 
38 namespace KotOR {
39 
41  load("optsoundadv");
42 
44 
45  // Hardcoded, the gui file returns incorrect values
46  getButton("BTN_EAXLEFT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
47  getButton("BTN_EAXLEFT", true)->setStaticHighlight();
48  getButton("BTN_EAXRIGHT", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
49  getButton("BTN_EAXRIGHT", true)->setStaticHighlight();
50  getCheckBox("CB_FORCESOFTWARE", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
51 
52  readConfig();
53 }
54 
56 }
57 
59  readConfig();
60  displayConfig();
61 
62  GUI::show();
63 }
64 
66 
67  if (widget.getTag() == "BTN_EAXRIGHT") {
68  if (0) { // if we have EAX
69  _eax++;
70  if (_eax > 3) {
71  _eax = 3;
72  }
73  updateEAX(_eax);
74  }
75  return;
76  }
77 
78  if (widget.getTag() == "BTN_EAXLEFT") {
79  _eax--;
80  if (_eax < 0) {
81  _eax = 0;
82  }
83  updateEAX(_eax);
84  return;
85  }
86 
87  if (widget.getTag() == "BTN_DEFAULT") {
88  setDefault();
89  readConfig();
90  }
91 
92  if (widget.getTag() == "BTN_CANCEL") {
93  _returnCode = 1;
94  return;
95  }
96 
97  if (widget.getTag() == "BTN_BACK") {
98  adoptChanges();
99  _returnCode = 1;
100  return;
101  }
102 
103  if (widget.getTag() == "CB_FORCESOFTWARE") {
104  _forceSoftware = getCheckBoxState("CB_FORCESOFTWARE");
105  return;
106  }
107 }
108 
110  _eax = ConfigMan.getDefaultInt("eax");
111  _forceSoftware = ConfigMan.getDefaultBool("forcesoftware");
112 }
113 
115  _eax = CLIP(ConfigMan.getInt("eax"), 0, 3);
116  _forceSoftware = ConfigMan.getBool("forcesoftware");
117 }
118 
120  updateEAX(_eax);
121 
122  setCheckBoxState("CB_FORCESOFTWARE", _forceSoftware);
123 }
124 
126  WidgetButton &eaxButton = *getButton("BTN_EAX", true);
127  WidgetButton &leftButton = *getButton("BTN_EAXLEFT", true);
128  WidgetButton &rightButton = *getButton("BTN_EAXRIGHT", true);
129 
130  eaxButton.setText(TalkMan.getString(48573 + eax));
131 
132  if (_eax == 0) {
133  leftButton.hide();
134  } else {
135  leftButton.show();
136  }
137 
138  if (_eax == 3) {
139  rightButton.hide();
140  } else {
141  rightButton.show();
142  }
143 }
144 
146  ConfigMan.setInt("eax", _eax, true);
147  ConfigMan.setBool("forcesoftware", _forceSoftware, true);
148 }
149 
150 } // End of namespace KotOR
151 
152 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
virtual void show()
Show the GUI.
Definition: soundadv.cpp:58
static const Common::UString & kBackgroundTypeMenu
Definition: guibackground.h:42
#define TalkMan
Shortcut for accessing the talk manager.
Definition: talkman.h:111
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
virtual void hide()
Hide the widget.
The global config manager.
A button widget for Star Wars: Knights of the Old Republic and Jade Empire.
A checkbox widget for Star Wars: Knights of the Old Repulic and Jade Empire.
bool getCheckBoxState(const Common::UString &tag)
Definition: gui.cpp:312
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:228
#define ConfigMan
Shortcut for accessing the config manager.
Definition: configman.h:176
virtual void show()
Show the widget.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
OptionsSoundAdvancedMenu(::Engines::Console *console=0)
Definition: soundadv.cpp:40
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
The global talk manager for Aurora strings.
void setColor(float r, float g, float b, float a)
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:240
void setText(const Common::UString &text)
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: soundadv.cpp:65
void setStaticHighlight()
Definition: button.cpp:69
A KotOR GUI.
Definition: gui.h:57
T CLIP(T v, T amin, T amax)
Definition: util.h:72
void setCheckBoxState(const Common::UString &tag, bool state)
Definition: gui.cpp:307
The advanced sound menu.