blob: 773ec62dee8fb8293f87df8a40f0b06bf3b85658 (
plain)
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
|
// 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_GLOBAL_H_
#define MUMBLE_MUMBLE_GLOBAL_H_
#include <QtCore/QDir>
#include <boost/shared_ptr.hpp>
#include "ACL.h"
#include "ChannelListenerManager.h"
#include "Settings.h"
#include "Timer.h"
#include "Version.h"
#include <memory>
// Global helper class to spread variables around across threads.
class MainWindow;
class ServerHandler;
class AudioInput;
class AudioOutput;
class Database;
class Log;
class PluginManager;
class QSettings;
class Overlay;
class LCD;
class Zeroconf;
class OverlayClient;
class CELTCodec;
class OpusCodec;
class LogEmitter;
class DeveloperConsole;
class TalkingUI;
class QNetworkAccessManager;
struct Global Q_DECL_FINAL {
private:
Q_DISABLE_COPY(Global)
public:
static Global *g_global_struct;
static Global &get();
MainWindow *mw;
Settings s;
boost::shared_ptr< ServerHandler > sh;
boost::shared_ptr< AudioInput > ai;
boost::shared_ptr< AudioOutput > ao;
/**
* @remark Must only be accessed from the main event loop
*/
Database *db;
Log *l;
/// A pointer to the PluginManager that is used in this session
PluginManager *pluginManager;
QSettings *qs;
#ifdef USE_OVERLAY
Overlay *o;
#endif
LCD *lcd;
Zeroconf *zeroconf;
QNetworkAccessManager *nam;
QSharedPointer< LogEmitter > le;
DeveloperConsole *c;
TalkingUI *talkingUI;
int iPushToTalk;
Timer tDoublePush;
quint64 uiDoublePush;
/// Holds the current VoiceTarget ID to send audio to
int iTarget;
/// Holds the value of iTarget before its last change until the current
/// audio-stream ends (and it has a value > 0). See the comment in
/// AudioInput::flushCheck for further details on this.
int iPrevTarget;
bool bPushToMute;
bool bCenterPosition;
bool bPosTest;
bool bInAudioWizard;
#ifdef USE_OVERLAY
OverlayClient *ocIntercept;
#endif
int iAudioPathTime;
/// A unique ID for the current user. It is being assigned by the server right
/// after connecting to it. An ID of 0 indicates that the user currently isn't
/// connected to a server.
unsigned int uiSession;
ChanACL::Permissions pPermissions;
int iMaxBandwidth;
int iAudioBandwidth;
QDir qdBasePath;
QMap< int, CELTCodec * > qmCodecs;
OpusCodec *oCodec;
int iCodecAlpha, iCodecBeta;
bool bPreferAlpha;
bool bOpus;
bool bAttenuateOthers;
/// If set the AudioOutput::mix will forcefully adjust the volume of all
/// non-priority speakers.
bool prioritySpeakerActiveOverride;
bool bAllowHTML;
unsigned int uiMessageLength;
unsigned int uiImageLength;
unsigned int uiMaxUsers;
bool bQuit;
QString windowTitlePostfix;
bool bDebugDumpInput;
bool bDebugPrintQueue;
std::unique_ptr< ChannelListenerManager > channelListenerManager;
bool bHappyEaster;
static const char ccHappyEaster[];
Global(const QString &qsConfigPath = QString());
~Global();
};
// Class to handle ordered initialization of globals.
// This allows the same link-time magic as used everywhere else
// for globals that need an init before the GUI starts, but
// after we reach main().
class DeferInit {
private:
Q_DISABLE_COPY(DeferInit)
protected:
static QMultiMap< int, DeferInit * > *qmDeferers;
void add(int priority);
public:
DeferInit(int priority) { add(priority); };
DeferInit() { add(0); };
virtual ~DeferInit();
virtual void initialize(){};
virtual void destroy(){};
static void run_initializers();
static void run_destroyers();
};
/// Special exit code which causes mumble to restart itself. The outward facing return code with be 0
const int MUMBLE_EXIT_CODE_RESTART = 64738;
#endif
|