ManaPlus
src
gui
widgets
tabs
setup_chat.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
23
#include "
gui/widgets/tabs/setup_chat.h
"
24
25
#include "
gui/windows/chatwindow.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/gettext.h
"
33
34
#include "
debug.h
"
35
36
Setup_Chat::Setup_Chat
(
const
Widget2
*
const
widget) :
37
SetupTabScroll
(widget)
38
{
39
// TRANSLATORS: settings tab name
40
setName
(
_
(
"Chat"
));
41
42
// Do the layout
43
LayoutHelper
h(
this
);
44
ContainerPlacer
place = h.
getPlacer
(0, 0);
45
place(0, 0,
mScroll
, 10, 10);
46
47
// TRANSLATORS: settings group
48
new
SetupItemLabel
(
_
(
"Window"
),
""
,
this
,
49
Separator_true
);
50
51
// TRANSLATORS: settings option
52
new
SetupItemCheckBox
(
_
(
"Auto hide chat window"
),
53
// TRANSLATORS: settings description
54
_
(
"Chat window will be automatically hidden when not in use.\n\n"
55
"Hit Enter or hover mouse to show chat again."
),
56
"autohideChat"
,
this
,
"autohideChatEvent"
,
57
MainConfig_true
);
58
59
// TRANSLATORS: settings option
60
new
SetupItemCheckBox
(
_
(
"Protect chat focus"
),
61
// TRANSLATORS: settings description
62
_
(
"Enables aggressive protection of input focus in chat window.\n\n"
63
"Note: no other text inputs will be allowed to receive text input "
64
"when you typing in chat window."
),
65
"protectChatFocus"
,
this
,
"protectChatFocusEvent"
,
66
MainConfig_true
);
67
68
69
// TRANSLATORS: settings group
70
new
SetupItemLabel
(
_
(
"Colors"
),
""
,
this
,
71
Separator_true
);
72
73
// TRANSLATORS: settings option
74
new
SetupItemCheckBox
(
_
(
"Remove colors from received chat messages"
),
75
// TRANSLATORS: settings description
76
_
(
"Enable this setting to strip colors from incoming chat messages. "
77
"All messages will use default chat text color if this enabled."
),
78
"removeColors"
,
this
,
"removeColorsEvent"
,
79
MainConfig_true
);
80
81
// TRANSLATORS: settings option
82
new
SetupItemCheckBox
(
_
(
"Show chat colors list"
),
83
// TRANSLATORS: settings description
84
_
(
"Enable this setting to show color selection drop-down in chat "
85
"window. Chat window will display color selection drop-down.\n\n"
86
"It allows one to select default color of outgoing chat messages "
87
"easily, but also occupies some space in chat window."
),
88
"showChatColorsList"
,
this
,
"showChatColorsListEvent"
,
89
MainConfig_true
);
90
91
92
// TRANSLATORS: settings option
93
new
SetupItemLabel
(
_
(
"Commands"
),
""
,
this
,
94
Separator_true
);
95
96
// TRANSLATORS: settings option
97
new
SetupItemCheckBox
(
_
(
"Allow magic and GM commands in all chat tabs"
),
98
// TRANSLATORS: settings description
99
_
(
"Enable this setting to be able to type spells and GM commands in "
100
"any tab."
),
101
"allowCommandsInChatTabs"
,
this
,
"allowCommandsInChatTabsEvent"
,
102
MainConfig_true
);
103
104
105
// TRANSLATORS: settings group
106
new
SetupItemLabel
(
_
(
"Limits"
),
""
,
this
,
107
Separator_true
);
108
109
// TRANSLATORS: settings option
110
new
SetupItemIntTextField
(
_
(
"Limit max chars in chat line"
),
111
// TRANSLATORS: settings description
112
_
(
"Limits how many characters will be shown in longest lines "
113
"of text displayed in chat.\n\n"
114
"Note: long lines can make client slower. Lines longer than this "
115
"limit will be truncated."
),
116
"chatMaxCharLimit"
,
this
,
"chatMaxCharLimitEvent"
, 0, 500,
117
MainConfig_true
);
118
119
// TRANSLATORS: settings option
120
new
SetupItemIntTextField
(
_
(
"Limit max lines in chat"
),
121
// TRANSLATORS: settings description
122
_
(
"Limits how many lines chat will keep in scrollback buffer. Chat "
123
"keeps specified number of last lines of text. Oldest lines exceeding "
124
"this limit are discarded from scrollback buffer.\n\n"
125
"Note: keeping too many lines in scroll buffer can slow client down."
),
126
"chatMaxLinesLimit"
,
this
,
"chatMaxLinesLimitEvent"
, 0, 500,
127
MainConfig_true
);
128
129
130
// TRANSLATORS: settings group
131
new
SetupItemLabel
(
_
(
"Logs"
),
""
,
this
,
132
Separator_true
);
133
134
// TRANSLATORS: settings option
135
new
SetupItemCheckBox
(
_
(
"Enable chat Log"
),
136
// TRANSLATORS: settings description
137
_
(
"If you enable this setting, chat logs will be written to disk.\n\n"
138
"Note: chat logs can take noticeable amount of disk space over time."
),
139
"enableChatLog"
,
this
,
"enableChatLogEvent"
,
140
MainConfig_true
);
141
142
// TRANSLATORS: settings option
143
new
SetupItemCheckBox
(
_
(
"Enable debug chat Log"
),
144
// TRANSLATORS: settings description
145
_
(
"If you enable this, debug chat tab also will be logged to disk."
),
146
"enableDebugLog"
,
this
,
"enableDebugLogEvent"
,
147
MainConfig_true
);
148
149
// TRANSLATORS: settings option
150
new
SetupItemCheckBox
(
_
(
"Show chat history"
),
151
// TRANSLATORS: settings description
152
_
(
"If this setting enabled, client will load old chat tabs content "
153
"from logs on startup instead of starting with empty chat tabs."
),
154
"showChatHistory"
,
this
,
"showChatHistoryEvent"
,
155
MainConfig_true
);
156
157
// TRANSLATORS: settings option
158
new
SetupItemCheckBox
(
_
(
"Show party online messages"
),
159
// TRANSLATORS: settings description
160
_
(
"If this setting is enabled, online status changes of party members"
161
" will be shown in party tab of chat.\n\nThis adds some extra noise "
162
"to chat, but allows one to see when your buddies are coming online."
),
163
"showPartyOnline"
,
this
,
"showPartyOnlineEvent"
,
164
MainConfig_true
);
165
166
// TRANSLATORS: settings option
167
new
SetupItemCheckBox
(
_
(
"Show guild online messages"
),
168
// TRANSLATORS: settings description
169
_
(
"If this setting is enabled, online status changes of guild members"
170
" will be shown in guild tab of chat.\n\nThis adds some extra noise "
171
"to chat, but allows one to see when your buddies are coming online."
),
172
"showGuildOnline"
,
this
,
"showGuildOnlineEvent"
,
173
MainConfig_true
);
174
175
176
// TRANSLATORS: settings group
177
new
SetupItemLabel
(
_
(
"Messages"
),
""
,
this
,
178
Separator_true
);
179
180
// TRANSLATORS: settings option
181
new
SetupItemCheckBox
(
_
(
"Hide shop messages"
),
182
// TRANSLATORS: settings description
183
_
(
"If this setting enabled, no messages related to built-in ManaPlus "
184
"shop will be displayed in chat. Disable this setting if you want "
185
"to see shop-related messages.\n\nNote: technically, ManaPlus shop "
186
"implemented as usual private messages with special content. If you "
187
"disable this setting, you will be able to see these messages and get "
188
"idea when other players are looking at your shop."
),
189
"hideShopMessages"
,
this
,
"hideShopMessagesEvent"
,
190
MainConfig_true
);
191
192
// TRANSLATORS: settings option
193
new
SetupItemCheckBox
(
_
(
"Show MVP messages"
),
194
// TRANSLATORS: settings description
195
_
(
"Enable this setting to see MVP messages from server.\n\n"
196
"Note: MVP messages are not used on TMW/Evol/etc servers, so this "
197
"feature usually makes little difference."
),
198
"showMVP"
,
this
,
"showMVPEvent"
,
199
MainConfig_true
);
200
201
202
// TRANSLATORS: settings group
203
new
SetupItemLabel
(
_
(
"Tabs"
),
""
,
this
,
204
Separator_true
);
205
206
// TRANSLATORS: settings option
207
new
SetupItemCheckBox
(
_
(
"Put all whispers in tabs"
),
208
// TRANSLATORS: settings description
209
_
(
"If this setting enabled, all whispers (private messages) will "
210
"be placed in separate tabs, separate tab for each player. If this "
211
"setting disabled, all whispers will appear in General tab.\n\n"
212
"Note: putting all whispers to single General tab is known to be "
213
"confusing. Think twice before disabling this feature."
),
214
"whispertab"
,
this
,
"whispertabEvent"
,
215
MainConfig_true
);
216
217
// TRANSLATORS: settings option
218
new
SetupItemCheckBox
(
_
(
"Log magic messages in debug tab"
),
219
// TRANSLATORS: settings description
220
_
(
"If this setting is enabled, spell invocation will be shown in "
221
"Debug tab. If disabled, it will be shown in General tab instead.\n\n"
222
"Note: it does not affects server replies related to spells."
),
223
"showMagicInDebug"
,
this
,
"showMagicInDebugEvent"
,
224
MainConfig_true
);
225
226
// TRANSLATORS: settings option
227
new
SetupItemCheckBox
(
_
(
"Show server messages in debug tab"
),
228
// TRANSLATORS: settings description
229
_
(
"If this setting is enabled, server messages will be shown in "
230
"Debug tab of chat. If disabled, server messages will appear in "
231
"General chat instead.\n\nNote: according to 4144, disabling this "
232
"could also make you to lose some debug messages from client in "
233
"Debug tab since these are fake server messages."
),
234
"serverMsgInDebug"
,
this
,
"serverMsgInDebugEvent"
,
235
MainConfig_true
);
236
237
// TRANSLATORS: settings option
238
new
SetupItemCheckBox
(
_
(
"Enable trade tab"
),
239
// TRANSLATORS: settings description
240
_
(
"Enables trade tab. Trade tab is basically some filter. Messages "
241
"containing words typical for trades will go to Trade tab. This "
242
"will make General tab less noisy. If this setting is disabled, all "
243
"trade related players messages will stay in General tab."
),
244
"enableTradeTab"
,
this
,
"enableTradeTabEvent"
,
245
MainConfig_true
);
246
247
// TRANSLATORS: settings option
248
new
SetupItemCheckBox
(
_
(
"Enable gm tab"
),
249
// TRANSLATORS: settings description
250
_
(
"If enabled, GM tab will appear in chat. It displays text related "
251
"GM activity.\n\nNote: this setting only makes difference for "
252
"GMs (Game Masters) since this tab only appears for GMs."
),
253
"enableGmTab"
,
this
,
"enableGmTabEvent"
,
254
MainConfig_true
);
255
256
// TRANSLATORS: settings option
257
new
SetupItemCheckBox
(
_
(
"Enable language tab"
),
258
// TRANSLATORS: settings description
259
_
(
"If this feature enabled, language tab will appear if server "
260
"supports this feature.\n\nNote: only supported by Evol server yet."
),
261
"enableLangTab"
,
this
,
"enableLangTabEvent"
,
262
MainConfig_false
);
263
264
// TRANSLATORS: settings option
265
new
SetupItemCheckBox
(
_
(
"Show all languages messages"
),
266
// TRANSLATORS: settings description
267
_
(
"If this setting enabled and server supports different chats "
268
"for different languages, you will see messages for all languages, "
269
"regardless of your language preferences.\n\nNote: it only works "
270
"on servers supporting language tabs feature, like Evol."
),
271
"showAllLang"
,
this
,
"showAllLangEvent"
,
272
MainConfig_false
);
273
274
// TRANSLATORS: settings option
275
new
SetupItemCheckBox
(
_
(
"Enable battle tab"
),
276
// TRANSLATORS: settings description
277
_
(
"If this setting enabled, Battle tab will appear in chat. This "
278
"tab will contain messages related to battles, like damage and "
279
"experience gain, if battle messages are enabled.\n\n"
280
"Note: client restart required to take effect."
),
281
"enableBattleTab"
,
this
,
"enableBattleTabEvent"
,
282
MainConfig_true
);
283
284
// TRANSLATORS: settings option
285
new
SetupItemCheckBox
(
_
(
"Show battle events"
),
286
// TRANSLATORS: settings description
287
_
(
"If this setting enabled, messages related to battle like damage "
288
"or experience gain will be displayed in Debug or Battle tab. If "
289
"disabled, no battle messages will be displayed."
),
290
"showBattleEvents"
,
this
,
"showBattleEventsEvent"
,
291
MainConfig_true
);
292
293
// TRANSLATORS: settings option
294
new
SetupItemCheckBox
(
_
(
"Resize chat tabs if need"
),
295
// TRANSLATORS: settings description
296
_
(
"If this feature enabled, text in chat will be automatically "
297
"adjusted to adapt to appearance of chat input field when you "
298
"typing message and when input field of chat disappears. If disabled, "
299
"chat input area will always occupy its place, which could be "
300
"otherwise usable for text.\n\n"
301
"Note: its mostly about jumpy attitude vs "
302
"less usable space for text."
),
303
"hideChatInput"
,
this
,
"hideChatInputEvent"
,
304
MainConfig_true
);
305
306
// TRANSLATORS: settings option
307
new
SetupItemCheckBox
(
_
(
"Enable trade spam filter"
),
308
""
,
"enableTradeFilter"
,
this
,
"enableTradeFilterEvent"
,
309
MainConfig_true
);
310
311
312
// TRANSLATORS: settings group
313
new
SetupItemLabel
(
_
(
"Time"
),
""
,
this
,
314
Separator_true
);
315
316
// TRANSLATORS: settings option
317
new
SetupItemCheckBox
(
_
(
"Use local time"
),
318
// TRANSLATORS: settings description
319
_
(
"If this feature enabled, timestamps in chat will use local times. "
320
"If disabled, server time will be used (often it is GMT+0)."
),
321
"useLocalTime"
,
this
,
"useLocalTimeEvent"
,
322
MainConfig_true
);
323
324
// TRANSLATORS: settings group
325
new
SetupItemLabel
(
_
(
"Other"
),
""
,
this
,
326
Separator_true
);
327
328
// TRANSLATORS: settings option
329
new
SetupItemTextField
(
_
(
"Highlight words (separated by comma)"
),
330
// TRANSLATORS: settings description
331
_
(
"Here you can specify some extra words which will also cause "
332
"highlighting. Use comma to separate words.\n\nNote: frequent "
333
"highlights are annoying - use it with caution."
),
334
"highlightWords"
,
this
,
"highlightWordsEvent"
,
335
MainConfig_true
,
UseBase64_false
);
336
337
// TRANSLATORS: settings option
338
new
SetupItemTextField
(
_
(
"Globals ignore names (separated by comma)"
),
339
// TRANSLATORS: settings description
340
_
(
"This setting allows you to ignore some global messages if "
341
"particular sender (NPC, GM) annoys you too much. Global will be "
342
"moved to Debug instead.\n\nNote: careless use of this feature can "
343
"make you to miss important announces!"
),
344
"globalsFilter"
,
this
,
"globalsFilterEvent"
,
345
MainConfig_true
,
UseBase64_false
);
346
347
// TRANSLATORS: settings option
348
new
SetupItemCheckBox
(
_
(
"Show emotes button in chat"
),
349
// TRANSLATORS: settings description
350
_
(
"If this setting enabled, button will appear near text input "
351
"field. This button allows one to invoke composing window, which "
352
"allows one to insert smiles and text formatting easily.\n\n"
353
"Note: same window can also be invoked by hotkey when typing, usually "
354
"F1 by default."
),
355
"showEmotesButton"
,
this
,
"showEmotesButtonEvent"
,
356
MainConfig_true
);
357
358
// TRANSLATORS: settings option
359
new
SetupItemCheckBox
(
_
(
"Show motd server message on start"
),
360
// TRANSLATORS: settings description
361
_
(
"If this setting enabled, client will display server MOTD (message"
362
" of the day) once you connect to server. Disable it to hide MOTD."
),
363
"showmotd"
,
this
,
"showmotdEvent"
,
364
MainConfig_true
);
365
366
setDimension
(
Rect
(0, 0, 550, 350));
367
}
368
369
void
Setup_Chat::apply
()
370
{
371
SetupTabScroll::apply
();
372
373
if
(
chatWindow
!=
nullptr
)
374
{
375
chatWindow
->
adjustTabSize
();
376
chatWindow
->
parseHighlights
();
377
}
378
}
379
380
void
Setup_Chat::externalUpdated
()
381
{
382
reread
(
"enableLangTab"
);
383
reread
(
"showAllLang"
);
384
}
chatWindow
ChatWindow * chatWindow
Definition:
chatwindow.cpp:94
chatwindow.h
ChatWindow::parseHighlights
void parseHighlights()
Definition:
chatwindow.cpp:2021
ChatWindow::adjustTabSize
void adjustTabSize()
Definition:
chatwindow.cpp:281
ContainerPlacer
Definition:
containerplacer.h:37
LayoutHelper
Definition:
layouthelper.h:40
LayoutHelper::getPlacer
ContainerPlacer getPlacer(const int x, const int y)
Definition:
layouthelper.cpp:60
Rect
Definition:
rect.h:74
SetupItemCheckBox
Definition:
setupitem.h:155
SetupItemIntTextField
Definition:
setupitem.h:242
SetupItemLabel
Definition:
setupitem.h:286
SetupItemTextField
Definition:
setupitem.h:187
SetupTabScroll
Definition:
setuptabscroll.h:34
SetupTabScroll::apply
void apply()
Definition:
setuptabscroll.cpp:107
SetupTabScroll::reread
void reread(const std::string &name)
Definition:
setuptabscroll.cpp:159
SetupTabScroll::mScroll
ScrollArea * mScroll
Definition:
setuptabscroll.h:76
SetupTab::setName
void setName(const std::string &name)
Definition:
setuptab.h:68
Setup_Chat::apply
void apply()
Definition:
setup_chat.cpp:369
Setup_Chat::externalUpdated
void externalUpdated()
Definition:
setup_chat.cpp:380
Setup_Chat::Setup_Chat
Setup_Chat(const Widget2 *const widget)
Definition:
setup_chat.cpp:36
Widget2
Definition:
widget2.h:37
Widget::setDimension
void setDimension(const Rect &dimension)
Definition:
widget.cpp:169
containerplacer.h
debug.h
gettext.h
_
#define _(s)
Definition:
gettext.h:35
layouthelper.h
MainConfig_true
const bool MainConfig_true
Definition:
mainconfig.h:30
MainConfig_false
const bool MainConfig_false
Definition:
mainconfig.h:30
scrollarea.h
Separator_true
const bool Separator_true
Definition:
separator.h:30
setup_chat.h
setupitem.h
UseBase64_false
const bool UseBase64_false
Definition:
usebase64.h:30
Generated on Wed Mar 17 2021 19:19:07 for ManaPlus by
1.9.1