ManaPlus
setup_players.cpp
Go to the documentation of this file.
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 
24 
25 #include "configuration.h"
26 #include "settings.h"
27 
28 #include "gui/models/namesmodel.h"
29 
32 #include "gui/widgets/scrollarea.h"
33 #include "gui/widgets/setupitem.h"
34 
35 #include "utils/delete2.h"
36 #include "utils/gettext.h"
37 
38 #include "debug.h"
39 
40 static const int badgesListSize = 4;
41 
42 static const char *const badgesList[] =
43 {
44  // TRANSLATORS: screen badges type
45  N_("hide"),
46  // TRANSLATORS: screen badges type
47  N_("show at top"),
48  // TRANSLATORS: screen badges type
49  N_("show at right"),
50  // TRANSLATORS: screen badges type
51  N_("show at bottom"),
52 };
53 
54 static const int visibleNamesListSize = 3;
55 
56 static const char *const visibleNamesList[] =
57 {
58  // TRANSLATORS: visible name type
59  N_("hide"),
60  // TRANSLATORS: visible name type
61  N_("show"),
62  // TRANSLATORS: visible name type
63  N_("show on selection")
64 };
65 
66 static const int topDownListSize = 2;
67 
68 static const char *const topDownList[] =
69 {
70  // TRANSLATORS: show on top or down
71  N_("top"),
72  // TRANSLATORS: show on top or down
73  N_("bottom")
74 };
75 
76 Setup_Players::Setup_Players(const Widget2 *const widget) :
77  SetupTabScroll(widget),
78  mBadgesList(new NamesModel),
79  mVisibleNamesList(new NamesModel),
80  mVisibleNamesPosList(new NamesModel)
81 {
82  // TRANSLATORS: settings tab name
83  setName(_("Players"));
84 
85  LayoutHelper h(this);
86  ContainerPlacer place = h.getPlacer(0, 0);
87  place(0, 0, mScroll, 10, 10);
88 
89  // TRANSLATORS: settings option
90  new SetupItemCheckBox(_("Show gender"), "",
91  "showgender", this, "showgenderEvent",
93 
94  // TRANSLATORS: settings option
95  new SetupItemCheckBox(_("Show level"), "",
96  "showlevel", this, "showlevelEvent",
98 
99  // TRANSLATORS: settings option
100  new SetupItemCheckBox(_("Show own name"), "",
101  "showownname", this, "showownnameEvent",
103 
104  // TRANSLATORS: settings option
105  new SetupItemCheckBox(_("Enable extended mouse targeting"), "",
106  "extMouseTargeting", this, "extMouseTargetingEvent",
108 
109  // TRANSLATORS: settings option
110  new SetupItemCheckBox(_("Target dead players"), "",
111  "targetDeadPlayers", this, "targetDeadPlayersEvent",
113 
116  // TRANSLATORS: settings option
117  new SetupItemDropDown(_("Show player names"), "",
118  "visiblenames", this, "visiblenamesEvent",
119  mVisibleNamesList, 150,
121 
124  // TRANSLATORS: settings option
125  new SetupItemDropDown(_("Show player names at"), "",
126  "visiblenamespos", this, "visiblenamesposEvent",
129 
130  // TRANSLATORS: settings option
131  new SetupItemCheckBox(_("Auto move names"), "",
132  "moveNames", this, "moveNamesEvent",
134 
136  // TRANSLATORS: settings option
137  new SetupItemDropDown(_("Badges"), "",
138  "showBadges", this, "showBadgesEvent", mBadgesList, 150,
140 
141  // TRANSLATORS: settings option
142  new SetupItemCheckBox(_("Secure trades"), "",
143  "securetrades", this, "securetradesEvent",
145 
146  // TRANSLATORS: settings option
147  new SetupItemTextField(_("Unsecure chars in names"), "",
148  "unsecureChars", this, "unsecureCharsEvent",
150 
151  // TRANSLATORS: settings option
152  new SetupItemCheckBox(_("Show statuses"), "",
153  "showPlayersStatus", this, "showPlayersStatusEvent",
155 
156  // TRANSLATORS: settings option
157  new SetupItemCheckBox(_("Show ip addresses on screenshots"), "",
158  "showip", this, "showipEvent",
160 
161  // TRANSLATORS: settings option
162  new SetupItemCheckBox(_("Allow self heal with mouse click"), "",
163  "selfMouseHeal", this, "selfMouseHealEvent",
165 
166  // TRANSLATORS: settings option
167  new SetupItemCheckBox(_("Group friends in who is online window"), "",
168  "groupFriends", this, "groupFriendsEvent",
170 
171  // TRANSLATORS: settings option
172  new SetupItemCheckBox(_("Hide erased players nicks"), "",
173  "hideErased", this, "hideErasedEvent",
175 
176  // TRANSLATORS: settings option
177  new SetupItemCheckBox(_("Collect players id and seen log"),
178  "", "enableIdCollecting", this, "enableIdCollectingEvent",
180 
181  // TRANSLATORS: settings option
182  new SetupItemCheckBox(_("Use special diagonal speed in players moving"),
183  "", "useDiagonalSpeed", this, "useDiagonalSpeedEvent",
185 
186  // TRANSLATORS: settings option
187  new SetupItemCheckBox(_("Log players actions (for GM)"),
188  "", "logPlayerActions", this, "logPlayerActionsEvent",
190 
191  // TRANSLATORS: settings option
192  new SetupItemCheckBox(_("Create screenshots for each complete trades"),
193  "", "tradescreenshot", this, "tradescreenshotEvent",
195 
196  // TRANSLATORS: settings option
197  new SetupItemCheckBox(_("Emulate right mouse button by long mouse click"
198  " (useful for touch interfaces)"),
199  "", "longmouseclick", this, "longmouseclickEvent",
201 
202  // TRANSLATORS: settings option
203  new SetupItemCheckBox(_("Enable remote commands"),
204  "", "enableRemoteCommands", this, "enableRemoteCommandsEvent",
205  "1",
207 
208  // TRANSLATORS: settings option
209  new SetupItemCheckBox(_("Allow move character by mouse"),
210  "", "allowMoveByMouse", this, "allowMoveByMouseEvent",
212 
213  setDimension(Rect(0, 0, 550, 350));
214 }
215 
217 {
221 }
222 
224 {
225  reread("enableRemoteCommands");
226 }
227 
229 {
232  "enableRemoteCommands", 1) != 0);
233 }
std::string getValue(const std::string &key, const std::string &deflt) const
ContainerPlacer getPlacer(const int x, const int y)
void fillFromArray(const char *const *const arr, const std::size_t size)
Definition: namesmodel.cpp:52
Definition: rect.h:74
bool enableRemoteCommands
Definition: settings.h:162
void reread(const std::string &name)
ScrollArea * mScroll
void setName(const std::string &name)
Definition: setuptab.h:68
Setup_Players(const Widget2 *const widget)
NamesModel * mVisibleNamesPosList
Definition: setup_players.h:46
NamesModel * mVisibleNamesList
Definition: setup_players.h:45
NamesModel * mBadgesList
Definition: setup_players.h:44
void externalUpdated()
void setDimension(const Rect &dimension)
Definition: widget.cpp:169
Configuration serverConfig
#define new
Definition: debug_new.h:147
#define delete2(var)
Definition: delete2.h:25
#define N_(s)
Definition: gettext.h:36
#define _(s)
Definition: gettext.h:35
const bool MainConfig_true
Definition: mainconfig.h:30
const bool MainConfig_false
Definition: mainconfig.h:30
Settings settings
Definition: settings.cpp:32
static const char *const visibleNamesList[]
static const int topDownListSize
static const int visibleNamesListSize
static const char *const topDownList[]
static const char *const badgesList[]
static const int badgesListSize
const bool UseBase64_false
Definition: usebase64.h:30