blob: 27040a62c402ae64376507da73b710821c3c0f6e (
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
|
// Copyright 2005-2016 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 <boost/shared_ptr.hpp>
#include <QtCore/QDir>
#include <QtCore/QSharedPointer>
#include "ACL.h"
#include "Settings.h"
#include "Timer.h"
#include "Version.h"
// Global helper class to spread variables around across threads.
class MainWindow;
class ServerHandler;
class AudioInput;
class AudioOutput;
class Database;
class Log;
class Plugins;
class QSettings;
class Overlay;
class LCD;
class BonjourClient;
class OverlayClient;
class CELTCodec;
class LogEmitter;
class DeveloperConsole;
class QNetworkAccessManager;
struct Global Q_DECL_FINAL {
private:
Q_DISABLE_COPY(Global)
public:
static Global *g_global_struct;
MainWindow *mw;
Settings s;
boost::shared_ptr<ServerHandler> sh;
QSharedPointer<AudioInput> ai;
QSharedPointer<AudioOutput> ao;
Database *db;
Log *l;
Plugins *p;
QSettings *qs;
Overlay *o;
LCD *lcd;
BonjourClient *bc;
QNetworkAccessManager *nam;
QSharedPointer<LogEmitter> le;
DeveloperConsole *c;
int iPushToTalk;
Timer tDoublePush;
quint64 uiDoublePush;
int iTarget;
int iPrevTarget;
bool bPushToMute;
bool bCenterPosition;
bool bPosTest;
bool bInAudioWizard;
OverlayClient *ocIntercept;
int iAudioPathTime;
unsigned int uiSession;
ChanACL::Permissions pPermissions;
int iMaxBandwidth;
int iAudioBandwidth;
QDir qdBasePath;
QMap<int, CELTCodec *> qmCodecs;
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;
bool bHappyEaster;
static const char ccHappyEaster[];
Global();
~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;
// -Wshadow is bugged. If an inline function of a class uses a variable or
// parameter named 'g', that will generate a warning even if the class header
// is included long before this definition.
#define g (*Global::g_global_struct)
#endif
|