GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/tabs/setup_perfomance.cpp Lines: 64 64 100.0 %
Date: 2017-11-29 Branches: 155 310 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-2017  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

4
        "", this);
80
81
    // TRANSLATORS: settings option
82


52
    new SetupItemCheckBox(_("Auto adjust performance"), "",
83

4
        "adjustPerfomance", this, "adjustPerfomanceEvent");
84
85
    // TRANSLATORS: settings option
86


52
    new SetupItemCheckBox(_("Hw acceleration"), "",
87

4
        "hwaccel", this, "hwaccelEvent");
88
89
    // TRANSLATORS: settings option
90


52
    new SetupItemCheckBox(_("Enable opacity cache (Software, can "
91

4
        "use much memory)"), "", "alphaCache", this, "alphaCacheEvent");
92
93
#ifndef USE_SDL2
94
    // TRANSLATORS: settings option
95


52
    new SetupItemCheckBox(_("Enable map reduce (Software)"), "",
96

4
        "enableMapReduce", this, "enableMapReduceEvent");
97
#endif  // USE_SDL2
98
99
    // TRANSLATORS: settings option
100


52
    new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "",
101

4
        "enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent");
102
103
    // TRANSLATORS: settings option
104


52
    new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "",
105

4
        "enableDelayedAnimations", this, "enableDelayedAnimationsEvent");
106
107
    // TRANSLATORS: settings option
108


52
    new SetupItemCheckBox(_("Enable texture sampler (OpenGL)"), "",
109

4
        "useTextureSampler", this, "useTextureSamplerEvent");
110
111
    // TRANSLATORS: settings option
112


52
    new SetupItemCheckBox(_("Enable OpenGL context creation"),
113

4
        "", "openglContext", this, "openglContextEvent");
114
115
    // TRANSLATORS: settings option
116


52
    new SetupItemCheckBox(_("Enable OpenGL direct state access"),
117

4
        "", "enableDSA", this, "enableDSAEvent");
118
119
120
    // TRANSLATORS: settings option
121

28
    new SetupItemLabel(_("Better quality (disable for better performance)"),
122

4
        "", this);
123
124
    // TRANSLATORS: settings option
125


52
    new SetupItemCheckBox(_("Enable alpha channel fix (Software, can "
126
        "be very slow)"), "Can slow down drawing", "enableAlphaFix",
127

4
        this, "enableAlphaFixEvent");
128
129
    // TRANSLATORS: settings option
130


52
    new SetupItemCheckBox(_("Show beings transparency"), "",
131

4
        "beingopacity", this, "beingopacityEvent");
132
133
    // TRANSLATORS: settings option
134


52
    new SetupItemCheckBox(_("Enable reorder sprites (need for mods support)."),
135

4
        "", "enableReorderSprites", this, "enableReorderSpritesEvent");
136
137
138
#ifndef USE_SDL2
139
    // TRANSLATORS: settings option
140

28
    new SetupItemLabel(_("Small memory (enable for lower memory usage)"),
141

4
         "", this);
142
143
    // TRANSLATORS: settings option
144


52
    new SetupItemCheckBox(_("Disable advanced beings caching (Software)"), "",
145

4
        "disableAdvBeingCaching", this, "disableAdvBeingCachingEvent");
146
147
    // TRANSLATORS: settings option
148


52
    new SetupItemCheckBox(_("Disable beings caching (Software)"), "",
149

4
        "disableBeingCaching", this, "disableBeingCachingEvent");
150
#endif  // USE_SDL2
151
152
153
    // TRANSLATORS: settings group
154

28
    new SetupItemLabel(_("Different options (enable or disable can "
155

4
        "improve performance)"), "", this);
156
157
#ifdef USE_SDL2
158
    mSdlDriversList->fillFromVector(sdlDriversList);
159
    new SetupItemDropDownStr(
160
        // TRANSLATORS: settings option
161
        _("Try first sdl driver (only for SDL2 default mode)"),
162
        "", "sdlDriver", this, "sdlDriverEvent", mSdlDriversList, 100);
163
#endif  // USE_SDL2
164
165
4
    mTexturesList->fillFromArray(&texturesList[0], texturesListSize);
166
    // TRANSLATORS: settings option
167


52
    new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "",
168

4
        "compresstextures", this, "compresstexturesEvent", mTexturesList, 100);
169
170
    // TRANSLATORS: settings option
171


52
    new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"),
172

4
        "", "rectangulartextures", this, "rectangulartexturesEvent");
173
174
    // TRANSLATORS: settings option
175


52
    new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"),
176

4
        "", "newtextures", this, "newtexturesEvent");
177
178
    // TRANSLATORS: settings option
179


52
    new SetupItemCheckBox(_("Enable texture atlases (OpenGL)"), "",
180

4
        "useAtlases", this, "useAtlasesEvent");
181
182
    // TRANSLATORS: settings option
183


52
    new SetupItemCheckBox(_("Cache all sprites per map (can use "
184
        "additional memory)"), "", "uselonglivesprites", this,
185

4
        "uselonglivespritesEvent");
186
187
    // TRANSLATORS: settings option
188


52
    new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"),
189
        "", "uselonglivesounds", this,
190

4
        "uselonglivesoundsEvent");
191
192
    // TRANSLATORS: settings group
193

28
    new SetupItemLabel(_("Critical options (DO NOT change if you don't "
194

4
        "know what you're doing)"), "", this);
195
196
    // TRANSLATORS: settings option
197


52
    new SetupItemCheckBox(_("Disable logging in game (do not enable)"),
198

4
        "", "disableLoggingInGame", this, "disableLoggingInGameEvent");
199
200
8
    setDimension(Rect(0, 0, 550, 350));
201
4
}
202
203
12
Setup_Perfomance::~Setup_Perfomance()
204
{
205
4
    delete2(mTexturesList);
206
#ifdef USE_SDL2
207
    delete2(mSdlDriversList);
208
#endif  // USE_SDL2
209
8
}