ManaPlus
setup_visual.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2009-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
23 
24 #include "gui/windowmanager.h"
25 
26 #include "gui/models/namesmodel.h"
27 
30 #include "gui/widgets/scrollarea.h"
31 
32 #include "utils/delete2.h"
33 #include "utils/gettext.h"
34 #include "utils/stringutils.h"
35 
36 #include "debug.h"
37 
38 static const int speachListSize = 4;
39 
40 static const char *const speachList[] =
41 {
42  // TRANSLATORS: speach type
43  N_("No text"),
44  // TRANSLATORS: speach type
45  N_("Text"),
46  // TRANSLATORS: speach type
47  N_("Bubbles, no names"),
48  // TRANSLATORS: speach type
49  N_("Bubbles with names")
50 };
51 
52 static const int ambientFxListSize = 3;
53 
54 static const char *const ambientFxList[] =
55 {
56  // TRANSLATORS: ambient effect type
57  N_("off"),
58  // TRANSLATORS: ambient effect type
59  N_("low"),
60  // TRANSLATORS: ambient effect type
61  N_("high")
62 };
63 
64 static const int particleTypeListSize = 3;
65 
66 static const char *const particleTypeList[] =
67 {
68  // TRANSLATORS: patricle effects type
69  N_("best quality"),
70  // TRANSLATORS: patricle effects type
71  N_("normal"),
72  // TRANSLATORS: patricle effects type
73  N_("best performance")
74 };
75 
76 static const int vSyncListSize = 3;
77 
78 static const char *const vSyncList[] =
79 {
80  // TRANSLATORS: vsync type
81  N_("default"),
82  // TRANSLATORS: vsync type
83  N_("off"),
84  // TRANSLATORS: vsync type
85  N_("on")
86 };
87 
88 Setup_Visual::Setup_Visual(const Widget2 *const widget) :
89  SetupTabScroll(widget),
90  mSpeachList(new NamesModel),
91  mAmbientFxList(new NamesModel),
92  mParticleList(new SetupItemNames),
93  mParticleTypeList(new NamesModel),
94  mVSyncList(new NamesModel),
95  mScaleList(new NamesModel)
96 {
97  // TRANSLATORS: settings tab name
98  setName(_("Visual"));
99  // Do the layout
100  LayoutHelper h(this);
101  ContainerPlacer place = h.getPlacer(0, 0);
102  place(0, 0, mScroll, 10, 10);
103 
105 
106  // TRANSLATORS: settings option
107  new SetupItemLabel(_("Scale"), "", this,
109 
110  for (int f = 1; f <= 7; f ++)
111  {
112  // TRANSLATORS: particle details
113  mScaleList->add(toString(f) + "x");
114  }
115  // TRANSLATORS: settings option
116  new SetupItemSliderInt(_("Scale"), "",
117  "scale", this, "scaleEvent", mScaleList, 1,
119 
120  // TRANSLATORS: settings option
121  new SetupItemLabel(_("Notifications"), "", this,
123 
124  // TRANSLATORS: settings option
125  new SetupItemCheckBox(_("Show pickup notifications in chat"), "",
126  "showpickupchat", this, "showpickupchatEvent",
128 
129  // TRANSLATORS: settings option
130  new SetupItemCheckBox(_("Show pickup notifications as particle effects"),
131  "", "showpickupparticle", this, "showpickupparticleEvent",
133 
134  // TRANSLATORS: settings option
135  new SetupItemLabel(_("Effects"), "", this,
137 
138 #ifndef ANDROID
139  // TRANSLATORS: settings option
140  new SetupItemCheckBox(_("Grab mouse and keyboard input"),
141  "", "grabinput", this, "grabinputEvent",
143 #endif // ANDROID
144 
145  // TRANSLATORS: settings option
146  new SetupItemCheckBox(_("Blurring textures (OpenGL)"),
147  "", "blur", this, "blurEvent",
149 
150  // TRANSLATORS: settings option
151  new SetupItemSlider(_("Gui opacity"), "", "guialpha",
152  this, "guialphaEvent", 0.1, 1.01, 0.1, 150,
155 
156  // TRANSLATORS: settings option
157  new SetupItemCheckBox(_("Enable gui opacity"),
158  "", "enableGuiOpacity", this, "enableGuiOpacityEvent",
160 
162  // TRANSLATORS: settings option
163  new SetupItemDropDown(_("Overhead text"), "", "speech", this,
164  "speechEvent", mSpeachList, 200,
166 
168  // TRANSLATORS: settings option
169  new SetupItemDropDown(_("Ambient FX"), "", "OverlayDetail", this,
170  "OverlayDetailEvent", mAmbientFxList, 100,
172 
173  // TRANSLATORS: settings option
174  new SetupItemCheckBox(_("Show particle effects"), "",
175  "particleeffects", this, "particleeffectsEvent",
177 
178  // TRANSLATORS: settings option
179  new SetupItemCheckBox(_("Show particle effects from maps"), "",
180  "mapparticleeffects", this, "mapparticleeffectsEvent",
182 
183  // TRANSLATORS: particle details
184  mParticleList->push_back(_("low"));
185  // TRANSLATORS: particle details
186  mParticleList->push_back(_("medium"));
187  // TRANSLATORS: particle details
188  mParticleList->push_back(_("high"));
189  // TRANSLATORS: particle details
190  mParticleList->push_back(_("max"));
191  // TRANSLATORS: settings option
192  (new SetupItemSlider2(_("Particle detail"), "", "particleEmitterSkip",
193  this, "particleEmitterSkipEvent", 0, 3, 1, mParticleList,
196  DoNotAlign_false))->setInvertValue(3);
197 
200  // TRANSLATORS: settings option
201  new SetupItemDropDown(_("Particle physics"), "", "particleFastPhysics",
202  this, "particleFastPhysicsEvent", mParticleTypeList, 200,
204 
205 
206  // TRANSLATORS: settings group
207  new SetupItemLabel(_("Gamma"), "", this,
209 
210  // TRANSLATORS: settings option
211  new SetupItemCheckBox(_("Enable gamma control"),
212  "", "enableGamma", this, "enableGammaEvent",
214 
215  // TRANSLATORS: settings option
216  new SetupItemSlider(_("Gamma"), "", "gamma",
217  this, "gammeEvent", 1, 20, 1, 350,
220 
221 
222  // TRANSLATORS: settings group
223  new SetupItemLabel(_("Other"), "", this,
225 
227  // TRANSLATORS: settings option
228  new SetupItemDropDown(_("Vsync"), "", "vsync", this,
229  "vsyncEvent", mVSyncList, 100,
231 
232 #if defined(WIN32) || defined(__APPLE__)
233  // TRANSLATORS: settings option
234  new SetupItemCheckBox(_("Center game window"),
235  "", "centerwindow", this, "centerwindowEvent",
237 #endif // defined(WIN32) || defined(__APPLE__)
238 
239  // TRANSLATORS: settings option
240  new SetupItemCheckBox(_("Allow screensaver to run"),
241  "", "allowscreensaver", this, "allowscreensaverEvent",
243 
244 
245  // TRANSLATORS: settings group
246  new SetupItemLabel(_("Screenshots"), "", this,
248 
249  // TRANSLATORS: settings option
250  new SetupItemCheckBox(_("Add water mark into screenshots"),
251  "", "addwatermark", this, "addwatermarkEvent",
253 
254  setDimension(Rect(0, 0, 550, 350));
255 }
256 
258 {
265 }
266 
268 {
271 #ifndef WIN32
273 #endif // WIN32
274 }
ContainerPlacer getPlacer(const int x, const int y)
void add(const std::string &str)
Definition: namesmodel.h:53
void fillFromArray(const char *const *const arr, const std::size_t size)
Definition: namesmodel.cpp:52
Definition: rect.h:74
int mPreferredFirstItemSize
ScrollArea * mScroll
void setName(const std::string &name)
Definition: setuptab.h:68
NamesModel * mSpeachList
Definition: setup_visual.h:43
SetupItemNames * mParticleList
Definition: setup_visual.h:45
NamesModel * mVSyncList
Definition: setup_visual.h:47
NamesModel * mAmbientFxList
Definition: setup_visual.h:44
Setup_Visual(const Widget2 *const widget)
NamesModel * mScaleList
Definition: setup_visual.h:48
NamesModel * mParticleTypeList
Definition: setup_visual.h:46
void setDimension(const Rect &dimension)
Definition: widget.cpp:169
#define new
Definition: debug_new.h:147
#define delete2(var)
Definition: delete2.h:25
const bool DoNotAlign_false
Definition: donotalign.h:30
#define N_(s)
Definition: gettext.h:36
#define _(s)
Definition: gettext.h:35
const bool MainConfig_true
Definition: mainconfig.h:30
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
const bool OnTheFly_false
Definition: onthefly.h:30
const bool OnTheFly_true
Definition: onthefly.h:30
const bool Separator_true
Definition: separator.h:30
static const char *const ambientFxList[]
static const int vSyncListSize
static const char *const vSyncList[]
static const int ambientFxListSize
static const char *const particleTypeList[]
static const int speachListSize
static const char *const speachList[]
static const int particleTypeListSize
std::vector< std::string > SetupItemNames
Definition: setupitem.h:451