1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
|
// Copyright 2007-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_MUMBLE_SETTINGS_H_
#define MUMBLE_MUMBLE_SETTINGS_H_
#include <QtCore/QList>
#include <QtCore/QPair>
#include <QtCore/QRectF>
#include <QtCore/QSettings>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtGui/QColor>
#include <QtGui/QFont>
#include <QtNetwork/QSslCertificate>
#include <QtNetwork/QSslKey>
#include "EchoCancelOption.h"
// Global helper classes to spread variables around across threads
// especially helpful to initialize things like the stored
// preference for audio transmission, since the GUI elements
// will be created long before the AudioInput object, and the
// latter lives in a separate thread and so cannot touch the
// GUI.
struct Shortcut {
int iIndex;
QList< QVariant > qlButtons;
QVariant qvData;
bool bSuppress;
bool operator<(const Shortcut &) const;
bool isServerSpecific() const;
bool operator==(const Shortcut &) const;
};
struct ShortcutTarget {
bool bCurrentSelection;
bool bUsers;
QStringList qlUsers;
QList< unsigned int > qlSessions;
int iChannel;
QString qsGroup;
bool bLinks;
bool bChildren;
bool bForceCenter;
ShortcutTarget();
bool isServerSpecific() const;
bool operator<(const ShortcutTarget &) const;
bool operator==(const ShortcutTarget &) const;
};
quint32 qHash(const ShortcutTarget &);
quint32 qHash(const QList< ShortcutTarget > &);
QDataStream &operator<<(QDataStream &, const ShortcutTarget &);
QDataStream &operator>>(QDataStream &, ShortcutTarget &);
Q_DECLARE_METATYPE(ShortcutTarget)
struct PluginSetting {
QString path;
bool enabled;
bool positionalDataEnabled;
bool allowKeyboardMonitoring;
};
QDataStream& operator>>(QDataStream &arch, PluginSetting &setting);
QDataStream& operator<<(QDataStream &arch, const PluginSetting &setting);
Q_DECLARE_METATYPE(PluginSetting);
struct OverlaySettings {
enum OverlayPresets { AvatarAndName, LargeSquareAvatar };
enum OverlayShow { Talking, Active, HomeChannel, LinkedChannels };
enum OverlaySort { Alphabetical, LastStateChange };
enum OverlayExclusionMode { LauncherFilterExclusionMode, WhitelistExclusionMode, BlacklistExclusionMode };
bool bEnable;
QString qsStyle;
OverlayShow osShow;
bool bAlwaysSelf;
int uiActiveTime; // Time in seconds for a user to stay active after talking
OverlaySort osSort;
float fX;
float fY;
qreal fZoom;
unsigned int uiColumns;
QColor qcUserName[5];
QFont qfUserName;
QColor qcChannel;
QFont qfChannel;
QColor qcFps;
QFont qfFps;
qreal fBoxPad;
qreal fBoxPenWidth;
QColor qcBoxPen;
QColor qcBoxFill;
bool bUserName;
bool bChannel;
bool bMutedDeafened;
bool bAvatar;
bool bBox;
bool bFps;
bool bTime;
qreal fUserName;
qreal fChannel;
qreal fMutedDeafened;
qreal fAvatar;
qreal fUser[5];
qreal fFps;
QRectF qrfUserName;
QRectF qrfChannel;
QRectF qrfMutedDeafened;
QRectF qrfAvatar;
QRectF qrfFps;
QRectF qrfTime;
Qt::Alignment qaUserName;
Qt::Alignment qaChannel;
Qt::Alignment qaMutedDeafened;
Qt::Alignment qaAvatar;
OverlayExclusionMode oemOverlayExcludeMode;
QStringList qslLaunchers;
QStringList qslLaunchersExclude;
QStringList qslWhitelist;
QStringList qslWhitelistExclude;
QStringList qslPaths;
QStringList qslPathsExclude;
QStringList qslBlacklist;
QStringList qslBlacklistExclude;
OverlaySettings();
void setPreset(const OverlayPresets preset = AvatarAndName);
void load();
void load(QSettings *);
void save();
void save(QSettings *);
};
struct Settings {
enum AudioTransmit { Continuous, VAD, PushToTalk };
enum VADSource { Amplitude, SignalToNoise };
enum LoopMode { None, Local, Server };
enum ChannelExpand { NoChannels, ChannelsWithUsers, AllChannels };
enum ChannelDrag { Ask, DoNothing, Move };
enum ServerShow { ShowPopulated, ShowReachable, ShowAll };
enum TalkState { Passive, Talking, Whispering, Shouting, MutedTalking };
enum IdleAction { Nothing, Deafen, Mute };
enum NoiseCancel { NoiseCancelOff, NoiseCancelSpeex, NoiseCancelRNN, NoiseCancelBoth };
typedef QPair< QList< QSslCertificate >, QSslKey > KeyPair;
AudioTransmit atTransmit;
quint64 uiDoublePush;
quint64 pttHold;
bool bTxAudioCue;
static const QString cqsDefaultPushClickOn;
static const QString cqsDefaultPushClickOff;
QString qsTxAudioCueOn;
QString qsTxAudioCueOff;
bool bTransmitPosition;
bool bMute, bDeaf;
bool bTTS;
bool bUserTop;
bool bWhisperFriends;
bool bTTSMessageReadBack;
bool bTTSNoScope;
bool bTTSNoAuthor;
int iTTSVolume, iTTSThreshold;
/// The Text-to-Speech language to use. This setting overrides
/// the default language for the Text-to-Speech engine, which
/// is usually inferred from the current locale.
///
/// The language is expected to be in BCP47 form.
///
/// The setting is currently only supported by the speech-dispatcher
/// backend.
QString qsTTSLanguage;
int iQuality, iMinLoudness, iVoiceHold, iJitterBufferSize;
bool bAllowLowDelay;
NoiseCancel noiseCancelMode;
int iSpeexNoiseCancelStrength;
quint64 uiAudioInputChannelMask;
// Idle auto actions
unsigned int iIdleTime;
IdleAction iaeIdleAction;
bool bUndoIdleActionUponActivity;
VADSource vsVAD;
float fVADmin, fVADmax;
int iFramesPerPacket;
QString qsAudioInput, qsAudioOutput;
float fVolume;
float fOtherVolume;
bool bAttenuateOthersOnTalk;
bool bAttenuateOthers;
bool bAttenuateUsersOnPrioritySpeak;
bool bOnlyAttenuateSameOutput;
bool bAttenuateLoopbacks;
int iOutputDelay;
QString qsALSAInput, qsALSAOutput;
QString qsPulseAudioInput, qsPulseAudioOutput;
QString qsJackClientName, qsJackAudioOutput;
bool bJackStartServer, bJackAutoConnect;
QString qsOSSInput, qsOSSOutput;
int iPortAudioInput, iPortAudioOutput;
bool bASIOEnable;
QString qsASIOclass;
QList< QVariant > qlASIOmic;
QList< QVariant > qlASIOspeaker;
QString qsCoreAudioInput, qsCoreAudioOutput;
QString qsWASAPIInput, qsWASAPIOutput;
/// qsWASAPIRole is configured via 'wasapi/role'.
/// It is a string explaining Mumble's purpose for opening
/// the audio device. This can be used to force Windows
/// to not treat Mumble as a communications program
/// (the default).
///
/// The default is "communications". When this is set,
/// Windows treats Mumble as a telephony app, including
/// potential audio ducking.
///
/// Other values include:
///
/// "console", which should be used for games, system
/// notification sounds, and voice commands.
///
/// "multimedia", which should be used for music, movies,
/// narration, and live music recording.
///
/// This is practically a direct mapping of the ERole enum
/// from Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/dd370842
QString qsWASAPIRole;
bool bExclusiveInput, bExclusiveOutput;
EchoCancelOptionID echoOption;
bool bPositionalAudio;
bool bPositionalHeadphone;
float fAudioMinDistance, fAudioMaxDistance, fAudioMaxDistVolume, fAudioBloom;
/// Contains the settings for each individual plugin. The key in this map is the Hex-represented SHA-1
/// hash of the plugin's UTF-8 encoded absolute file-path on the hard-drive.
QHash< QString, PluginSetting > qhPluginSettings;
OverlaySettings os;
int iOverlayWinHelperRestartCooldownMsec;
bool bOverlayWinHelperX86Enable;
bool bOverlayWinHelperX64Enable;
int iLCDUserViewMinColWidth;
int iLCDUserViewSplitterWidth;
QMap< QString, bool > qmLCDDevices;
bool bShortcutEnable;
bool bSuppressMacEventTapWarning;
bool bEnableEvdev;
bool bEnableXInput2;
bool bEnableGKey;
bool bEnableXboxInput;
bool bEnableWinHooks;
/// Enable verbose logging in GlobalShortcutWin's DirectInput backend.
bool bDirectInputVerboseLogging;
/// Enable use of UIAccess (Windows's UI automation feature). This allows
/// Mumble greater access to global shortcuts.
bool bEnableUIAccess;
QList< Shortcut > qlShortcuts;
enum MessageLog {
LogNone = 0x00,
LogConsole = 0x01,
LogTTS = 0x02,
LogBalloon = 0x04,
LogSoundfile = 0x08,
LogHighlight = 0x10
};
int iMaxLogBlocks;
bool bLog24HourClock;
int iChatMessageMargins;
static const QPoint UNSPECIFIED_POSITION;
QPoint qpTalkingUI_Position;
bool bShowTalkingUI;
bool bTalkingUI_LocalUserStaysVisible;
bool bTalkingUI_AbbreviateChannelNames;
bool bTalkingUI_AbbreviateCurrentChannel;
bool bTalkingUI_ShowLocalListeners;
/// relative font size in %
int iTalkingUI_RelativeFontSize;
int iTalkingUI_SilentUserLifeTime;
int iTalkingUI_ChannelHierarchyDepth;
int iTalkingUI_MaxChannelNameLength;
int iTalkingUI_PrefixCharCount;
int iTalkingUI_PostfixCharCount;
QString qsTalkingUI_ChannelSeparator;
QString qsTalkingUI_AbbreviationReplacement;
int manualPlugin_silentUserDisplaytime;
QMap< int, QString > qmMessageSounds;
QMap< int, quint32 > qmMessages;
QString qsLanguage;
/// Name of the theme to use. @see Themes
QString themeName;
/// Name of the style to use from theme. @see Themes
QString themeStyleName;
QByteArray qbaMainWindowGeometry, qbaMainWindowState, qbaMinimalViewGeometry, qbaMinimalViewState, qbaSplitterState,
qbaHeaderState;
QByteArray qbaConfigGeometry;
enum WindowLayout { LayoutClassic, LayoutStacked, LayoutHybrid, LayoutCustom };
WindowLayout wlWindowLayout;
ChannelExpand ceExpand;
ChannelDrag ceChannelDrag;
ChannelDrag ceUserDrag;
bool bMinimalView;
bool bHideFrame;
enum AlwaysOnTopBehaviour { OnTopNever, OnTopAlways, OnTopInMinimal, OnTopInNormal };
AlwaysOnTopBehaviour aotbAlwaysOnTop;
bool bAskOnQuit;
bool bEnableDeveloperMenu;
bool bLockLayout;
bool bHideInTray;
bool bStateInTray;
bool bUsage;
bool bShowUserCount;
bool bShowVolumeAdjustments;
bool bShowNicknamesOnly;
bool bChatBarUseSelection;
bool bFilterHidesEmptyChannels;
bool bFilterActive;
QByteArray qbaConnectDialogHeader, qbaConnectDialogGeometry;
bool bShowContextMenuInMenuBar;
QString qsUsername;
QString qsLastServer;
ServerShow ssFilter;
QString qsImagePath;
bool bUpdateCheck;
bool bPluginCheck;
bool bPluginAutoUpdate;
// PTT Button window
bool bShowPTTButtonWindow;
QByteArray qbaPTTButtonWindowGeometry;
// Network settings
enum ProxyType { NoProxy, HttpProxy, Socks5Proxy };
bool bTCPCompat;
bool bReconnect;
bool bAutoConnect;
bool bQoS;
/// Disables the "Public Internet" section in the connect dialog if set.
bool bDisablePublicList;
ProxyType ptProxyType;
QString qsProxyHost, qsProxyUsername, qsProxyPassword;
unsigned short usProxyPort;
/// The ping interval in milliseconds. The Mumble client
/// will regularly send TCP and UDP pings to the remote
/// server. This setting specifies the time (in milliseconds)
/// between each ping message.
int iPingIntervalMsec;
/// The connection timeout duration in milliseconds.
/// If a connection is not fully established to the
/// server within this duration, the client will
/// forcefully disconnect.
int iConnectionTimeoutDurationMsec;
/// bUdpForceTcpAddr forces Mumble to bind its UDP
/// socket to the same address as its TCP
/// connection is using.
bool bUdpForceTcpAddr;
/// iMaxInFlightTCPPings specifies the maximum
/// number of ping messages that the client has
/// sent, but not yet received a response for
/// from the server. This value is checked when
/// the client sends its next ping message. If
/// the maximum is reached, the connection will
/// be closed.
/// If this setting is assigned a value of 0 or
/// a negative number, the TCP ping check is
/// disabled.
int iMaxInFlightTCPPings;
/// The service prefix that the WebFetch class will use
/// when it constructs its fully-qualified URL. If this
/// is empty, no prefix is used.
///
/// When the WebFetch class receives a HTTP response which
/// includes the header "Use-Service-Prefix", this setting
/// is updated to reflect the received service prefix.
///
/// For more information, see the documentation for WebFetch::fetch().
QString qsServicePrefix;
// Network settings - SSL
QString qsSslCiphers;
// Privacy settings
bool bHideOS;
int iMaxImageWidth;
int iMaxImageHeight;
KeyPair kpCertificate;
bool bSuppressIdentity;
bool bShowTransmitModeComboBox;
// Accessibility
bool bHighContrast;
// Recording
QString qsRecordingPath;
QString qsRecordingFile;
enum RecordingMode { RecordingMixdown, RecordingMultichannel };
RecordingMode rmRecordingMode;
int iRecordingFormat;
// Special configuration options not exposed to UI
/// Codec kill-switch
bool bDisableCELT;
/// Removes the add and edit options in the connect dialog if set.
bool disableConnectDialogEditing;
/// Asks the user for consent to ping servers in the public server list if not set.
bool bPingServersDialogViewed;
// Config updates
unsigned int uiUpdateCounter;
/// Path to SQLite-DB
QString qsDatabaseLocation;
// Nonsaved
LoopMode lmLoopMode;
float dPacketLoss;
float dMaxPacketDelay;
/// If true settings in this structure require a client restart to apply fully
bool requireRestartToApply;
bool doEcho() const;
bool doPositionalAudio() const;
Settings();
void load();
void load(QSettings *);
void save();
};
#endif
|