GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/* |
||
2 |
* The ManaPlus Client |
||
3 |
* Copyright (C) 2009 The Mana World Development Team |
||
4 |
* Copyright (C) 2011-2019 The ManaPlus Developers |
||
5 |
* Copyright (C) 2009-2021 Andrei Karas |
||
6 |
* |
||
7 |
* This file is part of The ManaPlus Client. |
||
8 |
* |
||
9 |
* This program is free software; you can redistribute it and/or modify |
||
10 |
* it under the terms of the GNU General Public License as published by |
||
11 |
* the Free Software Foundation; either version 2 of the License, or |
||
12 |
* any later version. |
||
13 |
* |
||
14 |
* This program is distributed in the hope that it will be useful, |
||
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 |
* GNU General Public License for more details. |
||
18 |
* |
||
19 |
* You should have received a copy of the GNU General Public License |
||
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
21 |
*/ |
||
22 |
|||
23 |
#include "gui/widgets/tabs/setup_perfomance.h" |
||
24 |
|||
25 |
#include "gui/models/namesmodel.h" |
||
26 |
|||
27 |
#include "gui/widgets/containerplacer.h" |
||
28 |
#include "gui/widgets/layouthelper.h" |
||
29 |
#include "gui/widgets/scrollarea.h" |
||
30 |
#include "gui/widgets/setupitem.h" |
||
31 |
|||
32 |
#include "utils/delete2.h" |
||
33 |
#include "utils/gettext.h" |
||
34 |
#ifdef USE_SDL2 |
||
35 |
#include "configuration.h" |
||
36 |
#include "utils/sdlhelper.h" |
||
37 |
#endif // USE_SDL2 |
||
38 |
|||
39 |
#include "debug.h" |
||
40 |
|||
41 |
static const int texturesListSize = 5; |
||
42 |
|||
43 |
static const char *const texturesList[] = |
||
44 |
{ |
||
45 |
// TRANSLATORS: texture compression type |
||
46 |
N_("No"), |
||
47 |
"s3tc", |
||
48 |
"fxt1", |
||
49 |
"ARB", |
||
50 |
"bptc" |
||
51 |
}; |
||
52 |
|||
53 |
2 |
Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : |
|
54 |
SetupTabScroll(widget), |
||
55 |
#ifdef USE_SDL2 |
||
56 |
mSdlDriversList(new NamesModel), |
||
57 |
#endif // USE_SDL2 |
||
58 |
✓✗✓✗ |
2 |
mTexturesList(new NamesModel) |
59 |
{ |
||
60 |
// TRANSLATORS: settings tab name |
||
61 |
✓✗ | 8 |
setName(_("Performance")); |
62 |
|||
63 |
// Do the layout |
||
64 |
✓✗ | 4 |
LayoutHelper h(this); |
65 |
✓✗ | 2 |
ContainerPlacer place = h.getPlacer(0, 0); |
66 |
✓✗ | 2 |
place(0, 0, mScroll, 10, 10); |
67 |
|||
68 |
#ifdef USE_SDL2 |
||
69 |
StringVect sdlDriversList; |
||
70 |
SDL::getRenderers(sdlDriversList, |
||
71 |
config.getStringValue("sdlDriver")); |
||
72 |
sdlDriversList.insert(sdlDriversList.begin(), |
||
73 |
// TRANSLATORS: sdl driver name |
||
74 |
N_("default")); |
||
75 |
#endif // USE_SDL2 |
||
76 |
|||
77 |
// TRANSLATORS: settings option |
||
78 |
2 |
new SetupItemLabel(_("Better performance (enable for better performance)"), |
|
79 |
"", this, |
||
80 |
✓✗✓✗ ✓✗✓✗ |
12 |
Separator_true); |
81 |
|||
82 |
// TRANSLATORS: settings option |
||
83 |
2 |
new SetupItemCheckBox(_("Auto adjust performance"), "", |
|
84 |
"adjustPerfomance", this, "adjustPerfomanceEvent", |
||
85 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
86 |
|||
87 |
// TRANSLATORS: settings option |
||
88 |
2 |
new SetupItemCheckBox(_("Hw acceleration"), "", |
|
89 |
"hwaccel", this, "hwaccelEvent", |
||
90 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
91 |
|||
92 |
// TRANSLATORS: settings option |
||
93 |
2 |
new SetupItemCheckBox(_("Enable opacity cache (Software, can " |
|
94 |
"use much memory)"), "", "alphaCache", this, "alphaCacheEvent", |
||
95 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
96 |
|||
97 |
#ifndef USE_SDL2 |
||
98 |
// TRANSLATORS: settings option |
||
99 |
2 |
new SetupItemCheckBox(_("Enable map reduce (Software)"), "", |
|
100 |
"enableMapReduce", this, "enableMapReduceEvent", |
||
101 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
102 |
#endif // USE_SDL2 |
||
103 |
|||
104 |
// TRANSLATORS: settings option |
||
105 |
2 |
new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "", |
|
106 |
"enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent", |
||
107 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
108 |
|||
109 |
// TRANSLATORS: settings option |
||
110 |
2 |
new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "", |
|
111 |
"enableDelayedAnimations", this, "enableDelayedAnimationsEvent", |
||
112 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
113 |
|||
114 |
// TRANSLATORS: settings option |
||
115 |
2 |
new SetupItemCheckBox(_("Enable texture sampler (OpenGL)"), "", |
|
116 |
"useTextureSampler", this, "useTextureSamplerEvent", |
||
117 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
118 |
|||
119 |
// TRANSLATORS: settings option |
||
120 |
2 |
new SetupItemCheckBox(_("Enable OpenGL context creation"), |
|
121 |
"", "openglContext", this, "openglContextEvent", |
||
122 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
123 |
|||
124 |
// TRANSLATORS: settings option |
||
125 |
2 |
new SetupItemCheckBox(_("Enable OpenGL direct state access"), |
|
126 |
"", "enableDSA", this, "enableDSAEvent", |
||
127 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
128 |
|||
129 |
|||
130 |
// TRANSLATORS: settings option |
||
131 |
new SetupItemLabel(_("Better quality (disable for better performance)"), |
||
132 |
"", this, |
||
133 |
✓✗✓✗ ✓✗✓✗ |
12 |
Separator_true); |
134 |
|||
135 |
// TRANSLATORS: settings option |
||
136 |
2 |
new SetupItemCheckBox(_("Enable alpha channel fix (Software, can " |
|
137 |
"be very slow)"), "Can slow down drawing", "enableAlphaFix", |
||
138 |
this, "enableAlphaFixEvent", |
||
139 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
16 |
MainConfig_true); |
140 |
|||
141 |
// TRANSLATORS: settings option |
||
142 |
2 |
new SetupItemCheckBox(_("Show beings transparency"), "", |
|
143 |
"beingopacity", this, "beingopacityEvent", |
||
144 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
145 |
|||
146 |
// TRANSLATORS: settings option |
||
147 |
2 |
new SetupItemCheckBox(_("Enable reorder sprites (need for mods support)."), |
|
148 |
"", "enableReorderSprites", this, "enableReorderSpritesEvent", |
||
149 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
150 |
|||
151 |
|||
152 |
#ifndef USE_SDL2 |
||
153 |
// TRANSLATORS: settings option |
||
154 |
2 |
new SetupItemLabel(_("Small memory (enable for lower memory usage)"), |
|
155 |
"", this, |
||
156 |
✓✗✓✗ ✓✗✓✗ |
12 |
Separator_true); |
157 |
|||
158 |
// TRANSLATORS: settings option |
||
159 |
2 |
new SetupItemCheckBox(_("Disable advanced beings caching (Software)"), "", |
|
160 |
"disableAdvBeingCaching", this, "disableAdvBeingCachingEvent", |
||
161 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
162 |
|||
163 |
// TRANSLATORS: settings option |
||
164 |
2 |
new SetupItemCheckBox(_("Disable beings caching (Software)"), "", |
|
165 |
"disableBeingCaching", this, "disableBeingCachingEvent", |
||
166 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
167 |
#endif // USE_SDL2 |
||
168 |
|||
169 |
|||
170 |
// TRANSLATORS: settings group |
||
171 |
2 |
new SetupItemLabel(_("Different options (enable or disable can " |
|
172 |
"improve performance)"), "", this, |
||
173 |
✓✗✓✗ ✓✗✓✗ |
12 |
Separator_true); |
174 |
|||
175 |
#ifdef USE_SDL2 |
||
176 |
mSdlDriversList->fillFromVector(sdlDriversList); |
||
177 |
new SetupItemDropDownStr( |
||
178 |
// TRANSLATORS: settings option |
||
179 |
_("Try first sdl driver (only for SDL2 default mode)"), |
||
180 |
"", "sdlDriver", this, "sdlDriverEvent", mSdlDriversList, 100, |
||
181 |
MainConfig_true); |
||
182 |
#endif // USE_SDL2 |
||
183 |
|||
184 |
✓✗ | 2 |
mTexturesList->fillFromArray(&texturesList[0], texturesListSize); |
185 |
// TRANSLATORS: settings option |
||
186 |
2 |
new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "", |
|
187 |
2 |
"compresstextures", this, "compresstexturesEvent", mTexturesList, 100, |
|
188 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
26 |
MainConfig_true); |
189 |
|||
190 |
// TRANSLATORS: settings option |
||
191 |
2 |
new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"), |
|
192 |
"", "rectangulartextures", this, "rectangulartexturesEvent", |
||
193 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
194 |
|||
195 |
// TRANSLATORS: settings option |
||
196 |
2 |
new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"), |
|
197 |
"", "newtextures", this, "newtexturesEvent", |
||
198 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
199 |
|||
200 |
// TRANSLATORS: settings option |
||
201 |
2 |
new SetupItemCheckBox(_("Enable texture atlases (OpenGL)"), "", |
|
202 |
"useAtlases", this, "useAtlasesEvent", |
||
203 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
204 |
|||
205 |
// TRANSLATORS: settings option |
||
206 |
2 |
new SetupItemCheckBox(_("Cache all sprites per map (can use " |
|
207 |
"additional memory)"), "", "uselonglivesprites", this, |
||
208 |
"uselonglivespritesEvent", |
||
209 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
210 |
|||
211 |
// TRANSLATORS: settings option |
||
212 |
2 |
new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"), |
|
213 |
"", "uselonglivesounds", this, |
||
214 |
"uselonglivesoundsEvent", |
||
215 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
24 |
MainConfig_true); |
216 |
|||
217 |
// TRANSLATORS: settings group |
||
218 |
2 |
new SetupItemLabel(_("Critical options (DO NOT change if you don't " |
|
219 |
"know what you're doing)"), "", this, |
||
220 |
✓✗✓✗ ✓✗✓✗ |
12 |
Separator_true); |
221 |
|||
222 |
// TRANSLATORS: settings option |
||
223 |
2 |
new SetupItemCheckBox(_("Disable logging in game (do not enable)"), |
|
224 |
"", "disableLoggingInGame", this, "disableLoggingInGameEvent", |
||
225 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✗ |
26 |
MainConfig_true); |
226 |
|||
227 |
✓✗ | 2 |
setDimension(Rect(0, 0, 550, 350)); |
228 |
2 |
} |
|
229 |
|||
230 |
6 |
Setup_Perfomance::~Setup_Perfomance() |
|
231 |
{ |
||
232 |
✓✗ | 2 |
delete2(mTexturesList) |
233 |
#ifdef USE_SDL2 |
||
234 |
delete2(mSdlDriversList) |
||
235 |
#endif // USE_SDL2 |
||
236 |
4 |
} |
Generated by: GCOVR (Version 3.3) |