GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/tabs/setup_perfomance.cpp Lines: 65 65 100.0 %
Date: 2018-05-19 03:07:18 Branches: 154 308 50.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  Andrei Karas
5
 *  Copyright (C) 2011-2018  The ManaPlus Developers
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
4
Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) :
54
    SetupTabScroll(widget),
55
#ifdef USE_SDL2
56
    mSdlDriversList(new NamesModel),
57
#endif  // USE_SDL2
58

4
    mTexturesList(new NamesModel)
59
{
60
    // TRANSLATORS: settings tab name
61
20
    setName(_("Performance"));
62
63
    // Do the layout
64
8
    LayoutHelper h(this);
65
4
    ContainerPlacer place = h.getPlacer(0, 0);
66
4
    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

28
    new SetupItemLabel(_("Better performance (enable for better performance)"),
79
        "", this,
80

4
        Separator_true);
81
82
    // TRANSLATORS: settings option
83


52
    new SetupItemCheckBox(_("Auto adjust performance"), "",
84
        "adjustPerfomance", this, "adjustPerfomanceEvent",
85

4
        MainConfig_true);
86
87
    // TRANSLATORS: settings option
88


52
    new SetupItemCheckBox(_("Hw acceleration"), "",
89
        "hwaccel", this, "hwaccelEvent",
90

4
        MainConfig_true);
91
92
    // TRANSLATORS: settings option
93


52
    new SetupItemCheckBox(_("Enable opacity cache (Software, can "
94
        "use much memory)"), "", "alphaCache", this, "alphaCacheEvent",
95

4
        MainConfig_true);
96
97
#ifndef USE_SDL2
98
    // TRANSLATORS: settings option
99


52
    new SetupItemCheckBox(_("Enable map reduce (Software)"), "",
100
        "enableMapReduce", this, "enableMapReduceEvent",
101

4
        MainConfig_true);
102
#endif  // USE_SDL2
103
104
    // TRANSLATORS: settings option
105


52
    new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "",
106
        "enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent",
107

4
        MainConfig_true);
108
109
    // TRANSLATORS: settings option
110


52
    new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "",
111
        "enableDelayedAnimations", this, "enableDelayedAnimationsEvent",
112

4
        MainConfig_true);
113
114
    // TRANSLATORS: settings option
115


52
    new SetupItemCheckBox(_("Enable texture sampler (OpenGL)"), "",
116
        "useTextureSampler", this, "useTextureSamplerEvent",
117

4
        MainConfig_true);
118
119
    // TRANSLATORS: settings option
120


52
    new SetupItemCheckBox(_("Enable OpenGL context creation"),
121
        "", "openglContext", this, "openglContextEvent",
122

4
        MainConfig_true);
123
124
    // TRANSLATORS: settings option
125


52
    new SetupItemCheckBox(_("Enable OpenGL direct state access"),
126
        "", "enableDSA", this, "enableDSAEvent",
127

4
        MainConfig_true);
128
129
130
    // TRANSLATORS: settings option
131
20
    new SetupItemLabel(_("Better quality (disable for better performance)"),
132
        "", this,
133

4
        Separator_true);
134
135
    // TRANSLATORS: settings option
136


52
    new SetupItemCheckBox(_("Enable alpha channel fix (Software, can "
137
        "be very slow)"), "Can slow down drawing", "enableAlphaFix",
138
        this, "enableAlphaFixEvent",
139

4
        MainConfig_true);
140
141
    // TRANSLATORS: settings option
142


52
    new SetupItemCheckBox(_("Show beings transparency"), "",
143
        "beingopacity", this, "beingopacityEvent",
144

4
        MainConfig_true);
145
146
    // TRANSLATORS: settings option
147


52
    new SetupItemCheckBox(_("Enable reorder sprites (need for mods support)."),
148
        "", "enableReorderSprites", this, "enableReorderSpritesEvent",
149

4
        MainConfig_true);
150
151
152
#ifndef USE_SDL2
153
    // TRANSLATORS: settings option
154

28
    new SetupItemLabel(_("Small memory (enable for lower memory usage)"),
155
         "", this,
156

4
        Separator_true);
157
158
    // TRANSLATORS: settings option
159


52
    new SetupItemCheckBox(_("Disable advanced beings caching (Software)"), "",
160
        "disableAdvBeingCaching", this, "disableAdvBeingCachingEvent",
161

4
        MainConfig_true);
162
163
    // TRANSLATORS: settings option
164


52
    new SetupItemCheckBox(_("Disable beings caching (Software)"), "",
165
        "disableBeingCaching", this, "disableBeingCachingEvent",
166

4
        MainConfig_true);
167
#endif  // USE_SDL2
168
169
170
    // TRANSLATORS: settings group
171

28
    new SetupItemLabel(_("Different options (enable or disable can "
172
        "improve performance)"), "", this,
173

4
        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
4
    mTexturesList->fillFromArray(&texturesList[0], texturesListSize);
185
    // TRANSLATORS: settings option
186


52
    new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "",
187
4
        "compresstextures", this, "compresstexturesEvent", mTexturesList, 100,
188

8
        MainConfig_true);
189
190
    // TRANSLATORS: settings option
191


52
    new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"),
192
        "", "rectangulartextures", this, "rectangulartexturesEvent",
193

4
        MainConfig_true);
194
195
    // TRANSLATORS: settings option
196


52
    new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"),
197
        "", "newtextures", this, "newtexturesEvent",
198

4
        MainConfig_true);
199
200
    // TRANSLATORS: settings option
201


52
    new SetupItemCheckBox(_("Enable texture atlases (OpenGL)"), "",
202
        "useAtlases", this, "useAtlasesEvent",
203

4
        MainConfig_true);
204
205
    // TRANSLATORS: settings option
206


52
    new SetupItemCheckBox(_("Cache all sprites per map (can use "
207
        "additional memory)"), "", "uselonglivesprites", this,
208
        "uselonglivespritesEvent",
209

4
        MainConfig_true);
210
211
    // TRANSLATORS: settings option
212


52
    new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"),
213
        "", "uselonglivesounds", this,
214
        "uselonglivesoundsEvent",
215

4
        MainConfig_true);
216
217
    // TRANSLATORS: settings group
218

28
    new SetupItemLabel(_("Critical options (DO NOT change if you don't "
219
        "know what you're doing)"), "", this,
220

4
        Separator_true);
221
222
    // TRANSLATORS: settings option
223


52
    new SetupItemCheckBox(_("Disable logging in game (do not enable)"),
224
        "", "disableLoggingInGame", this, "disableLoggingInGameEvent",
225

4
        MainConfig_true);
226
227
8
    setDimension(Rect(0, 0, 550, 350));
228
4
}
229
230
12
Setup_Perfomance::~Setup_Perfomance()
231
{
232
4
    delete2(mTexturesList);
233
#ifdef USE_SDL2
234
    delete2(mSdlDriversList);
235
#endif  // USE_SDL2
236
8
}