Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Adam <dev@robert-adam.de>2021-04-17 09:37:05 +0300
committerGitHub <noreply@github.com>2021-04-17 09:37:05 +0300
commitbaeddddec4c301389a088a9f7059a4b5d28c7dd1 (patch)
treeabf6a4001f7b795242e49b619fc3ffb6c0623633 /src/mumble
parentd4a5fc1047837ce2018a6381e0e74a51f65b2a8f (diff)
parent923045ac6029bc7433c60ce2fad5a35e025beedd (diff)
Merge PR #4934: FORMAT: Run clang-format 10 on all source files1.4.0-development-snapshot-005
Diffstat (limited to 'src/mumble')
-rw-r--r--src/mumble/ACLEditor.cpp3
-rw-r--r--src/mumble/ALSAAudio.cpp8
-rw-r--r--src/mumble/API_v_1_0_x.cpp37
-rw-r--r--src/mumble/ASIOInput.cpp3
-rw-r--r--src/mumble/About.cpp2
-rw-r--r--src/mumble/Audio.cpp11
-rw-r--r--src/mumble/AudioConfigDialog.cpp25
-rw-r--r--src/mumble/AudioInput.cpp56
-rw-r--r--src/mumble/AudioInput.h3
-rw-r--r--src/mumble/AudioOutput.cpp23
-rw-r--r--src/mumble/AudioOutput.h6
-rw-r--r--src/mumble/AudioOutputSpeech.cpp3
-rw-r--r--src/mumble/AudioWizard.cpp18
-rw-r--r--src/mumble/ClientUser.cpp3
-rw-r--r--src/mumble/ConfigDialog.cpp12
-rw-r--r--src/mumble/ConnectDialog.cpp8
-rw-r--r--src/mumble/CrashReporter.cpp5
-rw-r--r--src/mumble/CustomElements.cpp7
-rw-r--r--src/mumble/Database.cpp3
-rw-r--r--src/mumble/Database.h2
-rw-r--r--src/mumble/EchoCancelOption.h32
-rw-r--r--src/mumble/GlobalShortcut.cpp2
-rw-r--r--src/mumble/GlobalShortcut_win.cpp2
-rw-r--r--src/mumble/JackAudio.cpp3
-rw-r--r--src/mumble/LCD.cpp3
-rw-r--r--src/mumble/LegacyPlugin.cpp75
-rw-r--r--src/mumble/LegacyPlugin.h107
-rw-r--r--src/mumble/Log.cpp5
-rw-r--r--src/mumble/LookConfig.cpp3
-rw-r--r--src/mumble/MainWindow.cpp114
-rw-r--r--src/mumble/MainWindow.h5
-rw-r--r--src/mumble/ManualPlugin.cpp10
-rw-r--r--src/mumble/ManualPlugin.h22
-rw-r--r--src/mumble/Messages.cpp302
-rw-r--r--src/mumble/MumbleApplication.cpp2
-rw-r--r--src/mumble/NetworkConfig.cpp4
-rw-r--r--src/mumble/Overlay.cpp2
-rw-r--r--src/mumble/OverlayClient.cpp2
-rw-r--r--src/mumble/OverlayConfig.cpp2
-rw-r--r--src/mumble/OverlayEditor.cpp2
-rw-r--r--src/mumble/OverlayEditorScene.cpp2
-rw-r--r--src/mumble/OverlayUser.cpp2
-rw-r--r--src/mumble/OverlayUserGroup.cpp2
-rw-r--r--src/mumble/Plugin.cpp218
-rw-r--r--src/mumble/Plugin.h749
-rw-r--r--src/mumble/PluginConfig.cpp56
-rw-r--r--src/mumble/PluginConfig.h93
-rw-r--r--src/mumble/PluginInstaller.cpp69
-rw-r--r--src/mumble/PluginInstaller.h119
-rw-r--r--src/mumble/PluginManager.cpp255
-rw-r--r--src/mumble/PluginManager.h475
-rw-r--r--src/mumble/PluginUpdater.cpp76
-rw-r--r--src/mumble/PluginUpdater.h128
-rw-r--r--src/mumble/PositionalData.cpp56
-rw-r--r--src/mumble/PositionalData.h281
-rw-r--r--src/mumble/PulseAudio.cpp5
-rw-r--r--src/mumble/RichTextEditor.cpp3
-rw-r--r--src/mumble/ServerHandler.cpp12
-rw-r--r--src/mumble/Settings.cpp40
-rw-r--r--src/mumble/Settings.h4
-rw-r--r--src/mumble/TalkingUI.cpp30
-rw-r--r--src/mumble/Translations.cpp15
-rw-r--r--src/mumble/Translations.h4
-rw-r--r--src/mumble/Usage.cpp3
-rw-r--r--src/mumble/UserInformation.cpp3
-rw-r--r--src/mumble/UserLocalNicknameDialog.cpp11
-rw-r--r--src/mumble/UserLocalNicknameDialog.h10
-rw-r--r--src/mumble/UserModel.cpp23
-rw-r--r--src/mumble/VersionCheck.cpp22
-rw-r--r--src/mumble/VoiceRecorderDialog.cpp2
-rw-r--r--src/mumble/WASAPI.cpp21
-rw-r--r--src/mumble/main.cpp72
-rw-r--r--src/mumble/os_win.cpp5
-rw-r--r--src/mumble/widgets/MultiStyleWidgetWrapper.cpp6
-rw-r--r--src/mumble/widgets/MultiStyleWidgetWrapper.h62
75 files changed, 2025 insertions, 1846 deletions
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp
index 616a7936b..d4bea977c 100644
--- a/src/mumble/ACLEditor.cpp
+++ b/src/mumble/ACLEditor.cpp
@@ -298,7 +298,8 @@ void ACLEditor::accept() {
// Update channel state
if (bAddChannelMode) {
Global::get().sh->createChannel(iChannel, qleChannelName->text(), rteChannelDescription->text(),
- qsbChannelPosition->value(), qcbChannelTemporary->isChecked(), qsbChannelMaxUsers->value());
+ qsbChannelPosition->value(), qcbChannelTemporary->isChecked(),
+ qsbChannelMaxUsers->value());
} else {
bool needs_update = false;
diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp
index 2e64d5b8d..b2b2e28aa 100644
--- a/src/mumble/ALSAAudio.cpp
+++ b/src/mumble/ALSAAudio.cpp
@@ -212,8 +212,8 @@ ALSAEnumerator::ALSAEnumerator() {
int err;
snd_ctl_t *ctl = nullptr;
if ((err = snd_card_get_longname(card, &name)) != 0) {
- Global::get().mw->msgBox(
- tr("Getting name (longname) of the sound card failed: %1").arg(QString::fromUtf8(snd_strerror(err)).toHtmlEscaped()));
+ Global::get().mw->msgBox(tr("Getting name (longname) of the sound card failed: %1")
+ .arg(QString::fromUtf8(snd_strerror(err)).toHtmlEscaped()));
return;
}
QByteArray dev = QString::fromLatin1("hw:%1").arg(card).toUtf8();
@@ -223,8 +223,8 @@ ALSAEnumerator::ALSAEnumerator() {
char *cname = nullptr;
if ((err = snd_card_get_name(card, &cname)) != 0) {
- Global::get().mw->msgBox(
- tr("Getting name of the sound card failed: %1").arg(QString::fromUtf8(snd_strerror(err)).toHtmlEscaped()));
+ Global::get().mw->msgBox(tr("Getting name of the sound card failed: %1")
+ .arg(QString::fromUtf8(snd_strerror(err)).toHtmlEscaped()));
return;
}
int device = -1;
diff --git a/src/mumble/API_v_1_0_x.cpp b/src/mumble/API_v_1_0_x.cpp
index ac8adf6f1..58a54314b 100644
--- a/src/mumble/API_v_1_0_x.cpp
+++ b/src/mumble/API_v_1_0_x.cpp
@@ -10,12 +10,12 @@
#include "Database.h"
#include "Log.h"
#include "MainWindow.h"
+#include "MumbleConstants.h"
#include "PluginComponents_v_1_0_x.h"
#include "PluginManager.h"
#include "ServerHandler.h"
#include "Settings.h"
#include "UserModel.h"
-#include "MumbleConstants.h"
#include "Global.h"
#include <QVariant>
@@ -35,22 +35,22 @@
} \
return;
-#define VERIFY_PLUGIN_ID(id) \
+#define VERIFY_PLUGIN_ID(id) \
if (!Global::get().pluginManager->pluginExists(id)) { \
- EXIT_WITH(EC_INVALID_PLUGIN_ID); \
+ EXIT_WITH(EC_INVALID_PLUGIN_ID); \
}
// Right now there can only be one connection managed by the current ServerHandler
-#define VERIFY_CONNECTION(connection) \
+#define VERIFY_CONNECTION(connection) \
if (!Global::get().sh || Global::get().sh->getConnectionID() != connection) { \
- EXIT_WITH(EC_CONNECTION_NOT_FOUND); \
+ EXIT_WITH(EC_CONNECTION_NOT_FOUND); \
}
-// Right now whether or not a connection has finished synchronizing is indicated by Global::get().uiSession. If it is zero,
-// synchronization is not done yet (or there is no connection to begin with). The connection parameter in the macro is
-// only present in case it will be needed in the future
+// Right now whether or not a connection has finished synchronizing is indicated by Global::get().uiSession. If it is
+// zero, synchronization is not done yet (or there is no connection to begin with). The connection parameter in the
+// macro is only present in case it will be needed in the future
#define ENSURE_CONNECTION_SYNCHRONIZED(connection) \
- if (Global::get().uiSession == 0) { \
+ if (Global::get().uiSession == 0) { \
EXIT_WITH(EC_CONNECTION_UNSYNCHRONIZED); \
}
@@ -67,7 +67,8 @@ MumbleAPICurator::~MumbleAPICurator() {
entry.m_deleter(current.first);
// Print an error about the leaked resource
- printf("[ERROR]: Plugin with ID %d leaked memory from a call to API function \"%s\"\n", entry.m_pluginID, entry.m_sourceFunctionName);
+ printf("[ERROR]: Plugin with ID %d leaked memory from a call to API function \"%s\"\n", entry.m_pluginID,
+ entry.m_sourceFunctionName);
}
}
// Some common delete-functions
@@ -86,12 +87,12 @@ void defaultDeleter(const void *ptr) {
// This macro registers type, type * and type ** to Qt's metatype system
// and also their const variants (except const value as that doesn't make sense)
-#define REGISTER_METATYPE(type) \
- qRegisterMetaType< type >(#type); \
- qRegisterMetaType< type * >(#type " *"); \
- qRegisterMetaType< type ** >(#type " **"); \
- qRegisterMetaType< const type * >("const " #type " *"); \
- qRegisterMetaType< const type ** >("const " #type " **"); \
+#define REGISTER_METATYPE(type) \
+ qRegisterMetaType< type >(#type); \
+ qRegisterMetaType< type * >(#type " *"); \
+ qRegisterMetaType< type ** >(#type " **"); \
+ qRegisterMetaType< const type * >("const " #type " *"); \
+ qRegisterMetaType< const type ** >("const " #type " **");
MumbleAPI::MumbleAPI() {
// Move this object to the main thread
@@ -194,8 +195,8 @@ void MumbleAPI::isConnectionSynchronized_v_1_0_x(mumble_plugin_id_t callerID, mu
VERIFY_PLUGIN_ID(callerID);
VERIFY_CONNECTION(connection);
- // Right now there can only be one connection and if Global::get().uiSession is zero, then the synchronization has not finished
- // yet (or there is no connection to begin with)
+ // Right now there can only be one connection and if Global::get().uiSession is zero, then the synchronization has
+ // not finished yet (or there is no connection to begin with)
*synchronized = Global::get().uiSession != 0;
EXIT_WITH(STATUS_OK);
diff --git a/src/mumble/ASIOInput.cpp b/src/mumble/ASIOInput.cpp
index 1014fe6f9..11cc5c33a 100644
--- a/src/mumble/ASIOInput.cpp
+++ b/src/mumble/ASIOInput.cpp
@@ -43,8 +43,7 @@ const QList< audioDevice > ASIOAudioInputRegistrar::getDeviceChoices() {
}
bool ASIOAudioInputRegistrar::canEcho(EchoCancelOptionID echoOption, const QString &) const {
- return (echoOption == EchoCancelOptionID::SPEEX_MIXED
- || echoOption == EchoCancelOptionID::SPEEX_MULTICHANNEL);
+ return (echoOption == EchoCancelOptionID::SPEEX_MIXED || echoOption == EchoCancelOptionID::SPEEX_MULTICHANNEL);
}
void ASIOAudioInputRegistrar::setDeviceChoice(const QVariant &, Settings &) {
diff --git a/src/mumble/About.cpp b/src/mumble/About.cpp
index c086653f1..2abac5852 100644
--- a/src/mumble/About.cpp
+++ b/src/mumble/About.cpp
@@ -60,7 +60,7 @@ AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
QString copyrightText;
#ifdef MUMBLE_BUILD_YEAR
copyrightText = "Copyright 2005-" QUOTE(MUMBLE_BUILD_YEAR) " The Mumble Developers";
-#else // MUMBLE_BUILD_YEAR
+#else // MUMBLE_BUILD_YEAR
copyrightText = "Copyright 2005-now The Mumble Developers";
#endif // MUMBLE_BUILD_YEAR
diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp
index b2d61025d..ab78c762f 100644
--- a/src/mumble/Audio.cpp
+++ b/src/mumble/Audio.cpp
@@ -270,15 +270,16 @@ void Audio::stopInput() {
void Audio::start(const QString &input, const QString &output) {
startInput(input);
startOutput(output);
-
+
// Now that the audio input and output is created, we connect them to the PluginManager
- // As these callbacks might want to change the audio before it gets further processed, all these connections have to be direct
+ // As these callbacks might want to change the audio before it gets further processed, all these connections have to
+ // be direct
QObject::connect(Global::get().ai.get(), &AudioInput::audioInputEncountered, Global::get().pluginManager,
- &PluginManager::on_audioInput, Qt::DirectConnection);
+ &PluginManager::on_audioInput, Qt::DirectConnection);
QObject::connect(Global::get().ao.get(), &AudioOutput::audioSourceFetched, Global::get().pluginManager,
- &PluginManager::on_audioSourceFetched, Qt::DirectConnection);
+ &PluginManager::on_audioSourceFetched, Qt::DirectConnection);
QObject::connect(Global::get().ao.get(), &AudioOutput::audioOutputAboutToPlay, Global::get().pluginManager,
- &PluginManager::on_audioOutputAboutToPlay, Qt::DirectConnection);
+ &PluginManager::on_audioOutputAboutToPlay, Qt::DirectConnection);
}
void Audio::stop() {
diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp
index c9b65a4e0..bed102293 100644
--- a/src/mumble/AudioConfigDialog.cpp
+++ b/src/mumble/AudioConfigDialog.cpp
@@ -245,13 +245,14 @@ void AudioInputDialog::verifyMicrophonePermission() {
qcbDevice->setEnabled(false);
if (air->name == QLatin1String("CoreAudio")) {
qlInputHelp->setVisible(true);
- qlInputHelp->setText(tr("Access to the microphone was denied. Please allow Mumble to use the microphone "
- "by changing the settings in System Preferences -> Security & Privacy -> Privacy -> "
- "Microphone."));
+ qlInputHelp->setText(
+ tr("Access to the microphone was denied. Please allow Mumble to use the microphone "
+ "by changing the settings in System Preferences -> Security & Privacy -> Privacy -> "
+ "Microphone."));
} else if (air->name == QLatin1String("WASAPI")) {
qlInputHelp->setVisible(true);
- qlInputHelp->setText( tr("Access to the microphone was denied. Please check that your operating system's "
- "microphone settings allow Mumble to use the microphone."));
+ qlInputHelp->setText(tr("Access to the microphone was denied. Please check that your operating system's "
+ "microphone settings allow Mumble to use the microphone."));
}
} else {
qcbDevice->setEnabled(true);
@@ -297,7 +298,7 @@ void AudioInputDialog::save() const {
s.qsTxAudioCueOff = qlePushClickPathOff->text();
s.qsAudioInput = qcbSystem->currentText();
- s.echoOption = static_cast<EchoCancelOptionID>(qcbEcho->currentData().toInt());
+ s.echoOption = static_cast< EchoCancelOptionID >(qcbEcho->currentData().toInt());
s.bExclusiveInput = qcbExclusive->isChecked();
if (AudioInputRegistrar::qmNew) {
@@ -519,9 +520,9 @@ void AudioInputDialog::updateEchoEnableState() {
for (EchoCancelOptionID ecoid : air->echoOptions) {
if (air->canEcho(ecoid, outputInterface)) {
++i;
- hasUsableEchoOption = true;
- const EchoCancelOption &echoOption = echoCancelOptions[static_cast<int>(ecoid)];
- qcbEcho->insertItem(i, echoOption.description, static_cast<int>(ecoid));
+ hasUsableEchoOption = true;
+ const EchoCancelOption &echoOption = echoCancelOptions[static_cast< int >(ecoid)];
+ qcbEcho->insertItem(i, echoOption.description, static_cast< int >(ecoid));
qcbEcho->setItemData(i, echoOption.explanation, Qt::ToolTipRole);
if (s.echoOption == ecoid) {
qcbEcho->setCurrentIndex(i);
@@ -535,9 +536,9 @@ void AudioInputDialog::updateEchoEnableState() {
qcbEcho->setCurrentIndex(0);
qcbEcho->setEnabled(false);
qcbEcho->setToolTip(QObject::tr("Echo cancellation is not supported for the interface "
- "combination \"%1\" (in) and \"%2\" (out).")
- .arg(air->name)
- .arg(outputInterface));
+ "combination \"%1\" (in) and \"%2\" (out).")
+ .arg(air->name)
+ .arg(outputInterface));
}
}
diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp
index cf1ca3820..0ac244a40 100644
--- a/src/mumble/AudioInput.cpp
+++ b/src/mumble/AudioInput.cpp
@@ -10,18 +10,16 @@
#ifdef USE_OPUS
# include "OpusCodec.h"
#endif
+#include "API.h"
#include "MainWindow.h"
-#include "User.h"
-#include "PacketDataStream.h"
-#include "PluginManager.h"
#include "Message.h"
#include "NetworkConfig.h"
#include "PacketDataStream.h"
+#include "PluginManager.h"
#include "ServerHandler.h"
#include "User.h"
#include "Utils.h"
#include "VoiceRecorder.h"
-#include "API.h"
#include "Global.h"
@@ -177,7 +175,7 @@ AudioInputPtr AudioInputRegistrar::newFromChoice(QString choice) {
if (!choice.isEmpty() && qmNew->contains(choice)) {
Global::get().s.qsAudioInput = choice;
- current = choice;
+ current = choice;
return AudioInputPtr(qmNew->value(current)->create());
}
choice = Global::get().s.qsAudioInput;
@@ -711,19 +709,20 @@ void AudioInput::setMaxBandwidth(int bitspersec) {
if (bitspersec != -1) {
if ((bitrate != Global::get().s.iQuality) || (frames != Global::get().s.iFramesPerPacket))
- Global::get().mw->msgBox(tr("Server maximum network bandwidth is only %1 kbit/s. Audio quality auto-adjusted to %2 "
- "kbit/s (%3 ms)")
- .arg(bitspersec / 1000)
- .arg(bitrate / 1000)
- .arg(frames * 10));
+ Global::get().mw->msgBox(
+ tr("Server maximum network bandwidth is only %1 kbit/s. Audio quality auto-adjusted to %2 "
+ "kbit/s (%3 ms)")
+ .arg(bitspersec / 1000)
+ .arg(bitrate / 1000)
+ .arg(frames * 10));
}
AudioInputPtr ai = Global::get().ai;
if (ai) {
- Global::get().iAudioBandwidth = getNetworkBandwidth(bitrate, frames);
- ai->iAudioQuality = bitrate;
- ai->iAudioFrames = frames;
- ai->bAllowLowDelay = allowLowDelay;
+ Global::get().iAudioBandwidth = getNetworkBandwidth(bitrate, frames);
+ ai->iAudioQuality = bitrate;
+ ai->iAudioFrames = frames;
+ ai->bAllowLowDelay = allowLowDelay;
return;
}
@@ -734,8 +733,8 @@ void AudioInput::setMaxBandwidth(int bitspersec) {
}
int AudioInput::getNetworkBandwidth(int bitrate, int frames) {
- int overhead =
- 20 + 8 + 4 + 1 + 2 + (Global::get().s.bTransmitPosition ? 12 : 0) + (NetworkConfig::TcpModeEnabled() ? 12 : 0) + frames;
+ int overhead = 20 + 8 + 4 + 1 + 2 + (Global::get().s.bTransmitPosition ? 12 : 0)
+ + (NetworkConfig::TcpModeEnabled() ? 12 : 0) + frames;
overhead *= (800 / frames);
int bw = overhead + bitrate;
@@ -810,7 +809,8 @@ bool AudioInput::selectCodec() {
if (!useOpus) {
CELTCodec *switchto = nullptr;
- if ((!Global::get().uiSession || (Global::get().s.lmLoopMode == Settings::Local)) && (!Global::get().qmCodecs.isEmpty())) {
+ if ((!Global::get().uiSession || (Global::get().s.lmLoopMode == Settings::Local))
+ && (!Global::get().qmCodecs.isEmpty())) {
// Use latest for local loopback
QMap< int, CELTCodec * >::const_iterator i = Global::get().qmCodecs.constEnd();
--i;
@@ -824,9 +824,11 @@ bool AudioInput::selectCodec() {
}
}
if (!switchto) {
- switchto = Global::get().qmCodecs.value(Global::get().bPreferAlpha ? Global::get().iCodecAlpha : Global::get().iCodecBeta);
+ switchto = Global::get().qmCodecs.value(Global::get().bPreferAlpha ? Global::get().iCodecAlpha
+ : Global::get().iCodecBeta);
if (!switchto)
- switchto = Global::get().qmCodecs.value(Global::get().bPreferAlpha ? Global::get().iCodecBeta : Global::get().iCodecAlpha);
+ switchto = Global::get().qmCodecs.value(Global::get().bPreferAlpha ? Global::get().iCodecBeta
+ : Global::get().iCodecAlpha);
}
if (switchto != cCodec) {
if (cCodec && ceEncoder) {
@@ -1062,13 +1064,15 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) {
iHoldFrames = 0;
}
- if (Global::get().s.atTransmit == Settings::Continuous || API::PluginData::get().overwriteMicrophoneActivation.load()) {
+ if (Global::get().s.atTransmit == Settings::Continuous
+ || API::PluginData::get().overwriteMicrophoneActivation.load()) {
// Continous transmission is enabled
bIsSpeech = true;
} else if (Global::get().s.atTransmit == Settings::PushToTalk) {
// PTT is enabled, so check if it is currently active
- bIsSpeech =
- Global::get().s.uiDoublePush && ((Global::get().uiDoublePush < Global::get().s.uiDoublePush) || (Global::get().tDoublePush.elapsed() < Global::get().s.uiDoublePush));
+ bIsSpeech = Global::get().s.uiDoublePush
+ && ((Global::get().uiDoublePush < Global::get().s.uiDoublePush)
+ || (Global::get().tDoublePush.elapsed() < Global::get().s.uiDoublePush));
}
// If Global::get().iPushToTalk > 0 that means that we are currently in some sort of PTT action. For
@@ -1076,8 +1080,8 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) {
bIsSpeech = bIsSpeech || (Global::get().iPushToTalk > 0);
ClientUser *p = ClientUser::get(Global::get().uiSession);
- if (Global::get().s.bMute || ((Global::get().s.lmLoopMode != Settings::Local) && p && (p->bMute || p->bSuppress)) || Global::get().bPushToMute
- || (voiceTargetID < 0)) {
+ if (Global::get().s.bMute || ((Global::get().s.lmLoopMode != Settings::Local) && p && (p->bMute || p->bSuppress))
+ || Global::get().bPushToMute || (voiceTargetID < 0)) {
bIsSpeech = false;
}
@@ -1148,7 +1152,7 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) {
Q_ASSERT(buffer.size() >= static_cast< size_t >(iAudioQuality / 100 * iAudioFrames / 8));
emit audioInputEncountered(psSource, iFrameSize, iMicChannels, SAMPLE_RATE, bIsSpeech);
-
+
int len = 0;
bool encoded = true;
@@ -1281,7 +1285,7 @@ void AudioInput::flushCheck(const QByteArray &frame, bool terminator, int voiceT
}
if (Global::get().s.bTransmitPosition && Global::get().pluginManager && !Global::get().bCenterPosition
- && Global::get().pluginManager->fetchPositionalData()) {
+ && Global::get().pluginManager->fetchPositionalData()) {
Position3D currentPos = Global::get().pluginManager->getPositionalData().getPlayerPos();
pds << currentPos.x;
diff --git a/src/mumble/AudioInput.h b/src/mumble/AudioInput.h
index 0410db421..d69c28f84 100644
--- a/src/mumble/AudioInput.h
+++ b/src/mumble/AudioInput.h
@@ -261,7 +261,8 @@ signals:
/// @param channelCount The amount of channels in the input
/// @param sampleRate The used sample rate in Hz
/// @param isSpeech Whether Mumble considers the inpu to be speech
- void audioInputEncountered(short *inputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech);
+ void audioInputEncountered(short *inputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool isSpeech);
public:
typedef enum { ActivityStateIdle, ActivityStateReturnedFromIdle, ActivityStateActive } ActivityState;
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp
index 784a29245..3216ee286 100644
--- a/src/mumble/AudioOutput.cpp
+++ b/src/mumble/AudioOutput.cpp
@@ -47,7 +47,7 @@ AudioOutputPtr AudioOutputRegistrar::newFromChoice(QString choice) {
if (!choice.isEmpty() && qmNew->contains(choice)) {
Global::get().s.qsAudioOutput = choice;
- current = choice;
+ current = choice;
return AudioOutputPtr(qmNew->value(choice)->create());
}
choice = Global::get().s.qsAudioOutput;
@@ -116,8 +116,9 @@ float AudioOutput::calcGain(float dotproduct, float distance) {
if (mvol < 0.01f)
mvol = 0.01f;
- float drel = (distance - Global::get().s.fAudioMinDistance) / (Global::get().s.fAudioMaxDistance - Global::get().s.fAudioMinDistance);
- datt = powf(10.0f, log10f(mvol) * drel);
+ float drel = (distance - Global::get().s.fAudioMinDistance)
+ / (Global::get().s.fAudioMaxDistance - Global::get().s.fAudioMinDistance);
+ datt = powf(10.0f, log10f(mvol) * drel);
}
att = datt * dotfactor;
@@ -395,13 +396,13 @@ bool AudioOutput::mix(void *outbuff, unsigned int frameCount) {
prioritySpeakerActive = true;
}
- // If the audio backend uses a float-array we can sample and mix the audio sources directly into the output. Otherwise we'll have to
- // use an intermediate buffer which we will convert to an array of shorts later
- STACKVAR(float, fOutput, iChannels * frameCount);
- float *output = (eSampleFormat == SampleFloat) ? reinterpret_cast<float *>(outbuff) : fOutput;
+ // If the audio backend uses a float-array we can sample and mix the audio sources directly into the output.
+ // Otherwise we'll have to use an intermediate buffer which we will convert to an array of shorts later
+ STACKVAR(float, fOutput, iChannels *frameCount);
+ float *output = (eSampleFormat == SampleFloat) ? reinterpret_cast< float * >(outbuff) : fOutput;
memset(output, 0, sizeof(float) * frameCount * iChannels);
- if (! qlMix.isEmpty()) {
+ if (!qlMix.isEmpty()) {
// There are audio sources available -> mix those sources together and feed them into the audio backend
STACKVAR(float, speaker, iChannels * 3);
STACKVAR(float, svol, iChannels);
@@ -497,7 +498,7 @@ bool AudioOutput::mix(void *outbuff, unsigned int frameCount) {
AudioOutputSpeech *speech = qobject_cast< AudioOutputSpeech * >(aop);
const ClientUser *user = nullptr;
if (speech) {
- user = speech->p;
+ user = speech->p;
volumeAdjustment *= user->getLocalVolumeAdjustments();
if (user->cChannel && ChannelListener::isListening(Global::get().uiSession, user->cChannel->iId)
@@ -639,7 +640,7 @@ bool AudioOutput::mix(void *outbuff, unsigned int frameCount) {
bool pluginModifiedAudio = false;
emit audioOutputAboutToPlay(output, frameCount, nchan, SAMPLE_RATE, &pluginModifiedAudio);
- if (pluginModifiedAudio || (! qlMix.isEmpty())) {
+ if (pluginModifiedAudio || (!qlMix.isEmpty())) {
// Clip the output audio
if (eSampleFormat == SampleFloat)
for (unsigned int i = 0; i < frameCount * iChannels; i++)
@@ -662,7 +663,7 @@ bool AudioOutput::mix(void *outbuff, unsigned int frameCount) {
#endif
// Return whether data has been written to the outbuff
- return (pluginModifiedAudio || (! qlMix.isEmpty()));
+ return (pluginModifiedAudio || (!qlMix.isEmpty()));
}
bool AudioOutput::isAlive() const {
diff --git a/src/mumble/AudioOutput.h b/src/mumble/AudioOutput.h
index 3d5c5b6da..b36b87e2c 100644
--- a/src/mumble/AudioOutput.h
+++ b/src/mumble/AudioOutput.h
@@ -137,7 +137,8 @@ signals:
/// @param sampleRate The used sample rate in Hz
/// @param isSpeech Whether the fetched output is considered to be speech
/// @param A pointer to the user that this speech belongs to or nullptr if this isn't speech
- void audioSourceFetched(float *outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech, const ClientUser *user);
+ void audioSourceFetched(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool isSpeech, const ClientUser *user);
/// Signal emitted whenever an audio is about to be played to the user
///
/// @param outputPCM The output PCM that is to be played
@@ -145,7 +146,8 @@ signals:
/// @param channelCount The amount of channels in the output
/// @param sampleRate The used sample rate in Hz
/// @param modifiedAudio Pointer to bool if audio has been modified or not and should be played
- void audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool *modifiedAudio);
+ void audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool *modifiedAudio);
};
#endif
diff --git a/src/mumble/AudioOutputSpeech.cpp b/src/mumble/AudioOutputSpeech.cpp
index ee7426a1e..2903f57ad 100644
--- a/src/mumble/AudioOutputSpeech.cpp
+++ b/src/mumble/AudioOutputSpeech.cpp
@@ -335,7 +335,8 @@ bool AudioOutputSpeech::prepareSampleBuffer(unsigned int frameCount) {
QByteArray qba = qlFrames.takeFirst();
if (umtType == MessageHandler::UDPVoiceCELTAlpha || umtType == MessageHandler::UDPVoiceCELTBeta) {
- int wantversion = (umtType == MessageHandler::UDPVoiceCELTAlpha) ? Global::get().iCodecAlpha : Global::get().iCodecBeta;
+ int wantversion = (umtType == MessageHandler::UDPVoiceCELTAlpha) ? Global::get().iCodecAlpha
+ : Global::get().iCodecBeta;
if ((p == &LoopUser::lpLoopy) && (!Global::get().qmCodecs.isEmpty())) {
QMap< int, CELTCodec * >::const_iterator i = Global::get().qmCodecs.constEnd();
--i;
diff --git a/src/mumble/AudioWizard.cpp b/src/mumble/AudioWizard.cpp
index 885858b0a..494960ea7 100644
--- a/src/mumble/AudioWizard.cpp
+++ b/src/mumble/AudioWizard.cpp
@@ -10,9 +10,9 @@
#include "Log.h"
#include "MainWindow.h"
#include "Utils.h"
+#include "Global.h"
#include "GlobalShortcut.h"
#include "GlobalShortcutButtons.h"
-#include "Global.h"
#include <QtGui/QMouseEvent>
#include <QtWidgets/QGraphicsEllipseItem>
@@ -20,8 +20,8 @@
#include <cmath>
AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
- bInit = true;
- bLastActive = false;
+ bInit = true;
+ bLastActive = false;
Global::get().bInAudioWizard = true;
ticker = new QTimer(this);
@@ -170,7 +170,7 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
resize(700, 500);
updateTriggerWidgets(qrPTT->isChecked());
- sOldSettings = Global::get().s;
+ sOldSettings = Global::get().s;
Global::get().s.lmLoopMode = Settings::Local;
Global::get().s.dPacketLoss = 0.0;
Global::get().s.dMaxPacketDelay = 0.0;
@@ -318,7 +318,7 @@ void AudioWizard::showPage(int pageid) {
Global::get().s.bMute = true;
playChord();
} else if (cp == qwpPositional) {
- fX = fY = 0.0f;
+ fX = fY = 0.0f;
Global::get().s.bMute = true;
Global::get().bPosTest = true;
if (qgsScene) {
@@ -390,7 +390,7 @@ void AudioWizard::reject() {
AudioOutputPtr ao = Global::get().ao;
if (ao)
ao->wipe();
- aosSource = nullptr;
+ aosSource = nullptr;
Global::get().bInAudioWizard = false;
QWizard::reject();
@@ -646,15 +646,15 @@ void AudioWizard::on_qpbPTT_clicked() {
shortcuts << shortcut;
}
- Global::get().s.qlShortcuts = shortcuts;
+ Global::get().s.qlShortcuts = shortcuts;
GlobalShortcutEngine::engine->bNeedRemap = true;
GlobalShortcutEngine::engine->needRemap();
}
void AudioWizard::on_qcbEcho_clicked(bool on) {
if (on) {
- AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
- Global::get().s.echoOption = firstUsableEchoCancellation(air, qcbOutput->currentText());
+ AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
+ Global::get().s.echoOption = firstUsableEchoCancellation(air, qcbOutput->currentText());
} else {
Global::get().s.echoOption = EchoCancelOptionID::DISABLED;
}
diff --git a/src/mumble/ClientUser.cpp b/src/mumble/ClientUser.cpp
index 8a66cf496..dea92fe92 100644
--- a/src/mumble/ClientUser.cpp
+++ b/src/mumble/ClientUser.cpp
@@ -63,7 +63,8 @@ ClientUser *ClientUser::add(unsigned int uiSession, QObject *po) {
p->uiSession = uiSession;
c_qmUsers[uiSession] = p;
- QObject::connect(p, &ClientUser::talkingStateChanged, Global::get().pluginManager, &PluginManager::on_userTalkingStateChanged);
+ QObject::connect(p, &ClientUser::talkingStateChanged, Global::get().pluginManager,
+ &PluginManager::on_userTalkingStateChanged);
return p;
}
diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp
index 8649ec307..5abf4035f 100644
--- a/src/mumble/ConfigDialog.cpp
+++ b/src/mumble/ConfigDialog.cpp
@@ -13,8 +13,8 @@
#include <QtCore/QMutexLocker>
#include <QtGui/QScreen>
#include <QtWidgets/QDesktopWidget>
-#include <QtWidgets/QPushButton>
#include <QtWidgets/QMessageBox>
+#include <QtWidgets/QPushButton>
// init static member fields
@@ -74,8 +74,7 @@ ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) {
"changed.<br />"
"To restore all settings to their defaults, you can press the \"Defaults (All)\" button."));
- QPushButton *restoreAllButton =
- pageButtonBox->addButton(tr("Defaults (All)"), QDialogButtonBox::ResetRole);
+ QPushButton *restoreAllButton = pageButtonBox->addButton(tr("Defaults (All)"), QDialogButtonBox::ResetRole);
restoreAllButton->setToolTip(tr("Restore all defaults"));
restoreAllButton->setWhatsThis(tr("This button will restore the defaults for all settings."));
@@ -162,15 +161,14 @@ void ConfigDialog::on_pageButtonBox_clicked(QAbstractButton *b) {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
msgBox.setText(QObject::tr("Reset all settings?"));
- msgBox.setInformativeText(QObject::tr("Do you really want to reset all settings (not only the ones currently visible) to their default value?"));
+ msgBox.setInformativeText(QObject::tr("Do you really want to reset all settings (not only the ones "
+ "currently visible) to their default value?"));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
if (msgBox.exec() == QMessageBox::Yes) {
Settings defaultSetting;
- foreach (ConfigWidget *cw, qmWidgets) {
- cw->load(defaultSetting);
- }
+ foreach (ConfigWidget *cw, qmWidgets) { cw->load(defaultSetting); }
}
break;
}
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp
index 279c3b7b3..536e5c0ce 100644
--- a/src/mumble/ConnectDialog.cpp
+++ b/src/mumble/ConnectDialog.cpp
@@ -406,10 +406,10 @@ ServerItem *ServerItem::fromUrl(QUrl url, QWidget *p) {
if (url.userName().isEmpty()) {
if (Global::get().s.qsUsername.isEmpty()) {
bool ok;
- QString defUserName =
- QInputDialog::getText(p, ConnectDialog::tr("Adding host %1").arg(url.host()),
- ConnectDialog::tr("Enter username"), QLineEdit::Normal, Global::get().s.qsUsername, &ok)
- .trimmed();
+ QString defUserName = QInputDialog::getText(p, ConnectDialog::tr("Adding host %1").arg(url.host()),
+ ConnectDialog::tr("Enter username"), QLineEdit::Normal,
+ Global::get().s.qsUsername, &ok)
+ .trimmed();
if (!ok)
return nullptr;
if (defUserName.isEmpty())
diff --git a/src/mumble/CrashReporter.cpp b/src/mumble/CrashReporter.cpp
index 73e85d789..c12cbf28e 100644
--- a/src/mumble/CrashReporter.cpp
+++ b/src/mumble/CrashReporter.cpp
@@ -93,8 +93,9 @@ void CrashReporter::uploadFinished() {
}
} else {
QMessageBox::critical(nullptr, tr("Crash upload failed"),
- tr("Internal error encountered in CrashReporter.cpp: Received network reply does not contain an HTTP status code."
- " Please inform a developer about error code %1")
+ tr("Internal error encountered in CrashReporter.cpp: Received network reply does not "
+ "contain an HTTP status code."
+ " Please inform a developer about error code %1")
.arg(qnrReply->error()));
}
diff --git a/src/mumble/CustomElements.cpp b/src/mumble/CustomElements.cpp
index 9e51ae37e..caed34c53 100644
--- a/src/mumble/CustomElements.cpp
+++ b/src/mumble/CustomElements.cpp
@@ -181,7 +181,7 @@ bool ChatbarTextEdit::sendImagesFromMimeData(const QMimeData *source) {
if (Global::get().bAllowHTML) {
if (source->hasImage()) {
// Process the image pasted onto the chatbar.
- QImage image = qvariant_cast<QImage>(source->imageData());
+ QImage image = qvariant_cast< QImage >(source->imageData());
if (emitPastedImage(image)) {
return true;
} else {
@@ -191,7 +191,7 @@ bool ChatbarTextEdit::sendImagesFromMimeData(const QMimeData *source) {
} else if (source->hasUrls()) {
// Process the files dropped onto the chatbar. URLs here should be understood as the URIs of files.
- QList<QUrl> urlList = source->urls();
+ QList< QUrl > urlList = source->urls();
int count = 0;
for (int i = 0; i < urlList.size(); ++i) {
@@ -256,7 +256,8 @@ bool ChatbarTextEdit::event(QEvent *evt) {
} else if (kev->key() == Qt::Key_Down && kev->modifiers() == Qt::ControlModifier) {
historyDown();
return true;
- } else if (kev->key() == Qt::Key_V && (kev->modifiers() & Qt::ControlModifier) && (kev->modifiers() & Qt::ShiftModifier)) {
+ } else if (kev->key() == Qt::Key_V && (kev->modifiers() & Qt::ControlModifier)
+ && (kev->modifiers() & Qt::ShiftModifier)) {
pasteAndSend_triggered();
return true;
}
diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp
index 7f76fc917..7e21c5be9 100644
--- a/src/mumble/Database.cpp
+++ b/src/mumble/Database.cpp
@@ -209,7 +209,8 @@ Database::Database(const QString &dbname) {
execQueryAndLogFailure(query, QLatin1String("CREATE UNIQUE INDEX IF NOT EXISTS `volume_hash` ON `volume`(`hash`)"));
execQueryAndLogFailure(query, QLatin1String("CREATE TABLE IF NOT EXISTS `nicknames` (`id` INTEGER PRIMARY KEY "
"AUTOINCREMENT, `hash` TEXT, `nickname` TEXT)"));
- execQueryAndLogFailure(query, QLatin1String("CREATE UNIQUE INDEX IF NOT EXISTS `nicknames_hash` ON `nicknames`(`hash`)"));
+ execQueryAndLogFailure(query,
+ QLatin1String("CREATE UNIQUE INDEX IF NOT EXISTS `nicknames_hash` ON `nicknames`(`hash`)"));
// Note: A previous snapshot version created a table called 'hidden'
execQueryAndLogFailure(
diff --git a/src/mumble/Database.h b/src/mumble/Database.h
index 7de543405..5210d670e 100644
--- a/src/mumble/Database.h
+++ b/src/mumble/Database.h
@@ -53,7 +53,7 @@ public:
QString getUserLocalNickname(const QString &hash);
void setUserLocalNickname(const QString &hash, const QString &nickname);
-
+
bool isChannelFiltered(const QByteArray &server_cert_digest, const int channel_id);
void setChannelFiltered(const QByteArray &server_cert_digest, const int channel_id, bool hidden);
diff --git a/src/mumble/EchoCancelOption.h b/src/mumble/EchoCancelOption.h
index 8cb63cfc7..f556b0e70 100644
--- a/src/mumble/EchoCancelOption.h
+++ b/src/mumble/EchoCancelOption.h
@@ -13,10 +13,10 @@
/// Each audio backend will determine which option is indeed available to that backend and
/// to the specific device combination
enum class EchoCancelOptionID {
- DISABLED = 0,
- SPEEX_MIXED = 1,
- SPEEX_MULTICHANNEL = 2,
- APPLE_AEC = 3 // Apple's Acoustic Echo Cancellation support for macOS and iOS.
+ DISABLED = 0,
+ SPEEX_MIXED = 1,
+ SPEEX_MULTICHANNEL = 2,
+ APPLE_AEC = 3 // Apple's Acoustic Echo Cancellation support for macOS and iOS.
};
struct EchoCancelOption {
@@ -27,23 +27,19 @@ struct EchoCancelOption {
// Please strictly follow the order of the EchoCancelOptionID when adding items to this array.
static const EchoCancelOption echoCancelOptions[] = {
- { EchoCancelOptionID::DISABLED,
- QObject::tr("Disabled"),
- QObject::tr("Echo cancellation is disabled.") },
- { EchoCancelOptionID::SPEEX_MIXED,
- QObject::tr("Mixed echo cancellation (speex)"),
+ { EchoCancelOptionID::DISABLED, QObject::tr("Disabled"), QObject::tr("Echo cancellation is disabled.") },
+ { EchoCancelOptionID::SPEEX_MIXED, QObject::tr("Mixed echo cancellation (speex)"),
QObject::tr("Mixed has low CPU impact, but only works well if your "
- "speakers are equally loud and equidistant from the microphone.") },
- { EchoCancelOptionID::SPEEX_MULTICHANNEL,
- QObject::tr("Multichannel echo cancellation (speex)"),
+ "speakers are equally loud and equidistant from the microphone.") },
+ { EchoCancelOptionID::SPEEX_MULTICHANNEL, QObject::tr("Multichannel echo cancellation (speex)"),
QObject::tr("Multichannel echo cancellation provides much better echo "
- "cancellation, but at a higher CPU cost. "
- "Multichannel echo cancellation requires more CPU, so "
- "you should try mixed first.") },
+ "cancellation, but at a higher CPU cost. "
+ "Multichannel echo cancellation requires more CPU, so "
+ "you should try mixed first.") },
// Available only on Apple devices
- { EchoCancelOptionID::APPLE_AEC,
- QObject::tr("EXPERIMENTAL: Acoustic echo cancellation (Apple)."),
- QObject::tr("The support for this option is experimental only! This option works best when using built-in microphone and speaker.") }
+ { EchoCancelOptionID::APPLE_AEC, QObject::tr("EXPERIMENTAL: Acoustic echo cancellation (Apple)."),
+ QObject::tr("The support for this option is experimental only! This option works best when using built-in "
+ "microphone and speaker.") }
};
#endif // MUMBLE_ECHOCANCELLATIONOPTION_H
diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp
index 720a61a01..338be677e 100644
--- a/src/mumble/GlobalShortcut.cpp
+++ b/src/mumble/GlobalShortcut.cpp
@@ -10,8 +10,8 @@
#include "ClientUser.h"
#include "Database.h"
#include "MainWindow.h"
-#include "GlobalShortcutButtons.h"
#include "Global.h"
+#include "GlobalShortcutButtons.h"
#include <QtCore/QProcess>
#include <QtCore/QSortFilterProxyModel>
diff --git a/src/mumble/GlobalShortcut_win.cpp b/src/mumble/GlobalShortcut_win.cpp
index 20bed0ddc..f061ed046 100644
--- a/src/mumble/GlobalShortcut_win.cpp
+++ b/src/mumble/GlobalShortcut_win.cpp
@@ -131,7 +131,7 @@ GlobalShortcutWin::~GlobalShortcutWin() {
void GlobalShortcutWin::run() {
if (HAS_FAILED(DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8,
- reinterpret_cast< void ** >(&pDI), nullptr))) {
+ reinterpret_cast< void ** >(&pDI), nullptr))) {
qFatal("GlobalShortcutWin: Failed to create d8input");
return;
}
diff --git a/src/mumble/JackAudio.cpp b/src/mumble/JackAudio.cpp
index 4207ad329..5b19ffb59 100644
--- a/src/mumble/JackAudio.cpp
+++ b/src/mumble/JackAudio.cpp
@@ -392,7 +392,8 @@ bool JackAudioSystem::isOk() {
}
uint8_t JackAudioSystem::outPorts() {
- return static_cast< uint8_t >(qBound< unsigned >(1, Global::get().s.qsJackAudioOutput.toUInt(), JACK_MAX_OUTPUT_PORTS));
+ return static_cast< uint8_t >(
+ qBound< unsigned >(1, Global::get().s.qsJackAudioOutput.toUInt(), JACK_MAX_OUTPUT_PORTS));
}
jack_nframes_t JackAudioSystem::sampleRate() {
diff --git a/src/mumble/LCD.cpp b/src/mumble/LCD.cpp
index a2248f0fe..e6323a917 100644
--- a/src/mumble/LCD.cpp
+++ b/src/mumble/LCD.cpp
@@ -186,7 +186,8 @@ LCD::LCD() : QObject() {
connect(qtTimer, SIGNAL(timeout()), this, SLOT(tick()));
foreach (LCDDevice *d, devmgr.qlDevices) {
- bool enabled = Global::get().s.qmLCDDevices.contains(d->name()) ? Global::get().s.qmLCDDevices.value(d->name()) : true;
+ bool enabled =
+ Global::get().s.qmLCDDevices.contains(d->name()) ? Global::get().s.qmLCDDevices.value(d->name()) : true;
d->setEnabled(enabled);
}
qiLogo = QIcon(QLatin1String("skin:mumble.svg")).pixmap(48, 48).toImage().convertToFormat(QImage::Format_MonoLSB);
diff --git a/src/mumble/LegacyPlugin.cpp b/src/mumble/LegacyPlugin.cpp
index 420f3cf73..eaa4b5165 100644
--- a/src/mumble/LegacyPlugin.cpp
+++ b/src/mumble/LegacyPlugin.cpp
@@ -6,27 +6,24 @@
#include "LegacyPlugin.h"
#include "MumblePlugin_v_1_0_x.h"
+#include <codecvt>
#include <cstdlib>
-#include <wchar.h>
+#include <locale>
#include <map>
#include <string.h>
-#include <codecvt>
-#include <locale>
+#include <wchar.h>
#include <QRegularExpression>
/// A regular expression used to extract the version from the legacy plugin's description
-static const QRegularExpression versionRegEx(QString::fromLatin1("(?:v)?(?:ersion)?[ \\t]*(\\d+)\\.(\\d+)(?:\\.(\\d+))?"), QRegularExpression::CaseInsensitiveOption);
+static const QRegularExpression
+ versionRegEx(QString::fromLatin1("(?:v)?(?:ersion)?[ \\t]*(\\d+)\\.(\\d+)(?:\\.(\\d+))?"),
+ QRegularExpression::CaseInsensitiveOption);
LegacyPlugin::LegacyPlugin(QString path, bool isBuiltIn, QObject *p)
- : Plugin(path, isBuiltIn, p),
- m_name(),
- m_description(),
- m_version(VERSION_UNKNOWN),
- m_mumPlug(0),
- m_mumPlug2(0),
+ : Plugin(path, isBuiltIn, p), m_name(), m_description(), m_version(VERSION_UNKNOWN), m_mumPlug(0), m_mumPlug2(0),
m_mumPlugQt(0) {
}
@@ -37,19 +34,19 @@ bool LegacyPlugin::doInitialize() {
if (Plugin::doInitialize()) {
// initialization seems to have succeeded so far
// This means that mumPlug is initialized
-
+
m_name = QString::fromStdWString(m_mumPlug->shortname);
// Although the MumblePlugin struct has a member called "description", the actual description seems to
- // always only be returned by the longdesc function (The description member is actually just the name with some version
- // info)
+ // always only be returned by the longdesc function (The description member is actually just the name with some
+ // version info)
m_description = QString::fromStdWString(m_mumPlug->longdesc());
// The version field in the MumblePlugin2 struct is the positional-audio-plugin-API version and not the version
// of the plugin itself. This information is not provided for legacy plugins.
- // Most of them however provide information about the version of the game they support. Thus we will try to parse the
- // description and extract this version using it for the plugin's version as well.
- // Some plugins have the version in the actual description field of the old API (see above comment why these aren't the same)
- // so we will use a combination of both to search for the version. If multiple version(-like) strings are found, the last one
- // will be used.
+ // Most of them however provide information about the version of the game they support. Thus we will try to
+ // parse the description and extract this version using it for the plugin's version as well. Some plugins have
+ // the version in the actual description field of the old API (see above comment why these aren't the same) so
+ // we will use a combination of both to search for the version. If multiple version(-like) strings are found,
+ // the last one will be used.
QString matchContent = m_description + QChar::Null + QString::fromStdWString(m_mumPlug->description);
QRegularExpressionMatchIterator matchIt = versionRegEx.globalMatch(matchContent);
@@ -61,7 +58,7 @@ bool LegacyPlugin::doInitialize() {
if (match.hasMatch()) {
// Store version
- m_version = { match.captured(1).toInt(), match.captured(2).toInt(), match.captured(3).toInt() };
+ m_version = { match.captured(1).toInt(), match.captured(2).toInt(), match.captured(3).toInt() };
}
return true;
@@ -84,9 +81,9 @@ void LegacyPlugin::resolveFunctionPointers() {
QWriteLocker lock(&m_pluginLock);
- mumblePluginFunc pluginFunc = reinterpret_cast<mumblePluginFunc>(m_lib.resolve("getMumblePlugin"));
- mumblePlugin2Func plugin2Func = reinterpret_cast<mumblePlugin2Func>(m_lib.resolve("getMumblePlugin2"));
- mumblePluginQtFunc pluginQtFunc = reinterpret_cast<mumblePluginQtFunc>(m_lib.resolve("getMumblePluginQt"));
+ mumblePluginFunc pluginFunc = reinterpret_cast< mumblePluginFunc >(m_lib.resolve("getMumblePlugin"));
+ mumblePlugin2Func plugin2Func = reinterpret_cast< mumblePlugin2Func >(m_lib.resolve("getMumblePlugin2"));
+ mumblePluginQtFunc pluginQtFunc = reinterpret_cast< mumblePluginQtFunc >(m_lib.resolve("getMumblePluginQt"));
if (pluginFunc) {
m_mumPlug = pluginFunc();
@@ -102,15 +99,16 @@ void LegacyPlugin::resolveFunctionPointers() {
// and the plugin has been compiled by the same compiler as this client (determined by the plugin's
// "magic") and it isn't retracted
bool suitableMagic = m_mumPlug && m_mumPlug->magic == MUMBLE_PLUGIN_MAGIC;
- bool retracted = m_mumPlug && m_mumPlug->shortname == L"Retracted";
- m_pluginIsValid = pluginFunc && suitableMagic && !retracted;
+ bool retracted = m_mumPlug && m_mumPlug->shortname == L"Retracted";
+ m_pluginIsValid = pluginFunc && suitableMagic && !retracted;
#ifdef MUMBLE_PLUGIN_DEBUG
if (!m_pluginIsValid) {
if (!pluginFunc) {
qDebug("Plugin \"%s\" is missing the getMumblePlugin() function", qPrintable(m_pluginPath));
} else if (!suitableMagic) {
- qDebug("Plugin \"%s\" was compiled with a different compiler (magic differs)", qPrintable(m_pluginPath));
+ qDebug("Plugin \"%s\" was compiled with a different compiler (magic differs)",
+ qPrintable(m_pluginPath));
} else {
qDebug("Plugin \"%s\" is retracted", qPrintable(m_pluginPath));
}
@@ -138,7 +136,7 @@ QString LegacyPlugin::getName() const {
return m_name;
} else {
return QString::fromLatin1("<Unknown Legacy Plugin>");
- }
+ }
}
QString LegacyPlugin::getDescription() const {
@@ -185,18 +183,20 @@ bool LegacyPlugin::showConfigDialog(QWidget *parent) const {
return false;
}
-uint8_t LegacyPlugin::initPositionalData(const char *const*programNames, const uint64_t *programPIDs, size_t programCount) {
+uint8_t LegacyPlugin::initPositionalData(const char *const *programNames, const uint64_t *programPIDs,
+ size_t programCount) {
int retCode;
if (m_mumPlug2) {
// Create and populate a multimap holding the names and PIDs to pass to the tryLock-function
- std::multimap<std::wstring, unsigned long long int> pidMap;
+ std::multimap< std::wstring, unsigned long long int > pidMap;
- for (size_t i=0; i<programCount; i++) {
+ for (size_t i = 0; i < programCount; i++) {
std::string currentName = programNames[i];
- std::wstring currentNameWstr = std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(currentName);
+ std::wstring currentNameWstr =
+ std::wstring_convert< std::codecvt_utf8< wchar_t > >().from_bytes(currentName);
- pidMap.insert(std::pair<std::wstring, unsigned long long int>(currentNameWstr, programPIDs[i]));
+ pidMap.insert(std::pair< std::wstring, unsigned long long int >(currentNameWstr, programPIDs[i]));
}
retCode = m_mumPlug2->trylock(pidMap);
@@ -220,15 +220,18 @@ uint8_t LegacyPlugin::initPositionalData(const char *const*programNames, const u
}
}
-bool LegacyPlugin::fetchPositionalData(Position3D& avatarPos, Vector3D& avatarDir, Vector3D& avatarAxis, Position3D& cameraPos, Vector3D& cameraDir,
- Vector3D& cameraAxis, QString& context, QString& identity) const {
+bool LegacyPlugin::fetchPositionalData(Position3D &avatarPos, Vector3D &avatarDir, Vector3D &avatarAxis,
+ Position3D &cameraPos, Vector3D &cameraDir, Vector3D &cameraAxis,
+ QString &context, QString &identity) const {
std::wstring identityWstr;
std::string contextStr;
- int retCode = m_mumPlug->fetch(static_cast<float*>(avatarPos), static_cast<float*>(avatarDir), static_cast<float*>(avatarAxis),
- static_cast<float*>(cameraPos), static_cast<float*>(cameraDir), static_cast<float*>(cameraAxis), contextStr, identityWstr);
+ int retCode = m_mumPlug->fetch(static_cast< float * >(avatarPos), static_cast< float * >(avatarDir),
+ static_cast< float * >(avatarAxis), static_cast< float * >(cameraPos),
+ static_cast< float * >(cameraDir), static_cast< float * >(cameraAxis), contextStr,
+ identityWstr);
- context = QString::fromStdString(contextStr);
+ context = QString::fromStdString(contextStr);
identity = QString::fromStdWString(identityWstr);
// The fetch-function should return if it is "still locked on" meaning that it can continue providing
diff --git a/src/mumble/LegacyPlugin.h b/src/mumble/LegacyPlugin.h
index 250b624a0..8dd163c9b 100644
--- a/src/mumble/LegacyPlugin.h
+++ b/src/mumble/LegacyPlugin.h
@@ -10,8 +10,8 @@
#include <QtCore/QString>
-#include <string>
#include <memory>
+#include <string>
#define MUMBLE_ALLOW_DEPRECATED_LEGACY_PLUGIN_API
#include "mumble_legacy_plugin.h"
@@ -19,64 +19,67 @@
class LegacyPlugin;
/// Typedef for a LegacyPlugin pointer
-typedef std::shared_ptr<LegacyPlugin> legacy_plugin_ptr_t;
+typedef std::shared_ptr< LegacyPlugin > legacy_plugin_ptr_t;
/// Typedef for a const LegacyPlugin pointer
-typedef std::shared_ptr<const LegacyPlugin> const_legacy_plugin_ptr_t;
+typedef std::shared_ptr< const LegacyPlugin > const_legacy_plugin_ptr_t;
/// This class is meant for compatibility for old Mumble "plugins" that stem from before the plugin framework has been
/// introduced. Thus the "plugins" represented by this class are for positional data gathering only.
class LegacyPlugin : public Plugin {
friend class Plugin; // needed in order for Plugin::createNew to access LegacyPlugin::doInitialize()
- private:
- Q_OBJECT
- Q_DISABLE_COPY(LegacyPlugin)
-
- protected:
- /// The name of the "plugin"
- QString m_name;
- /// The description of the "plugin"
- QString m_description;
- /// The Version of the "plugin"
- mumble_version_t m_version;
- /// A pointer to the PluginStruct in its initial version. After initialization this
- /// field is effectively const and therefore it is not needed to protect read-access by a lock.
- MumblePlugin *m_mumPlug;
- /// A pointer to the PluginStruct in its second, enhanced version. After initialization this
- /// field is effectively const and therefore it is not needed to protect read-access by a lock.
- MumblePlugin2 *m_mumPlug2;
- /// A pointer to the PluginStruct that encorporates Qt functionality. After initialization this
- /// field is effectively const and therefore it is not needed to protect read-access by a lock.
- MumblePluginQt *m_mumPlugQt;
-
- virtual void resolveFunctionPointers() override;
- virtual bool doInitialize() override;
-
- LegacyPlugin(QString path, bool isBuiltIn = false, QObject *p = 0);
-
- virtual bool showAboutDialog(QWidget *parent) const override;
- virtual bool showConfigDialog(QWidget *parent) const override;
- virtual uint8_t initPositionalData(const char *const*programNames, const uint64_t *programPIDs, size_t programCount) override;
- virtual bool fetchPositionalData(Position3D& avatarPos, Vector3D& avatarDir, Vector3D& avatarAxis, Position3D& cameraPos, Vector3D& cameraDir,
- Vector3D& cameraAxis, QString& context, QString& identity) const override;
- virtual void shutdownPositionalData() override;
- public:
- virtual ~LegacyPlugin() override;
-
- virtual mumble_error_t init() override;
-
- // functions for direct plugin-interaction
- virtual QString getName() const override;
-
- virtual QString getDescription() const override;
- virtual uint32_t getFeatures() const override;
- virtual mumble_version_t getAPIVersion() const override;
-
- virtual mumble_version_t getVersion() const override;
-
- // functions for checking which underlying plugin functions are implemented
- virtual bool providesAboutDialog() const override;
- virtual bool providesConfigDialog() const override;
+private:
+ Q_OBJECT
+ Q_DISABLE_COPY(LegacyPlugin)
+
+protected:
+ /// The name of the "plugin"
+ QString m_name;
+ /// The description of the "plugin"
+ QString m_description;
+ /// The Version of the "plugin"
+ mumble_version_t m_version;
+ /// A pointer to the PluginStruct in its initial version. After initialization this
+ /// field is effectively const and therefore it is not needed to protect read-access by a lock.
+ MumblePlugin *m_mumPlug;
+ /// A pointer to the PluginStruct in its second, enhanced version. After initialization this
+ /// field is effectively const and therefore it is not needed to protect read-access by a lock.
+ MumblePlugin2 *m_mumPlug2;
+ /// A pointer to the PluginStruct that encorporates Qt functionality. After initialization this
+ /// field is effectively const and therefore it is not needed to protect read-access by a lock.
+ MumblePluginQt *m_mumPlugQt;
+
+ virtual void resolveFunctionPointers() override;
+ virtual bool doInitialize() override;
+
+ LegacyPlugin(QString path, bool isBuiltIn = false, QObject *p = 0);
+
+ virtual bool showAboutDialog(QWidget *parent) const override;
+ virtual bool showConfigDialog(QWidget *parent) const override;
+ virtual uint8_t initPositionalData(const char *const *programNames, const uint64_t *programPIDs,
+ size_t programCount) override;
+ virtual bool fetchPositionalData(Position3D &avatarPos, Vector3D &avatarDir, Vector3D &avatarAxis,
+ Position3D &cameraPos, Vector3D &cameraDir, Vector3D &cameraAxis, QString &context,
+ QString &identity) const override;
+ virtual void shutdownPositionalData() override;
+
+public:
+ virtual ~LegacyPlugin() override;
+
+ virtual mumble_error_t init() override;
+
+ // functions for direct plugin-interaction
+ virtual QString getName() const override;
+
+ virtual QString getDescription() const override;
+ virtual uint32_t getFeatures() const override;
+ virtual mumble_version_t getAPIVersion() const override;
+
+ virtual mumble_version_t getVersion() const override;
+
+ // functions for checking which underlying plugin functions are implemented
+ virtual bool providesAboutDialog() const override;
+ virtual bool providesConfigDialog() const override;
};
#endif
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp
index 5a2b14edc..2f3e05562 100644
--- a/src/mumble/Log.cpp
+++ b/src/mumble/Log.cpp
@@ -334,7 +334,7 @@ QVector< LogMessage > Log::qvDeferredLogs;
Log::Log(QObject *p) : QObject(p) {
- qRegisterMetaType<Log::MsgType>();
+ qRegisterMetaType< Log::MsgType >();
#ifndef USE_NO_TTS
tts = new TextToSpeech(this);
@@ -687,7 +687,8 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
tc.insertBlock();
}
- const QString timeString = dt.time().toString(QLatin1String(Global::get().s.bLog24HourClock ? "HH:mm:ss" : "hh:mm:ss AP"));
+ const QString timeString =
+ dt.time().toString(QLatin1String(Global::get().s.bLog24HourClock ? "HH:mm:ss" : "hh:mm:ss AP"));
tc.insertHtml(Log::msgColor(QString::fromLatin1("[%1] ").arg(timeString.toHtmlEscaped()), Log::Time));
validHtml(console, &tc);
diff --git a/src/mumble/LookConfig.cpp b/src/mumble/LookConfig.cpp
index 53afa73ae..1683f0e4f 100644
--- a/src/mumble/LookConfig.cpp
+++ b/src/mumble/LookConfig.cpp
@@ -271,7 +271,8 @@ void LookConfig::save() const {
}
void LookConfig::accept() const {
- Global::get().mw->setShowDockTitleBars((Global::get().s.wlWindowLayout == Settings::LayoutCustom) && !Global::get().s.bLockLayout);
+ Global::get().mw->setShowDockTitleBars((Global::get().s.wlWindowLayout == Settings::LayoutCustom)
+ && !Global::get().s.bLockLayout);
}
void LookConfig::themeDirectoryChanged() {
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index f2718f0a3..d4698d00d 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -33,8 +33,8 @@
#include "ChannelListener.h"
#include "ListenerLocalVolumeDialog.h"
#include "Markdown.h"
-#include "PluginManager.h"
#include "PTTButtonWidget.h"
+#include "PluginManager.h"
#include "RichTextEditor.h"
#include "SSLCipherInfo.h"
#include "Screen.h"
@@ -186,7 +186,8 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
|| (Global::get().s.bMinimalView && Global::get().s.aotbAlwaysOnTop == Settings::OnTopInMinimal)
|| (!Global::get().s.bMinimalView && Global::get().s.aotbAlwaysOnTop == Settings::OnTopInNormal));
- QObject::connect(this, &MainWindow::serverSynchronized, Global::get().pluginManager, &PluginManager::on_serverSynchronized);
+ QObject::connect(this, &MainWindow::serverSynchronized, Global::get().pluginManager,
+ &PluginManager::on_serverSynchronized);
}
void MainWindow::createActions() {
@@ -318,14 +319,16 @@ void MainWindow::setupGui() {
this, &MainWindow::userRemovedChannelListener, pmModel,
static_cast< void (UserModel::*)(const ClientUser *, const Channel *) >(&UserModel::removeChannelListener));
QObject::connect(&ChannelListener::get(), &ChannelListener::localVolumeAdjustmentsChanged, pmModel,
- &UserModel::on_channelListenerLocalVolumeAdjustmentChanged);
+ &UserModel::on_channelListenerLocalVolumeAdjustmentChanged);
// connect slots to PluginManager
QObject::connect(pmModel, &UserModel::userAdded, Global::get().pluginManager, &PluginManager::on_userAdded);
QObject::connect(pmModel, &UserModel::userRemoved, Global::get().pluginManager, &PluginManager::on_userRemoved);
QObject::connect(pmModel, &UserModel::channelAdded, Global::get().pluginManager, &PluginManager::on_channelAdded);
- QObject::connect(pmModel, &UserModel::channelRemoved, Global::get().pluginManager, &PluginManager::on_channelRemoved);
- QObject::connect(pmModel, &UserModel::channelRenamed, Global::get().pluginManager, &PluginManager::on_channelRenamed);
+ QObject::connect(pmModel, &UserModel::channelRemoved, Global::get().pluginManager,
+ &PluginManager::on_channelRemoved);
+ QObject::connect(pmModel, &UserModel::channelRenamed, Global::get().pluginManager,
+ &PluginManager::on_channelRenamed);
qaAudioMute->setChecked(Global::get().s.bMute);
qaAudioDeaf->setChecked(Global::get().s.bDeaf);
@@ -758,7 +761,7 @@ void MainWindow::on_qtvUsers_customContextMenuRequested(const QPoint &mpos, bool
qtvUsers->setCurrentIndex(idx);
}
- ClientUser *p = pmModel->getUser(idx);
+ ClientUser *p = pmModel->getUser(idx);
Channel *channel = pmModel->getChannel(idx);
qpContextPosition = mpos;
@@ -906,25 +909,27 @@ static void recreateServerHandler() {
Global::get().sh = sh;
Global::get().mw->connect(sh.get(), SIGNAL(connected()), Global::get().mw, SLOT(serverConnected()));
Global::get().mw->connect(sh.get(), SIGNAL(disconnected(QAbstractSocket::SocketError, QString)), Global::get().mw,
- SLOT(serverDisconnected(QAbstractSocket::SocketError, QString)));
+ SLOT(serverDisconnected(QAbstractSocket::SocketError, QString)));
Global::get().mw->connect(sh.get(), SIGNAL(error(QAbstractSocket::SocketError, QString)), Global::get().mw,
- SLOT(resolverError(QAbstractSocket::SocketError, QString)));
+ SLOT(resolverError(QAbstractSocket::SocketError, QString)));
- QObject::connect(sh.get(), &ServerHandler::disconnected, Global::get().talkingUI, &TalkingUI::on_serverDisconnected);
+ QObject::connect(sh.get(), &ServerHandler::disconnected, Global::get().talkingUI,
+ &TalkingUI::on_serverDisconnected);
// We have to use direct connections for these here as the PluginManager must be able to access the connection's ID
// and in order for that to be possible the (dis)connection process must not proceed in the background.
Global::get().pluginManager->connect(sh.get(), &ServerHandler::connected, Global::get().pluginManager,
- &PluginManager::on_serverConnected, Qt::DirectConnection);
+ &PluginManager::on_serverConnected, Qt::DirectConnection);
// We connect the plugin manager to "aboutToDisconnect" instead of "disconnect" in order for the slot to be
// guaranteed to be completed *before* the acutal disconnect logic (e.g. MainWindow::serverDisconnected) kicks in.
// In order for that to work it is ESSENTIAL to use a DIRECT CONNECTION!
Global::get().pluginManager->connect(sh.get(), &ServerHandler::aboutToDisconnect, Global::get().pluginManager,
- &PluginManager::on_serverDisconnected, Qt::DirectConnection);
+ &PluginManager::on_serverDisconnected, Qt::DirectConnection);
}
void MainWindow::openUrl(const QUrl &url) {
- Global::get().l->log(Log::Information, tr("Opening URL %1").arg(url.toString(QUrl::RemovePassword).toHtmlEscaped()));
+ Global::get().l->log(Log::Information,
+ tr("Opening URL %1").arg(url.toString(QUrl::RemovePassword).toHtmlEscaped()));
if (url.scheme() == QLatin1String("file")) {
QFile f(url.toLocalFile());
if (!f.exists() || !f.open(QIODevice::ReadOnly)) {
@@ -966,26 +971,27 @@ void MainWindow::openUrl(const QUrl &url) {
if (version.size() > 0) {
if (!MumbleVersion::get(&major, &minor, &patch, version)) {
// The version format is invalid
- Global::get().l->log(Log::Warning, QObject::tr("The provided URL uses an invalid version format: \"%1\"").arg(version));
+ Global::get().l->log(Log::Warning,
+ QObject::tr("The provided URL uses an invalid version format: \"%1\"").arg(version));
return;
}
}
// We can't handle URLs for versions < 1.2.0
- const int minMajor = 1;
- const int minMinor = 2;
- const int minPatch = 0;
+ const int minMajor = 1;
+ const int minMinor = 2;
+ const int minPatch = 0;
const bool isPre_120 = major < minMajor || (major == minMajor && minor < minMinor)
- || (major == minMajor && minor == minMinor && patch < minPatch);
+ || (major == minMajor && minor == minMinor && patch < minPatch);
// We also can't handle URLs for versions newer than the running Mumble instance
- const bool isFuture = major > thismajor || (major == thismajor && minor > thisminor)
- || (major == thismajor && minor == thisminor && patch > thispatch);
+ const bool isFuture = major > thismajor || (major == thismajor && minor > thisminor)
+ || (major == thismajor && minor == thisminor && patch > thispatch);
if (isPre_120 || isFuture) {
Global::get().l->log(Log::Warning, tr("This version of Mumble can't handle URLs for Mumble version %1.%2.%3")
- .arg(major)
- .arg(minor)
- .arg(patch));
+ .arg(major)
+ .arg(minor)
+ .arg(patch));
return;
}
@@ -1029,10 +1035,11 @@ void MainWindow::openUrl(const QUrl &url) {
recreateServerHandler();
Global::get().s.qsLastServer = name;
- rtLast = MumbleProto::Reject_RejectType_None;
- bRetryServer = true;
+ rtLast = MumbleProto::Reject_RejectType_None;
+ bRetryServer = true;
qaServerDisconnect->setEnabled(true);
- Global::get().l->log(Log::Information, tr("Connecting to server %1.").arg(Log::msgColor(host.toHtmlEscaped(), Log::Server)));
+ Global::get().l->log(Log::Information,
+ tr("Connecting to server %1.").arg(Log::msgColor(host.toHtmlEscaped(), Log::Server)));
Global::get().sh->setConnectionInfo(host, port, user, pw);
Global::get().sh->start(QThread::TimeCriticalPriority);
}
@@ -1254,8 +1261,9 @@ void MainWindow::on_qaServerConnect_triggered(bool autoconnect) {
rtLast = MumbleProto::Reject_RejectType_None;
bRetryServer = true;
qaServerDisconnect->setEnabled(true);
- Global::get().l->log(Log::Information,
- tr("Connecting to server %1.").arg(Log::msgColor(cd->qsServer.toHtmlEscaped(), Log::Server)));
+ Global::get().l->log(
+ Log::Information,
+ tr("Connecting to server %1.").arg(Log::msgColor(cd->qsServer.toHtmlEscaped(), Log::Server)));
Global::get().sh->setConnectionInfo(cd->qsServer, cd->usPort, cd->qsUsername, cd->qsPassword);
Global::get().sh->start(QThread::TimeCriticalPriority);
}
@@ -1585,10 +1593,12 @@ void MainWindow::qmUser_aboutToShow() {
qaUserTextureReset->setEnabled(!p->qbaTextureHash.isEmpty()
&& (Global::get().pPermissions & (ChanACL::Move | ChanACL::Write)));
} else {
- qaUserCommentReset->setEnabled(!p->qbaCommentHash.isEmpty()
- && (Global::get().pPermissions & (ChanACL::ResetUserContent | ChanACL::Write)));
- qaUserTextureReset->setEnabled(!p->qbaTextureHash.isEmpty()
- && (Global::get().pPermissions & (ChanACL::ResetUserContent | ChanACL::Write)));
+ qaUserCommentReset->setEnabled(
+ !p->qbaCommentHash.isEmpty()
+ && (Global::get().pPermissions & (ChanACL::ResetUserContent | ChanACL::Write)));
+ qaUserTextureReset->setEnabled(
+ !p->qbaTextureHash.isEmpty()
+ && (Global::get().pPermissions & (ChanACL::ResetUserContent | ChanACL::Write)));
}
qaUserCommentView->setEnabled(!p->qbaCommentHash.isEmpty());
@@ -1868,8 +1878,9 @@ void MainWindow::openTextMessageDialog(ClientUser *p) {
if (!msg.isEmpty()) {
Global::get().sh->sendUserTextMessage(p->uiSession, msg);
- Global::get().l->log(Log::TextMessage, tr("To %1: %2").arg(Log::formatClientUser(p, Log::Target), texm->message()),
- tr("Message to %1").arg(p->qsName), true);
+ Global::get().l->log(Log::TextMessage,
+ tr("To %1: %2").arg(Log::formatClientUser(p, Log::Target), texm->message()),
+ tr("Message to %1").arg(p->qsName), true);
}
}
delete texm;
@@ -1995,12 +2006,12 @@ void MainWindow::sendChatbarMessage(QString qsMessage) {
Global::get().sh->sendChannelTextMessage(c->iId, qsMessage, false);
Global::get().l->log(Log::TextMessage, tr("To %1: %2").arg(Log::formatChannel(c), qsMessage),
- tr("Message to channel %1").arg(c->qsName), true);
+ tr("Message to channel %1").arg(c->qsName), true);
} else {
// User message
Global::get().sh->sendUserTextMessage(p->uiSession, qsMessage);
Global::get().l->log(Log::TextMessage, tr("To %1: %2").arg(Log::formatClientUser(p, Log::Target), qsMessage),
- tr("Message to %1").arg(p->qsName), true);
+ tr("Message to %1").arg(p->qsName), true);
}
}
@@ -2305,10 +2316,10 @@ void MainWindow::on_qaChannelSendMessage_triggered() {
if (texm->bTreeMessage)
Global::get().l->log(Log::TextMessage, tr("To %1 (Tree): %2").arg(Log::formatChannel(c), texm->message()),
- tr("Message to tree %1").arg(c->qsName), true);
+ tr("Message to tree %1").arg(c->qsName), true);
else
Global::get().l->log(Log::TextMessage, tr("To %1: %2").arg(Log::formatChannel(c), texm->message()),
- tr("Message to channel %1").arg(c->qsName), true);
+ tr("Message to channel %1").arg(c->qsName), true);
}
delete texm;
}
@@ -2458,7 +2469,8 @@ void MainWindow::userStateChanged() {
case Settings::Shouting:
Global::get().bAttenuateOthers = Global::get().s.bAttenuateOthersOnTalk;
- Global::get().prioritySpeakerActiveOverride = Global::get().s.bAttenuateUsersOnPrioritySpeak && user->bPrioritySpeaker;
+ Global::get().prioritySpeakerActiveOverride =
+ Global::get().s.bAttenuateUsersOnPrioritySpeak && user->bPrioritySpeaker;
break;
case Settings::Passive:
@@ -2536,8 +2548,8 @@ void MainWindow::on_qaAudioDeaf_triggered() {
Global::get().s.bDeaf = qaAudioDeaf->isChecked();
if (Global::get().s.bDeaf && !Global::get().s.bMute) {
- bAutoUnmute = true;
- Global::get().s.bMute = true;
+ bAutoUnmute = true;
+ Global::get().s.bMute = true;
qaAudioMute->setChecked(true);
Global::get().l->log(Log::SelfDeaf, tr("Muted and deafened."));
} else if (Global::get().s.bDeaf) {
@@ -3028,7 +3040,7 @@ void MainWindow::on_gsSendTextMessage_triggered(bool down, QVariant scdata) {
Channel *c = ClientUser::get(Global::get().uiSession)->cChannel;
Global::get().sh->sendChannelTextMessage(c->iId, qsText, false);
Global::get().l->log(Log::TextMessage, tr("To %1: %2").arg(Log::formatChannel(c), qsText),
- tr("Message to channel %1").arg(c->qsName), true);
+ tr("Message to channel %1").arg(c->qsName), true);
}
void MainWindow::on_gsSendClipboardTextMessage_triggered(bool down, QVariant) {
@@ -3053,8 +3065,7 @@ void MainWindow::whisperReleased(QVariant scdata) {
updateTarget();
}
-void MainWindow::onResetAudio()
-{
+void MainWindow::onResetAudio() {
qWarning("MainWindow: Start audio reset");
Audio::stop();
Audio::start();
@@ -3260,7 +3271,8 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
vc.exec();
continue;
} else if (res == QMessageBox::Yes) {
- Global::get().db->setDigest(host, port, QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex()));
+ Global::get().db->setDigest(host, port,
+ QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex()));
qaServerDisconnect->setEnabled(true);
on_Reconnect_timeout();
}
@@ -3277,7 +3289,8 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
if (!reason.isEmpty()) {
- Global::get().l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(reason.toHtmlEscaped()));
+ Global::get().l->log(Log::ServerDisconnected,
+ tr("Server connection failed: %1.").arg(reason.toHtmlEscaped()));
} else {
Global::get().l->log(Log::ServerDisconnected, tr("Disconnected from server."));
}
@@ -3587,11 +3600,12 @@ QPair< QByteArray, QImage > MainWindow::openImageFile() {
}
void MainWindow::logChangeNotPermanent(const QString &actionName, ClientUser *const p) const {
- Global::get().l->log(Log::Warning,
- QObject::tr(
- "\"%1\" could not be saved permanently and is lost on restart because %2 does not have a certificate.")
- .arg(actionName)
- .arg(Log::formatClientUser(p, Log::Target)));
+ Global::get().l->log(
+ Log::Warning,
+ QObject::tr(
+ "\"%1\" could not be saved permanently and is lost on restart because %2 does not have a certificate.")
+ .arg(actionName)
+ .arg(Log::formatClientUser(p, Log::Target)));
}
void MainWindow::destroyUserInformation() {
diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h
index 20c8a3000..f29064831 100644
--- a/src/mumble/MainWindow.h
+++ b/src/mumble/MainWindow.h
@@ -17,8 +17,8 @@
#include "Message.h"
#include "Mumble.pb.h"
#include "Usage.h"
-#include "UserLocalVolumeDialog.h"
#include "UserLocalNicknameDialog.h"
+#include "UserLocalVolumeDialog.h"
#include "ui_MainWindow.h"
@@ -81,7 +81,8 @@ public:
GlobalShortcut *gsToggleOverlay;
#endif
GlobalShortcut *gsMinimal, *gsVolumeUp, *gsVolumeDown, *gsWhisper, *gsLinkChannel;
- GlobalShortcut *gsCycleTransmitMode, *gsToggleMainWindowVisibility, *gsTransmitModePushToTalk, *gsTransmitModeContinuous, *gsTransmitModeVAD;
+ GlobalShortcut *gsCycleTransmitMode, *gsToggleMainWindowVisibility, *gsTransmitModePushToTalk,
+ *gsTransmitModeContinuous, *gsTransmitModeVAD;
GlobalShortcut *gsSendTextMessage, *gsSendClipboardTextMessage;
DockTitleBar *dtbLogDockTitle, *dtbChatDockTitle;
diff --git a/src/mumble/ManualPlugin.cpp b/src/mumble/ManualPlugin.cpp
index e4ea84336..b90aefe9f 100644
--- a/src/mumble/ManualPlugin.cpp
+++ b/src/mumble/ManualPlugin.cpp
@@ -13,8 +13,8 @@
#include <QPointer>
-#include <float.h>
#include <cmath>
+#include <float.h>
#define MUMBLE_ALLOW_DEPRECATED_LEGACY_PLUGIN_API
#include "../../plugins/mumble_legacy_plugin.h"
@@ -136,7 +136,7 @@ void Manual::on_qpbActivated_clicked(bool b) {
}
void Manual::on_qdsbX_valueChanged(double d) {
- my.avatar_pos[0] = my.camera_pos[0] = static_cast<float>(d);
+ my.avatar_pos[0] = my.camera_pos[0] = static_cast< float >(d);
m_qgiPosition->setPos(my.avatar_pos[0], -my.avatar_pos[2]);
}
@@ -145,7 +145,7 @@ void Manual::on_qdsbY_valueChanged(double d) {
}
void Manual::on_qdsbZ_valueChanged(double d) {
- my.avatar_pos[2] = my.camera_pos[2] = static_cast<float>(d);
+ my.avatar_pos[2] = my.camera_pos[2] = static_cast< float >(d);
m_qgiPosition->setPos(my.avatar_pos[0], -my.avatar_pos[2]);
}
@@ -265,7 +265,7 @@ void Manual::on_speakerPositionUpdate(QHash< unsigned int, Position2D > position
const float speakerRadius = 1.2;
QGraphicsItem *speakerItem = m_qgsScene->addEllipse(-speakerRadius, -speakerRadius, 2 * speakerRadius,
- 2 * speakerRadius, QPen(), QBrush(Qt::red));
+ 2 * speakerRadius, QPen(), QBrush(Qt::red));
Position2D pos = remainingIt.value();
@@ -427,6 +427,6 @@ ManualPlugin::~ManualPlugin() {
}
void ManualPlugin::resolveFunctionPointers() {
- m_mumPlug = &manual;
+ m_mumPlug = &manual;
m_mumPlugQt = &manualqt;
}
diff --git a/src/mumble/ManualPlugin.h b/src/mumble/ManualPlugin.h
index dbeee0d31..64a36f615 100644
--- a/src/mumble/ManualPlugin.h
+++ b/src/mumble/ManualPlugin.h
@@ -11,8 +11,8 @@
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsScene>
-#include "ui_ManualPlugin.h"
#include "LegacyPlugin.h"
+#include "ui_ManualPlugin.h"
#include <atomic>
#include <chrono>
@@ -86,16 +86,16 @@ MumblePluginQt *ManualPlugin_getMumblePluginQt();
/// A built-in "plugin" for positional data gatherig allowing for manually placing the "players" in a UI
class ManualPlugin : public LegacyPlugin {
friend class Plugin; // needed in order for Plugin::createNew to access LegacyPlugin::doInitialize()
- private:
- Q_OBJECT
- Q_DISABLE_COPY(ManualPlugin)
-
- protected:
- virtual void resolveFunctionPointers() Q_DECL_OVERRIDE;
- ManualPlugin(QObject *p = nullptr);
-
- public:
- virtual ~ManualPlugin() Q_DECL_OVERRIDE;
+private:
+ Q_OBJECT
+ Q_DISABLE_COPY(ManualPlugin)
+
+protected:
+ virtual void resolveFunctionPointers() Q_DECL_OVERRIDE;
+ ManualPlugin(QObject *p = nullptr);
+
+public:
+ virtual ~ManualPlugin() Q_DECL_OVERRIDE;
};
#endif
diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp
index 729085f5e..34018abe4 100644
--- a/src/mumble/Messages.cpp
+++ b/src/mumble/Messages.cpp
@@ -24,6 +24,7 @@
# include "Overlay.h"
#endif
#include "ChannelListener.h"
+#include "PluginManager.h"
#include "ServerHandler.h"
#include "TalkingUI.h"
#include "User.h"
@@ -34,7 +35,6 @@
#include "VersionCheck.h"
#include "ViewCert.h"
#include "crypto/CryptState.h"
-#include "PluginManager.h"
#include "Global.h"
#include <QTextDocumentFragment>
@@ -52,11 +52,11 @@
return; \
}
-#define SELF_INIT \
+#define SELF_INIT \
ClientUser *pSelf = ClientUser::get(Global::get().uiSession); \
- if (!pSelf) { \
+ if (!pSelf) { \
qWarning("MainWindow: Received message outside of session (sid %d).", Global::get().uiSession); \
- return; \
+ return; \
}
/// The authenticate message is being used by the client to send the authentication credentials to the server. Therefore
@@ -198,12 +198,13 @@ void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) {
{
// Since we are only loading the adjustments from the database, we don't really want to consider the adjustments
// to have "changed" by this action. Furthermore we are setting the volume adjustments before the listeners
- // officially exist. Therefore some code that would receive the change-event would try to get the respective listener
- // and fail due to it not existing yet.
- // Therefore we block all signals while setting the volume adjustments.
+ // officially exist. Therefore some code that would receive the change-event would try to get the respective
+ // listener and fail due to it not existing yet. Therefore we block all signals while setting the volume
+ // adjustments.
const QSignalBlocker blocker(ChannelListener::get());
- QHash< int, float > volumeMap = Global::get().db->getChannelListenerLocalVolumeAdjustments(Global::get().sh->qbaDigest);
+ QHash< int, float > volumeMap =
+ Global::get().db->getChannelListenerLocalVolumeAdjustments(Global::get().sh->qbaDigest);
QHashIterator< int, float > it(volumeMap);
while (it.hasNext()) {
it.next();
@@ -265,13 +266,13 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
} else {
if (pDst == pSelf)
Global::get().l->log(Log::PermissionDenied, tr("You were denied %1 privileges in %2.")
- .arg(Log::msgColor(pname, Log::Privilege))
- .arg(Log::formatChannel(c)));
+ .arg(Log::msgColor(pname, Log::Privilege))
+ .arg(Log::formatChannel(c)));
else
Global::get().l->log(Log::PermissionDenied, tr("%3 was denied %1 privileges in %2.")
- .arg(Log::msgColor(pname, Log::Privilege))
- .arg(Log::formatChannel(c))
- .arg(Log::formatClientUser(pDst, Log::Target)));
+ .arg(Log::msgColor(pname, Log::Privilege))
+ .arg(Log::formatChannel(c))
+ .arg(Log::formatClientUser(pDst, Log::Target)));
}
} break;
case MumbleProto::PermissionDenied_DenyType_SuperUser: {
@@ -285,14 +286,15 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
} break;
case MumbleProto::PermissionDenied_DenyType_H9K: {
if (Global::get().bHappyEaster) {
- bool bold = Global::get().s.bDeaf;
- bool bold2 = Global::get().s.bTTS;
- Global::get().s.bDeaf = false;
- Global::get().s.bTTS = true;
- quint32 oflags = Global::get().s.qmMessages.value(Log::PermissionDenied);
- Global::get().s.qmMessages[Log::PermissionDenied] = (oflags | Settings::LogTTS) & (~Settings::LogSoundfile);
- Global::get().l->log(Log::PermissionDenied,
- QString::fromUtf8(Global::get().ccHappyEaster + 39).arg(Global::get().s.qsUsername.toHtmlEscaped()));
+ bool bold = Global::get().s.bDeaf;
+ bool bold2 = Global::get().s.bTTS;
+ Global::get().s.bDeaf = false;
+ Global::get().s.bTTS = true;
+ quint32 oflags = Global::get().s.qmMessages.value(Log::PermissionDenied);
+ Global::get().s.qmMessages[Log::PermissionDenied] =
+ (oflags | Settings::LogTTS) & (~Settings::LogSoundfile);
+ Global::get().l->log(Log::PermissionDenied, QString::fromUtf8(Global::get().ccHappyEaster + 39)
+ .arg(Global::get().s.qsUsername.toHtmlEscaped()));
Global::get().s.qmMessages[Log::PermissionDenied] = oflags;
Global::get().s.bDeaf = bold;
Global::get().s.bTTS = bold2;
@@ -310,12 +312,14 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
if (pDst == pSelf)
Global::get().l->log(Log::PermissionDenied, tr("You need a certificate to perform this operation."));
else
- Global::get().l->log(Log::PermissionDenied,
- tr("%1 does not have a certificate.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::PermissionDenied,
+ tr("%1 does not have a certificate.").arg(Log::formatClientUser(pDst, Log::Target)));
} break;
case MumbleProto::PermissionDenied_DenyType_UserName: {
if (msg.has_name())
- Global::get().l->log(Log::PermissionDenied, tr("Invalid username: %1.").arg(u8(msg.name()).toHtmlEscaped()));
+ Global::get().l->log(Log::PermissionDenied,
+ tr("Invalid username: %1.").arg(u8(msg.name()).toHtmlEscaped()));
else
Global::get().l->log(Log::PermissionDenied, tr("Invalid username."));
} break;
@@ -327,14 +331,14 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
} break;
case MumbleProto::PermissionDenied_DenyType_ChannelCountLimit: {
Global::get().l->log(Log::PermissionDenied,
- tr("Channel count limit reached. Need to delete channels before creating new ones."));
+ tr("Channel count limit reached. Need to delete channels before creating new ones."));
} break;
case MumbleProto::PermissionDenied_DenyType_ChannelListenerLimit: {
Global::get().l->log(Log::PermissionDenied, tr("No more listeners allowed in this channel."));
} break;
case MumbleProto::PermissionDenied_DenyType_UserListenerLimit: {
Global::get().l->log(Log::PermissionDenied,
- tr("You are not allowed to listen to more channels than you currently are."));
+ tr("You are not allowed to listen to more channels than you currently are."));
} break;
default: {
if (msg.has_reason())
@@ -390,8 +394,9 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
if (pSelf) {
if (pDst->cChannel == pSelf->cChannel) {
- Global::get().l->log(Log::ChannelJoinConnect,
- tr("%1 connected and entered channel.").arg(Log::formatClientUser(pDst, Log::Source)));
+ Global::get().l->log(
+ Log::ChannelJoinConnect,
+ tr("%1 connected and entered channel.").arg(Log::formatClientUser(pDst, Log::Source)));
} else {
Global::get().l->log(Log::UserJoin, tr("%1 connected.").arg(Log::formatClientUser(pDst, Log::Source)));
}
@@ -421,49 +426,53 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
if (pDst == pSelf) {
if (pSrc == pSelf) {
- Global::get().l->log(Log::SelfChannelJoin, tr("You joined %1.").arg(Log::formatChannel(channel)));
+ Global::get().l->log(Log::SelfChannelJoin,
+ tr("You joined %1.").arg(Log::formatChannel(channel)));
} else {
- Global::get().l->log(Log::SelfChannelJoinOther, tr("You were moved to %1 by %2.")
- .arg(Log::formatChannel(channel))
- .arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::SelfChannelJoinOther,
+ tr("You were moved to %1 by %2.")
+ .arg(Log::formatChannel(channel))
+ .arg(Log::formatClientUser(pSrc, Log::Source)));
}
} else if (pSrc == pSelf) {
if (channel == pSelf->cChannel) {
Global::get().l->log(Log::ChannelJoin, tr("You moved %1 to %2.")
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatChannel(channel)));
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatChannel(channel)));
} else {
Global::get().l->log(Log::ChannelLeave, tr("You moved %1 to %2.")
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatChannel(channel)));
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatChannel(channel)));
}
} else if ((channel == pSelf->cChannel) || (oldChannel == pSelf->cChannel)) {
if (pDst == pSrc) {
if (channel == pSelf->cChannel) {
- Global::get().l->log(Log::ChannelJoin,
- tr("%1 entered channel.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::ChannelJoin,
+ tr("%1 entered channel.").arg(Log::formatClientUser(pDst, Log::Target)));
} else {
Global::get().l->log(Log::ChannelLeave, tr("%1 moved to %2.")
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatChannel(channel)));
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatChannel(channel)));
}
} else {
if (channel == pSelf->cChannel) {
Global::get().l->log(Log::ChannelJoin, tr("%1 moved in from %2 by %3.")
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatChannel(oldChannel))
- .arg(Log::formatClientUser(pSrc, Log::Source)));
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatChannel(oldChannel))
+ .arg(Log::formatClientUser(pSrc, Log::Source)));
} else {
Global::get().l->log(Log::ChannelLeave, tr("%1 moved to %2 by %3.")
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatChannel(channel))
- .arg(Log::formatClientUser(pSrc, Log::Source)));
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatChannel(channel))
+ .arg(Log::formatClientUser(pSrc, Log::Source)));
}
}
}
if ((channel == pSelf->cChannel) && pDst->bRecording) {
- Global::get().l->log(Log::Recording, tr("%1 is recording").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(Log::Recording,
+ tr("%1 is recording").arg(Log::formatClientUser(pDst, Log::Target)));
}
}
}
@@ -529,13 +538,13 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
if (!oldName.isNull() && oldName != newName) {
if (pSrc != pDst) {
Global::get().l->log(Log::UserRenamed, tr("%1 renamed to %2 by %3.")
- .arg(Log::formatClientUser(pDst, Log::Target, oldName))
- .arg(Log::formatClientUser(pDst, Log::Target))
- .arg(Log::formatClientUser(pSrc, Log::Source)));
+ .arg(Log::formatClientUser(pDst, Log::Target, oldName))
+ .arg(Log::formatClientUser(pDst, Log::Target))
+ .arg(Log::formatClientUser(pSrc, Log::Source)));
} else {
Global::get().l->log(Log::UserRenamed, tr("%1 renamed to %2.")
- .arg(Log::formatClientUser(pDst, Log::Target, oldName),
- Log::formatClientUser(pDst, Log::Target)));
+ .arg(Log::formatClientUser(pDst, Log::Target, oldName),
+ Log::formatClientUser(pDst, Log::Target)));
}
}
}
@@ -564,11 +573,13 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
&& ((pDst->cChannel == pSelf->cChannel) || pDst->cChannel->allLinks().contains(pSelf->cChannel))) {
if (pDst->bSelfMute && pDst->bSelfDeaf)
Global::get().l->log(Log::OtherSelfMute,
- tr("%1 is now muted and deafened.").arg(Log::formatClientUser(pDst, Log::Target)));
+ tr("%1 is now muted and deafened.").arg(Log::formatClientUser(pDst, Log::Target)));
else if (pDst->bSelfMute)
- Global::get().l->log(Log::OtherSelfMute, tr("%1 is now muted.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(Log::OtherSelfMute,
+ tr("%1 is now muted.").arg(Log::formatClientUser(pDst, Log::Target)));
else
- Global::get().l->log(Log::OtherSelfMute, tr("%1 is now unmuted.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(Log::OtherSelfMute,
+ tr("%1 is now unmuted.").arg(Log::formatClientUser(pDst, Log::Target)));
}
}
@@ -585,9 +596,11 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
}
} else if (pDst->cChannel->allLinks().contains(pSelf->cChannel)) {
if (pDst->bRecording) {
- Global::get().l->log(Log::Recording, tr("%1 started recording.").arg(Log::formatClientUser(pDst, Log::Source)));
+ Global::get().l->log(Log::Recording,
+ tr("%1 started recording.").arg(Log::formatClientUser(pDst, Log::Source)));
} else {
- Global::get().l->log(Log::Recording, tr("%1 stopped recording.").arg(Log::formatClientUser(pDst, Log::Source)));
+ Global::get().l->log(Log::Recording,
+ tr("%1 stopped recording.").arg(Log::formatClientUser(pDst, Log::Source)));
}
}
}
@@ -609,13 +622,14 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
Log::YouMutedOther,
tr("%1 revoked your priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
} else {
- Global::get().l->log(Log::YouMutedOther,
- tr("%1 gave you priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("%1 gave you priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
}
} else if ((pSrc == pSelf) && (pSrc != pDst)) {
if (pDst->bPrioritySpeaker) {
Global::get().l->log(Log::YouMutedOther, tr("You revoked priority speaker status for %1.")
- .arg(Log::formatClientUser(pDst, Log::Target)));
+ .arg(Log::formatClientUser(pDst, Log::Target)));
} else {
Global::get().l->log(
Log::YouMutedOther,
@@ -627,18 +641,19 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
Log::OtherMutedOther,
tr("%1 revoked own priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
} else {
- Global::get().l->log(Log::OtherMutedOther,
- tr("%1 assumed priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::OtherMutedOther,
+ tr("%1 assumed priority speaker status.").arg(Log::formatClientUser(pSrc, Log::Source)));
}
} else if ((pSrc != pSelf) && (pDst != pSelf)) {
if (pDst->bPrioritySpeaker) {
Global::get().l->log(Log::OtherMutedOther, tr("%1 revoked priority speaker status for %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source),
- Log::formatClientUser(pDst, Log::Target)));
+ .arg(Log::formatClientUser(pSrc, Log::Source),
+ Log::formatClientUser(pDst, Log::Target)));
} else if (!pDst->bPrioritySpeaker) {
Global::get().l->log(Log::OtherMutedOther, tr("%1 gave priority speaker status to %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source),
- Log::formatClientUser(pDst, Log::Target)));
+ .arg(Log::formatClientUser(pSrc, Log::Source),
+ Log::formatClientUser(pDst, Log::Target)));
}
}
}
@@ -659,8 +674,9 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
|| (pSrc == pSelf))) {
if (pDst == pSelf) {
if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
- Global::get().l->log(Log::YouMuted,
- tr("You were muted and deafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMuted,
+ tr("You were muted and deafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
Global::get().l->log(
Log::YouMuted,
@@ -668,17 +684,20 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
} else {
if (msg.has_mute()) {
if (pDst->bMute)
- Global::get().l->log(Log::YouMuted,
- tr("You were muted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMuted,
+ tr("You were muted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
else
- Global::get().l->log(Log::YouMuted,
- tr("You were unmuted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMuted,
+ tr("You were unmuted by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
}
if (msg.has_deaf()) {
if (!pDst->bDeaf)
- Global::get().l->log(Log::YouMuted,
- tr("You were undeafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMuted,
+ tr("You were undeafened by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
}
}
@@ -689,85 +708,96 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
if (msg.has_channel_id())
Global::get().l->log(Log::YouMuted, tr("You were unsuppressed."));
else
- Global::get().l->log(Log::YouMuted,
- tr("You were unsuppressed by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(
+ Log::YouMuted,
+ tr("You were unsuppressed by %1.").arg(Log::formatClientUser(pSrc, Log::Source)));
}
}
updateTrayIcon();
} else if (pSrc == pSelf) {
if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
- Global::get().l->log(Log::YouMutedOther,
- tr("You muted and deafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("You muted and deafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
- Global::get().l->log(Log::YouMutedOther,
- tr("You unmuted and undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("You unmuted and undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
} else {
if (msg.has_mute()) {
if (pDst->bMute)
Global::get().l->log(Log::YouMutedOther,
- tr("You muted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ tr("You muted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
else
Global::get().l->log(Log::YouMutedOther,
- tr("You unmuted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ tr("You unmuted %1.").arg(Log::formatClientUser(pDst, Log::Target)));
}
if (msg.has_deaf()) {
if (!pDst->bDeaf)
- Global::get().l->log(Log::YouMutedOther,
- tr("You undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("You undeafened %1.").arg(Log::formatClientUser(pDst, Log::Target)));
}
}
if (msg.has_suppress()) {
if (!msg.has_channel_id()) {
if (pDst->bSuppress)
- Global::get().l->log(Log::YouMutedOther,
- tr("You suppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("You suppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
else
- Global::get().l->log(Log::YouMutedOther,
- tr("You unsuppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
+ Global::get().l->log(
+ Log::YouMutedOther,
+ tr("You unsuppressed %1.").arg(Log::formatClientUser(pDst, Log::Target)));
}
}
} else {
if (msg.has_mute() && msg.has_deaf() && pDst->bMute && pDst->bDeaf) {
Global::get().l->log(Log::OtherMutedOther, tr("%1 muted and deafened by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
} else if (msg.has_mute() && msg.has_deaf() && !pDst->bMute && !pDst->bDeaf) {
Global::get().l->log(Log::OtherMutedOther, tr("%1 unmuted and undeafened by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
} else {
if (msg.has_mute()) {
if (pDst->bMute)
- Global::get().l->log(Log::OtherMutedOther, tr("%1 muted by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::OtherMutedOther,
+ tr("%1 muted by %2.")
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
else
- Global::get().l->log(Log::OtherMutedOther, tr("%1 unmuted by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::OtherMutedOther,
+ tr("%1 unmuted by %2.")
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
}
if (msg.has_deaf()) {
if (!pDst->bDeaf)
- Global::get().l->log(Log::OtherMutedOther, tr("%1 undeafened by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::OtherMutedOther,
+ tr("%1 undeafened by %2.")
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
}
}
if (msg.has_suppress()) {
if (!msg.has_channel_id()) {
if (pDst->bSuppress)
- Global::get().l->log(Log::OtherMutedOther, tr("%1 suppressed by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::OtherMutedOther,
+ tr("%1 suppressed by %2.")
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
else
- Global::get().l->log(Log::OtherMutedOther, tr("%1 unsuppressed by %2.")
- .arg(Log::formatClientUser(pDst, Log::Target),
- Log::formatClientUser(pSrc, Log::Source)));
+ Global::get().l->log(Log::OtherMutedOther,
+ tr("%1 unsuppressed by %2.")
+ .arg(Log::formatClientUser(pDst, Log::Target),
+ Log::formatClientUser(pSrc, Log::Source)));
}
}
}
@@ -816,29 +846,29 @@ void MainWindow::msgUserRemove(const MumbleProto::UserRemove &msg) {
bRetryServer = false;
if (msg.ban())
Global::get().l->log(Log::YouKicked, tr("You were kicked and banned from the server by %1: %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source))
- .arg(reason));
+ .arg(Log::formatClientUser(pSrc, Log::Source))
+ .arg(reason));
else
Global::get().l->log(Log::YouKicked, tr("You were kicked from the server by %1: %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source))
- .arg(reason));
+ .arg(Log::formatClientUser(pSrc, Log::Source))
+ .arg(reason));
} else if (pSrc) {
if (msg.ban())
Global::get().l->log((pSrc == pSelf) ? Log::YouKicked : Log::UserKicked,
- tr("%3 was kicked and banned from the server by %1: %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source))
- .arg(reason)
- .arg(Log::formatClientUser(pDst, Log::Target)));
+ tr("%3 was kicked and banned from the server by %1: %2.")
+ .arg(Log::formatClientUser(pSrc, Log::Source))
+ .arg(reason)
+ .arg(Log::formatClientUser(pDst, Log::Target)));
else
Global::get().l->log((pSrc == pSelf) ? Log::YouKicked : Log::UserKicked,
- tr("%3 was kicked from the server by %1: %2.")
- .arg(Log::formatClientUser(pSrc, Log::Source))
- .arg(reason)
- .arg(Log::formatClientUser(pDst, Log::Target)));
+ tr("%3 was kicked from the server by %1: %2.")
+ .arg(Log::formatClientUser(pSrc, Log::Source))
+ .arg(reason)
+ .arg(Log::formatClientUser(pDst, Log::Target)));
} else {
if (pDst->cChannel == pSelf->cChannel || pDst->cChannel->allLinks().contains(pSelf->cChannel)) {
Global::get().l->log(Log::ChannelLeaveDisconnect,
- tr("%1 left channel and disconnected.").arg(Log::formatClientUser(pDst, Log::Source)));
+ tr("%1 left channel and disconnected.").arg(Log::formatClientUser(pDst, Log::Source)));
} else {
Global::get().l->log(Log::UserLeave, tr("%1 disconnected.").arg(Log::formatClientUser(pDst, Log::Source)));
}
@@ -969,7 +999,8 @@ void MainWindow::msgChannelRemove(const MumbleProto::ChannelRemove &msg) {
c->bFiltered = false;
}
if (!pmModel->removeChannel(c, true)) {
- Global::get().l->log(Log::CriticalError, tr("Protocol violation. Server sent remove for occupied channel."));
+ Global::get().l->log(Log::CriticalError,
+ tr("Protocol violation. Server sent remove for occupied channel."));
Global::get().sh->disconnect();
return;
}
@@ -1017,8 +1048,8 @@ void MainWindow::msgTextMessage(const MumbleProto::TextMessage &msg) {
const QString prefixMessage = target.isEmpty() ? name : tr("(%1) %2").arg(target).arg(name);
Global::get().l->log(privateMessage ? Log::PrivateTextMessage : Log::TextMessage,
- tr("%1: %2").arg(prefixMessage).arg(u8(msg.message())), tr("Message from %1").arg(plainName), false,
- overrideTTS, pSrc ? pSrc->bLocalIgnoreTTS : false);
+ tr("%1: %2").arg(prefixMessage).arg(u8(msg.message())), tr("Message from %1").arg(plainName),
+ false, overrideTTS, pSrc ? pSrc->bLocalIgnoreTTS : false);
}
/// This message is being received when the server informs the client about the access control list (ACL) for
@@ -1210,10 +1241,11 @@ void MainWindow::msgCodecVersion(const MumbleProto::CodecVersion &msg) {
#ifdef USE_OPUS
static bool warnedOpus = false;
- Global::get().bOpus = msg.opus();
+ Global::get().bOpus = msg.opus();
if (!Global::get().oCodec && !warnedOpus) {
- Global::get().l->log(Log::CriticalError, tr("Failed to load Opus, it will not be available for audio encoding/decoding."));
+ Global::get().l->log(Log::CriticalError,
+ tr("Failed to load Opus, it will not be available for audio encoding/decoding."));
warnedOpus = true;
}
#endif
@@ -1244,8 +1276,9 @@ void MainWindow::msgCodecVersion(const MumbleProto::CodecVersion &msg) {
if (!Global::get().qmCodecs.contains(willuse)) {
if (!warnedCELT) {
- Global::get().l->log(Log::CriticalError, tr("Unable to find matching CELT codecs with other clients. You will not be "
- "able to talk to all users."));
+ Global::get().l->log(Log::CriticalError,
+ tr("Unable to find matching CELT codecs with other clients. You will not be "
+ "able to talk to all users."));
warnedCELT = true;
}
} else {
@@ -1286,8 +1319,9 @@ void MainWindow::msgRequestBlob(const MumbleProto::RequestBlob &) {
/// @param msg The message object containing the suggestions
void MainWindow::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) {
if (msg.has_version() && (msg.version() > MumbleVersion::getRaw())) {
- Global::get().l->log(Log::Warning,
- tr("The server requests minimum client version %1").arg(MumbleVersion::toString(msg.version())));
+ Global::get().l->log(
+ Log::Warning,
+ tr("The server requests minimum client version %1").arg(MumbleVersion::toString(msg.version())));
}
if (msg.has_positional() && (msg.positional() != Global::get().s.doPositionalAudio())) {
if (msg.positional())
@@ -1306,19 +1340,21 @@ void MainWindow::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) {
void MainWindow::msgPluginDataTransmission(const MumbleProto::PluginDataTransmission &msg) {
// Another client's plugin has sent us some data. Verify the necessary parts are there and delegate it to the
// PluginManager
-
+
if (!msg.has_sendersession() || !msg.has_data() || !msg.has_dataid()) {
- // if the message contains no sender session, no data or no ID for the data, it is of no use to us and we discard it
+ // if the message contains no sender session, no data or no ID for the data, it is of no use to us and we
+ // discard it
return;
}
const ClientUser *sender = ClientUser::get(msg.sendersession());
- const std::string &data = msg.data();
+ const std::string &data = msg.data();
if (sender) {
static_assert(sizeof(unsigned char) == sizeof(uint8_t), "Unsigned char does not have expected 8bit size");
// As long as above assertion is true, we are only casting away the sign, which is fine
- Global::get().pluginManager->on_receiveData(sender, reinterpret_cast< const uint8_t * >(data.c_str()), data.size(), msg.dataid().c_str());
+ Global::get().pluginManager->on_receiveData(sender, reinterpret_cast< const uint8_t * >(data.c_str()),
+ data.size(), msg.dataid().c_str());
}
}
diff --git a/src/mumble/MumbleApplication.cpp b/src/mumble/MumbleApplication.cpp
index eb78b40b3..f729438ce 100644
--- a/src/mumble/MumbleApplication.cpp
+++ b/src/mumble/MumbleApplication.cpp
@@ -7,8 +7,8 @@
#include "EnvUtils.h"
#include "MainWindow.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#if defined(Q_OS_WIN)
# include "GlobalShortcut_win.h"
diff --git a/src/mumble/NetworkConfig.cpp b/src/mumble/NetworkConfig.cpp
index 6b75bd644..674caedb1 100644
--- a/src/mumble/NetworkConfig.cpp
+++ b/src/mumble/NetworkConfig.cpp
@@ -196,8 +196,8 @@ void Network::prepareRequest(QNetworkRequest &req) {
} else {
req.setRawHeader(QString::fromLatin1("User-Agent").toUtf8(),
QString::fromLatin1("Mozilla/5.0 (%1; %2) Mumble/%3 %4")
- .arg(OSInfo::getOS(), OSInfo::getOSVersion(),
- QLatin1String(MUMTEXT(MUMBLE_VERSION)), QLatin1String(MUMBLE_RELEASE))
+ .arg(OSInfo::getOS(), OSInfo::getOSVersion(), QLatin1String(MUMTEXT(MUMBLE_VERSION)),
+ QLatin1String(MUMBLE_RELEASE))
.toUtf8());
}
}
diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp
index b594472e5..2904b084c 100644
--- a/src/mumble/Overlay.cpp
+++ b/src/mumble/Overlay.cpp
@@ -17,8 +17,8 @@
#include "User.h"
#include "Utils.h"
#include "WebFetch.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#include <QtCore/QProcessEnvironment>
#include <QtCore/QtEndian>
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index 24b229b95..37efb29b6 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -16,8 +16,8 @@
#include "Themes.h"
#include "User.h"
#include "Utils.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#ifdef Q_OS_WIN
# include <QtGui/QBitmap>
diff --git a/src/mumble/OverlayConfig.cpp b/src/mumble/OverlayConfig.cpp
index b3e7c59cc..1fdbbf384 100644
--- a/src/mumble/OverlayConfig.cpp
+++ b/src/mumble/OverlayConfig.cpp
@@ -18,8 +18,8 @@
#include "Screen.h"
#include "ServerHandler.h"
#include "User.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#ifdef Q_OS_WIN
# include "../../overlay/overlay_blacklist.h"
diff --git a/src/mumble/OverlayEditor.cpp b/src/mumble/OverlayEditor.cpp
index e35ad417a..a73662ca5 100644
--- a/src/mumble/OverlayEditor.cpp
+++ b/src/mumble/OverlayEditor.cpp
@@ -15,8 +15,8 @@
#include "ServerHandler.h"
#include "User.h"
#include "Utils.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#include <QtWidgets/QGraphicsProxyWidget>
diff --git a/src/mumble/OverlayEditorScene.cpp b/src/mumble/OverlayEditorScene.cpp
index 7ed0c848f..6cc4c632c 100644
--- a/src/mumble/OverlayEditorScene.cpp
+++ b/src/mumble/OverlayEditorScene.cpp
@@ -16,8 +16,8 @@
#include "ServerHandler.h"
#include "User.h"
#include "Utils.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#include <QtGui/QImageReader>
#include <QtWidgets/QColorDialog>
diff --git a/src/mumble/OverlayUser.cpp b/src/mumble/OverlayUser.cpp
index 84f14e2f9..5ff764a86 100644
--- a/src/mumble/OverlayUser.cpp
+++ b/src/mumble/OverlayUser.cpp
@@ -15,8 +15,8 @@
#include "ServerHandler.h"
#include "User.h"
#include "Utils.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#include <QtGui/QImageReader>
diff --git a/src/mumble/OverlayUserGroup.cpp b/src/mumble/OverlayUserGroup.cpp
index d8dff48fa..087752ba9 100644
--- a/src/mumble/OverlayUserGroup.cpp
+++ b/src/mumble/OverlayUserGroup.cpp
@@ -18,8 +18,8 @@
#include "ServerHandler.h"
#include "User.h"
#include "Utils.h"
-#include "GlobalShortcut.h"
#include "Global.h"
+#include "GlobalShortcut.h"
#include <QtGui/QImageReader>
#include <QtWidgets/QGraphicsSceneContextMenuEvent>
diff --git a/src/mumble/Plugin.cpp b/src/mumble/Plugin.cpp
index 8317c584f..95260e7fd 100644
--- a/src/mumble/Plugin.cpp
+++ b/src/mumble/Plugin.cpp
@@ -4,11 +4,11 @@
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include "Plugin.h"
-#include "Version.h"
#include "API.h"
+#include "Version.h"
-#include <QWriteLocker>
#include <QMutexLocker>
+#include <QWriteLocker>
#include <cstring>
@@ -17,7 +17,7 @@
plugin_id_t Plugin::s_nextID = 1;
QMutex Plugin::s_idLock(QMutex::NonRecursive);
-void assertPluginLoaded(const Plugin* plugin) {
+void assertPluginLoaded(const Plugin *plugin) {
// don't throw and exception in release build
if (!plugin->isLoaded()) {
#ifdef QT_DEBUG
@@ -29,15 +29,8 @@ void assertPluginLoaded(const Plugin* plugin) {
}
Plugin::Plugin(QString path, bool isBuiltIn, QObject *p)
- : QObject(p),
- m_lib(path),
- m_pluginPath(path),
- m_pluginIsLoaded(false),
- m_pluginLock(QReadWriteLock::NonRecursive),
- m_pluginFnc(),
- m_isBuiltIn(isBuiltIn),
- m_positionalDataIsEnabled(true),
- m_positionalDataIsActive(false),
+ : QObject(p), m_lib(path), m_pluginPath(path), m_pluginIsLoaded(false), m_pluginLock(QReadWriteLock::NonRecursive),
+ m_pluginFnc(), m_isBuiltIn(isBuiltIn), m_positionalDataIsEnabled(true), m_positionalDataIsActive(false),
m_mayMonitorKeyboard(false) {
// See if the plugin is loadable in the first place unless it is a built-in plugin
m_pluginIsValid = isBuiltIn || m_lib.load();
@@ -66,7 +59,7 @@ QString Plugin::extractWrappedString(MumbleStringWrapper wrapper) const {
QString wrappedString = QString::fromUtf8(wrapper.data, wrapper.size);
if (wrapper.needsReleasing) {
- releaseResource(static_cast<const void *>(wrapper.data));
+ releaseResource(static_cast< const void * >(wrapper.data));
}
return wrappedString;
@@ -74,7 +67,7 @@ QString Plugin::extractWrappedString(MumbleStringWrapper wrapper) const {
bool Plugin::doInitialize() {
resolveFunctionPointers();
-
+
return m_pluginIsValid;
}
@@ -84,66 +77,107 @@ void Plugin::resolveFunctionPointers() {
// the missing ones
QWriteLocker lock(&m_pluginLock);
-
+
// resolve the mandatory functions first
- m_pluginFnc.init = reinterpret_cast<decltype(MumblePluginFunctions::init)>(m_lib.resolve("mumble_init"));
- m_pluginFnc.shutdown = reinterpret_cast<decltype(MumblePluginFunctions::shutdown)>(m_lib.resolve("mumble_shutdown"));
- m_pluginFnc.getName = reinterpret_cast<decltype(MumblePluginFunctions::getName)>(m_lib.resolve("mumble_getName"));
- m_pluginFnc.getAPIVersion = reinterpret_cast<decltype(MumblePluginFunctions::getAPIVersion)>(m_lib.resolve("mumble_getAPIVersion"));
- m_pluginFnc.registerAPIFunctions = reinterpret_cast<decltype(MumblePluginFunctions::registerAPIFunctions)>(m_lib.resolve("mumble_registerAPIFunctions"));
- m_pluginFnc.releaseResource = reinterpret_cast<decltype(MumblePluginFunctions::releaseResource)>(m_lib.resolve("mumble_releaseResource"));
+ m_pluginFnc.init = reinterpret_cast< decltype(MumblePluginFunctions::init) >(m_lib.resolve("mumble_init"));
+ m_pluginFnc.shutdown =
+ reinterpret_cast< decltype(MumblePluginFunctions::shutdown) >(m_lib.resolve("mumble_shutdown"));
+ m_pluginFnc.getName =
+ reinterpret_cast< decltype(MumblePluginFunctions::getName) >(m_lib.resolve("mumble_getName"));
+ m_pluginFnc.getAPIVersion =
+ reinterpret_cast< decltype(MumblePluginFunctions::getAPIVersion) >(m_lib.resolve("mumble_getAPIVersion"));
+ m_pluginFnc.registerAPIFunctions = reinterpret_cast< decltype(MumblePluginFunctions::registerAPIFunctions) >(
+ m_lib.resolve("mumble_registerAPIFunctions"));
+ m_pluginFnc.releaseResource = reinterpret_cast< decltype(MumblePluginFunctions::releaseResource) >(
+ m_lib.resolve("mumble_releaseResource"));
// validate that all those functions are available in the loaded lib
m_pluginIsValid = m_pluginFnc.init && m_pluginFnc.shutdown && m_pluginFnc.getName && m_pluginFnc.getAPIVersion
- && m_pluginFnc.registerAPIFunctions && m_pluginFnc.releaseResource;
+ && m_pluginFnc.registerAPIFunctions && m_pluginFnc.releaseResource;
if (!m_pluginIsValid) {
// Don't bother trying to resolve any other functions
#ifdef MUMBLE_PLUGIN_DEBUG
-#define CHECK_AND_LOG(name) if (!m_pluginFnc.name) { qDebug("\t\"%s\" is missing the %s() function", qPrintable(m_pluginPath), "mumble_" #name); }
+# define CHECK_AND_LOG(name) \
+ if (!m_pluginFnc.name) { \
+ qDebug("\t\"%s\" is missing the %s() function", qPrintable(m_pluginPath), "mumble_" #name); \
+ }
CHECK_AND_LOG(init);
CHECK_AND_LOG(shutdown);
CHECK_AND_LOG(getName);
CHECK_AND_LOG(getAPIVersion);
CHECK_AND_LOG(registerAPIFunctions);
CHECK_AND_LOG(releaseResource);
-#undef CHECK_AND_LOG
+# undef CHECK_AND_LOG
#endif
return;
}
// The mandatory functions are there, now see if any optional functions are implemented as well
- m_pluginFnc.setMumbleInfo = reinterpret_cast<decltype(MumblePluginFunctions::setMumbleInfo)>(m_lib.resolve("mumble_setMumbleInfo"));
- m_pluginFnc.getVersion = reinterpret_cast<decltype(MumblePluginFunctions::getVersion)>(m_lib.resolve("mumble_getVersion"));
- m_pluginFnc.getAuthor = reinterpret_cast<decltype(MumblePluginFunctions::getAuthor)>(m_lib.resolve("mumble_getAuthor"));
- m_pluginFnc.getDescription = reinterpret_cast<decltype(MumblePluginFunctions::getDescription)>(m_lib.resolve("mumble_getDescription"));
- m_pluginFnc.getFeatures = reinterpret_cast<decltype(MumblePluginFunctions::getFeatures)>(m_lib.resolve("mumble_getFeatures"));
- m_pluginFnc.deactivateFeatures = reinterpret_cast<decltype(MumblePluginFunctions::deactivateFeatures)>(m_lib.resolve("mumble_deactivateFeatures"));
- m_pluginFnc.initPositionalData = reinterpret_cast<decltype(MumblePluginFunctions::initPositionalData)>(m_lib.resolve("mumble_initPositionalData"));
- m_pluginFnc.fetchPositionalData = reinterpret_cast<decltype(MumblePluginFunctions::fetchPositionalData)>(m_lib.resolve("mumble_fetchPositionalData"));
- m_pluginFnc.shutdownPositionalData = reinterpret_cast<decltype(MumblePluginFunctions::shutdownPositionalData)>(m_lib.resolve("mumble_shutdownPositionalData"));
- m_pluginFnc.onServerConnected = reinterpret_cast<decltype(MumblePluginFunctions::onServerConnected)>(m_lib.resolve("mumble_onServerConnected"));
- m_pluginFnc.onServerDisconnected = reinterpret_cast<decltype(MumblePluginFunctions::onServerDisconnected)>(m_lib.resolve("mumble_onServerDisconnected"));
- m_pluginFnc.onChannelEntered = reinterpret_cast<decltype(MumblePluginFunctions::onChannelEntered)>(m_lib.resolve("mumble_onChannelEntered"));
- m_pluginFnc.onChannelExited = reinterpret_cast<decltype(MumblePluginFunctions::onChannelExited)>(m_lib.resolve("mumble_onChannelExited"));
- m_pluginFnc.onUserTalkingStateChanged = reinterpret_cast<decltype(MumblePluginFunctions::onUserTalkingStateChanged)>(m_lib.resolve("mumble_onUserTalkingStateChanged"));
- m_pluginFnc.onReceiveData = reinterpret_cast<decltype(MumblePluginFunctions::onReceiveData)>(m_lib.resolve("mumble_onReceiveData"));
- m_pluginFnc.onAudioInput = reinterpret_cast<decltype(MumblePluginFunctions::onAudioInput)>(m_lib.resolve("mumble_onAudioInput"));
- m_pluginFnc.onAudioSourceFetched = reinterpret_cast<decltype(MumblePluginFunctions::onAudioSourceFetched)>(m_lib.resolve("mumble_onAudioSourceFetched"));
- m_pluginFnc.onAudioOutputAboutToPlay = reinterpret_cast<decltype(MumblePluginFunctions::onAudioOutputAboutToPlay)>(m_lib.resolve("mumble_onAudioOutputAboutToPlay"));
- m_pluginFnc.onServerSynchronized = reinterpret_cast<decltype(MumblePluginFunctions::onServerSynchronized)>(m_lib.resolve("mumble_onServerSynchronized"));
- m_pluginFnc.onUserAdded = reinterpret_cast<decltype(MumblePluginFunctions::onUserAdded)>(m_lib.resolve("mumble_onUserAdded"));
- m_pluginFnc.onUserRemoved = reinterpret_cast<decltype(MumblePluginFunctions::onUserRemoved)>(m_lib.resolve("mumble_onUserRemoved"));
- m_pluginFnc.onChannelAdded = reinterpret_cast<decltype(MumblePluginFunctions::onChannelAdded)>(m_lib.resolve("mumble_onChannelAdded"));
- m_pluginFnc.onChannelRemoved = reinterpret_cast<decltype(MumblePluginFunctions::onChannelRemoved)>(m_lib.resolve("mumble_onChannelRemoved"));
- m_pluginFnc.onChannelRenamed = reinterpret_cast<decltype(MumblePluginFunctions::onChannelRenamed)>(m_lib.resolve("mumble_onChannelRenamed"));
- m_pluginFnc.onKeyEvent = reinterpret_cast<decltype(MumblePluginFunctions::onKeyEvent)>(m_lib.resolve("mumble_onKeyEvent"));
- m_pluginFnc.hasUpdate = reinterpret_cast<decltype(MumblePluginFunctions::hasUpdate)>(m_lib.resolve("mumble_hasUpdate"));
- m_pluginFnc.getUpdateDownloadURL = reinterpret_cast<decltype(MumblePluginFunctions::getUpdateDownloadURL)>(m_lib.resolve("mumble_getUpdateDownloadURL"));
+ m_pluginFnc.setMumbleInfo =
+ reinterpret_cast< decltype(MumblePluginFunctions::setMumbleInfo) >(m_lib.resolve("mumble_setMumbleInfo"));
+ m_pluginFnc.getVersion =
+ reinterpret_cast< decltype(MumblePluginFunctions::getVersion) >(m_lib.resolve("mumble_getVersion"));
+ m_pluginFnc.getAuthor =
+ reinterpret_cast< decltype(MumblePluginFunctions::getAuthor) >(m_lib.resolve("mumble_getAuthor"));
+ m_pluginFnc.getDescription =
+ reinterpret_cast< decltype(MumblePluginFunctions::getDescription) >(m_lib.resolve("mumble_getDescription"));
+ m_pluginFnc.getFeatures =
+ reinterpret_cast< decltype(MumblePluginFunctions::getFeatures) >(m_lib.resolve("mumble_getFeatures"));
+ m_pluginFnc.deactivateFeatures = reinterpret_cast< decltype(MumblePluginFunctions::deactivateFeatures) >(
+ m_lib.resolve("mumble_deactivateFeatures"));
+ m_pluginFnc.initPositionalData = reinterpret_cast< decltype(MumblePluginFunctions::initPositionalData) >(
+ m_lib.resolve("mumble_initPositionalData"));
+ m_pluginFnc.fetchPositionalData = reinterpret_cast< decltype(MumblePluginFunctions::fetchPositionalData) >(
+ m_lib.resolve("mumble_fetchPositionalData"));
+ m_pluginFnc.shutdownPositionalData =
+ reinterpret_cast< decltype(MumblePluginFunctions::shutdownPositionalData) >(
+ m_lib.resolve("mumble_shutdownPositionalData"));
+ m_pluginFnc.onServerConnected = reinterpret_cast< decltype(MumblePluginFunctions::onServerConnected) >(
+ m_lib.resolve("mumble_onServerConnected"));
+ m_pluginFnc.onServerDisconnected = reinterpret_cast< decltype(MumblePluginFunctions::onServerDisconnected) >(
+ m_lib.resolve("mumble_onServerDisconnected"));
+ m_pluginFnc.onChannelEntered = reinterpret_cast< decltype(MumblePluginFunctions::onChannelEntered) >(
+ m_lib.resolve("mumble_onChannelEntered"));
+ m_pluginFnc.onChannelExited = reinterpret_cast< decltype(MumblePluginFunctions::onChannelExited) >(
+ m_lib.resolve("mumble_onChannelExited"));
+ m_pluginFnc.onUserTalkingStateChanged =
+ reinterpret_cast< decltype(MumblePluginFunctions::onUserTalkingStateChanged) >(
+ m_lib.resolve("mumble_onUserTalkingStateChanged"));
+ m_pluginFnc.onReceiveData =
+ reinterpret_cast< decltype(MumblePluginFunctions::onReceiveData) >(m_lib.resolve("mumble_onReceiveData"));
+ m_pluginFnc.onAudioInput =
+ reinterpret_cast< decltype(MumblePluginFunctions::onAudioInput) >(m_lib.resolve("mumble_onAudioInput"));
+ m_pluginFnc.onAudioSourceFetched = reinterpret_cast< decltype(MumblePluginFunctions::onAudioSourceFetched) >(
+ m_lib.resolve("mumble_onAudioSourceFetched"));
+ m_pluginFnc.onAudioOutputAboutToPlay =
+ reinterpret_cast< decltype(MumblePluginFunctions::onAudioOutputAboutToPlay) >(
+ m_lib.resolve("mumble_onAudioOutputAboutToPlay"));
+ m_pluginFnc.onServerSynchronized = reinterpret_cast< decltype(MumblePluginFunctions::onServerSynchronized) >(
+ m_lib.resolve("mumble_onServerSynchronized"));
+ m_pluginFnc.onUserAdded =
+ reinterpret_cast< decltype(MumblePluginFunctions::onUserAdded) >(m_lib.resolve("mumble_onUserAdded"));
+ m_pluginFnc.onUserRemoved =
+ reinterpret_cast< decltype(MumblePluginFunctions::onUserRemoved) >(m_lib.resolve("mumble_onUserRemoved"));
+ m_pluginFnc.onChannelAdded =
+ reinterpret_cast< decltype(MumblePluginFunctions::onChannelAdded) >(m_lib.resolve("mumble_onChannelAdded"));
+ m_pluginFnc.onChannelRemoved = reinterpret_cast< decltype(MumblePluginFunctions::onChannelRemoved) >(
+ m_lib.resolve("mumble_onChannelRemoved"));
+ m_pluginFnc.onChannelRenamed = reinterpret_cast< decltype(MumblePluginFunctions::onChannelRenamed) >(
+ m_lib.resolve("mumble_onChannelRenamed"));
+ m_pluginFnc.onKeyEvent =
+ reinterpret_cast< decltype(MumblePluginFunctions::onKeyEvent) >(m_lib.resolve("mumble_onKeyEvent"));
+ m_pluginFnc.hasUpdate =
+ reinterpret_cast< decltype(MumblePluginFunctions::hasUpdate) >(m_lib.resolve("mumble_hasUpdate"));
+ m_pluginFnc.getUpdateDownloadURL = reinterpret_cast< decltype(MumblePluginFunctions::getUpdateDownloadURL) >(
+ m_lib.resolve("mumble_getUpdateDownloadURL"));
#ifdef MUMBLE_PLUGIN_DEBUG
-#define CHECK_AND_LOG(name) qDebug("\t" "mumble_" #name ": %s", (m_pluginFnc.name == nullptr ? "no" : "yes"))
+# define CHECK_AND_LOG(name) \
+ qDebug("\t" \
+ "mumble_" #name ": %s", \
+ (m_pluginFnc.name == nullptr ? "no" : "yes"))
qDebug(">>>> Found optional functions for plugin \"%s\"", qUtf8Printable(m_pluginPath));
CHECK_AND_LOG(setMumbleInfo);
CHECK_AND_LOG(getVersion);
@@ -178,12 +212,14 @@ void Plugin::resolveFunctionPointers() {
// If positional audio is to be supported, all three corresponding functions have to be implemented
// For PA it is all or nothing
if (!(m_pluginFnc.initPositionalData && m_pluginFnc.fetchPositionalData && m_pluginFnc.shutdownPositionalData)
- && (m_pluginFnc.initPositionalData || m_pluginFnc.fetchPositionalData || m_pluginFnc.shutdownPositionalData)) {
- m_pluginFnc.initPositionalData = nullptr;
- m_pluginFnc.fetchPositionalData = nullptr;
+ && (m_pluginFnc.initPositionalData || m_pluginFnc.fetchPositionalData
+ || m_pluginFnc.shutdownPositionalData)) {
+ m_pluginFnc.initPositionalData = nullptr;
+ m_pluginFnc.fetchPositionalData = nullptr;
m_pluginFnc.shutdownPositionalData = nullptr;
#ifdef MUMBLE_PLUGIN_DEBUG
- qDebug("\t\"%s\" has only partially implemented positional data functions -> deactivating all of them", qPrintable(m_pluginPath));
+ qDebug("\t\"%s\" has only partially implemented positional data functions -> deactivating all of them",
+ qPrintable(m_pluginPath));
#endif
}
}
@@ -272,11 +308,12 @@ mumble_error_t Plugin::init() {
//////////////////////////////
// Step 2: Provide the API functions to the plugin
const mumble_version_t apiVersion = getAPIVersion();
- if (apiVersion >= mumble_version_t({1, 0, 0}) && apiVersion < mumble_version_t({1, 2, 0})) {
+ if (apiVersion >= mumble_version_t({ 1, 0, 0 }) && apiVersion < mumble_version_t({ 1, 2, 0 })) {
MumbleAPI_v_1_0_x api = API::getMumbleAPI_v_1_0_x();
registerAPIFunctions(&api);
} else {
- // The API version could not be obtained -> this is an invalid plugin that shouldn't have been loaded in the first place
+ // The API version could not be obtained -> this is an invalid plugin that shouldn't have been loaded in the
+ // first place
qWarning("Unable to obtain requested MumbleAPI version");
return EC_INVALID_API_VERSION;
}
@@ -354,7 +391,8 @@ void Plugin::releaseResource(const void *pointer) const {
}
}
-void Plugin::setMumbleInfo(mumble_version_t mumbleVersion, mumble_version_t mumbleAPIVersion, mumble_version_t minimalExpectedAPIVersion) const {
+void Plugin::setMumbleInfo(mumble_version_t mumbleVersion, mumble_version_t mumbleAPIVersion,
+ mumble_version_t minimalExpectedAPIVersion) const {
if (m_pluginFnc.setMumbleInfo) {
m_pluginFnc.setMumbleInfo(mumbleVersion, mumbleAPIVersion, minimalExpectedAPIVersion);
}
@@ -416,7 +454,7 @@ bool Plugin::showConfigDialog(QWidget *parent) const {
return false;
}
-uint8_t Plugin::initPositionalData(const char *const*programNames, const uint64_t *programPIDs, size_t programCount) {
+uint8_t Plugin::initPositionalData(const char *const *programNames, const uint64_t *programPIDs, size_t programCount) {
assertPluginLoaded(this);
if (m_pluginFnc.initPositionalData) {
@@ -433,19 +471,21 @@ uint8_t Plugin::initPositionalData(const char *const*programNames, const uint64_
}
}
-bool Plugin::fetchPositionalData(Position3D& avatarPos, Vector3D& avatarDir, Vector3D& avatarAxis, Position3D& cameraPos, Vector3D& cameraDir,
- Vector3D& cameraAxis, QString& context, QString& identity) const {
+bool Plugin::fetchPositionalData(Position3D &avatarPos, Vector3D &avatarDir, Vector3D &avatarAxis,
+ Position3D &cameraPos, Vector3D &cameraDir, Vector3D &cameraAxis, QString &context,
+ QString &identity) const {
assertPluginLoaded(this);
if (m_pluginFnc.fetchPositionalData) {
- const char *contextPtr = "";
+ const char *contextPtr = "";
const char *identityPtr = "";
- bool retStatus = m_pluginFnc.fetchPositionalData(static_cast<float*>(avatarPos), static_cast<float*>(avatarDir),
- static_cast<float*>(avatarAxis), static_cast<float*>(cameraPos), static_cast<float*>(cameraDir), static_cast<float*>(cameraAxis),
- &contextPtr, &identityPtr);
+ bool retStatus = m_pluginFnc.fetchPositionalData(
+ static_cast< float * >(avatarPos), static_cast< float * >(avatarDir), static_cast< float * >(avatarAxis),
+ static_cast< float * >(cameraPos), static_cast< float * >(cameraDir), static_cast< float * >(cameraAxis),
+ &contextPtr, &identityPtr);
- context = QString::fromUtf8(contextPtr);
+ context = QString::fromUtf8(contextPtr);
identity = QString::fromUtf8(identityPtr);
return retStatus;
@@ -456,9 +496,9 @@ bool Plugin::fetchPositionalData(Position3D& avatarPos, Vector3D& avatarDir, Vec
cameraPos.toZero();
cameraDir.toZero();
cameraAxis.toZero();
- context = QString();
+ context = QString();
identity = QString();
-
+
return false;
}
}
@@ -489,8 +529,8 @@ void Plugin::onServerDisconnected(mumble_connection_t connection) const {
}
}
-void Plugin::onChannelEntered(mumble_connection_t connection, mumble_userid_t userID, mumble_channelid_t previousChannelID,
- mumble_channelid_t newChannelID) const {
+void Plugin::onChannelEntered(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_channelid_t previousChannelID, mumble_channelid_t newChannelID) const {
assertPluginLoaded(this);
if (m_pluginFnc.onChannelEntered) {
@@ -498,7 +538,8 @@ void Plugin::onChannelEntered(mumble_connection_t connection, mumble_userid_t us
}
}
-void Plugin::onChannelExited(mumble_connection_t connection, mumble_userid_t userID, mumble_channelid_t channelID) const {
+void Plugin::onChannelExited(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_channelid_t channelID) const {
assertPluginLoaded(this);
if (m_pluginFnc.onChannelExited) {
@@ -506,7 +547,8 @@ void Plugin::onChannelExited(mumble_connection_t connection, mumble_userid_t use
}
}
-void Plugin::onUserTalkingStateChanged(mumble_connection_t connection, mumble_userid_t userID, mumble_talking_state_t talkingState) const {
+void Plugin::onUserTalkingStateChanged(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_talking_state_t talkingState) const {
assertPluginLoaded(this);
if (m_pluginFnc.onUserTalkingStateChanged) {
@@ -514,7 +556,8 @@ void Plugin::onUserTalkingStateChanged(mumble_connection_t connection, mumble_us
}
}
-bool Plugin::onReceiveData(mumble_connection_t connection, mumble_userid_t sender, const uint8_t *data, size_t dataLength, const char *dataID) const {
+bool Plugin::onReceiveData(mumble_connection_t connection, mumble_userid_t sender, const uint8_t *data,
+ size_t dataLength, const char *dataID) const {
assertPluginLoaded(this);
if (m_pluginFnc.onReceiveData) {
@@ -524,7 +567,8 @@ bool Plugin::onReceiveData(mumble_connection_t connection, mumble_userid_t sende
}
}
-bool Plugin::onAudioInput(short *inputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate, bool isSpeech) const {
+bool Plugin::onAudioInput(short *inputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate,
+ bool isSpeech) const {
assertPluginLoaded(this);
if (m_pluginFnc.onAudioInput) {
@@ -534,7 +578,8 @@ bool Plugin::onAudioInput(short *inputPCM, uint32_t sampleCount, uint16_t channe
}
}
-bool Plugin::onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate, bool isSpeech, mumble_userid_t userID) const {
+bool Plugin::onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate,
+ bool isSpeech, mumble_userid_t userID) const {
assertPluginLoaded(this);
if (m_pluginFnc.onAudioSourceFetched) {
@@ -544,7 +589,8 @@ bool Plugin::onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16
}
}
-bool Plugin::onAudioOutputAboutToPlay(float *outputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate) const {
+bool Plugin::onAudioOutputAboutToPlay(float *outputPCM, uint32_t sampleCount, uint16_t channelCount,
+ uint32_t sampleRate) const {
assertPluginLoaded(this);
if (m_pluginFnc.onAudioOutputAboutToPlay) {
@@ -645,9 +691,7 @@ bool Plugin::providesConfigDialog() const {
/////////////////// Implementation of the PluginReadLocker /////////////////////////
-PluginReadLocker::PluginReadLocker(QReadWriteLock *lock)
- : m_lock(lock),
- m_unlocked(false) {
+PluginReadLocker::PluginReadLocker(QReadWriteLock *lock) : m_lock(lock), m_unlocked(false) {
relock();
}
@@ -671,14 +715,14 @@ void PluginReadLocker::relock() {
// First try to lock for read-access
if (!m_lock->tryLockForRead()) {
// if that fails, we'll try to lock for write-access
- // That will only succeed in the case that the current thread holds the write-access to this lock already which caused
- // the previous attempt to lock for reading to fail (by design of the QtReadWriteLock).
- // As we are in the thread with the write-access, it means that this threads has asked for read-access on top of it which we will
- // grant (in contrast of QtReadLocker) because if you have the permission to change something you surely should have permission
- // to read it. This assumes that the thread won't try to read data it temporarily has corrupted.
+ // That will only succeed in the case that the current thread holds the write-access to this lock already which
+ // caused the previous attempt to lock for reading to fail (by design of the QtReadWriteLock). As we are in the
+ // thread with the write-access, it means that this threads has asked for read-access on top of it which we will
+ // grant (in contrast of QtReadLocker) because if you have the permission to change something you surely should
+ // have permission to read it. This assumes that the thread won't try to read data it temporarily has corrupted.
if (!m_lock->tryLockForWrite()) {
- // If we couldn't lock for write at this point, it means another thread has write-access granted by the lock so we'll have to wait
- // in order to gain regular read-access as would be with QtReadLocker
+ // If we couldn't lock for write at this point, it means another thread has write-access granted by the lock
+ // so we'll have to wait in order to gain regular read-access as would be with QtReadLocker
m_lock->lockForRead();
}
}
diff --git a/src/mumble/Plugin.h b/src/mumble/Plugin.h
index 049e622f2..28324cc83 100644
--- a/src/mumble/Plugin.h
+++ b/src/mumble/Plugin.h
@@ -7,96 +7,97 @@
#define MUMBLE_MUMBLE_PLUGIN_H_
#include "MumbleAPI_v_1_0_x.h"
+#include "MumblePlugin_v_1_0_x.h"
#include "PluginComponents_v_1_0_x.h"
#include "PositionalData.h"
-#include "MumblePlugin_v_1_0_x.h"
+#include <QLibrary>
+#include <QMutex>
#include <QObject>
#include <QReadWriteLock>
#include <QString>
-#include <QLibrary>
-#include <QMutex>
#include <QUrl>
-#include <stdexcept>
#include <memory>
+#include <stdexcept>
/// A struct for holding the function pointers to the functions inside the plugin's library
/// For the documentation of those functions, see the plugin's header file (the one used when developing a plugin)
struct MumblePluginFunctions {
- decltype(&mumble_init) init;
- decltype(&mumble_shutdown) shutdown;
- decltype(&mumble_getName) getName;
- decltype(&mumble_getAPIVersion) getAPIVersion;
- decltype(&mumble_registerAPIFunctions) registerAPIFunctions;
- decltype(&mumble_releaseResource) releaseResource;
-
- // Further utility functions the plugin may implement
- decltype(&mumble_setMumbleInfo) setMumbleInfo;
- decltype(&mumble_getVersion) getVersion;
- decltype(&mumble_getAuthor) getAuthor;
- decltype(&mumble_getDescription) getDescription;
- decltype(&mumble_getFeatures) getFeatures;
- decltype(&mumble_deactivateFeatures) deactivateFeatures;
-
- // Functions for dealing with positional audio (or rather the fetching of the needed data)
- decltype(&mumble_initPositionalData) initPositionalData;
- decltype(&mumble_fetchPositionalData) fetchPositionalData;
- decltype(&mumble_shutdownPositionalData) shutdownPositionalData;
-
- // Callback functions and EventHandlers
- decltype(&mumble_onServerConnected) onServerConnected;
- decltype(&mumble_onServerDisconnected) onServerDisconnected;
- decltype(&mumble_onChannelEntered) onChannelEntered;
- decltype(&mumble_onChannelExited) onChannelExited;
- decltype(&mumble_onUserTalkingStateChanged) onUserTalkingStateChanged;
- decltype(&mumble_onReceiveData) onReceiveData;
- decltype(&mumble_onAudioInput) onAudioInput;
- decltype(&mumble_onAudioSourceFetched) onAudioSourceFetched;
- decltype(&mumble_onAudioOutputAboutToPlay) onAudioOutputAboutToPlay;
- decltype(&mumble_onServerSynchronized) onServerSynchronized;
- decltype(&mumble_onUserAdded) onUserAdded;
- decltype(&mumble_onUserRemoved) onUserRemoved;
- decltype(&mumble_onChannelAdded) onChannelAdded;
- decltype(&mumble_onChannelRemoved) onChannelRemoved;
- decltype(&mumble_onChannelRenamed) onChannelRenamed;
- decltype(&mumble_onKeyEvent) onKeyEvent;
-
- // Plugin updates
- decltype(&mumble_hasUpdate) hasUpdate;
- decltype(&mumble_getUpdateDownloadURL) getUpdateDownloadURL;
+ decltype(&mumble_init) init;
+ decltype(&mumble_shutdown) shutdown;
+ decltype(&mumble_getName) getName;
+ decltype(&mumble_getAPIVersion) getAPIVersion;
+ decltype(&mumble_registerAPIFunctions) registerAPIFunctions;
+ decltype(&mumble_releaseResource) releaseResource;
+
+ // Further utility functions the plugin may implement
+ decltype(&mumble_setMumbleInfo) setMumbleInfo;
+ decltype(&mumble_getVersion) getVersion;
+ decltype(&mumble_getAuthor) getAuthor;
+ decltype(&mumble_getDescription) getDescription;
+ decltype(&mumble_getFeatures) getFeatures;
+ decltype(&mumble_deactivateFeatures) deactivateFeatures;
+
+ // Functions for dealing with positional audio (or rather the fetching of the needed data)
+ decltype(&mumble_initPositionalData) initPositionalData;
+ decltype(&mumble_fetchPositionalData) fetchPositionalData;
+ decltype(&mumble_shutdownPositionalData) shutdownPositionalData;
+
+ // Callback functions and EventHandlers
+ decltype(&mumble_onServerConnected) onServerConnected;
+ decltype(&mumble_onServerDisconnected) onServerDisconnected;
+ decltype(&mumble_onChannelEntered) onChannelEntered;
+ decltype(&mumble_onChannelExited) onChannelExited;
+ decltype(&mumble_onUserTalkingStateChanged) onUserTalkingStateChanged;
+ decltype(&mumble_onReceiveData) onReceiveData;
+ decltype(&mumble_onAudioInput) onAudioInput;
+ decltype(&mumble_onAudioSourceFetched) onAudioSourceFetched;
+ decltype(&mumble_onAudioOutputAboutToPlay) onAudioOutputAboutToPlay;
+ decltype(&mumble_onServerSynchronized) onServerSynchronized;
+ decltype(&mumble_onUserAdded) onUserAdded;
+ decltype(&mumble_onUserRemoved) onUserRemoved;
+ decltype(&mumble_onChannelAdded) onChannelAdded;
+ decltype(&mumble_onChannelRemoved) onChannelRemoved;
+ decltype(&mumble_onChannelRenamed) onChannelRenamed;
+ decltype(&mumble_onKeyEvent) onKeyEvent;
+
+ // Plugin updates
+ decltype(&mumble_hasUpdate) hasUpdate;
+ decltype(&mumble_getUpdateDownloadURL) getUpdateDownloadURL;
};
/// An exception that is being thrown by a plugin whenever it encounters an error
class PluginError : public std::runtime_error {
- public:
- // inherit constructors of runtime_error
- using std::runtime_error::runtime_error;
+public:
+ // inherit constructors of runtime_error
+ using std::runtime_error::runtime_error;
};
/// An implementation similar to QReadLocker except that this one allows to lock on a lock the same thread is already
-/// holding a write-lock on. This could also result in obtaining a write-lock though so it shouldn't be used for code regions
-/// that take quite some time and rely on other readers still having access to the locked object.
+/// holding a write-lock on. This could also result in obtaining a write-lock though so it shouldn't be used for code
+/// regions that take quite some time and rely on other readers still having access to the locked object.
class PluginReadLocker {
- protected:
- /// The lock this lock-guard is acting upon
- QReadWriteLock *m_lock;
- /// A flag indicating whether the lock has been unlocked (manually) and thus doesn't have to be unlocked
- /// in the destructor.
- bool m_unlocked;
- public:
- /// Constructor of the PluginReadLocker. If the passed lock-pointer is not nullptr, the constructor will
- /// already lock the provided lock.
- ///
- /// @param lock A pointer to the QReadWriteLock that shall be managed by this object. May be nullptr
- PluginReadLocker(QReadWriteLock *lock);
- /// Locks this lock again after it has been unlocked before (Locking a locked lock results in a runtime error)
- void relock();
- /// Unlocks this lock
- void unlock();
- ~PluginReadLocker();
+protected:
+ /// The lock this lock-guard is acting upon
+ QReadWriteLock *m_lock;
+ /// A flag indicating whether the lock has been unlocked (manually) and thus doesn't have to be unlocked
+ /// in the destructor.
+ bool m_unlocked;
+
+public:
+ /// Constructor of the PluginReadLocker. If the passed lock-pointer is not nullptr, the constructor will
+ /// already lock the provided lock.
+ ///
+ /// @param lock A pointer to the QReadWriteLock that shall be managed by this object. May be nullptr
+ PluginReadLocker(QReadWriteLock *lock);
+ /// Locks this lock again after it has been unlocked before (Locking a locked lock results in a runtime error)
+ void relock();
+ /// Unlocks this lock
+ void unlock();
+ ~PluginReadLocker();
};
class Plugin;
@@ -104,314 +105,328 @@ class Plugin;
/// Typedef for the plugin ID
typedef uint32_t plugin_id_t;
/// Typedef for a plugin pointer
-typedef std::shared_ptr<Plugin> plugin_ptr_t;
+typedef std::shared_ptr< Plugin > plugin_ptr_t;
/// Typedef for a const plugin pointer
-typedef std::shared_ptr<const Plugin> const_plugin_ptr_t;
+typedef std::shared_ptr< const Plugin > const_plugin_ptr_t;
-/// A class representing a plugin library attached to Mumble. It can be used to manage (load/unload) and access plugin libraries.
+/// A class representing a plugin library attached to Mumble. It can be used to manage (load/unload) and access plugin
+/// libraries.
class Plugin : public QObject {
friend class PluginManager;
friend class PluginConfig;
- private:
- Q_OBJECT
- Q_DISABLE_COPY(Plugin)
- protected:
- /// A mutex guarding Plugin::nextID
- static QMutex s_idLock;
- /// The ID of the plugin that will be loaded next. Whenever accessing this field, Plugin::idLock should be locked.
- static plugin_id_t s_nextID;
-
- /// Constructor of the Plugin.
- ///
- /// @param path The path to the plugin's shared library file. This path has to exist unless isBuiltIn is true
- /// @param isBuiltIn A flag indicating that this is a plugin built into Mumble itself and is does not backed by a shared library
- /// @param p A pointer to a QObject representing the parent of this object or nullptr if there is no parent
- Plugin(QString path, bool isBuiltIn = false, QObject *p = nullptr);
-
- /// A flag indicating whether this plugin is valid. It is mainly used throughout the plugin's initialization.
- bool m_pluginIsValid;
- /// The QLibrary representing the shared library of this plugin
- QLibrary m_lib;
- /// The path to the shared library file in the host's filesystem
- QString m_pluginPath;
- /// The unique ID of this plugin. Note though that this ID is not suitable for uniquely identifying this plugin between restarts of Mumble
- /// (not even between rescans of the plugins) let alone across clients.
- plugin_id_t m_pluginID;
- // a flag indicating whether this plugin has been loaded by calling its init function.
- bool m_pluginIsLoaded;
- /// The lock guarding this plugin object. Every time a member is accessed this lock should be locked accordingly.
- /// After successful construction and initialization (doInitilize()), this member variable is effectively const
- /// and therefore no locking is required in order to read from it!
- /// In fact protecting read-accesses by a non-recursive lock can introduce deadlocks by plugins using certain
- /// API functions.
- mutable QReadWriteLock m_pluginLock;
- /// The struct holding the function pointers to the functions in the shared library.
- MumblePluginFunctions m_pluginFnc;
- /// A flag indicating whether this plugin is built into Mumble and is thus not represented by a shared library.
- bool m_isBuiltIn;
- /// A flag indicating whether positional data gathering is enabled for this plugin (Enabled as in allowed via preferences).
- bool m_positionalDataIsEnabled;
- /// A flag indicating whether positional data gathering is currently active (Active as in running)
- bool m_positionalDataIsActive;
- /// A flag indicating whether this plugin has permission to monitor keyboard events that occur while
- /// Mumble has the keyboard focus.
- bool m_mayMonitorKeyboard;
-
-
- QString extractWrappedString(MumbleStringWrapper wrapper) const;
-
-
- // Most of this class's functions are protected in order to only allow access to them via the PluginManager
- // as some require additional handling before/after calling them.
-
- /// Initializes this plugin. This function must be called directly after construction. This is guaranteed when the
- /// plugin is created via Plugin::createNew
- virtual bool doInitialize();
- /// Resolves the function pointers in the shared library and sets the respective fields in Plugin::apiFnc
- virtual void resolveFunctionPointers();
- /// Enables positional data gathering for this plugin (as in allowing)
- ///
- /// @param enable Whether to enable the data gathering
- virtual void enablePositionalData(bool enable = true);
- /// Allows or forbids the monitoring of keyboard events for this plugin.
- ///
- /// @param allow Whether to allow or forbid it
- virtual void allowKeyboardMonitoring(bool allow);
-
-
- /// Initializes this plugin
- virtual mumble_error_t init();
- /// Shuts this plugin down
- virtual void shutdown();
- /// Delegates the struct of API function pointers to the plugin backend
- ///
- /// @param api The pointer to the API struct
- virtual void registerAPIFunctions(void *api) const;
- /// Asks the plugin to release (free/delete) the resource pointed to by the given pointer
- ///
- /// @param pointer Pointer to the resource
- virtual void releaseResource(const void *pointer) const;
- /// Provides the plugin backend with some version information about Mumble
- ///
- /// @param mumbleVersion The version of the Mumble client
- /// @param mumbleAPIVersion The API version used by the Mumble client
- /// @param minimalExpectedAPIVersion The minimal API version expected to be used by the plugin backend
- virtual void setMumbleInfo(mumble_version_t mumbleVersion, mumble_version_t mumbleAPIVersion, mumble_version_t minimalExpectedAPIVersion) const;
- /// Asks the plugin to deactivate certain features
- ///
- /// @param features The feature list or'ed together
- /// @returns The list of features that couldn't be deactivated or'ed together
- virtual uint32_t deactivateFeatures(uint32_t features) const;
- /// Shows an about-dialog
- ///
- /// @parent A pointer to the QWidget that should be used as a parent
- /// @returns Whether the dialog could be shown successfully
- virtual bool showAboutDialog(QWidget *parent) const;
- /// Shows a config-dialog
- ///
- /// @parent A pointer to the QWidget that should be used as a parent
- /// @returns Whether the dialog could be shown successfully
- virtual bool showConfigDialog(QWidget *parent) const;
- /// Initializes the positional data gathering
- ///
- /// @params programNames A pointer to an array of const char* representing the program names
- /// @params programCount A pointer to an array of PIDs corresponding to the program names
- /// @params programCount The length of the two previous arrays
- virtual uint8_t initPositionalData(const char *const*programNames, const uint64_t *programPIDs, size_t programCount);
- /// Fetches the positional data
- ///
- /// @param[out] avatarPos The position of the ingame avatar (player)
- /// @param[out] avatarDir The directiion in which the avatar (player) is looking/facing
- /// @param[out] avatarAxis The vector from the avatar's toes to its head
- /// @param[out] cameraPos The position of the ingame camera
- /// @param[out] cameraDir The direction in which the camera is looking/facing
- /// @param[out] cameraAxis The vector from the camera's bottom to its top
- /// @param[out] context The context of the current game-session (includes server/squad info)
- /// @param[out] identity The ingame identity of the player (name)
- virtual bool fetchPositionalData(Position3D& avatarPos, Vector3D& avatarDir, Vector3D& avatarAxis, Position3D& cameraPos, Vector3D& cameraDir,
- Vector3D& cameraAxis, QString& context, QString& identity) const;
- /// Shuts down positional data gathering
- virtual void shutdownPositionalData();
- /// Called to indicate that the client has connected to a server
- ///
- /// @param connection An object used to identify the current connection
- virtual void onServerConnected(mumble_connection_t connection) const;
- /// Called to indicate that the client disconnected from a server
- ///
- /// @param connection An object used to identify the connection that has been disconnected
- virtual void onServerDisconnected(mumble_connection_t connection) const;
- /// Called to indicate that a user has switched its channel
- ///
- /// @param connection An object used to identify the current connection
- /// @param userID The ID of the user that switched channel
- /// @param previousChannelID The ID of the channel the user came from (-1 if there is no previous channel)
- /// æparam newChannelID The ID of the channel the user has switched to
- virtual void onChannelEntered(mumble_connection_t connection, mumble_userid_t userID, mumble_channelid_t previousChannelID,
- mumble_channelid_t newChannelID) const;
- /// Called to indicate that a user exited a channel.
- ///
- /// @param connection An object used to identify the current connection
- /// @param userID The ID of the user that switched channel
- /// @param channelID The ID of the channel the user exited
- virtual void onChannelExited(mumble_connection_t connection, mumble_userid_t userID, mumble_channelid_t channelID) const;
- /// Called to indicate that a user has changed its talking state
- ///
- /// @param connection An object used to identify the current connection
- /// @param userID The ID of the user that switched channel
- /// @param talkingState The new talking state of the user
- virtual void onUserTalkingStateChanged(mumble_connection_t connection, mumble_userid_t userID, mumble_talking_state_t talkingState) const;
- /// Called to indicate that a data packet has been received
- ///
- /// @param connection An object used to identify the current connection
- /// @param sender The ID of the user whose client sent the data
- /// @param data The actual data
- /// @param dataLength The length of the data array
- /// @param datID The ID of the data used to determine whether this plugin handles this data or not
- /// @returns Whether this plugin handled the data
- virtual bool onReceiveData(mumble_connection_t connection, mumble_userid_t sender, const uint8_t *data, size_t dataLength, const char *dataID) const;
- /// Called to indicate that there is audio input
- ///
- /// @param inputPCM A pointer to a short array representing the input PCM
- /// @param sampleCount The amount of samples per channel
- /// @param channelCount The amount of channels in the PCM
- /// @param sampleRate The used sample rate in Hz
- /// @param isSpeech Whether Mumble considers the input as speech
- /// @returns Whether this pluign has modified the audio
- virtual bool onAudioInput(short *inputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate, bool isSpeech) const;
- /// Called to indicate that an audio source has been fetched
- ///
- /// @param outputPCM A pointer to a short array representing the output PCM
- /// @param sampleCount The amount of samples per channel
- /// @param channelCount The amount of channels in the PCM
- /// @param sampleRate The used sample rate in Hz
- /// @param isSpeech Whether Mumble considers the output as speech
- /// @param userID The ID of the user responsible for the output (only relevant if isSpeech == true)
- /// @returns Whether this pluign has modified the audio
- virtual bool onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate, bool isSpeech, mumble_userid_t userID) const;
- /// Called to indicate that audio is about to be played
- ///
- /// @param outputPCM A pointer to a short array representing the output PCM
- /// @param sampleCount The amount of samples per channel
- /// @param channelCount The amount of channels in the PCM
- /// @param sampleRate The used sample rate in Hz
- /// @returns Whether this pluign has modified the audio
- virtual bool onAudioOutputAboutToPlay(float *outputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate) const;
- /// Called when the server has synchronized with the client
- ///
- /// @param connection An object used to identify the current connection
- virtual void onServerSynchronized(mumble_connection_t connection) const;
- /// Called when a new user gets added to the user model. This is the case when that new user freshly connects to the server the
- /// local user is on but also when the local user connects to a server other clients are already connected to (in this case this
- /// method will be called for every client already on that server).
- ///
- /// @param connection An object used to identify the current connection
- /// @param userID The ID of the user that has been added
- virtual void onUserAdded(mumble_connection_t connection, mumble_userid_t userID) const;
- /// Called when a user gets removed from the user model. This is the case when that user disconnects from the server the
- /// local user is on but also when the local user disconnects from a server other clients are connected to (in this case this
- /// method will be called for every client on that server).
- ///
- /// @param connection An object used to identify the current connection
- /// @param userID The ID of the user that has been removed
- virtual void onUserRemoved(mumble_connection_t connection, mumble_userid_t userID) const;
- /// Called when a new channel gets added to the user model. This is the case when a new channel is created on the server the local
- /// user is on but also when the local user connects to a server that contains channels other than the root-channel (in this case
- /// this method will be called for ever non-root channel on that server).
- ///
- /// @param connection An object used to identify the current connection
- /// @param channelID The ID of the channel that has been added
- virtual void onChannelAdded(mumble_connection_t connection, mumble_channelid_t channelID) const;
- /// Called when a channel gets removed from the user model. This is the case when a channel is removed on the server the local
- /// user is on but also when the local user disconnects from a server that contains channels other than the root-channel (in this case
- /// this method will be called for ever non-root channel on that server).
- ///
- /// @param connection An object used to identify the current connection
- /// @param channelID The ID of the channel that has been removed
- virtual void onChannelRemoved(mumble_connection_t connection, mumble_channelid_t channelID) const;
- /// Called when a channel gets renamed. This also applies when a new channel is created (thus assigning it an initial name is
- /// also considered renaming).
- ///
- /// @param connection An object used to identify the current connection
- /// @param channelID The ID of the channel that has been renamed
- virtual void onChannelRenamed(mumble_connection_t connection, mumble_channelid_t channelID) const;
- /// Called when a key has been pressed or released while Mumble has keyboard focus.
- ///
- /// @param keyCode The key code of the respective key. The character codes are defined
- /// via the KeyCode enum. For printable 7-bit ASCII characters these codes conform
- /// to the ASCII code-page with the only difference that case is not distinguished. Therefore
- /// always the upper-case letter code will be used for letters.
- /// @param wasPress Whether the key has been pressed (instead of released)
- virtual void onKeyEvent(mumble_keycode_t keyCode, bool wasPress) const;
-
-
- public:
- /// A template function for instantiating new plugin objects and initializing them. The plugin will be allocated on the heap and has
- /// thus to be deleted via the delete instruction.
- ///
- /// @tparam T The type of the plugin to be instantiated
- /// @tparam Ts The types of the contructor arguments
- /// @param args A list of args passed to the contructor of the plugin object
- /// @returns A pointer to the allocated plugin
- ///
- /// @throws PluginError if the plugin could not be loaded
- template<typename T, typename ... Ts>
- static T* createNew(Ts&&...args) {
- static_assert(std::is_base_of<Plugin, T>::value, "The Plugin::create() can only be used to instantiate objects of base-type Plugin");
- static_assert(!std::is_pointer<T>::value, "Plugin::create() can't be used to instantiate pointers. It will return a pointer automatically");
-
- T *instancePtr = new T(std::forward<Ts>(args)...);
-
- // call the initialize-method and throw an exception of it doesn't succeed
- if (!instancePtr->doInitialize()) {
- delete instancePtr;
- // Delete the constructed object to prevent a memory leak
- throw PluginError("Failed to initialize plugin");
- }
-
- return instancePtr;
+private:
+ Q_OBJECT
+ Q_DISABLE_COPY(Plugin)
+protected:
+ /// A mutex guarding Plugin::nextID
+ static QMutex s_idLock;
+ /// The ID of the plugin that will be loaded next. Whenever accessing this field, Plugin::idLock should be locked.
+ static plugin_id_t s_nextID;
+
+ /// Constructor of the Plugin.
+ ///
+ /// @param path The path to the plugin's shared library file. This path has to exist unless isBuiltIn is true
+ /// @param isBuiltIn A flag indicating that this is a plugin built into Mumble itself and is does not backed by a
+ /// shared library
+ /// @param p A pointer to a QObject representing the parent of this object or nullptr if there is no parent
+ Plugin(QString path, bool isBuiltIn = false, QObject *p = nullptr);
+
+ /// A flag indicating whether this plugin is valid. It is mainly used throughout the plugin's initialization.
+ bool m_pluginIsValid;
+ /// The QLibrary representing the shared library of this plugin
+ QLibrary m_lib;
+ /// The path to the shared library file in the host's filesystem
+ QString m_pluginPath;
+ /// The unique ID of this plugin. Note though that this ID is not suitable for uniquely identifying this plugin
+ /// between restarts of Mumble (not even between rescans of the plugins) let alone across clients.
+ plugin_id_t m_pluginID;
+ // a flag indicating whether this plugin has been loaded by calling its init function.
+ bool m_pluginIsLoaded;
+ /// The lock guarding this plugin object. Every time a member is accessed this lock should be locked accordingly.
+ /// After successful construction and initialization (doInitilize()), this member variable is effectively const
+ /// and therefore no locking is required in order to read from it!
+ /// In fact protecting read-accesses by a non-recursive lock can introduce deadlocks by plugins using certain
+ /// API functions.
+ mutable QReadWriteLock m_pluginLock;
+ /// The struct holding the function pointers to the functions in the shared library.
+ MumblePluginFunctions m_pluginFnc;
+ /// A flag indicating whether this plugin is built into Mumble and is thus not represented by a shared library.
+ bool m_isBuiltIn;
+ /// A flag indicating whether positional data gathering is enabled for this plugin (Enabled as in allowed via
+ /// preferences).
+ bool m_positionalDataIsEnabled;
+ /// A flag indicating whether positional data gathering is currently active (Active as in running)
+ bool m_positionalDataIsActive;
+ /// A flag indicating whether this plugin has permission to monitor keyboard events that occur while
+ /// Mumble has the keyboard focus.
+ bool m_mayMonitorKeyboard;
+
+
+ QString extractWrappedString(MumbleStringWrapper wrapper) const;
+
+
+ // Most of this class's functions are protected in order to only allow access to them via the PluginManager
+ // as some require additional handling before/after calling them.
+
+ /// Initializes this plugin. This function must be called directly after construction. This is guaranteed when the
+ /// plugin is created via Plugin::createNew
+ virtual bool doInitialize();
+ /// Resolves the function pointers in the shared library and sets the respective fields in Plugin::apiFnc
+ virtual void resolveFunctionPointers();
+ /// Enables positional data gathering for this plugin (as in allowing)
+ ///
+ /// @param enable Whether to enable the data gathering
+ virtual void enablePositionalData(bool enable = true);
+ /// Allows or forbids the monitoring of keyboard events for this plugin.
+ ///
+ /// @param allow Whether to allow or forbid it
+ virtual void allowKeyboardMonitoring(bool allow);
+
+
+ /// Initializes this plugin
+ virtual mumble_error_t init();
+ /// Shuts this plugin down
+ virtual void shutdown();
+ /// Delegates the struct of API function pointers to the plugin backend
+ ///
+ /// @param api The pointer to the API struct
+ virtual void registerAPIFunctions(void *api) const;
+ /// Asks the plugin to release (free/delete) the resource pointed to by the given pointer
+ ///
+ /// @param pointer Pointer to the resource
+ virtual void releaseResource(const void *pointer) const;
+ /// Provides the plugin backend with some version information about Mumble
+ ///
+ /// @param mumbleVersion The version of the Mumble client
+ /// @param mumbleAPIVersion The API version used by the Mumble client
+ /// @param minimalExpectedAPIVersion The minimal API version expected to be used by the plugin backend
+ virtual void setMumbleInfo(mumble_version_t mumbleVersion, mumble_version_t mumbleAPIVersion,
+ mumble_version_t minimalExpectedAPIVersion) const;
+ /// Asks the plugin to deactivate certain features
+ ///
+ /// @param features The feature list or'ed together
+ /// @returns The list of features that couldn't be deactivated or'ed together
+ virtual uint32_t deactivateFeatures(uint32_t features) const;
+ /// Shows an about-dialog
+ ///
+ /// @parent A pointer to the QWidget that should be used as a parent
+ /// @returns Whether the dialog could be shown successfully
+ virtual bool showAboutDialog(QWidget *parent) const;
+ /// Shows a config-dialog
+ ///
+ /// @parent A pointer to the QWidget that should be used as a parent
+ /// @returns Whether the dialog could be shown successfully
+ virtual bool showConfigDialog(QWidget *parent) const;
+ /// Initializes the positional data gathering
+ ///
+ /// @params programNames A pointer to an array of const char* representing the program names
+ /// @params programCount A pointer to an array of PIDs corresponding to the program names
+ /// @params programCount The length of the two previous arrays
+ virtual uint8_t initPositionalData(const char *const *programNames, const uint64_t *programPIDs,
+ size_t programCount);
+ /// Fetches the positional data
+ ///
+ /// @param[out] avatarPos The position of the ingame avatar (player)
+ /// @param[out] avatarDir The directiion in which the avatar (player) is looking/facing
+ /// @param[out] avatarAxis The vector from the avatar's toes to its head
+ /// @param[out] cameraPos The position of the ingame camera
+ /// @param[out] cameraDir The direction in which the camera is looking/facing
+ /// @param[out] cameraAxis The vector from the camera's bottom to its top
+ /// @param[out] context The context of the current game-session (includes server/squad info)
+ /// @param[out] identity The ingame identity of the player (name)
+ virtual bool fetchPositionalData(Position3D &avatarPos, Vector3D &avatarDir, Vector3D &avatarAxis,
+ Position3D &cameraPos, Vector3D &cameraDir, Vector3D &cameraAxis, QString &context,
+ QString &identity) const;
+ /// Shuts down positional data gathering
+ virtual void shutdownPositionalData();
+ /// Called to indicate that the client has connected to a server
+ ///
+ /// @param connection An object used to identify the current connection
+ virtual void onServerConnected(mumble_connection_t connection) const;
+ /// Called to indicate that the client disconnected from a server
+ ///
+ /// @param connection An object used to identify the connection that has been disconnected
+ virtual void onServerDisconnected(mumble_connection_t connection) const;
+ /// Called to indicate that a user has switched its channel
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param userID The ID of the user that switched channel
+ /// @param previousChannelID The ID of the channel the user came from (-1 if there is no previous channel)
+ /// æparam newChannelID The ID of the channel the user has switched to
+ virtual void onChannelEntered(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_channelid_t previousChannelID, mumble_channelid_t newChannelID) const;
+ /// Called to indicate that a user exited a channel.
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param userID The ID of the user that switched channel
+ /// @param channelID The ID of the channel the user exited
+ virtual void onChannelExited(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_channelid_t channelID) const;
+ /// Called to indicate that a user has changed its talking state
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param userID The ID of the user that switched channel
+ /// @param talkingState The new talking state of the user
+ virtual void onUserTalkingStateChanged(mumble_connection_t connection, mumble_userid_t userID,
+ mumble_talking_state_t talkingState) const;
+ /// Called to indicate that a data packet has been received
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param sender The ID of the user whose client sent the data
+ /// @param data The actual data
+ /// @param dataLength The length of the data array
+ /// @param datID The ID of the data used to determine whether this plugin handles this data or not
+ /// @returns Whether this plugin handled the data
+ virtual bool onReceiveData(mumble_connection_t connection, mumble_userid_t sender, const uint8_t *data,
+ size_t dataLength, const char *dataID) const;
+ /// Called to indicate that there is audio input
+ ///
+ /// @param inputPCM A pointer to a short array representing the input PCM
+ /// @param sampleCount The amount of samples per channel
+ /// @param channelCount The amount of channels in the PCM
+ /// @param sampleRate The used sample rate in Hz
+ /// @param isSpeech Whether Mumble considers the input as speech
+ /// @returns Whether this pluign has modified the audio
+ virtual bool onAudioInput(short *inputPCM, uint32_t sampleCount, uint16_t channelCount, uint32_t sampleRate,
+ bool isSpeech) const;
+ /// Called to indicate that an audio source has been fetched
+ ///
+ /// @param outputPCM A pointer to a short array representing the output PCM
+ /// @param sampleCount The amount of samples per channel
+ /// @param channelCount The amount of channels in the PCM
+ /// @param sampleRate The used sample rate in Hz
+ /// @param isSpeech Whether Mumble considers the output as speech
+ /// @param userID The ID of the user responsible for the output (only relevant if isSpeech == true)
+ /// @returns Whether this pluign has modified the audio
+ virtual bool onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16_t channelCount,
+ uint32_t sampleRate, bool isSpeech, mumble_userid_t userID) const;
+ /// Called to indicate that audio is about to be played
+ ///
+ /// @param outputPCM A pointer to a short array representing the output PCM
+ /// @param sampleCount The amount of samples per channel
+ /// @param channelCount The amount of channels in the PCM
+ /// @param sampleRate The used sample rate in Hz
+ /// @returns Whether this pluign has modified the audio
+ virtual bool onAudioOutputAboutToPlay(float *outputPCM, uint32_t sampleCount, uint16_t channelCount,
+ uint32_t sampleRate) const;
+ /// Called when the server has synchronized with the client
+ ///
+ /// @param connection An object used to identify the current connection
+ virtual void onServerSynchronized(mumble_connection_t connection) const;
+ /// Called when a new user gets added to the user model. This is the case when that new user freshly connects to the
+ /// server the local user is on but also when the local user connects to a server other clients are already
+ /// connected to (in this case this method will be called for every client already on that server).
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param userID The ID of the user that has been added
+ virtual void onUserAdded(mumble_connection_t connection, mumble_userid_t userID) const;
+ /// Called when a user gets removed from the user model. This is the case when that user disconnects from the server
+ /// the local user is on but also when the local user disconnects from a server other clients are connected to (in
+ /// this case this method will be called for every client on that server).
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param userID The ID of the user that has been removed
+ virtual void onUserRemoved(mumble_connection_t connection, mumble_userid_t userID) const;
+ /// Called when a new channel gets added to the user model. This is the case when a new channel is created on the
+ /// server the local user is on but also when the local user connects to a server that contains channels other than
+ /// the root-channel (in this case this method will be called for ever non-root channel on that server).
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param channelID The ID of the channel that has been added
+ virtual void onChannelAdded(mumble_connection_t connection, mumble_channelid_t channelID) const;
+ /// Called when a channel gets removed from the user model. This is the case when a channel is removed on the server
+ /// the local user is on but also when the local user disconnects from a server that contains channels other than
+ /// the root-channel (in this case this method will be called for ever non-root channel on that server).
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param channelID The ID of the channel that has been removed
+ virtual void onChannelRemoved(mumble_connection_t connection, mumble_channelid_t channelID) const;
+ /// Called when a channel gets renamed. This also applies when a new channel is created (thus assigning it an
+ /// initial name is also considered renaming).
+ ///
+ /// @param connection An object used to identify the current connection
+ /// @param channelID The ID of the channel that has been renamed
+ virtual void onChannelRenamed(mumble_connection_t connection, mumble_channelid_t channelID) const;
+ /// Called when a key has been pressed or released while Mumble has keyboard focus.
+ ///
+ /// @param keyCode The key code of the respective key. The character codes are defined
+ /// via the KeyCode enum. For printable 7-bit ASCII characters these codes conform
+ /// to the ASCII code-page with the only difference that case is not distinguished. Therefore
+ /// always the upper-case letter code will be used for letters.
+ /// @param wasPress Whether the key has been pressed (instead of released)
+ virtual void onKeyEvent(mumble_keycode_t keyCode, bool wasPress) const;
+
+
+public:
+ /// A template function for instantiating new plugin objects and initializing them. The plugin will be allocated on
+ /// the heap and has thus to be deleted via the delete instruction.
+ ///
+ /// @tparam T The type of the plugin to be instantiated
+ /// @tparam Ts The types of the contructor arguments
+ /// @param args A list of args passed to the contructor of the plugin object
+ /// @returns A pointer to the allocated plugin
+ ///
+ /// @throws PluginError if the plugin could not be loaded
+ template< typename T, typename... Ts > static T *createNew(Ts &&... args) {
+ static_assert(std::is_base_of< Plugin, T >::value,
+ "The Plugin::create() can only be used to instantiate objects of base-type Plugin");
+ static_assert(!std::is_pointer< T >::value,
+ "Plugin::create() can't be used to instantiate pointers. It will return a pointer automatically");
+
+ T *instancePtr = new T(std::forward< Ts >(args)...);
+
+ // call the initialize-method and throw an exception of it doesn't succeed
+ if (!instancePtr->doInitialize()) {
+ delete instancePtr;
+ // Delete the constructed object to prevent a memory leak
+ throw PluginError("Failed to initialize plugin");
}
- /// Destructor
- virtual ~Plugin() Q_DECL_OVERRIDE;
- /// @returns Whether this plugin is in a valid state
- virtual bool isValid() const;
- /// @returns Whether this plugin is loaded (has been initialized via Plugin::init())
- virtual bool isLoaded() const Q_DECL_FINAL;
- /// @returns The unique ID of this plugin. This ID holds only as long as this plugin isn't "reconstructed".
- virtual plugin_id_t getID() const Q_DECL_FINAL;
- /// @returns Whether this plugin is built into Mumble (thus not backed by a shared library)
- virtual bool isBuiltInPlugin() const Q_DECL_FINAL;
- /// @returns The path to the shared library in the host's filesystem
- virtual QString getFilePath() const;
- /// @returns Whether positional data gathering is enabled (as in allowed via preferences)
- virtual bool isPositionalDataEnabled() const Q_DECL_FINAL;
- /// @returns Whether positional data gathering is currently active (as in running)
- virtual bool isPositionalDataActive() const Q_DECL_FINAL;
- /// @returns Whether this plugin is currently allowed to monitor keyboard events
- virtual bool isKeyboardMonitoringAllowed() const Q_DECL_FINAL;
-
-
- /// @returns Whether this plugin provides an about-dialog
- virtual bool providesAboutDialog() const;
- /// @returns Whether this plugin provides an config-dialog
- virtual bool providesConfigDialog() const;
- /// @returns The name of this plugin
- virtual QString getName() const;
- /// @returns The API version this plugin intends to use
- virtual mumble_version_t getAPIVersion() const;
- /// @returns The version of this plugin
- virtual mumble_version_t getVersion() const;
- /// @returns The author of this plugin
- virtual QString getAuthor() const;
- /// @returns The plugin's description
- virtual QString getDescription() const;
- /// @returns The plugin's features or'ed together (See the PluginFeature enum in MumblePlugin.h for what features are available)
- virtual uint32_t getFeatures() const;
- /// @return Whether the plugin has found a new/updated version of itself available for download
- virtual bool hasUpdate() const;
- /// @return The URL to download the updated plugin. May be empty
- virtual QUrl getUpdateDownloadURL() const;
+ return instancePtr;
+ }
+
+ /// Destructor
+ virtual ~Plugin() Q_DECL_OVERRIDE;
+ /// @returns Whether this plugin is in a valid state
+ virtual bool isValid() const;
+ /// @returns Whether this plugin is loaded (has been initialized via Plugin::init())
+ virtual bool isLoaded() const Q_DECL_FINAL;
+ /// @returns The unique ID of this plugin. This ID holds only as long as this plugin isn't "reconstructed".
+ virtual plugin_id_t getID() const Q_DECL_FINAL;
+ /// @returns Whether this plugin is built into Mumble (thus not backed by a shared library)
+ virtual bool isBuiltInPlugin() const Q_DECL_FINAL;
+ /// @returns The path to the shared library in the host's filesystem
+ virtual QString getFilePath() const;
+ /// @returns Whether positional data gathering is enabled (as in allowed via preferences)
+ virtual bool isPositionalDataEnabled() const Q_DECL_FINAL;
+ /// @returns Whether positional data gathering is currently active (as in running)
+ virtual bool isPositionalDataActive() const Q_DECL_FINAL;
+ /// @returns Whether this plugin is currently allowed to monitor keyboard events
+ virtual bool isKeyboardMonitoringAllowed() const Q_DECL_FINAL;
+
+
+ /// @returns Whether this plugin provides an about-dialog
+ virtual bool providesAboutDialog() const;
+ /// @returns Whether this plugin provides an config-dialog
+ virtual bool providesConfigDialog() const;
+ /// @returns The name of this plugin
+ virtual QString getName() const;
+ /// @returns The API version this plugin intends to use
+ virtual mumble_version_t getAPIVersion() const;
+ /// @returns The version of this plugin
+ virtual mumble_version_t getVersion() const;
+ /// @returns The author of this plugin
+ virtual QString getAuthor() const;
+ /// @returns The plugin's description
+ virtual QString getDescription() const;
+ /// @returns The plugin's features or'ed together (See the PluginFeature enum in MumblePlugin.h for what features
+ /// are available)
+ virtual uint32_t getFeatures() const;
+ /// @return Whether the plugin has found a new/updated version of itself available for download
+ virtual bool hasUpdate() const;
+ /// @return The URL to download the updated plugin. May be empty
+ virtual QUrl getUpdateDownloadURL() const;
};
#endif
diff --git a/src/mumble/PluginConfig.cpp b/src/mumble/PluginConfig.cpp
index e70877067..6b1c1dd31 100644
--- a/src/mumble/PluginConfig.cpp
+++ b/src/mumble/PluginConfig.cpp
@@ -7,20 +7,20 @@
#include "Log.h"
#include "MainWindow.h"
+#include "ManualPlugin.h"
#include "Message.h"
-#include "ServerHandler.h"
-#include "WebFetch.h"
#include "MumbleApplication.h"
-#include "ManualPlugin.h"
-#include "Utils.h"
#include "PluginInstaller.h"
#include "PluginManager.h"
+#include "ServerHandler.h"
+#include "Utils.h"
+#include "WebFetch.h"
-#include <QtWidgets/QMessageBox>
-#include <QtCore/QUrl>
#include <QtCore/QDir>
#include <QtCore/QStandardPaths>
+#include <QtCore/QUrl>
#include <QtWidgets/QFileDialog>
+#include <QtWidgets/QMessageBox>
#include "Global.h"
const QString PluginConfig::name = QLatin1String("PluginConfig");
@@ -74,7 +74,8 @@ void PluginConfig::on_qpbInstallPlugin_clicked() {
// Reload plugins so the new one actually shows up
on_qpbReload_clicked();
- QMessageBox::information(this, "Mumble", tr("The plugin was installed successfully"), QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::information(this, "Mumble", tr("The plugin was installed successfully"), QMessageBox::Ok,
+ QMessageBox::NoButton);
}
} catch (const PluginInstallException &e) {
QMessageBox::critical(this, "Mumble", e.getMessage(), QMessageBox::Ok, QMessageBox::NoButton);
@@ -91,15 +92,14 @@ void PluginConfig::save() const {
Global::get().pluginManager->unlinkPositionalData();
}
- constexpr int enableCol = 1;
- constexpr int positionalDataCol = 2;
+ constexpr int enableCol = 1;
+ constexpr int positionalDataCol = 2;
constexpr int keyboardMonitorCol = 3;
- QList<QTreeWidgetItem *> list = qtwPlugins->findItems(QString(), Qt::MatchContains);
- for(QTreeWidgetItem *i : list) {
-
- bool enable = (i->checkState(enableCol) == Qt::Checked);
- bool positionalDataEnabled = (i->checkState(positionalDataCol) == Qt::Checked);
+ QList< QTreeWidgetItem * > list = qtwPlugins->findItems(QString(), Qt::MatchContains);
+ for (QTreeWidgetItem *i : list) {
+ bool enable = (i->checkState(enableCol) == Qt::Checked);
+ bool positionalDataEnabled = (i->checkState(positionalDataCol) == Qt::Checked);
bool keyboardMonitoringEnabled = (i->checkState(keyboardMonitorCol) == Qt::Checked);
const_plugin_ptr_t plugin = pluginForItem(i);
@@ -122,10 +122,13 @@ void PluginConfig::save() const {
}
if (featuresToDeactivate != FEATURE_NONE) {
- uint32_t remainingFeatures = Global::get().pluginManager->deactivateFeaturesFor(plugin->getID(), featuresToDeactivate);
+ uint32_t remainingFeatures =
+ Global::get().pluginManager->deactivateFeaturesFor(plugin->getID(), featuresToDeactivate);
if (remainingFeatures != FEATURE_NONE) {
- Global::get().l->log(Log::Warning, tr("Unable to deactivate all requested features for plugin \"%1\"").arg(plugin->getName()));
+ Global::get().l->log(Log::Warning,
+ tr("Unable to deactivate all requested features for plugin \"%1\"")
+ .arg(plugin->getName()));
}
}
} else {
@@ -137,8 +140,10 @@ void PluginConfig::save() const {
Global::get().pluginManager->unloadPlugin(plugin->getID());
}
- QString pluginKey = QLatin1String(QCryptographicHash::hash(plugin->getFilePath().toUtf8(), QCryptographicHash::Sha1).toHex());
- s.qhPluginSettings.insert(pluginKey, { plugin->getFilePath(), enable, positionalDataEnabled, keyboardMonitoringEnabled });
+ QString pluginKey = QLatin1String(
+ QCryptographicHash::hash(plugin->getFilePath().toUtf8(), QCryptographicHash::Sha1).toHex());
+ s.qhPluginSettings.insert(
+ pluginKey, { plugin->getFilePath(), enable, positionalDataEnabled, keyboardMonitoringEnabled });
}
}
}
@@ -157,7 +162,8 @@ void PluginConfig::on_qpbConfig_clicked() {
if (plugin) {
if (!plugin->showConfigDialog(this)) {
// if the plugin doesn't support showing such a dialog, we'll show a default one
- QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no configure function."), QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no configure function."),
+ QMessageBox::Ok, QMessageBox::NoButton);
}
}
}
@@ -168,7 +174,8 @@ void PluginConfig::on_qpbAbout_clicked() {
if (plugin) {
if (!plugin->showAboutDialog(this)) {
// if the plugin doesn't support showing such a dialog, we'll show a default one
- QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no about function."), QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no about function."),
+ QMessageBox::Ok, QMessageBox::NoButton);
}
}
}
@@ -203,13 +210,13 @@ void PluginConfig::refillPluginList() {
qtwPlugins->clear();
// get plugins already sorted according to their name
- const QVector<const_plugin_ptr_t > plugins = Global::get().pluginManager->getPlugins(true);
+ const QVector< const_plugin_ptr_t > plugins = Global::get().pluginManager->getPlugins(true);
- foreach(const_plugin_ptr_t currentPlugin, plugins) {
+ foreach (const_plugin_ptr_t currentPlugin, plugins) {
QTreeWidgetItem *i = new QTreeWidgetItem(qtwPlugins);
i->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
i->setCheckState(1, currentPlugin->isLoaded() ? Qt::Checked : Qt::Unchecked);
-
+
if (currentPlugin->getFeatures() & FEATURE_POSITIONAL) {
i->setCheckState(2, currentPlugin->isPositionalDataEnabled() ? Qt::Checked : Qt::Unchecked);
i->setToolTip(2, tr("Whether the positional audio feature of this plugin should be enabled"));
@@ -218,7 +225,8 @@ void PluginConfig::refillPluginList() {
}
i->setCheckState(3, currentPlugin->isKeyboardMonitoringAllowed() ? Qt::Checked : Qt::Unchecked);
- i->setToolTip(3, tr("Whether this plugin has the permission to be listening to all keyboard events that occur while Mumble has focus"));
+ i->setToolTip(3, tr("Whether this plugin has the permission to be listening to all keyboard events that occur "
+ "while Mumble has focus"));
i->setText(0, currentPlugin->getName());
i->setToolTip(0, currentPlugin->getDescription().toHtmlEscaped());
diff --git a/src/mumble/PluginConfig.h b/src/mumble/PluginConfig.h
index cab9ce7b3..807422085 100644
--- a/src/mumble/PluginConfig.h
+++ b/src/mumble/PluginConfig.h
@@ -7,60 +7,61 @@
#define MUMBLE_MUMBLE_PLUGINS_H_
#include "ConfigDialog.h"
-#include "ui_PluginConfig.h"
#include "Plugin.h"
+#include "ui_PluginConfig.h"
-#include <QtCore/QObject>
#include <QtCore/QMutex>
+#include <QtCore/QObject>
#include <QtCore/QReadWriteLock>
struct PluginInfo;
class PluginConfig : public ConfigWidget, public Ui::PluginConfig {
- private:
- Q_OBJECT
- Q_DISABLE_COPY(PluginConfig)
- protected:
- /// Clears and (re-) populates the plugin list in the UI with the currently available plugins
- void refillPluginList();
- /// @param item The QTreeWidgetItem to retrieve the plugin for
- /// @returns The plugin corresponding to the provided item
- const_plugin_ptr_t pluginForItem(QTreeWidgetItem *item) const;
- public:
- /// The unique name of this ConfigWidget
- static const QString name;
- /// Constructor
- ///
- /// @param st The settings object to work on
- PluginConfig(Settings &st);
- /// @returns The title of this widget
- virtual QString title() const Q_DECL_OVERRIDE;
- /// @returns The name of this ConfigWidget
- const QString &getName() const Q_DECL_OVERRIDE;
- /// @returns The icon for this widget
- virtual QIcon icon() const Q_DECL_OVERRIDE;
- public slots:
- /// Saves the current configuration to the respective settings object
- void save() const Q_DECL_OVERRIDE;
- /// Loads the transmit-position from the provided settings object
- ///
- /// @param The setting sobject to read from
- void load(const Settings &r) Q_DECL_OVERRIDE;
- /// Slot triggered when the install-button in the UI has been clicked
- void on_qpbInstallPlugin_clicked();
- /// Slot triggered when the config-button in the UI has been clicked
- void on_qpbConfig_clicked();
- /// Slot triggered when the about-button in the UI has been clicked
- void on_qpbAbout_clicked();
- /// Slot triggered when the reload-button in the UI has been clicked
- void on_qpbReload_clicked();
- /// Slot triggered when the unload-button in the UI has been clicked
- void on_qpbUnload_clicked();
- /// Slot triggered when the selection in the plugin list hast changed
- ///
- /// @param current The currently selected item
- /// @param old The previously selected item (if applicable - otherwise NULL/nullptr)
- void on_qtwPlugins_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *old);
+private:
+ Q_OBJECT
+ Q_DISABLE_COPY(PluginConfig)
+protected:
+ /// Clears and (re-) populates the plugin list in the UI with the currently available plugins
+ void refillPluginList();
+ /// @param item The QTreeWidgetItem to retrieve the plugin for
+ /// @returns The plugin corresponding to the provided item
+ const_plugin_ptr_t pluginForItem(QTreeWidgetItem *item) const;
+
+public:
+ /// The unique name of this ConfigWidget
+ static const QString name;
+ /// Constructor
+ ///
+ /// @param st The settings object to work on
+ PluginConfig(Settings &st);
+ /// @returns The title of this widget
+ virtual QString title() const Q_DECL_OVERRIDE;
+ /// @returns The name of this ConfigWidget
+ const QString &getName() const Q_DECL_OVERRIDE;
+ /// @returns The icon for this widget
+ virtual QIcon icon() const Q_DECL_OVERRIDE;
+public slots:
+ /// Saves the current configuration to the respective settings object
+ void save() const Q_DECL_OVERRIDE;
+ /// Loads the transmit-position from the provided settings object
+ ///
+ /// @param The setting sobject to read from
+ void load(const Settings &r) Q_DECL_OVERRIDE;
+ /// Slot triggered when the install-button in the UI has been clicked
+ void on_qpbInstallPlugin_clicked();
+ /// Slot triggered when the config-button in the UI has been clicked
+ void on_qpbConfig_clicked();
+ /// Slot triggered when the about-button in the UI has been clicked
+ void on_qpbAbout_clicked();
+ /// Slot triggered when the reload-button in the UI has been clicked
+ void on_qpbReload_clicked();
+ /// Slot triggered when the unload-button in the UI has been clicked
+ void on_qpbUnload_clicked();
+ /// Slot triggered when the selection in the plugin list hast changed
+ ///
+ /// @param current The currently selected item
+ /// @param old The previously selected item (if applicable - otherwise NULL/nullptr)
+ void on_qtwPlugins_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *old);
};
#endif
diff --git a/src/mumble/PluginInstaller.cpp b/src/mumble/PluginInstaller.cpp
index 41494d64e..f9c7a9a35 100644
--- a/src/mumble/PluginInstaller.cpp
+++ b/src/mumble/PluginInstaller.cpp
@@ -6,25 +6,24 @@
#include "PluginInstaller.h"
#include "Global.h"
-#include <QtCore/QString>
+#include <QtCore/QDir>
#include <QtCore/QException>
#include <QtCore/QObject>
+#include <QtCore/QString>
#include <QtCore/QStringList>
-#include <QtCore/QDir>
#include <QtGui/QIcon>
#include <exception>
-#include <string>
#include <fstream>
+#include <string>
+#include <Poco/Exception.h>
+#include <Poco/StreamCopier.h>
#include <Poco/Zip/ZipArchive.h>
#include <Poco/Zip/ZipStream.h>
-#include <Poco/StreamCopier.h>
-#include <Poco/Exception.h>
-PluginInstallException::PluginInstallException(const QString& msg)
- : m_msg(msg) {
+PluginInstallException::PluginInstallException(const QString &msg) : m_msg(msg) {
}
QString PluginInstallException::getMessage() const {
@@ -33,14 +32,14 @@ QString PluginInstallException::getMessage() const {
const QString PluginInstaller::pluginFileExtension = QLatin1String("mumble_plugin");
-bool PluginInstaller::canBePluginFile(const QFileInfo& fileInfo) noexcept {
+bool PluginInstaller::canBePluginFile(const QFileInfo &fileInfo) noexcept {
if (!fileInfo.isFile()) {
// A plugin file has to be a file (obviously)
return false;
}
if (fileInfo.suffix().compare(PluginInstaller::pluginFileExtension, Qt::CaseInsensitive) == 0
- || fileInfo.suffix().compare(QLatin1String("zip"), Qt::CaseInsensitive) == 0) {
+ || fileInfo.suffix().compare(QLatin1String("zip"), Qt::CaseInsensitive) == 0) {
// A plugin file has either the extension given in PluginInstaller::pluginFileExtension or zip
return true;
}
@@ -49,12 +48,8 @@ bool PluginInstaller::canBePluginFile(const QFileInfo& fileInfo) noexcept {
return QLibrary::isLibrary(fileInfo.fileName());
}
-PluginInstaller::PluginInstaller(const QFileInfo& fileInfo, QWidget *p)
- : QDialog(p),
- m_pluginArchive(fileInfo),
- m_plugin(nullptr),
- m_pluginSource(),
- m_pluginDestination(),
+PluginInstaller::PluginInstaller(const QFileInfo &fileInfo, QWidget *p)
+ : QDialog(p), m_pluginArchive(fileInfo), m_plugin(nullptr), m_pluginSource(), m_pluginDestination(),
m_copyPlugin(false) {
setupUi(this);
@@ -96,8 +91,11 @@ void PluginInstaller::init() {
if (QLibrary::isLibrary(currentFileName)) {
if (!pluginName.isEmpty()) {
// There seem to be multiple plugins in here. That's not allowed
- throw PluginInstallException(tr("Found more than one plugin library for the current OS in \"%1\" (\"%2\" and \"%3\")!").arg(
- m_pluginArchive.fileName()).arg(pluginName).arg(currentFileName));
+ throw PluginInstallException(
+ tr("Found more than one plugin library for the current OS in \"%1\" (\"%2\" and \"%3\")!")
+ .arg(m_pluginArchive.fileName())
+ .arg(pluginName)
+ .arg(currentFileName));
}
pluginName = currentFileName;
@@ -107,22 +105,24 @@ void PluginInstaller::init() {
}
if (pluginName.isEmpty()) {
- throw PluginInstallException(tr("Unable to find a plugin for the current OS in \"%1\"").arg(m_pluginArchive.fileName()));
+ throw PluginInstallException(
+ tr("Unable to find a plugin for the current OS in \"%1\"").arg(m_pluginArchive.fileName()));
}
// Unpack the plugin library into the tmp dir
// We don't have to create the directory structure as we're only interested in the library itself
QString tmpPluginPath = QDir::temp().filePath(QFileInfo(pluginName).fileName());
- auto pluginIt = archive.findHeader(pluginName.toStdString());
+ auto pluginIt = archive.findHeader(pluginName.toStdString());
zipInput.clear();
Poco::Zip::ZipInputStream zipin(zipInput, pluginIt->second);
std::ofstream out(tmpPluginPath.toStdString());
Poco::StreamCopier::copyStream(zipin, out);
m_pluginSource = QFileInfo(tmpPluginPath);
- } catch(const Poco::Exception &e) {
+ } catch (const Poco::Exception &e) {
// Something didn't work out during the Zip processing
- throw PluginInstallException(QString::fromStdString(std::string("Failed to process zip archive: ") + e.message()));
+ throw PluginInstallException(
+ QString::fromStdString(std::string("Failed to process zip archive: ") + e.message()));
}
}
@@ -130,9 +130,10 @@ void PluginInstaller::init() {
// Try to load the plugin up to see if it is actually valid
try {
- m_plugin = Plugin::createNew<Plugin>(m_pluginSource.absoluteFilePath());
- } catch(const PluginError&) {
- throw PluginInstallException(tr("Unable to load plugin \"%1\" - check the plugin interface!").arg(pluginFileName));
+ m_plugin = Plugin::createNew< Plugin >(m_pluginSource.absoluteFilePath());
+ } catch (const PluginError &) {
+ throw PluginInstallException(
+ tr("Unable to load plugin \"%1\" - check the plugin interface!").arg(pluginFileName));
}
m_pluginDestination = QFileInfo(QString::fromLatin1("%1/%2").arg(getInstallDir()).arg(pluginFileName));
@@ -141,11 +142,12 @@ void PluginInstaller::init() {
// Now that we located the plugin, it is time to fill in its details in the UI
qlName->setText(m_plugin->getName());
- mumble_version_t pluginVersion = m_plugin->getVersion();
+ mumble_version_t pluginVersion = m_plugin->getVersion();
mumble_version_t usedAPIVersion = m_plugin->getAPIVersion();
- qlVersion->setText(QString::fromLatin1("%1 (API %2)").arg(pluginVersion == VERSION_UNKNOWN ?
- "Unknown" : static_cast<QString>(pluginVersion)).arg(
- usedAPIVersion == VERSION_UNKNOWN ? "Unknown" : static_cast<QString>(usedAPIVersion)));
+ qlVersion->setText(
+ QString::fromLatin1("%1 (API %2)")
+ .arg(pluginVersion == VERSION_UNKNOWN ? "Unknown" : static_cast< QString >(pluginVersion))
+ .arg(usedAPIVersion == VERSION_UNKNOWN ? "Unknown" : static_cast< QString >(usedAPIVersion)));
qlAuthor->setText(m_plugin->getAuthor());
@@ -166,19 +168,22 @@ void PluginInstaller::install() const {
if (m_pluginDestination.exists()) {
// Delete old version first
if (!QFile(m_pluginDestination.absoluteFilePath()).remove()) {
- throw PluginInstallException(tr("Unable to delete old plugin at \"%1\"").arg(m_pluginDestination.absoluteFilePath()));
+ throw PluginInstallException(
+ tr("Unable to delete old plugin at \"%1\"").arg(m_pluginDestination.absoluteFilePath()));
}
}
if (m_copyPlugin) {
if (!QFile(m_pluginSource.absoluteFilePath()).copy(m_pluginDestination.absoluteFilePath())) {
- throw PluginInstallException(tr("Unable to copy plugin library from \"%1\" to \"%2\"").arg(m_pluginSource.absoluteFilePath()).arg(
- m_pluginDestination.absoluteFilePath()));
+ throw PluginInstallException(tr("Unable to copy plugin library from \"%1\" to \"%2\"")
+ .arg(m_pluginSource.absoluteFilePath())
+ .arg(m_pluginDestination.absoluteFilePath()));
}
} else {
// Move the plugin into the respective dir
if (!QFile(m_pluginSource.absoluteFilePath()).rename(m_pluginDestination.absoluteFilePath())) {
- throw PluginInstallException(tr("Unable to move plugin library to \"%1\"").arg(m_pluginDestination.absoluteFilePath()));
+ throw PluginInstallException(
+ tr("Unable to move plugin library to \"%1\"").arg(m_pluginDestination.absoluteFilePath()));
}
}
}
diff --git a/src/mumble/PluginInstaller.h b/src/mumble/PluginInstaller.h
index d8df3c303..e092ee8f9 100644
--- a/src/mumble/PluginInstaller.h
+++ b/src/mumble/PluginInstaller.h
@@ -7,8 +7,8 @@
#define MUMBLE_MUMBLE_PLUGININSTALLER_H_
-#include <QtCore/QFileInfo>
#include <QtCore/QException>
+#include <QtCore/QFileInfo>
#include "Plugin.h"
@@ -16,69 +16,72 @@
/// An exception thrown by the PluginInstaller
class PluginInstallException : public QException {
- protected:
- /// The exception's message
- QString m_msg;
- public:
- /// @param msg The message stating why this exception has been thrown
- PluginInstallException(const QString& msg);
-
- /// @returns This exception's message
- QString getMessage() const;
+protected:
+ /// The exception's message
+ QString m_msg;
+
+public:
+ /// @param msg The message stating why this exception has been thrown
+ PluginInstallException(const QString &msg);
+
+ /// @returns This exception's message
+ QString getMessage() const;
};
/// The PluginInstaller can be used to install plugins into Mumble. It verifies that the respective
/// plugin is functional and will automatiacally copy/move the plugin library to the respective
/// directory on the FileSystem.
class PluginInstaller : public QDialog, public Ui::PluginInstaller {
- private:
- Q_OBJECT;
- Q_DISABLE_COPY(PluginInstaller);
- protected:
- /// The file the installer has been invoked on
- QFileInfo m_pluginArchive;
- /// A pointer to the plugin instance created from the plugin library that shall be installed
- Plugin *m_plugin;
- /// The actual plugin library file
- QFileInfo m_pluginSource;
- /// The destinaton file to which the plugin library shall be copied
- QFileInfo m_pluginDestination;
- /// A flag indicating that the plugin library shall be copied instead of moved in order
- /// to install it.
- bool m_copyPlugin;
-
- /// Initializes this installer by processing the provided plugin source and filling all
- /// internal fields. This function is called from the constructor.
- ///
- /// @throws PluginInstallException If something isn't right or goes wrong
- void init();
- public:
- /// The "special" file-extension associated with Mumble plugins
- static const QString pluginFileExtension;
-
- /// A helper function checking whether the provided file could be a plugin source
- ///
- /// @param fileInfo The file to check
- /// @returns Whether the provided file could (!) be a plugin source
- static bool canBePluginFile(const QFileInfo& fileInfo) noexcept;
-
- /// @param fileInfo The plugin source to process
- ///
- /// @throws PluginInstallException If something isn't right or goes wrong
- PluginInstaller(const QFileInfo& fileInfo, QWidget *p = nullptr);
- /// Destructor
- ~PluginInstaller();
-
- /// Performs the actual installation (moving/copying of the library) of the plugin
- void install() const;
-
- static QString getInstallDir();
-
- public slots:
- /// Slot called when the user clicks the yes button
- void on_qpbYesClicked();
- /// Slot called when the user clicks the no button
- void on_qpbNoClicked();
+private:
+ Q_OBJECT;
+ Q_DISABLE_COPY(PluginInstaller);
+
+protected:
+ /// The file the installer has been invoked on
+ QFileInfo m_pluginArchive;
+ /// A pointer to the plugin instance created from the plugin library that shall be installed
+ Plugin *m_plugin;
+ /// The actual plugin library file
+ QFileInfo m_pluginSource;
+ /// The destinaton file to which the plugin library shall be copied
+ QFileInfo m_pluginDestination;
+ /// A flag indicating that the plugin library shall be copied instead of moved in order
+ /// to install it.
+ bool m_copyPlugin;
+
+ /// Initializes this installer by processing the provided plugin source and filling all
+ /// internal fields. This function is called from the constructor.
+ ///
+ /// @throws PluginInstallException If something isn't right or goes wrong
+ void init();
+
+public:
+ /// The "special" file-extension associated with Mumble plugins
+ static const QString pluginFileExtension;
+
+ /// A helper function checking whether the provided file could be a plugin source
+ ///
+ /// @param fileInfo The file to check
+ /// @returns Whether the provided file could (!) be a plugin source
+ static bool canBePluginFile(const QFileInfo &fileInfo) noexcept;
+
+ /// @param fileInfo The plugin source to process
+ ///
+ /// @throws PluginInstallException If something isn't right or goes wrong
+ PluginInstaller(const QFileInfo &fileInfo, QWidget *p = nullptr);
+ /// Destructor
+ ~PluginInstaller();
+
+ /// Performs the actual installation (moving/copying of the library) of the plugin
+ void install() const;
+
+ static QString getInstallDir();
+
+public slots:
+ /// Slot called when the user clicks the yes button
+ void on_qpbYesClicked();
+ /// Slot called when the user clicks the no button
+ void on_qpbNoClicked();
};
#endif // MUMBLE_MUMBLE_PLUGININSTALLER_H_
diff --git a/src/mumble/PluginManager.cpp b/src/mumble/PluginManager.cpp
index 817eb69be..db7a8dfef 100644
--- a/src/mumble/PluginManager.cpp
+++ b/src/mumble/PluginManager.cpp
@@ -3,56 +3,47 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-#include <limits>
+#include <limits>
-#include "PluginManager.h"
#include "LegacyPlugin.h"
-#include <QReadLocker>
-#include <QWriteLocker>
-#include <QReadLocker>
-#include <QDir>
-#include <QFileInfoList>
-#include <QFileInfo>
-#include <QVector>
+#include "PluginManager.h"
#include <QByteArray>
#include <QChar>
-#include <QMutexLocker>
+#include <QDir>
+#include <QFileInfo>
+#include <QFileInfoList>
#include <QHashIterator>
#include <QKeyEvent>
+#include <QMutexLocker>
+#include <QReadLocker>
#include <QTimer>
+#include <QVector>
+#include <QWriteLocker>
-#include "ManualPlugin.h"
+#include "API.h"
#include "Log.h"
+#include "ManualPlugin.h"
#include "PluginInstaller.h"
+#include "PluginUpdater.h"
#include "ProcessResolver.h"
#include "ServerHandler.h"
-#include "PluginUpdater.h"
-#include "API.h"
#include "Global.h"
#include <memory>
#ifdef Q_OS_WIN
- #include <tlhelp32.h>
- #include <string>
+# include <tlhelp32.h>
+# include <string>
#endif
#ifdef Q_OS_LINUX
- #include <QtCore/QStringList>
+# include <QtCore/QStringList>
#endif
-PluginManager::PluginManager(QSet<QString> *additionalSearchPaths, QObject *p)
- : QObject(p),
- m_pluginCollectionLock(QReadWriteLock::NonRecursive),
- m_pluginHashMap(),
- m_positionalData(),
- m_positionalDataCheckTimer(),
- m_sentDataMutex(),
- m_sentData(),
- m_activePosDataPluginLock(QReadWriteLock::NonRecursive),
- m_activePositionalDataPlugin(),
- m_updater() {
-
+PluginManager::PluginManager(QSet< QString > *additionalSearchPaths, QObject *p)
+ : QObject(p), m_pluginCollectionLock(QReadWriteLock::NonRecursive), m_pluginHashMap(), m_positionalData(),
+ m_positionalDataCheckTimer(), m_sentDataMutex(), m_sentData(),
+ m_activePosDataPluginLock(QReadWriteLock::NonRecursive), m_activePositionalDataPlugin(), m_updater() {
// Setup search-paths
if (additionalSearchPaths) {
for (const auto &currentPath : *additionalSearchPaths) {
@@ -72,7 +63,8 @@ PluginManager::PluginManager(QSet<QString> *additionalSearchPaths, QObject *p)
// Path to "plugins" dir right next to the executable's location. This is the case for when Mumble
// is run after compilation without having installed it anywhere special
- m_pluginSearchPaths.insert(QString::fromLatin1("%1/plugins").arg(MumbleApplication::instance()->applicationVersionRootPath()));
+ m_pluginSearchPaths.insert(
+ QString::fromLatin1("%1/plugins").arg(MumbleApplication::instance()->applicationVersionRootPath()));
// Path to where the plugin installer will write plugins
m_pluginSearchPaths.insert(PluginInstaller::getInstallDir());
@@ -91,7 +83,7 @@ PluginManager::PluginManager(QSet<QString> *additionalSearchPaths, QObject *p)
TOKEN_PRIVILEGES tp;
LUID luid;
- m_cbPrevious=sizeof(TOKEN_PRIVILEGES);
+ m_cbPrevious = sizeof(TOKEN_PRIVILEGES);
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid);
@@ -116,7 +108,8 @@ PluginManager::PluginManager(QSet<QString> *additionalSearchPaths, QObject *p)
// Set up the timer for regularly checking for available positional data plugins
m_positionalDataCheckTimer.setInterval(POSITIONAL_DATA_CHECK_INTERVAL);
m_positionalDataCheckTimer.start();
- QObject::connect(&m_positionalDataCheckTimer, &QTimer::timeout, this, &PluginManager::checkForAvailablePositionalDataPlugin);
+ QObject::connect(&m_positionalDataCheckTimer, &QTimer::timeout, this,
+ &PluginManager::checkForAvailablePositionalDataPlugin);
QObject::connect(&m_updater, &PluginUpdater::updatesAvailable, this, &PluginManager::on_updatesAvailable);
QObject::connect(this, &PluginManager::keyEvent, this, &PluginManager::on_keyEvent);
@@ -134,15 +127,15 @@ PluginManager::~PluginManager() {
/// Emits a log about a plugin with the given name having lost link (positional audio)
///
/// @param pluginName The name of the plugin that lost link
-void reportLostLink(const QString& pluginName) {
- Global::get().l->log(Log::Information, PluginManager::tr("%1 lost link").arg(pluginName.toHtmlEscaped()));
+void reportLostLink(const QString &pluginName) {
+ Global::get().l->log(Log::Information, PluginManager::tr("%1 lost link").arg(pluginName.toHtmlEscaped()));
}
bool PluginManager::eventFilter(QObject *target, QEvent *event) {
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
- static QVector<QKeyEvent*> processedEvents;
+ static QVector< QKeyEvent * > processedEvents;
- QKeyEvent *kEvent = static_cast<QKeyEvent *>(event);
+ QKeyEvent *kEvent = static_cast< QKeyEvent * >(event);
// We have to keep track of which events we have processed already as
// the same event might be sent to multiple targets and since this is
@@ -162,7 +155,6 @@ bool PluginManager::eventFilter(QObject *target, QEvent *event) {
QTimer::singleShot(0, []() { processedEvents.clear(); });
}
}
-
}
// standard event processing
@@ -200,8 +192,8 @@ bool PluginManager::selectActivePositionalDataPlugin() {
QWriteLocker activePluginLock(&m_activePosDataPluginLock);
if (!Global::get().s.bTransmitPosition) {
- // According to the settings the position shall not be transmitted meaning that we don't have to select any plugin
- // for positional data
+ // According to the settings the position shall not be transmitted meaning that we don't have to select any
+ // plugin for positional data
m_activePositionalDataPlugin = nullptr;
return false;
@@ -217,26 +209,28 @@ bool PluginManager::selectActivePositionalDataPlugin() {
plugin_ptr_t currentPlugin = it.value();
if (currentPlugin->isPositionalDataEnabled() && currentPlugin->isLoaded()) {
- switch(currentPlugin->initPositionalData(procRes.getProcessNames().data(),
- procRes.getProcessPIDs().data(), procRes.amountOfProcesses())) {
+ switch (currentPlugin->initPositionalData(procRes.getProcessNames().data(), procRes.getProcessPIDs().data(),
+ procRes.amountOfProcesses())) {
case PDEC_OK:
// the plugin is ready to provide positional data
m_activePositionalDataPlugin = currentPlugin;
- Global::get().l->log(Log::Information, tr("%1 linked").arg(currentPlugin->getName().toHtmlEscaped()));
+ Global::get().l->log(Log::Information,
+ tr("%1 linked").arg(currentPlugin->getName().toHtmlEscaped()));
return true;
case PDEC_ERROR_PERM:
// the plugin encountered a permanent error -> disable it
- Global::get().l->log(Log::Warning, tr(
- "Plugin \"%1\" encountered a permanent error in positional data gathering").arg(currentPlugin->getName()));
+ Global::get().l->log(Log::Warning,
+ tr("Plugin \"%1\" encountered a permanent error in positional data gathering")
+ .arg(currentPlugin->getName()));
currentPlugin->enablePositionalData(false);
break;
case PDEC_ERROR_TEMP:
- //The plugin encountered a temporary error -> skip it for now (that is: do nothing)
+ // The plugin encountered a temporary error -> skip it for now (that is: do nothing)
break;
}
}
@@ -249,7 +243,8 @@ bool PluginManager::selectActivePositionalDataPlugin() {
return false;
}
-#define LOG_FOUND(plugin, path, legacyStr) qDebug("Found %splugin '%s' at \"%s\"", legacyStr, qUtf8Printable(plugin->getName()), qUtf8Printable(path));\
+#define LOG_FOUND(plugin, path, legacyStr) \
+ qDebug("Found %splugin '%s' at \"%s\"", legacyStr, qUtf8Printable(plugin->getName()), qUtf8Printable(path)); \
qDebug() << "Its description:" << qUtf8Printable(plugin->getDescription())
#define LOG_FOUND_PLUGIN(plugin, path) LOG_FOUND(plugin, path, "")
#define LOG_FOUND_LEGACY_PLUGIN(plugin, path) LOG_FOUND(plugin, path, "legacy ")
@@ -264,41 +259,43 @@ void PluginManager::rescanPlugins() {
for (const auto &currentPath : m_pluginSearchPaths) {
QFileInfoList currentList = QDir(currentPath).entryInfoList();
- for (int k=0; k<currentList.size(); k++) {
+ for (int k = 0; k < currentList.size(); k++) {
QFileInfo currentInfo = currentList[k];
if (!QLibrary::isLibrary(currentInfo.absoluteFilePath())) {
// consider only files that actually could be libraries
continue;
}
-
+
try {
- plugin_ptr_t p(Plugin::createNew<Plugin>(currentInfo.absoluteFilePath()));
+ plugin_ptr_t p(Plugin::createNew< Plugin >(currentInfo.absoluteFilePath()));
#ifdef MUMBLE_PLUGIN_DEBUG
LOG_FOUND_PLUGIN(p, currentInfo.absoluteFilePath());
#endif
- // if this code block is reached, the plugin was instantiated successfully so we can add it to the map
+ // if this code block is reached, the plugin was instantiated successfully so we can add it to the
+ // map
m_pluginHashMap.insert(p->getID(), p);
- } catch(const PluginError& e) {
+ } catch (const PluginError &e) {
Q_UNUSED(e);
// If an exception is thrown, this library does not represent a proper plugin
// Check if it might be a legacy plugin instead
try {
- legacy_plugin_ptr_t lp(Plugin::createNew<LegacyPlugin>(currentInfo.absoluteFilePath()));
-
+ legacy_plugin_ptr_t lp(Plugin::createNew< LegacyPlugin >(currentInfo.absoluteFilePath()));
+
#ifdef MUMBLE_PLUGIN_DEBUG
LOG_FOUND_LEGACY_PLUGIN(lp, currentInfo.absoluteFilePath());
#endif
m_pluginHashMap.insert(lp->getID(), lp);
- } catch(const PluginError& e) {
+ } catch (const PluginError &e) {
Q_UNUSED(e);
-
- // At the time this function is running the MainWindow is not necessarily created yet, so we can't use
- // the normal Log::log function
- Log::logOrDefer(Log::Warning,
- tr("Non-plugin found in plugin directory: \"%1\"").arg(currentInfo.absoluteFilePath()));
+
+ // At the time this function is running the MainWindow is not necessarily created yet, so we
+ // can't use the normal Log::log function
+ Log::logOrDefer(
+ Log::Warning,
+ tr("Non-plugin found in plugin directory: \"%1\"").arg(currentInfo.absoluteFilePath()));
}
}
}
@@ -307,13 +304,13 @@ void PluginManager::rescanPlugins() {
// handle built-in plugins
#ifdef USE_MANUAL_PLUGIN
try {
- std::shared_ptr<ManualPlugin> mp(Plugin::createNew<ManualPlugin>());
+ std::shared_ptr< ManualPlugin > mp(Plugin::createNew< ManualPlugin >());
m_pluginHashMap.insert(mp->getID(), mp);
-#ifdef MUMBLE_PLUGIN_DEBUG
+# ifdef MUMBLE_PLUGIN_DEBUG
LOG_FOUND_BUILTIN(mp);
-#endif
- } catch(const PluginError& e) {
+# endif
+ } catch (const PluginError &e) {
// At the time this function is running the MainWindow is not necessarily created yet, so we can't use
// the normal Log::log function
Log::logOrDefer(Log::Warning, tr("Failed at loading manual plugin: %1").arg(QString::fromUtf8(e.what())));
@@ -328,14 +325,15 @@ void PluginManager::rescanPlugins() {
auto it = Global::get().s.qhPluginSettings.constBegin();
while (it != Global::get().s.qhPluginSettings.constEnd()) {
// for this we need a way to get a plugin based on the filepath
- const QString pluginKey = it.key();
+ const QString pluginKey = it.key();
const PluginSetting setting = it.value();
// iterate over all loaded plugins to see if the current setting is applicable
auto pluginIt = m_pluginHashMap.begin();
while (pluginIt != m_pluginHashMap.end()) {
plugin_ptr_t plugin = pluginIt.value();
- QString pluginHash = QLatin1String(QCryptographicHash::hash(plugin->getFilePath().toUtf8(), QCryptographicHash::Sha1).toHex());
+ QString pluginHash = QLatin1String(
+ QCryptographicHash::hash(plugin->getFilePath().toUtf8(), QCryptographicHash::Sha1).toHex());
if (pluginKey == pluginHash) {
if (setting.enabled) {
loadPlugin(plugin->getID());
@@ -366,7 +364,7 @@ void PluginManager::rescanPlugins() {
const_plugin_ptr_t PluginManager::getPlugin(plugin_id_t pluginID) const {
QReadLocker lock(&m_pluginCollectionLock);
-
+
return m_pluginHashMap.value(pluginID);
}
@@ -379,9 +377,9 @@ bool PluginManager::fetchPositionalData() {
// This is for testing-purposes only so the "fetched" position doesn't have any real meaning
m_positionalData.reset();
- m_positionalData.m_playerDir.z = 1.0f;
+ m_positionalData.m_playerDir.z = 1.0f;
m_positionalData.m_playerAxis.y = 1.0f;
- m_positionalData.m_cameraDir.z = 1.0f;
+ m_positionalData.m_cameraDir.z = 1.0f;
m_positionalData.m_cameraAxis.y = 1.0f;
return true;
@@ -399,9 +397,10 @@ bool PluginManager::fetchPositionalData() {
QWriteLocker posDataLock(&m_positionalData.m_lock);
- bool retStatus = m_activePositionalDataPlugin->fetchPositionalData(m_positionalData.m_playerPos, m_positionalData.m_playerDir,
- m_positionalData.m_playerAxis, m_positionalData.m_cameraPos, m_positionalData.m_cameraDir, m_positionalData.m_cameraAxis,
- m_positionalData.m_context, m_positionalData.m_identity);
+ bool retStatus = m_activePositionalDataPlugin->fetchPositionalData(
+ m_positionalData.m_playerPos, m_positionalData.m_playerDir, m_positionalData.m_playerAxis,
+ m_positionalData.m_cameraPos, m_positionalData.m_cameraDir, m_positionalData.m_cameraAxis,
+ m_positionalData.m_context, m_positionalData.m_identity);
// Add the plugin's name to the context as well to prevent name-clashes between plugins
if (!m_positionalData.m_context.isEmpty()) {
@@ -420,15 +419,15 @@ bool PluginManager::fetchPositionalData() {
selectActivePositionalDataPlugin();
} else {
// If the return-status doesn't indicate an error, we can assume that positional data is available
- // The remaining problematic case is, if the player is exactly at position (0,0,0) as this is used as an indicator for the
- // absence of positional data in the mix() function in AudioOutput.cpp
- // Thus we have to make sure that this position is never set if positional data is actually available.
- // We solve this problem by shifting the player a minimal amount on the z-axis
+ // The remaining problematic case is, if the player is exactly at position (0,0,0) as this is used as an
+ // indicator for the absence of positional data in the mix() function in AudioOutput.cpp Thus we have to make
+ // sure that this position is never set if positional data is actually available. We solve this problem by
+ // shifting the player a minimal amount on the z-axis
if (m_positionalData.m_playerPos == Position3D(0.0f, 0.0f, 0.0f)) {
- m_positionalData.m_playerPos = {0.0f, 0.0f, std::numeric_limits<float>::min()};
+ m_positionalData.m_playerPos = { 0.0f, 0.0f, std::numeric_limits< float >::min() };
}
if (m_positionalData.m_cameraPos == Position3D(0.0f, 0.0f, 0.0f)) {
- m_positionalData.m_cameraPos = {0.0f, 0.0f, std::numeric_limits<float>::min()};
+ m_positionalData.m_cameraPos = { 0.0f, 0.0f, std::numeric_limits< float >::min() };
}
}
@@ -454,7 +453,7 @@ bool PluginManager::isPositionalDataAvailable() const {
return m_activePositionalDataPlugin != nullptr;
}
-const PositionalData& PluginManager::getPositionalData() const {
+const PositionalData &PluginManager::getPositionalData() const {
return m_positionalData;
}
@@ -468,24 +467,23 @@ void PluginManager::enablePositionalDataFor(plugin_id_t pluginID, bool enable) c
}
}
-const QVector<const_plugin_ptr_t > PluginManager::getPlugins(bool sorted) const {
+const QVector< const_plugin_ptr_t > PluginManager::getPlugins(bool sorted) const {
QReadLocker lock(&m_pluginCollectionLock);
- QVector<const_plugin_ptr_t> pluginList;
+ QVector< const_plugin_ptr_t > pluginList;
auto it = m_pluginHashMap.constBegin();
if (sorted) {
- QList<plugin_id_t> ids = m_pluginHashMap.keys();
+ QList< plugin_id_t > ids = m_pluginHashMap.keys();
// sort keys so that the corresponding Plugins are in alphabetical order based on their name
std::sort(ids.begin(), ids.end(), [this](plugin_id_t first, plugin_id_t second) {
return QString::compare(m_pluginHashMap.value(first)->getName(), m_pluginHashMap.value(second)->getName(),
- Qt::CaseInsensitive) <= 0;
+ Qt::CaseInsensitive)
+ <= 0;
});
- foreach(plugin_id_t currentID, ids) {
- pluginList.append(m_pluginHashMap.value(currentID));
- }
+ foreach (plugin_id_t currentID, ids) { pluginList.append(m_pluginHashMap.value(currentID)); }
} else {
while (it != m_pluginHashMap.constEnd()) {
pluginList.append(it.value());
@@ -509,7 +507,7 @@ bool PluginManager::loadPlugin(plugin_id_t pluginID) const {
// before hitting ok.
return true;
}
-
+
return plugin->init() == STATUS_OK;
}
@@ -551,7 +549,7 @@ bool PluginManager::clearPlugin(plugin_id_t pluginID) {
return plugin != nullptr;
}
-uint32_t PluginManager::deactivateFeaturesFor(plugin_id_t pluginID, uint32_t features) const {
+uint32_t PluginManager::deactivateFeaturesFor(plugin_id_t pluginID, uint32_t features) const {
QReadLocker lock(&m_pluginCollectionLock);
plugin_ptr_t plugin = m_pluginHashMap.value(pluginID);
@@ -579,7 +577,7 @@ bool PluginManager::pluginExists(plugin_id_t pluginID) const {
return m_pluginHashMap.contains(pluginID);
}
-void PluginManager::foreachPlugin(std::function<void(Plugin&)> pluginProcessor) const {
+void PluginManager::foreachPlugin(std::function< void(Plugin &) > pluginProcessor) const {
QReadLocker lock(&m_pluginCollectionLock);
auto it = m_pluginHashMap.constBegin();
@@ -598,7 +596,7 @@ void PluginManager::on_serverConnected() const {
qDebug("PluginManager: Connected to a server with connection ID %d", connectionID);
#endif
- foreachPlugin([connectionID](Plugin& plugin) {
+ foreachPlugin([connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onServerConnected(connectionID);
}
@@ -612,7 +610,7 @@ void PluginManager::on_serverDisconnected() const {
qDebug("PluginManager: Disconnected from a server with connection ID %d", connectionID);
#endif
- foreachPlugin([connectionID](Plugin& plugin) {
+ foreachPlugin([connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onServerDisconnected(connectionID);
}
@@ -621,7 +619,8 @@ void PluginManager::on_serverDisconnected() const {
void PluginManager::on_channelEntered(const Channel *newChannel, const Channel *prevChannel, const User *user) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: User" << user->qsName << "entered channel" << newChannel->qsName << "- ID:" << newChannel->iId;
+ qDebug() << "PluginManager: User" << user->qsName << "entered channel" << newChannel->qsName
+ << "- ID:" << newChannel->iId;
#endif
if (!Global::get().sh) {
@@ -631,21 +630,22 @@ void PluginManager::on_channelEntered(const Channel *newChannel, const Channel *
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([user, newChannel, prevChannel, connectionID](Plugin& plugin) {
+ foreachPlugin([user, newChannel, prevChannel, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
- plugin.onChannelEntered(connectionID, user->uiSession, prevChannel ? prevChannel->iId : -1, newChannel->iId);
+ plugin.onChannelEntered(connectionID, user->uiSession, prevChannel ? prevChannel->iId : -1,
+ newChannel->iId);
}
});
}
void PluginManager::on_channelExited(const Channel *channel, const User *user) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: User" << user->qsName << "left channel" << channel->qsName << "- ID:" << channel->iId;
+ qDebug() << "PluginManager: User" << user->qsName << "left channel" << channel->qsName << "- ID:" << channel->iId;
#endif
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([user, channel, connectionID](Plugin& plugin) {
+ foreachPlugin([user, channel, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onChannelExited(connectionID, user->uiSession, channel->iId);
}
@@ -653,7 +653,7 @@ void PluginManager::on_channelExited(const Channel *channel, const User *user) c
}
QString getTalkingStateStr(Settings::TalkState ts) {
- switch(ts) {
+ switch (ts) {
case Settings::TalkState::Passive:
return QString::fromLatin1("Passive");
case Settings::TalkState::Talking:
@@ -670,10 +670,11 @@ QString getTalkingStateStr(Settings::TalkState ts) {
}
void PluginManager::on_userTalkingStateChanged() const {
- const ClientUser *user = qobject_cast<ClientUser*>(QObject::sender());
+ const ClientUser *user = qobject_cast< ClientUser * >(QObject::sender());
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
if (user) {
- qDebug() << "PluginManager: User" << user->qsName << "changed talking state to" << getTalkingStateStr(user->tsState);
+ qDebug() << "PluginManager: User" << user->qsName << "changed talking state to"
+ << getTalkingStateStr(user->tsState);
} else {
qCritical() << "PluginManager: Unable to identify ClientUser";
}
@@ -683,7 +684,7 @@ void PluginManager::on_userTalkingStateChanged() const {
// Convert Mumble's talking state to the TalkingState used in the API
mumble_talking_state_t ts = INVALID;
- switch(user->tsState) {
+ switch (user->tsState) {
case Settings::TalkState::Passive:
ts = PASSIVE;
break;
@@ -709,7 +710,7 @@ void PluginManager::on_userTalkingStateChanged() const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([user, ts, connectionID](Plugin& plugin) {
+ foreachPlugin([user, ts, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onUserTalkingStateChanged(connectionID, user->uiSession, ts);
}
@@ -717,54 +718,63 @@ void PluginManager::on_userTalkingStateChanged() const {
}
}
-void PluginManager::on_audioInput(short *inputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech) const {
+void PluginManager::on_audioInput(short *inputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool isSpeech) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: AudioInput with" << channelCount << "channels and" << sampleCount << "samples per channel. IsSpeech:" << isSpeech;
+ qDebug() << "PluginManager: AudioInput with" << channelCount << "channels and" << sampleCount
+ << "samples per channel. IsSpeech:" << isSpeech;
#endif
- foreachPlugin([inputPCM, sampleCount, channelCount, sampleRate, isSpeech](Plugin& plugin) {
+ foreachPlugin([inputPCM, sampleCount, channelCount, sampleRate, isSpeech](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onAudioInput(inputPCM, sampleCount, channelCount, sampleRate, isSpeech);
}
});
}
-void PluginManager::on_audioSourceFetched(float* outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech, const ClientUser* user) const {
+void PluginManager::on_audioSourceFetched(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool isSpeech, const ClientUser *user) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: AudioSource with" << channelCount << "channels and" << sampleCount << "samples per channel fetched. IsSpeech:" << isSpeech;
+ qDebug() << "PluginManager: AudioSource with" << channelCount << "channels and" << sampleCount
+ << "samples per channel fetched. IsSpeech:" << isSpeech;
if (user != nullptr) {
qDebug() << "Sender-ID:" << user->uiSession;
}
#endif
- foreachPlugin([outputPCM, sampleCount, channelCount, sampleRate, isSpeech, user](Plugin& plugin) {
+ foreachPlugin([outputPCM, sampleCount, channelCount, sampleRate, isSpeech, user](Plugin &plugin) {
if (plugin.isLoaded()) {
- plugin.onAudioSourceFetched(outputPCM, sampleCount, channelCount, sampleRate, isSpeech, user ? user->uiSession : -1);
+ plugin.onAudioSourceFetched(outputPCM, sampleCount, channelCount, sampleRate, isSpeech,
+ user ? user->uiSession : -1);
}
});
}
-void PluginManager::on_audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool *modifiedAudio) const {
+void PluginManager::on_audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool *modifiedAudio) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: AudioOutput with" << channelCount << "channels and" << sampleCount << "samples per channel";
+ qDebug() << "PluginManager: AudioOutput with" << channelCount << "channels and" << sampleCount
+ << "samples per channel";
#endif
- foreachPlugin([outputPCM, sampleCount, channelCount, sampleRate, modifiedAudio](Plugin& plugin) {
+ foreachPlugin([outputPCM, sampleCount, channelCount, sampleRate, modifiedAudio](Plugin &plugin) {
if (plugin.isLoaded()) {
- if(plugin.onAudioOutputAboutToPlay(outputPCM, sampleCount, sampleRate, channelCount)) {
+ if (plugin.onAudioOutputAboutToPlay(outputPCM, sampleCount, sampleRate, channelCount)) {
*modifiedAudio = true;
}
}
});
}
-void PluginManager::on_receiveData(const ClientUser *sender, const uint8_t *data, size_t dataLength, const char *dataID) const {
+void PluginManager::on_receiveData(const ClientUser *sender, const uint8_t *data, size_t dataLength,
+ const char *dataID) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: Data with ID" << dataID << "and length" << dataLength << "received. Sender-ID:" << sender->uiSession;
+ qDebug() << "PluginManager: Data with ID" << dataID << "and length" << dataLength
+ << "received. Sender-ID:" << sender->uiSession;
#endif
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([sender, data, dataLength, dataID, connectionID](Plugin& plugin) {
+ foreachPlugin([sender, data, dataLength, dataID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onReceiveData(connectionID, sender->uiSession, data, dataLength, dataID);
}
@@ -778,7 +788,7 @@ void PluginManager::on_serverSynchronized() const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([connectionID](Plugin& plugin) {
+ foreachPlugin([connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onServerSynchronized(connectionID);
}
@@ -792,7 +802,7 @@ void PluginManager::on_userAdded(mumble_userid_t userID) const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([userID, connectionID](Plugin& plugin) {
+ foreachPlugin([userID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onUserAdded(connectionID, userID);
};
@@ -806,7 +816,7 @@ void PluginManager::on_userRemoved(mumble_userid_t userID) const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([userID, connectionID](Plugin& plugin) {
+ foreachPlugin([userID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onUserRemoved(connectionID, userID);
};
@@ -820,7 +830,7 @@ void PluginManager::on_channelAdded(mumble_channelid_t channelID) const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([channelID, connectionID](Plugin& plugin) {
+ foreachPlugin([channelID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onChannelAdded(connectionID, channelID);
};
@@ -834,7 +844,7 @@ void PluginManager::on_channelRemoved(mumble_channelid_t channelID) const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([channelID, connectionID](Plugin& plugin) {
+ foreachPlugin([channelID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onChannelRemoved(connectionID, channelID);
};
@@ -848,7 +858,7 @@ void PluginManager::on_channelRenamed(int channelID) const {
const mumble_connection_t connectionID = Global::get().sh->getConnectionID();
- foreachPlugin([channelID, connectionID](Plugin& plugin) {
+ foreachPlugin([channelID, connectionID](Plugin &plugin) {
if (plugin.isLoaded()) {
plugin.onChannelRenamed(connectionID, channelID);
};
@@ -857,8 +867,8 @@ void PluginManager::on_channelRenamed(int channelID) const {
void PluginManager::on_keyEvent(unsigned int key, Qt::KeyboardModifiers modifiers, bool isPress) const {
#ifdef MUMBLE_PLUGIN_CALLBACK_DEBUG
- qDebug() << "PluginManager: Key event detected: keyCode =" << key << "modifiers:"
- << modifiers << "isPress =" << isPress;
+ qDebug() << "PluginManager: Key event detected: keyCode =" << key << "modifiers:" << modifiers
+ << "isPress =" << isPress;
#else
Q_UNUSED(modifiers);
#endif
@@ -889,7 +899,8 @@ void PluginManager::on_syncPositionalData() {
QMutexLocker mLock(&m_sentDataMutex);
QReadLocker rLock(&m_positionalData.m_lock);
- if (m_sentData.context != m_positionalData.m_context || m_sentData.identity != m_positionalData.m_identity ) {
+ if (m_sentData.context != m_positionalData.m_context
+ || m_sentData.identity != m_positionalData.m_identity) {
MumbleProto::UserState mpus;
mpus.set_session(Global::get().uiSession);
diff --git a/src/mumble/PluginManager.h b/src/mumble/PluginManager.h
index 02f4db5fa..891e0ff91 100644
--- a/src/mumble/PluginManager.h
+++ b/src/mumble/PluginManager.h
@@ -6,27 +6,27 @@
#ifndef MUMBLE_MUMBLE_PLUGINMANAGER_H_
#define MUMBLE_MUMBLE_PLUGINMANAGER_H_
+#include <QHash>
+#include <QMutex>
#include <QObject>
#include <QReadWriteLock>
#include <QString>
#include <QTimer>
-#include <QHash>
-#include <QMutex>
#ifdef Q_OS_WIN
- #ifndef NOMINMAX
- #define NOMINMAX
- #endif
- #include <windows.h>
+# ifndef NOMINMAX
+# define NOMINMAX
+# endif
+# include <windows.h>
#endif
-#include "Plugin.h"
#include "MumbleApplication.h"
+#include "Plugin.h"
#include "PositionalData.h"
-#include "User.h"
-#include "ClientUser.h"
#include "Channel.h"
-#include "Settings.h"
+#include "ClientUser.h"
#include "PluginUpdater.h"
+#include "Settings.h"
+#include "User.h"
#include <functional>
@@ -41,239 +41,254 @@ struct PluginManager_SentData {
/// finding, loading and managing the plugins. It also is responsible for invoking callback functions in the plugins
/// and can be used by Mumble to communicate with them
class PluginManager : public QObject {
- private:
- Q_OBJECT
- Q_DISABLE_COPY(PluginManager)
- protected:
- /// Lock for pluginHashMap. This lock has to be aquired when accessing pluginHashMap
- mutable QReadWriteLock m_pluginCollectionLock;
- /// A map between plugin-IDs and the actual plugin objects. You have to aquire pluginCollectionLock before
- /// accessing this map.
- QHash<plugin_id_t, plugin_ptr_t> m_pluginHashMap;
- /// A set of directories to search plugins in
- QSet<QString> m_pluginSearchPaths;
+private:
+ Q_OBJECT
+ Q_DISABLE_COPY(PluginManager)
+protected:
+ /// Lock for pluginHashMap. This lock has to be aquired when accessing pluginHashMap
+ mutable QReadWriteLock m_pluginCollectionLock;
+ /// A map between plugin-IDs and the actual plugin objects. You have to aquire pluginCollectionLock before
+ /// accessing this map.
+ QHash< plugin_id_t, plugin_ptr_t > m_pluginHashMap;
+ /// A set of directories to search plugins in
+ QSet< QString > m_pluginSearchPaths;
#ifdef Q_OS_WIN
- // This stuff is apparently needed on Windows in order to deal with DLLs
- HANDLE m_hToken;
- TOKEN_PRIVILEGES m_tpPrevious;
- DWORD m_cbPrevious;
+ // This stuff is apparently needed on Windows in order to deal with DLLs
+ HANDLE m_hToken;
+ TOKEN_PRIVILEGES m_tpPrevious;
+ DWORD m_cbPrevious;
#endif
- /// The PositionalData object holding the current positional data (as retrieved by the respective plugin)
- PositionalData m_positionalData;
+ /// The PositionalData object holding the current positional data (as retrieved by the respective plugin)
+ PositionalData m_positionalData;
+
+ /// A timer that causes the manager to regularly check for available plugins that can currently
+ /// deliver positional data.
+ QTimer m_positionalDataCheckTimer;
+
+ /// The mutex for sentData. This has to be aquired before accessing sentData
+ mutable QMutex m_sentDataMutex;
+ /// The bits of the positional data that have already been sent to the server. It is used to determine whether
+ /// the new data has to be sent to the server (in case it has changed). You have ti aquire sentDataMutex before
+ /// accessing this field.
+ PluginManager_SentData m_sentData;
- /// A timer that causes the manager to regularly check for available plugins that can currently
- /// deliver positional data.
- QTimer m_positionalDataCheckTimer;
+ /// The lock for activePositionalDataPlugin. It has to be aquired before accessing the respective field.
+ mutable QReadWriteLock m_activePosDataPluginLock;
+ /// The plugin that is currently used to retrieve positional data. You have to aquire activePosDataPluginLock before
+ /// accessing this field.
+ plugin_ptr_t m_activePositionalDataPlugin;
+ /// The PluginUpdater used to handle plugin updates.
+ PluginUpdater m_updater;
- /// The mutex for sentData. This has to be aquired before accessing sentData
- mutable QMutex m_sentDataMutex;
- /// The bits of the positional data that have already been sent to the server. It is used to determine whether
- /// the new data has to be sent to the server (in case it has changed). You have ti aquire sentDataMutex before
- /// accessing this field.
- PluginManager_SentData m_sentData;
+ // We override the QObject::eventFilter function in order to be able to install the pluginManager as an event filter
+ // to the main application in order to get notified about keystrokes.
+ bool eventFilter(QObject *target, QEvent *event) Q_DECL_OVERRIDE;
- /// The lock for activePositionalDataPlugin. It has to be aquired before accessing the respective field.
- mutable QReadWriteLock m_activePosDataPluginLock;
- /// The plugin that is currently used to retrieve positional data. You have to aquire activePosDataPluginLock before
- /// accessing this field.
- plugin_ptr_t m_activePositionalDataPlugin;
- /// The PluginUpdater used to handle plugin updates.
- PluginUpdater m_updater;
+ /// Unloads all plugins that are currently loaded.
+ void unloadPlugins() const;
+ /// Clears the current list of plugins
+ void clearPlugins();
+ /// Iterates over the plugins and tries to select a plugin that currently claims to be able to deliver positional
+ /// data. If it found a plugin, activePositionalDataPlugin is set accordingly. If not, it is set to nullptr.
+ ///
+ /// @returns Whether this function succeeded in finding such a plugin
+ bool selectActivePositionalDataPlugin();
- // We override the QObject::eventFilter function in order to be able to install the pluginManager as an event filter
- // to the main application in order to get notified about keystrokes.
- bool eventFilter(QObject *target, QEvent *event) Q_DECL_OVERRIDE;
-
- /// Unloads all plugins that are currently loaded.
- void unloadPlugins() const;
- /// Clears the current list of plugins
- void clearPlugins();
- /// Iterates over the plugins and tries to select a plugin that currently claims to be able to deliver positional data. If
- /// it found a plugin, activePositionalDataPlugin is set accordingly. If not, it is set to nullptr.
- ///
- /// @returns Whether this function succeeded in finding such a plugin
- bool selectActivePositionalDataPlugin();
+ /// A internal helper function that iterates over all plugins and calls the given function providing the current
+ /// plugin as a parameter.
+ void foreachPlugin(std::function< void(Plugin &) >) const;
- /// A internal helper function that iterates over all plugins and calls the given function providing the current plugin as
- /// a parameter.
- void foreachPlugin(std::function<void(Plugin&)>) const;
- public:
- // How often positional data (identity & context) should be synched with the server if there is any (in ms)
- static constexpr int POSITIONAL_SERVER_SYNC_INTERVAL = 500;
- // How often the manager should check for available positional data plugins
- static constexpr int POSITIONAL_DATA_CHECK_INTERVAL = 1000;
+public:
+ // How often positional data (identity & context) should be synched with the server if there is any (in ms)
+ static constexpr int POSITIONAL_SERVER_SYNC_INTERVAL = 500;
+ // How often the manager should check for available positional data plugins
+ static constexpr int POSITIONAL_DATA_CHECK_INTERVAL = 1000;
- /// Constructor
- ///
- /// @param additionalSearchPaths A pointer to a set of additional search paths or nullptr if no additional
- /// paths are required.
- /// @param p The parent QObject
- PluginManager(QSet<QString> *additionalSearchPaths = nullptr, QObject *p = nullptr);
- /// Destructor
- virtual ~PluginManager() Q_DECL_OVERRIDE;
+ /// Constructor
+ ///
+ /// @param additionalSearchPaths A pointer to a set of additional search paths or nullptr if no additional
+ /// paths are required.
+ /// @param p The parent QObject
+ PluginManager(QSet< QString > *additionalSearchPaths = nullptr, QObject *p = nullptr);
+ /// Destructor
+ virtual ~PluginManager() Q_DECL_OVERRIDE;
- /// @param pluginID The ID of the plugin that should be retreved
- /// @returns A pointer to the plugin with the given ID or nullptr if no such plugin could be found
- const_plugin_ptr_t getPlugin(plugin_id_t pluginID) const;
- /// Checks whether there are any updates for the plugins and if there are it invokes the PluginUpdater.
- void checkForPluginUpdates();
- /// Fetches positional data from the activePositionalDataPlugin if there is one set. This function will update the
- /// positionalData field
- ///
- /// @returns Whether the positional data could be retrieved successfully
- bool fetchPositionalData();
- /// Unlinks the currently active positional data plugin. Effectively this sets activePositionalDataPlugin to nullptr
- void unlinkPositionalData();
- /// @returns Whether positional data is currently available (it has been successfully set via fetchPositionalData)
- bool isPositionalDataAvailable() const;
- /// @returns The most recent positional data
- const PositionalData& getPositionalData() const;
- /// Enables positional data gathering for the plugin with the given ID. A plugin is only even asked whether it can deliver
- /// positional data if this is enabled.
- ///
- /// @param pluginID The ID of the plugin to access
- /// @param enable Whether to enable positional data (alternative is to disable it)
- void enablePositionalDataFor(plugin_id_t pluginID, bool enable = true) const;
- /// @returns A const vector of the plugins
- const QVector<const_plugin_ptr_t> getPlugins(bool sorted = false) const;
- /// Loads the plugin with the given ID. Loading means initializing the plugin.
- ///
- /// @param pluginID The ID of the plugin to load
- /// @returns Whether the plugin could be successfully loaded
- bool loadPlugin(plugin_id_t pluginID) const;
- /// Unloads the plugin with the given ID. Unloading means shutting the plugign down.
- ///
- /// @param pluginID The ID of the plugin to unload
- void unloadPlugin(plugin_id_t pluginID) const;
- /// Unloads the given plugin. Unloading means shutting the plugign down.
- ///
- /// @param plugin The plugin to unload
- void unloadPlugin(Plugin &plugin) const;
- /// Clears the plugin from the list of known plugins
- ///
- /// @param pluginID The ID of the plugin to forget about
- /// @returns Whether the plugin has been cleared successfully
- bool clearPlugin(plugin_id_t pluginID);
- /// Deactivates the given features for the plugin with the given ID
- ///
- /// @param pluginID The ID of the plugin to access
- /// @param features The feature set that should be deactivated. The features are or'ed together.
- /// @returns The feature set that could not be deactivated
- uint32_t deactivateFeaturesFor(plugin_id_t pluginID, uint32_t features) const;
- /// Allows or forbids the given plugin to monitor keyboard events.
- ///
- /// @param pluginID The ID of the plugin to access
- /// @param allow Whether to allow the monitoring or not
- void allowKeyboardMonitoringFor(plugin_id_t pluginID, bool allow) const;
- /// Checks whether a plugin with the given ID exists.
- ///
- /// @param pluginID The ID to check
- /// @returns Whether such a plugin exists
- bool pluginExists(plugin_id_t pluginID) const;
+ /// @param pluginID The ID of the plugin that should be retreved
+ /// @returns A pointer to the plugin with the given ID or nullptr if no such plugin could be found
+ const_plugin_ptr_t getPlugin(plugin_id_t pluginID) const;
+ /// Checks whether there are any updates for the plugins and if there are it invokes the PluginUpdater.
+ void checkForPluginUpdates();
+ /// Fetches positional data from the activePositionalDataPlugin if there is one set. This function will update the
+ /// positionalData field
+ ///
+ /// @returns Whether the positional data could be retrieved successfully
+ bool fetchPositionalData();
+ /// Unlinks the currently active positional data plugin. Effectively this sets activePositionalDataPlugin to nullptr
+ void unlinkPositionalData();
+ /// @returns Whether positional data is currently available (it has been successfully set via fetchPositionalData)
+ bool isPositionalDataAvailable() const;
+ /// @returns The most recent positional data
+ const PositionalData &getPositionalData() const;
+ /// Enables positional data gathering for the plugin with the given ID. A plugin is only even asked whether it can
+ /// deliver positional data if this is enabled.
+ ///
+ /// @param pluginID The ID of the plugin to access
+ /// @param enable Whether to enable positional data (alternative is to disable it)
+ void enablePositionalDataFor(plugin_id_t pluginID, bool enable = true) const;
+ /// @returns A const vector of the plugins
+ const QVector< const_plugin_ptr_t > getPlugins(bool sorted = false) const;
+ /// Loads the plugin with the given ID. Loading means initializing the plugin.
+ ///
+ /// @param pluginID The ID of the plugin to load
+ /// @returns Whether the plugin could be successfully loaded
+ bool loadPlugin(plugin_id_t pluginID) const;
+ /// Unloads the plugin with the given ID. Unloading means shutting the plugign down.
+ ///
+ /// @param pluginID The ID of the plugin to unload
+ void unloadPlugin(plugin_id_t pluginID) const;
+ /// Unloads the given plugin. Unloading means shutting the plugign down.
+ ///
+ /// @param plugin The plugin to unload
+ void unloadPlugin(Plugin &plugin) const;
+ /// Clears the plugin from the list of known plugins
+ ///
+ /// @param pluginID The ID of the plugin to forget about
+ /// @returns Whether the plugin has been cleared successfully
+ bool clearPlugin(plugin_id_t pluginID);
+ /// Deactivates the given features for the plugin with the given ID
+ ///
+ /// @param pluginID The ID of the plugin to access
+ /// @param features The feature set that should be deactivated. The features are or'ed together.
+ /// @returns The feature set that could not be deactivated
+ uint32_t deactivateFeaturesFor(plugin_id_t pluginID, uint32_t features) const;
+ /// Allows or forbids the given plugin to monitor keyboard events.
+ ///
+ /// @param pluginID The ID of the plugin to access
+ /// @param allow Whether to allow the monitoring or not
+ void allowKeyboardMonitoringFor(plugin_id_t pluginID, bool allow) const;
+ /// Checks whether a plugin with the given ID exists.
+ ///
+ /// @param pluginID The ID to check
+ /// @returns Whether such a plugin exists
+ bool pluginExists(plugin_id_t pluginID) const;
- public slots:
- /// Rescans the plugin directory and load all plugins from there after having cleared the current plugin list
- void rescanPlugins();
- /// Slot that gets called whenever data from another plugin has been received. This function will then delegate
- /// this to the respective plugin callback
- ///
- /// @param sender A pointer to the ClientUser whose client has sent the data
- /// @param data The byte-array representing the sent data
- /// @param dataLength The length of the data array
- /// @param dataID The ID of the data
- void on_receiveData(const ClientUser *sender, const uint8_t *data, size_t dataLength, const char *dataID) const;
- /// Slot that gets called when the local client connects to a server. It will delegate it to the respective plugin callback.
- void on_serverConnected() const;
- /// Slot that gets called when the local client disconnects to a server. It will delegate it to the respective plugin callback.
- void on_serverDisconnected() const;
- /// Slot that gets called when a client enters a channel. It will delegate it to the respective plugin callback.
- ///
- /// @param newChannel A pointer to the new channel
- /// @param prevChannel A pointer to the previous channel or nullptr if no such channel exists
- /// @param user A pointer to the user that entered the channel
- void on_channelEntered(const Channel *newChannel, const Channel *prevChannel, const User *user) const;
- /// Slot that gets called when a client leaves a channel. It will delegate it to the respective plugin callback.
- ///
- /// @param channel A pointer to the channel that has been left
- /// @param user A pointer to the user that entered the channel
- void on_channelExited(const Channel *channel, const User *user) const;
- /// Slot that gets called when the local client changes its talking state. It will delegate it to the respective plugin callback.
- void on_userTalkingStateChanged() const;
- /// Slot that gets called when the local client receives audio input. It will delegate it to the respective plugin callback.
- ///
- /// @param inputPCM The array containing the input PCM (pulse-code-modulation). Its length is sampleCount * channelCount
- /// @param sampleCount The amount of samples in the PCM array
- /// @param channelCount The amount of channels in the PCM array
- /// @param sampleRate The used sample rate in Hz
- /// @param isSpeech Whether Mumble considers this input as speech
- void on_audioInput(short *inputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech) const;
- /// Slot that gets called when the local client has fetched an audio source. It will delegate it to the respective plugin callback.
- ///
- /// @param outputPCM The array containing the output-PCM (pulse-code-modulation). Its length is sampleCount * channelCount
- /// @param sampleCount The amount of samples in the PCM array
- /// @param channelCount The amount of channels in the PCM array
- /// @param sampleRate The used sample rate in Hz
- /// @param isSpeech Whether Mumble considers this input as speech
- /// @param user A pointer to the ClientUser the audio source corresposnds to
- void on_audioSourceFetched(float *outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate, bool isSpeech,
- const ClientUser *user) const;
- /// Slot that gets called when the local client is about to play some audio. It will delegate it to the respective plugin callback.
- ///
- /// @param outputPCM The array containing the output-PCM (pulse-code-modulation). Its length is sampleCount * channelCount
- /// @param sampleCount The amount of samples in the PCM array
- /// @param channelCount The amount of channels in the PCM array
- /// @param sampleRate The used sample rate in Hz
- void on_audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate,
- bool *modifiedAudio) const;
- /// Slot that gets called after the local client has finished synchronizing with the server. It will delegate it to the respective
- /// plugin callback.
- void on_serverSynchronized() const;
- /// Slot that gets called when a new user is added to the user model. It will delegate it to the respective plugin callbacks.
- ///
- /// @param userID The ID of the added user
- void on_userAdded(unsigned int userID) const;
- /// Slot that gets called when a user is removed from the user model. It will delegate it to the respective plugin callbacks.
- ///
- /// @param userID The ID of the removed user
- void on_userRemoved(unsigned int userID) const;
- /// Slot that gets called when a new channel is added to the user model. It will delegate it to the respective plugin callbacks.
- ///
- /// @param channelID The ID of the added channel
- void on_channelAdded(int channelID) const;
- /// Slot that gets called when a channel is removed from the user model. It will delegate it to the respective plugin callbacks.
- ///
- /// @param channelID The ID of the removed channel
- void on_channelRemoved(int channelID) const;
- /// Slot that gets called when a channel is renamed. It will delegate it to the respective plugin callbacks.
- ///
- /// @param channelID The ID of the renamed channel
- void on_channelRenamed(int channelID) const;
- /// Slot that gets called when a key has been pressed or released while Mumble has keyboard focus.
- ///
- /// @param key The code of the affected key (as encoded by Qt::Key)
- /// @param modifiers The modifiers that were active in the moment of the event
- /// @param isPress True if the key has been pressed, false if it has been released
- void on_keyEvent(unsigned int key, Qt::KeyboardModifiers modifiers, bool isPress) const;
+public slots:
+ /// Rescans the plugin directory and load all plugins from there after having cleared the current plugin list
+ void rescanPlugins();
+ /// Slot that gets called whenever data from another plugin has been received. This function will then delegate
+ /// this to the respective plugin callback
+ ///
+ /// @param sender A pointer to the ClientUser whose client has sent the data
+ /// @param data The byte-array representing the sent data
+ /// @param dataLength The length of the data array
+ /// @param dataID The ID of the data
+ void on_receiveData(const ClientUser *sender, const uint8_t *data, size_t dataLength, const char *dataID) const;
+ /// Slot that gets called when the local client connects to a server. It will delegate it to the respective plugin
+ /// callback.
+ void on_serverConnected() const;
+ /// Slot that gets called when the local client disconnects to a server. It will delegate it to the respective
+ /// plugin callback.
+ void on_serverDisconnected() const;
+ /// Slot that gets called when a client enters a channel. It will delegate it to the respective plugin callback.
+ ///
+ /// @param newChannel A pointer to the new channel
+ /// @param prevChannel A pointer to the previous channel or nullptr if no such channel exists
+ /// @param user A pointer to the user that entered the channel
+ void on_channelEntered(const Channel *newChannel, const Channel *prevChannel, const User *user) const;
+ /// Slot that gets called when a client leaves a channel. It will delegate it to the respective plugin callback.
+ ///
+ /// @param channel A pointer to the channel that has been left
+ /// @param user A pointer to the user that entered the channel
+ void on_channelExited(const Channel *channel, const User *user) const;
+ /// Slot that gets called when the local client changes its talking state. It will delegate it to the respective
+ /// plugin callback.
+ void on_userTalkingStateChanged() const;
+ /// Slot that gets called when the local client receives audio input. It will delegate it to the respective plugin
+ /// callback.
+ ///
+ /// @param inputPCM The array containing the input PCM (pulse-code-modulation). Its length is sampleCount *
+ /// channelCount
+ /// @param sampleCount The amount of samples in the PCM array
+ /// @param channelCount The amount of channels in the PCM array
+ /// @param sampleRate The used sample rate in Hz
+ /// @param isSpeech Whether Mumble considers this input as speech
+ void on_audioInput(short *inputPCM, unsigned int sampleCount, unsigned int channelCount, unsigned int sampleRate,
+ bool isSpeech) const;
+ /// Slot that gets called when the local client has fetched an audio source. It will delegate it to the respective
+ /// plugin callback.
+ ///
+ /// @param outputPCM The array containing the output-PCM (pulse-code-modulation). Its length is sampleCount *
+ /// channelCount
+ /// @param sampleCount The amount of samples in the PCM array
+ /// @param channelCount The amount of channels in the PCM array
+ /// @param sampleRate The used sample rate in Hz
+ /// @param isSpeech Whether Mumble considers this input as speech
+ /// @param user A pointer to the ClientUser the audio source corresposnds to
+ void on_audioSourceFetched(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool isSpeech, const ClientUser *user) const;
+ /// Slot that gets called when the local client is about to play some audio. It will delegate it to the respective
+ /// plugin callback.
+ ///
+ /// @param outputPCM The array containing the output-PCM (pulse-code-modulation). Its length is sampleCount *
+ /// channelCount
+ /// @param sampleCount The amount of samples in the PCM array
+ /// @param channelCount The amount of channels in the PCM array
+ /// @param sampleRate The used sample rate in Hz
+ void on_audioOutputAboutToPlay(float *outputPCM, unsigned int sampleCount, unsigned int channelCount,
+ unsigned int sampleRate, bool *modifiedAudio) const;
+ /// Slot that gets called after the local client has finished synchronizing with the server. It will delegate it to
+ /// the respective plugin callback.
+ void on_serverSynchronized() const;
+ /// Slot that gets called when a new user is added to the user model. It will delegate it to the respective plugin
+ /// callbacks.
+ ///
+ /// @param userID The ID of the added user
+ void on_userAdded(unsigned int userID) const;
+ /// Slot that gets called when a user is removed from the user model. It will delegate it to the respective plugin
+ /// callbacks.
+ ///
+ /// @param userID The ID of the removed user
+ void on_userRemoved(unsigned int userID) const;
+ /// Slot that gets called when a new channel is added to the user model. It will delegate it to the respective
+ /// plugin callbacks.
+ ///
+ /// @param channelID The ID of the added channel
+ void on_channelAdded(int channelID) const;
+ /// Slot that gets called when a channel is removed from the user model. It will delegate it to the respective
+ /// plugin callbacks.
+ ///
+ /// @param channelID The ID of the removed channel
+ void on_channelRemoved(int channelID) const;
+ /// Slot that gets called when a channel is renamed. It will delegate it to the respective plugin callbacks.
+ ///
+ /// @param channelID The ID of the renamed channel
+ void on_channelRenamed(int channelID) const;
+ /// Slot that gets called when a key has been pressed or released while Mumble has keyboard focus.
+ ///
+ /// @param key The code of the affected key (as encoded by Qt::Key)
+ /// @param modifiers The modifiers that were active in the moment of the event
+ /// @param isPress True if the key has been pressed, false if it has been released
+ void on_keyEvent(unsigned int key, Qt::KeyboardModifiers modifiers, bool isPress) const;
- /// Slot that gets called whenever the positional data should be synchronized with the server. Before it does that, it tries to
- /// fetch new data.
- void on_syncPositionalData();
- /// Slot called if there are plugin updates available
- void on_updatesAvailable();
+ /// Slot that gets called whenever the positional data should be synchronized with the server. Before it does that,
+ /// it tries to fetch new data.
+ void on_syncPositionalData();
+ /// Slot called if there are plugin updates available
+ void on_updatesAvailable();
- protected slots:
- /// If there is no active positional data plugin, this function will initiate searching for a
- /// new one.
- void checkForAvailablePositionalDataPlugin();
+protected slots:
+ /// If there is no active positional data plugin, this function will initiate searching for a
+ /// new one.
+ void checkForAvailablePositionalDataPlugin();
- signals:
- /// A signal emitted if the PluginManager (acting as an event filter) detected
- /// a QKeyEvent.
- ///
- /// @param key The code of the affected key (as encoded by Qt::Key)
- /// @param modifiers The modifiers that were active in the moment of the event
- /// @param isPress True if the key has been pressed, false if it has been released
- void keyEvent(unsigned int key, Qt::KeyboardModifiers modifiers, bool isPress);
+signals:
+ /// A signal emitted if the PluginManager (acting as an event filter) detected
+ /// a QKeyEvent.
+ ///
+ /// @param key The code of the affected key (as encoded by Qt::Key)
+ /// @param modifiers The modifiers that were active in the moment of the event
+ /// @param isPress True if the key has been pressed, false if it has been released
+ void keyEvent(unsigned int key, Qt::KeyboardModifiers modifiers, bool isPress);
};
#endif
diff --git a/src/mumble/PluginUpdater.cpp b/src/mumble/PluginUpdater.cpp
index e7f4f2594..694f977a6 100644
--- a/src/mumble/PluginUpdater.cpp
+++ b/src/mumble/PluginUpdater.cpp
@@ -4,31 +4,26 @@
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include "PluginUpdater.h"
-#include "PluginManager.h"
#include "Log.h"
#include "PluginInstaller.h"
+#include "PluginManager.h"
#include "Global.h"
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QLabel>
-#include <QtCore/QHashIterator>
-#include <QtCore/QSignalBlocker>
+#include <QNetworkRequest>
+#include <QtConcurrent>
#include <QtCore/QByteArray>
#include <QtCore/QDir>
#include <QtCore/QFile>
-#include <QtConcurrent>
-#include <QNetworkRequest>
+#include <QtCore/QHashIterator>
+#include <QtCore/QSignalBlocker>
+#include <QtWidgets/QCheckBox>
+#include <QtWidgets/QLabel>
#include <algorithm>
PluginUpdater::PluginUpdater(QWidget *parent)
- : QDialog(parent),
- m_wasInterrupted(false),
- m_dataMutex(),
- m_pluginsToUpdate(),
- m_networkManager(),
+ : QDialog(parent), m_wasInterrupted(false), m_dataMutex(), m_pluginsToUpdate(), m_networkManager(),
m_pluginUpdateWidgets() {
-
QObject::connect(&m_networkManager, &QNetworkAccessManager::finished, this, &PluginUpdater::on_updateDownloaded);
}
@@ -41,7 +36,7 @@ void PluginUpdater::checkForUpdates() {
QtConcurrent::run([this]() {
QMutexLocker lock(&m_dataMutex);
- const QVector<const_plugin_ptr_t> plugins = Global::get().pluginManager->getPlugins();
+ const QVector< const_plugin_ptr_t > plugins = Global::get().pluginManager->getPlugins();
for (int i = 0; i < plugins.size(); i++) {
const_plugin_ptr_t plugin = plugins[i];
@@ -100,7 +95,7 @@ void PluginUpdater::populateUI() {
QMutexLocker l(&m_dataMutex);
for (int i = 0; i < m_pluginsToUpdate.size(); i++) {
UpdateEntry currentEntry = m_pluginsToUpdate[i];
- plugin_id_t pluginID = currentEntry.pluginID;
+ plugin_id_t pluginID = currentEntry.pluginID;
const_plugin_ptr_t plugin = Global::get().pluginManager->getPlugin(pluginID);
@@ -125,15 +120,16 @@ void PluginUpdater::populateUI() {
}
// sort the plugins alphabetically
- std::sort(m_pluginUpdateWidgets.begin(), m_pluginUpdateWidgets.end(), [](const UpdateWidgetPair &first, const UpdateWidgetPair &second) {
- return first.pluginCheckBox->text().compare(second.pluginCheckBox->text(), Qt::CaseInsensitive) < 0;
- });
+ std::sort(m_pluginUpdateWidgets.begin(), m_pluginUpdateWidgets.end(),
+ [](const UpdateWidgetPair &first, const UpdateWidgetPair &second) {
+ return first.pluginCheckBox->text().compare(second.pluginCheckBox->text(), Qt::CaseInsensitive) < 0;
+ });
// add the widgets to the layout
for (int i = 0; i < m_pluginUpdateWidgets.size(); i++) {
UpdateWidgetPair &currentPair = m_pluginUpdateWidgets[i];
- static_cast<QFormLayout*>(qwContent->layout())->addRow(currentPair.pluginCheckBox, currentPair.urlLabel);
+ static_cast< QFormLayout * >(qwContent->layout())->addRow(currentPair.pluginCheckBox, currentPair.urlLabel);
}
}
@@ -160,7 +156,7 @@ void PluginUpdater::on_selectAll(int checkState) {
for (int i = 0; i < m_pluginUpdateWidgets.size(); i++) {
UpdateWidgetPair &currentPair = m_pluginUpdateWidgets[i];
- currentPair.pluginCheckBox->setCheckState(static_cast<Qt::CheckState>(checkState));
+ currentPair.pluginCheckBox->setCheckState(static_cast< Qt::CheckState >(checkState));
}
}
@@ -210,9 +206,9 @@ void PluginUpdater::on_finished(int result) {
bool updateCurrent = false;
for (int k = 0; k < m_pluginUpdateWidgets.size(); k++) {
QCheckBox *checkBox = m_pluginUpdateWidgets[k].pluginCheckBox;
- QVariant idVariant = checkBox->property("pluginID");
+ QVariant idVariant = checkBox->property("pluginID");
- if (idVariant.isValid() && static_cast<plugin_id_t>(idVariant.toInt()) == id) {
+ if (idVariant.isValid() && static_cast< plugin_id_t >(idVariant.toInt()) == id) {
updateCurrent = checkBox->isChecked();
break;
}
@@ -263,8 +259,8 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
if (!foundID) {
// Can't match the URL to a pluginID
- qWarning() << "PluginUpdater: Requested update for plugin from"
- << reply->url() << "but didn't find corresponding plugin again!";
+ qWarning() << "PluginUpdater: Requested update for plugin from" << reply->url()
+ << "but didn't find corresponding plugin again!";
return;
}
@@ -273,8 +269,8 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
if (!plugin) {
// Can't find plugin with given ID
- qWarning() << "PluginUpdater: Got update for plugin with id"
- << entry.pluginID << "but it doesn't seem to exist anymore!";
+ qWarning() << "PluginUpdater: Got update for plugin with id" << entry.pluginID
+ << "but it doesn't seem to exist anymore!";
return;
}
@@ -282,13 +278,11 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
if (reply->error() != QNetworkReply::NoError) {
// There was an error during this request. Report it
Log::logOrDefer(Log::Warning,
- tr("Unable to download plugin update for \"%1\" from \"%2\" (%3)").arg(
- plugin->getName()).arg(reply->url().toString()).arg(
- QString::fromLatin1(
- QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(reply->error())
- )
- )
- );
+ tr("Unable to download plugin update for \"%1\" from \"%2\" (%3)")
+ .arg(plugin->getName())
+ .arg(reply->url().toString())
+ .arg(QString::fromLatin1(
+ QMetaEnum::fromType< QNetworkReply::NetworkError >().valueToKey(reply->error()))));
return;
}
@@ -300,13 +294,14 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
// We have been redirected
if (entry.redirects >= MAX_REDIRECTS - 1) {
// Maximum redirect count exceeded
- Log::logOrDefer(Log::Warning, tr("Update for plugin \"%1\" failed due to too many redirects").arg(plugin->getName()));
+ Log::logOrDefer(Log::Warning,
+ tr("Update for plugin \"%1\" failed due to too many redirects").arg(plugin->getName()));
return;
}
QUrl redirectedUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
- // Because the redirection url can be relative,
+ // Because the redirection url can be relative,
// we have to use the previous one to resolve it
redirectedUrl = reply->url().resolved(redirectedUrl);
@@ -329,9 +324,10 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
if (httpStatusCode < 200 || httpStatusCode >= 300) {
// HTTP request has failed
Log::logOrDefer(Log::Warning,
- tr("Unable to download plugin update for \"%1\" from \"%2\" (HTTP status code %3)").arg(
- plugin->getName()).arg(reply->url().toString()).arg(httpStatusCode)
- );
+ tr("Unable to download plugin update for \"%1\" from \"%2\" (HTTP status code %3)")
+ .arg(plugin->getName())
+ .arg(reply->url().toString())
+ .arg(httpStatusCode));
return;
}
@@ -341,8 +337,8 @@ void PluginUpdater::on_updateDownloaded(QNetworkReply *reply) {
// Write the content to a file in the temp-dir
if (content.isEmpty()) {
- qWarning() << "PluginUpdater: Update for" << plugin->getName() << "from"
- << reply->url().toString() << "resulted in no content!";
+ qWarning() << "PluginUpdater: Update for" << plugin->getName() << "from" << reply->url().toString()
+ << "resulted in no content!";
return;
}
diff --git a/src/mumble/PluginUpdater.h b/src/mumble/PluginUpdater.h
index 2d9041d3d..499325f4d 100644
--- a/src/mumble/PluginUpdater.h
+++ b/src/mumble/PluginUpdater.h
@@ -6,16 +6,16 @@
#ifndef MUMBLE_MUMBLE_PLUGINUPDATER_H_
#define MUMBLE_MUMBLE_PLUGINUPDATER_H_
-#include <QtCore/QVector>
-#include <QtCore/QUrl>
-#include <QtCore/QMutex>
#include <QNetworkAccessManager>
#include <QNetworkReply>
+#include <QtCore/QMutex>
+#include <QtCore/QUrl>
+#include <QtCore/QVector>
#include <atomic>
-#include "ui_PluginUpdater.h"
#include "Plugin.h"
+#include "ui_PluginUpdater.h"
/// A helper struct to store a pair of a CheckBox and a label corresponding to
/// a single plugin.
@@ -36,72 +36,72 @@ struct UpdateEntry {
/// A class designed for managing plugin updates. At the same time this also represents
/// a Dialog that can be used to prompt the user whether certain updates should be updated.
class PluginUpdater : public QDialog, public Ui::PluginUpdater {
- private:
- Q_OBJECT;
- Q_DISABLE_COPY(PluginUpdater);
+private:
+ Q_OBJECT;
+ Q_DISABLE_COPY(PluginUpdater);
- protected:
- /// An atomic flag indicating whether the plugin update has been interrupted. It is used
- /// to exit some loops in different threads before they are done.
- std::atomic<bool> m_wasInterrupted;
- /// A mutex for m_pluginsToUpdate.
- QMutex m_dataMutex;
- /// A vector holding plugins that can be updated by storing a pluginID and the download URL
- /// in form of an UpdateEntry.
- QVector<UpdateEntry> m_pluginsToUpdate;
- /// The NetworkManager used to perform the downloding of plugins.
- QNetworkAccessManager m_networkManager;
- /// A vector of the UI elements created for the individual plugins (in form of UpdateWidgetPairs).
- /// NOTE: This vector may only be accessed from the UI thread this dialog is living in!
- QVector<UpdateWidgetPair> m_pluginUpdateWidgets;
+protected:
+ /// An atomic flag indicating whether the plugin update has been interrupted. It is used
+ /// to exit some loops in different threads before they are done.
+ std::atomic< bool > m_wasInterrupted;
+ /// A mutex for m_pluginsToUpdate.
+ QMutex m_dataMutex;
+ /// A vector holding plugins that can be updated by storing a pluginID and the download URL
+ /// in form of an UpdateEntry.
+ QVector< UpdateEntry > m_pluginsToUpdate;
+ /// The NetworkManager used to perform the downloding of plugins.
+ QNetworkAccessManager m_networkManager;
+ /// A vector of the UI elements created for the individual plugins (in form of UpdateWidgetPairs).
+ /// NOTE: This vector may only be accessed from the UI thread this dialog is living in!
+ QVector< UpdateWidgetPair > m_pluginUpdateWidgets;
- /// Populates the UI with plugins that have been found to have an update available (through a call
- /// to checkForUpdates()).
- void populateUI();
+ /// Populates the UI with plugins that have been found to have an update available (through a call
+ /// to checkForUpdates()).
+ void populateUI();
- public:
- /// Constructor
- ///
- /// @param parent A pointer to the QWidget parent of this object
- PluginUpdater(QWidget *parent = nullptr);
- /// Destructor
- ~PluginUpdater();
+public:
+ /// Constructor
+ ///
+ /// @param parent A pointer to the QWidget parent of this object
+ PluginUpdater(QWidget *parent = nullptr);
+ /// Destructor
+ ~PluginUpdater();
- // The maximum number of redirects to allow
- static constexpr int MAX_REDIRECTS = 10;
+ // The maximum number of redirects to allow
+ static constexpr int MAX_REDIRECTS = 10;
- /// Triggers an update check for all plugins that are currently recognized by Mumble. This is done
- /// in a non-blocking fashion (in another thread). Once all plugins have been checked and if there
- /// are updates available, the updatesAvailable signal is emitted.
- void checkForUpdates();
- /// Launches a Dialog that asks the user which of the plugins an update has been found for, shall be
- /// updated. If the user has selected at least selected one plugin and has accepted the dialog, this
- /// function will automatically call update().
- void promptAndUpdate();
- /// Starts the update process of the plugins. This is done asynchronously.
- void update();
- public slots:
- /// Clears the UI from the widgets created for the individual plugins.
- void clearUI();
- /// Slot triggered if the user changes the state of the selectAll CheckBox.
- void on_selectAll(int checkState);
- /// Slot triggered if the user toggles the CheckBox for any individual plugin.
- void on_singleSelectionChanged(int checkState);
- /// Slot triggered when the dialog is being closed.
- void on_finished(int result);
- /// Slot that can be triggered to ask for the update process to be interrupted.
- void interrupt();
- protected slots:
- /// Slot triggered once an update for a plugin has been downloaded.
- void on_updateDownloaded(QNetworkReply *reply);
+ /// Triggers an update check for all plugins that are currently recognized by Mumble. This is done
+ /// in a non-blocking fashion (in another thread). Once all plugins have been checked and if there
+ /// are updates available, the updatesAvailable signal is emitted.
+ void checkForUpdates();
+ /// Launches a Dialog that asks the user which of the plugins an update has been found for, shall be
+ /// updated. If the user has selected at least selected one plugin and has accepted the dialog, this
+ /// function will automatically call update().
+ void promptAndUpdate();
+ /// Starts the update process of the plugins. This is done asynchronously.
+ void update();
+public slots:
+ /// Clears the UI from the widgets created for the individual plugins.
+ void clearUI();
+ /// Slot triggered if the user changes the state of the selectAll CheckBox.
+ void on_selectAll(int checkState);
+ /// Slot triggered if the user toggles the CheckBox for any individual plugin.
+ void on_singleSelectionChanged(int checkState);
+ /// Slot triggered when the dialog is being closed.
+ void on_finished(int result);
+ /// Slot that can be triggered to ask for the update process to be interrupted.
+ void interrupt();
+protected slots:
+ /// Slot triggered once an update for a plugin has been downloaded.
+ void on_updateDownloaded(QNetworkReply *reply);
- signals:
- /// This signal is emitted once it has been determined that there are plugin updates available.
- void updatesAvailable();
- /// This signal is emitted once all plugin updates have been downloaded and processed.
- void updatingFinished();
- /// This signal is emitted every time the update process has been interrupted.
- void updateInterrupted();
+signals:
+ /// This signal is emitted once it has been determined that there are plugin updates available.
+ void updatesAvailable();
+ /// This signal is emitted once all plugin updates have been downloaded and processed.
+ void updatingFinished();
+ /// This signal is emitted every time the update process has been interrupted.
+ void updateInterrupted();
};
#endif // MUMBLE_MUMBLE_PLUGINUPDATER_H_
diff --git a/src/mumble/PositionalData.cpp b/src/mumble/PositionalData.cpp
index 8a510e1df..8dd9332a9 100644
--- a/src/mumble/PositionalData.cpp
+++ b/src/mumble/PositionalData.cpp
@@ -17,14 +17,14 @@ Vector3D::Vector3D() : x(0.0f), y(0.0f), z(0.0f) {
Vector3D::Vector3D(float x, float y, float z) : x(x), y(y), z(z) {
}
-Vector3D::Vector3D(const Vector3D& other) : x(other.x), y(other.y), z(other.z) {
+Vector3D::Vector3D(const Vector3D &other) : x(other.x), y(other.y), z(other.z) {
}
Vector3D::~Vector3D() {
}
float Vector3D::operator[](Coord coord) const {
- switch(coord) {
+ switch (coord) {
case Coord::X:
return x;
case Coord::Y:
@@ -57,15 +57,15 @@ void Vector3D::operator/=(float divisor) {
z /= divisor;
}
-bool Vector3D::operator==(const Vector3D& other) const {
+bool Vector3D::operator==(const Vector3D &other) const {
return equals(other, 0.0f);
}
-Vector3D Vector3D::operator-(const Vector3D& other) const {
+Vector3D Vector3D::operator-(const Vector3D &other) const {
return { x - other.x, y - other.y, z - other.z };
}
-Vector3D Vector3D::operator+(const Vector3D& other) const {
+Vector3D Vector3D::operator+(const Vector3D &other) const {
return { x + other.x, y + other.y, z + other.z };
}
@@ -77,21 +77,22 @@ float Vector3D::norm() const {
return std::sqrt(normSquared());
}
-float Vector3D::dotProduct(const Vector3D& other) const {
+float Vector3D::dotProduct(const Vector3D &other) const {
return x * other.x + y * other.y + z * other.z;
}
-Vector3D Vector3D::crossProduct(const Vector3D& other) const {
+Vector3D Vector3D::crossProduct(const Vector3D &other) const {
return { y * other.z - z * other.y, z * other.x - x * other.z, x * other.y - y * other.x };
}
-bool Vector3D::equals(const Vector3D& other, float threshold) const {
+bool Vector3D::equals(const Vector3D &other, float threshold) const {
if (threshold == 0.0f) {
return x == other.x && y == other.y && z == other.z;
} else {
threshold = std::abs(threshold);
- return std::abs(x - other.x) < threshold && std::abs(y - other.y) < threshold && std::abs(z - other.z) < threshold;
+ return std::abs(x - other.x) < threshold && std::abs(y - other.y) < threshold
+ && std::abs(z - other.z) < threshold;
}
}
@@ -118,27 +119,14 @@ void Vector3D::toZero() {
}
PositionalData::PositionalData()
- : m_playerPos(),
- m_playerDir(),
- m_playerAxis(),
- m_cameraPos(),
- m_cameraDir(),
- m_cameraAxis(),
- m_context(),
- m_identity(),
- m_lock(QReadWriteLock::NonRecursive) {
+ : m_playerPos(), m_playerDir(), m_playerAxis(), m_cameraPos(), m_cameraDir(), m_cameraAxis(), m_context(),
+ m_identity(), m_lock(QReadWriteLock::NonRecursive) {
}
PositionalData::PositionalData(Position3D playerPos, Vector3D playerDir, Vector3D playerAxis, Position3D cameraPos,
- Vector3D cameraDir, Vector3D cameraAxis, QString context, QString identity)
- : m_playerPos(playerPos),
- m_playerDir(playerDir),
- m_playerAxis(playerAxis),
- m_cameraPos(cameraPos),
- m_cameraDir(cameraDir),
- m_cameraAxis(cameraAxis),
- m_context(context),
- m_identity(identity),
+ Vector3D cameraDir, Vector3D cameraAxis, QString context, QString identity)
+ : m_playerPos(playerPos), m_playerDir(playerDir), m_playerAxis(playerAxis), m_cameraPos(cameraPos),
+ m_cameraDir(cameraDir), m_cameraAxis(cameraAxis), m_context(context), m_identity(identity),
m_lock(QReadWriteLock::NonRecursive) {
}
@@ -146,7 +134,7 @@ PositionalData::~PositionalData() {
}
-void PositionalData::getPlayerPos(Position3D& pos) const {
+void PositionalData::getPlayerPos(Position3D &pos) const {
QReadLocker lock(&m_lock);
pos = m_playerPos;
@@ -158,7 +146,7 @@ Position3D PositionalData::getPlayerPos() const {
return m_playerPos;
}
-void PositionalData::getPlayerDir(Vector3D& vec) const {
+void PositionalData::getPlayerDir(Vector3D &vec) const {
QReadLocker lock(&m_lock);
vec = m_playerDir;
@@ -170,7 +158,7 @@ Vector3D PositionalData::getPlayerDir() const {
return m_playerDir;
}
-void PositionalData::getPlayerAxis(Vector3D& vec) const {
+void PositionalData::getPlayerAxis(Vector3D &vec) const {
QReadLocker lock(&m_lock);
vec = m_playerAxis;
@@ -182,7 +170,7 @@ Vector3D PositionalData::getPlayerAxis() const {
return m_playerAxis;
}
-void PositionalData::getCameraPos(Position3D& pos) const {
+void PositionalData::getCameraPos(Position3D &pos) const {
QReadLocker lock(&m_lock);
pos = m_cameraPos;
@@ -194,7 +182,7 @@ Position3D PositionalData::getCameraPos() const {
return m_cameraPos;
}
-void PositionalData::getCameraDir(Vector3D& vec) const {
+void PositionalData::getCameraDir(Vector3D &vec) const {
QReadLocker lock(&m_lock);
vec = m_cameraDir;
@@ -206,7 +194,7 @@ Vector3D PositionalData::getCameraDir() const {
return m_cameraDir;
}
-void PositionalData::getCameraAxis(Vector3D& vec) const {
+void PositionalData::getCameraAxis(Vector3D &vec) const {
QReadLocker lock(&m_lock);
vec = m_cameraAxis;
@@ -237,6 +225,6 @@ void PositionalData::reset() {
m_cameraPos.toZero();
m_cameraDir.toZero();
m_cameraAxis.toZero();
- m_context = QString();
+ m_context = QString();
m_identity = QString();
}
diff --git a/src/mumble/PositionalData.h b/src/mumble/PositionalData.h
index a0f6f4013..5bbbeb9f8 100644
--- a/src/mumble/PositionalData.h
+++ b/src/mumble/PositionalData.h
@@ -6,99 +6,100 @@
#ifndef MUMBLE_MUMBLE_POSITIONAL_AUDIO_CONTEXT_H_
#define MUMBLE_MUMBLE_POSITIONAL_AUDIO_CONTEXT_H_
-#include <QtCore/QString>
#include <QtCore/QReadWriteLock>
+#include <QtCore/QString>
/// An enum for the three cartesian coordinate axes x, y and z
-enum class Coord {X=0,Y,Z};
+enum class Coord { X = 0, Y, Z };
/// A 3D vector class holding an x-, y- and z-coordinate
struct Vector3D {
- /// The vector's x-coordinate
- float x;
- /// The vector's y-coordinate
- float y;
- /// The vector's z-coordinate
- float z;
+ /// The vector's x-coordinate
+ float x;
+ /// The vector's y-coordinate
+ float y;
+ /// The vector's z-coordinate
+ float z;
- /// Access the respective coordinate in an array-like fashion
- ///
- /// @param coord The Coord to access
- /// @returns The value of the respective coordinate
- float operator[](Coord coord) const;
- /// @param factor The factor to scale by
- /// @returns A new vector that has been created by scaling this vector by the given factor
- Vector3D operator*(float factor) const;
- /// @param divisor The divisor to apply to all coordinates
- /// @returns A new vector obtained from this one by applying the divisor to all coordinates
- Vector3D operator/(float divisor) const;
- /// Scales this vector by the given factor
- ///
- /// @param factor The factor to use
- void operator*=(float factor);
- /// Divides all of this vector's coordinates by the given divisor
- ///
- /// @param divisor The divisor to use
- void operator/=(float divisor);
- /// @param other The vector to compare this one to
- /// @returns Whether the given vector is equal to this one (their coordinates are the same)
- bool operator==(const Vector3D& other) const;
- /// @param other The vector to subtract from this one
- /// @returns A new vector representing the difference of this vector and the other one
- Vector3D operator-(const Vector3D& other) const;
- /// @param other The vector to add to this one
- /// @returns A new vector representing the sum of this vector and the other one
- Vector3D operator+(const Vector3D& other) const;
- /// @param other The vector to copy
- /// @returns A copy of the other vector
- Vector3D& operator=(const Vector3D& other) = default;
+ /// Access the respective coordinate in an array-like fashion
+ ///
+ /// @param coord The Coord to access
+ /// @returns The value of the respective coordinate
+ float operator[](Coord coord) const;
+ /// @param factor The factor to scale by
+ /// @returns A new vector that has been created by scaling this vector by the given factor
+ Vector3D operator*(float factor) const;
+ /// @param divisor The divisor to apply to all coordinates
+ /// @returns A new vector obtained from this one by applying the divisor to all coordinates
+ Vector3D operator/(float divisor) const;
+ /// Scales this vector by the given factor
+ ///
+ /// @param factor The factor to use
+ void operator*=(float factor);
+ /// Divides all of this vector's coordinates by the given divisor
+ ///
+ /// @param divisor The divisor to use
+ void operator/=(float divisor);
+ /// @param other The vector to compare this one to
+ /// @returns Whether the given vector is equal to this one (their coordinates are the same)
+ bool operator==(const Vector3D &other) const;
+ /// @param other The vector to subtract from this one
+ /// @returns A new vector representing the difference of this vector and the other one
+ Vector3D operator-(const Vector3D &other) const;
+ /// @param other The vector to add to this one
+ /// @returns A new vector representing the sum of this vector and the other one
+ Vector3D operator+(const Vector3D &other) const;
+ /// @param other The vector to copy
+ /// @returns A copy of the other vector
+ Vector3D &operator=(const Vector3D &other) = default;
- // allow explicit conversions from this struct to a float-array / float-pointer
- /// Explicit conversion to a float-array (of length 3) containing the coordinates of this vector
- explicit operator const float*() const { return &x; };
- /// Explicit conversion to a float-array (of length 3) containing the coordinates of this vector
- explicit operator float*() { return &x; };
+ // allow explicit conversions from this struct to a float-array / float-pointer
+ /// Explicit conversion to a float-array (of length 3) containing the coordinates of this vector
+ explicit operator const float *() const { return &x; };
+ /// Explicit conversion to a float-array (of length 3) containing the coordinates of this vector
+ explicit operator float *() { return &x; };
- /// Default constructor - sets all coordinates to 0
- Vector3D();
- /// @param x The x-coordinate
- /// @param y The y-coordinate
- /// @param z The z-coordinate
- Vector3D(float x, float y, float z);
- /// Copy constructor
- ///
- /// @param other The vector to copy
- Vector3D(const Vector3D& other);
- /// Destructor
- ~Vector3D();
- /// @returns The squared euclidean norm (length of the vector)
- float normSquared() const;
- /// If possible normSquared() should be preferred as this doesn't require a square-root operator
- ///
- /// @returns The euclidean norm (length of the vector)
- float norm() const;
- /// @param other The vector to calculate the dot-product with
- /// @returns The dot-product between this vector an the other one
- float dotProduct(const Vector3D& other) const;
- /// @param other The vector to calculate the cross-product (vector-product) with
- /// @returns The vector resulting from the cross-product (vector-product)
- Vector3D crossProduct(const Vector3D& other) const;
- /// @param other The vector to compare this one to
- /// @param threshold The maximum absolute difference for coordinates to still be considered equal
- /// @returns Whether this and the given vector are equal
- bool equals(const Vector3D& other, float threshold = 0.0f) const;
- /// @param threshold The maximum absolute value a coordinate may have to still be considered zero
- /// @returns Whether this vector is the zero-vector
- bool isZero(float threshold = 0.0f) const;
- /// Normalizes this vector to a unit-vector. Callin this function on a zero-vector results in undefined behaviour!
- void normalize();
- /// Transforms this vector to a zero-vector by setting all coordinates to zero
- void toZero();
+ /// Default constructor - sets all coordinates to 0
+ Vector3D();
+ /// @param x The x-coordinate
+ /// @param y The y-coordinate
+ /// @param z The z-coordinate
+ Vector3D(float x, float y, float z);
+ /// Copy constructor
+ ///
+ /// @param other The vector to copy
+ Vector3D(const Vector3D &other);
+ /// Destructor
+ ~Vector3D();
+ /// @returns The squared euclidean norm (length of the vector)
+ float normSquared() const;
+ /// If possible normSquared() should be preferred as this doesn't require a square-root operator
+ ///
+ /// @returns The euclidean norm (length of the vector)
+ float norm() const;
+ /// @param other The vector to calculate the dot-product with
+ /// @returns The dot-product between this vector an the other one
+ float dotProduct(const Vector3D &other) const;
+ /// @param other The vector to calculate the cross-product (vector-product) with
+ /// @returns The vector resulting from the cross-product (vector-product)
+ Vector3D crossProduct(const Vector3D &other) const;
+ /// @param other The vector to compare this one to
+ /// @param threshold The maximum absolute difference for coordinates to still be considered equal
+ /// @returns Whether this and the given vector are equal
+ bool equals(const Vector3D &other, float threshold = 0.0f) const;
+ /// @param threshold The maximum absolute value a coordinate may have to still be considered zero
+ /// @returns Whether this vector is the zero-vector
+ bool isZero(float threshold = 0.0f) const;
+ /// Normalizes this vector to a unit-vector. Callin this function on a zero-vector results in undefined behaviour!
+ void normalize();
+ /// Transforms this vector to a zero-vector by setting all coordinates to zero
+ void toZero();
};
-// As we're casting the vector struct to float-arrays, we have to make sure that the compiler won't introduce any padding
-// into the structure
-static_assert(sizeof(Vector3D) == 3*sizeof(float), "The compiler added padding to the Vector3D structure so it can't be cast to a float-array!");
+// As we're casting the vector struct to float-arrays, we have to make sure that the compiler won't introduce any
+// padding into the structure
+static_assert(sizeof(Vector3D) == 3 * sizeof(float),
+ "The compiler added padding to the Vector3D structure so it can't be cast to a float-array!");
/// A convenient alias as a position can be treated the same way a vector can
typedef Vector3D Position3D;
@@ -107,65 +108,65 @@ typedef Vector3D Position3D;
/// A class holding positional data used in the positional audio feature
class PositionalData {
friend class PluginManager; // needed in order for PluginManager::fetch to write to the contained fields
- protected:
- /// The player's position in the 3D world
- Position3D m_playerPos;
- /// The direction in which the player is looking
- Vector3D m_playerDir;
- /// The connection vector between the player's feet and his/her head
- Vector3D m_playerAxis;
- /// The camera's position un the 3D world
- Position3D m_cameraPos;
- /// The direction in which the camera is looking
- Vector3D m_cameraDir;
- /// The connection from the camera's bottom to its top
- Vector3D m_cameraAxis;
- /// The context of this positional data. This might include the game's name, the server currently connected to, etc. and is used
- /// to determine which players can hear one another
- QString m_context;
- /// The player's ingame identity (name)
- QString m_identity;
- /// The lock guarding all fields of this class
- mutable QReadWriteLock m_lock;
+protected:
+ /// The player's position in the 3D world
+ Position3D m_playerPos;
+ /// The direction in which the player is looking
+ Vector3D m_playerDir;
+ /// The connection vector between the player's feet and his/her head
+ Vector3D m_playerAxis;
+ /// The camera's position un the 3D world
+ Position3D m_cameraPos;
+ /// The direction in which the camera is looking
+ Vector3D m_cameraDir;
+ /// The connection from the camera's bottom to its top
+ Vector3D m_cameraAxis;
+ /// The context of this positional data. This might include the game's name, the server currently connected to, etc.
+ /// and is used to determine which players can hear one another
+ QString m_context;
+ /// The player's ingame identity (name)
+ QString m_identity;
+ /// The lock guarding all fields of this class
+ mutable QReadWriteLock m_lock;
- public:
- /// Default constructor
- PositionalData();
- /// Constructor initializing all fields to a specific value
- PositionalData(Position3D playerPos, Vector3D playerDir, Vector3D playerAxis, Position3D cameraPos, Vector3D cameraDir,
- Vector3D cameraAxis, QString context, QString identity);
- /// Destructor
- ~PositionalData();
- /// @param[out] pos The player's 3D position
- void getPlayerPos(Position3D& pos) const;
- /// @returns The player's 3D position
- Position3D getPlayerPos() const;
- /// @param[out] vec The direction in which the player is currently looking
- void getPlayerDir(Vector3D& vec) const;
- /// @returns The direction in which the player is currently looking
- Vector3D getPlayerDir() const;
- /// @param[out] axis The connection between the player's feet and his/her head
- void getPlayerAxis(Vector3D& axis) const;
- /// @returns The connection between the player's feet and his/her head
- Vector3D getPlayerAxis() const;
- /// @param[out] pos The camera's 3D position
- void getCameraPos(Position3D& pos) const;
- /// @returns The camera's 3D position
- Position3D getCameraPos() const;
- /// @param[out] vec The direction in which the camera is currently looking
- void getCameraDir(Vector3D& vec) const;
- /// @returns The direction in which the camera is currently looking
- Vector3D getCameraDir() const;
- /// @param[out] axis The connection between the player's feet and his/her head
- void getCameraAxis(Vector3D& axis) const;
- /// @returns The connection between the player's feet and his/her head
- Vector3D getCameraAxis() const;
- /// @returns The player's identity
- QString getPlayerIdentity() const;
- /// @returns The current context
- QString getContext() const;
- /// Resets all fields in this object
- void reset();
+public:
+ /// Default constructor
+ PositionalData();
+ /// Constructor initializing all fields to a specific value
+ PositionalData(Position3D playerPos, Vector3D playerDir, Vector3D playerAxis, Position3D cameraPos,
+ Vector3D cameraDir, Vector3D cameraAxis, QString context, QString identity);
+ /// Destructor
+ ~PositionalData();
+ /// @param[out] pos The player's 3D position
+ void getPlayerPos(Position3D &pos) const;
+ /// @returns The player's 3D position
+ Position3D getPlayerPos() const;
+ /// @param[out] vec The direction in which the player is currently looking
+ void getPlayerDir(Vector3D &vec) const;
+ /// @returns The direction in which the player is currently looking
+ Vector3D getPlayerDir() const;
+ /// @param[out] axis The connection between the player's feet and his/her head
+ void getPlayerAxis(Vector3D &axis) const;
+ /// @returns The connection between the player's feet and his/her head
+ Vector3D getPlayerAxis() const;
+ /// @param[out] pos The camera's 3D position
+ void getCameraPos(Position3D &pos) const;
+ /// @returns The camera's 3D position
+ Position3D getCameraPos() const;
+ /// @param[out] vec The direction in which the camera is currently looking
+ void getCameraDir(Vector3D &vec) const;
+ /// @returns The direction in which the camera is currently looking
+ Vector3D getCameraDir() const;
+ /// @param[out] axis The connection between the player's feet and his/her head
+ void getCameraAxis(Vector3D &axis) const;
+ /// @returns The connection between the player's feet and his/her head
+ Vector3D getCameraAxis() const;
+ /// @returns The player's identity
+ QString getPlayerIdentity() const;
+ /// @returns The current context
+ QString getContext() const;
+ /// Resets all fields in this object
+ void reset();
};
#endif
diff --git a/src/mumble/PulseAudio.cpp b/src/mumble/PulseAudio.cpp
index dcfb1cef5..947532dd8 100644
--- a/src/mumble/PulseAudio.cpp
+++ b/src/mumble/PulseAudio.cpp
@@ -320,7 +320,6 @@ void PulseAudioSystem::eventCallback(pa_mainloop_api *api, pa_defer_event *) {
qsInputCache = idev;
m_pulseAudio.stream_connect_record(pasInput, qPrintable(idev), &buff, PA_STREAM_ADJUST_LATENCY);
-
}
}
@@ -920,8 +919,8 @@ void PulseAudioInputRegistrar::setDeviceChoice(const QVariant &choice, Settings
}
bool PulseAudioInputRegistrar::canEcho(EchoCancelOptionID echoOption, const QString &osys) const {
- return (echoOption == EchoCancelOptionID::SPEEX_MIXED
- || echoOption == EchoCancelOptionID::SPEEX_MULTICHANNEL) && (osys == name);
+ return (echoOption == EchoCancelOptionID::SPEEX_MIXED || echoOption == EchoCancelOptionID::SPEEX_MULTICHANNEL)
+ && (osys == name);
}
PulseAudioOutputRegistrar::PulseAudioOutputRegistrar() : AudioOutputRegistrar(QLatin1String("PulseAudio"), 10) {
diff --git a/src/mumble/RichTextEditor.cpp b/src/mumble/RichTextEditor.cpp
index 5d361059d..6a8cd1759 100644
--- a/src/mumble/RichTextEditor.cpp
+++ b/src/mumble/RichTextEditor.cpp
@@ -235,7 +235,8 @@ void RichTextEditor::on_qaImage_triggered() {
if (qba.isEmpty())
return;
- if ((Global::get().uiImageLength > 0) && (static_cast< unsigned int >(qba.length()) > Global::get().uiImageLength)) {
+ if ((Global::get().uiImageLength > 0)
+ && (static_cast< unsigned int >(qba.length()) > Global::get().uiImageLength)) {
QMessageBox::warning(this, tr("Failed to load image"),
tr("Image file too large to embed in document. Please use images smaller than %1 kB.")
.arg(Global::get().uiImageLength / 1024));
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 429adc3f3..4eb8d6e14 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -462,9 +462,9 @@ void ServerHandler::run() {
#ifdef Q_OS_WIN
if (hQoS) {
if (!QOSRemoveSocketFromFlow(hQoS, 0, dwFlowUDP, 0)) {
- qWarning(
- "ServerHandler: Failed to remove UDP from QoS. QOSRemoveSocketFromFlow() failed with error %lu!",
- GetLastError());
+ qWarning("ServerHandler: Failed to remove UDP from QoS. QOSRemoveSocketFromFlow() failed with "
+ "error %lu!",
+ GetLastError());
}
dwFlowUDP = 0;
@@ -644,9 +644,11 @@ void ServerHandler::message(unsigned int msgType, const QByteArray &qbaMsg) {
Global::get().mw->msgBox(
tr("UDP packets cannot be sent to or received from the server. Switching to TCP mode."));
else if (connection->csCrypt->uiRemoteGood == 0)
- Global::get().mw->msgBox(tr("UDP packets cannot be sent to the server. Switching to TCP mode."));
+ Global::get().mw->msgBox(
+ tr("UDP packets cannot be sent to the server. Switching to TCP mode."));
else
- Global::get().mw->msgBox(tr("UDP packets cannot be received from the server. Switching to TCP mode."));
+ Global::get().mw->msgBox(
+ tr("UDP packets cannot be received from the server. Switching to TCP mode."));
database->setUdp(qbaDigest, false);
}
diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp
index aac13c4a9..aa85f4220 100644
--- a/src/mumble/Settings.cpp
+++ b/src/mumble/Settings.cpp
@@ -13,13 +13,13 @@
#include "../../overlay/overlay.h"
-#include <QtCore/QProcessEnvironment>
-#include <QtCore/QStandardPaths>
#include <QtCore/QFileInfo>
+#include <QtCore/QProcessEnvironment>
#include <QtCore/QRegularExpression>
+#include <QtCore/QStandardPaths>
#include <QtGui/QImageReader>
#include <QtWidgets/QSystemTrayIcon>
-#if QT_VERSION >= QT_VERSION_CHECK(5,9,0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
# include <QOperatingSystemVersion>
#endif
@@ -365,7 +365,7 @@ Settings::Settings() {
bLockLayout = false;
#ifdef Q_OS_WIN
// Don't enable minimize to tray by default on Windows >= 7
-# if QT_VERSION >= QT_VERSION_CHECK(5,9,0)
+# if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
// Since Qt 5.9 QOperatingSystemVersion is preferred over QSysInfo::WinVersion
bHideInTray = QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows7;
# else
@@ -549,7 +549,7 @@ Settings::Settings() {
qmMessages[Log::OtherMutedOther] = Settings::LogConsole;
qmMessages[Log::UserRenamed] = Settings::LogConsole;
qmMessages[Log::PluginMessage] = Settings::LogConsole;
-
+
// Default theme
themeName = QLatin1String("Mumble");
themeStyleName = QLatin1String("Lite");
@@ -560,7 +560,7 @@ bool Settings::doEcho() const {
AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qsAudioInput);
if (air) {
if ((Global::get().s.echoOption != EchoCancelOptionID::DISABLED)
- && air->canEcho(Global::get().s.echoOption, qsAudioOutput))
+ && air->canEcho(Global::get().s.echoOption, qsAudioOutput))
return true;
}
}
@@ -619,7 +619,7 @@ BOOST_TYPEOF_REGISTER_TEMPLATE(QList, 1)
// a zero value.
#ifdef Q_OS_MACOS
# undef LOAD
-# define LOAD(var, name) \
+# define LOAD(var, name) \
do { \
if (settings_ptr->value(QLatin1String(name)).toString() != QLatin1String("@Variant(")) { \
var = qvariant_cast< BOOST_TYPEOF(var) >(settings_ptr->value(QLatin1String(name), var)); \
@@ -1011,12 +1011,12 @@ void Settings::load(QSettings *settings_ptr) {
// Plugins
settings_ptr->beginGroup(QLatin1String("plugins"));
- foreach(const QString &pluginKey, settings_ptr->childGroups()) {
+ foreach (const QString &pluginKey, settings_ptr->childGroups()) {
QString pluginHash;
if (pluginKey.contains(QLatin1String("_"))) {
// The key contains the filename as well as the hash
- int index = pluginKey.lastIndexOf(QLatin1String("_"));
+ int index = pluginKey.lastIndexOf(QLatin1String("_"));
pluginHash = pluginKey.right(pluginKey.size() - index - 1);
} else {
pluginHash = pluginKey;
@@ -1024,9 +1024,11 @@ void Settings::load(QSettings *settings_ptr) {
PluginSetting pluginSettings;
pluginSettings.path = settings_ptr->value(pluginKey + QLatin1String("/path")).toString();
- pluginSettings.allowKeyboardMonitoring = settings_ptr->value(pluginKey + QLatin1String("/allowKeyboardMonitoring")).toBool();
+ pluginSettings.allowKeyboardMonitoring =
+ settings_ptr->value(pluginKey + QLatin1String("/allowKeyboardMonitoring")).toBool();
pluginSettings.enabled = settings_ptr->value(pluginKey + QLatin1String("/enabled")).toBool();
- pluginSettings.positionalDataEnabled = settings_ptr->value(pluginKey + QLatin1String("/positionalDataEnabled")).toBool();
+ pluginSettings.positionalDataEnabled =
+ settings_ptr->value(pluginKey + QLatin1String("/positionalDataEnabled")).toBool();
qhPluginSettings.insert(pluginHash, pluginSettings);
}
@@ -1038,7 +1040,7 @@ void Settings::load(QSettings *settings_ptr) {
}
#undef LOAD
-#define SAVE(var, name) \
+#define SAVE(var, name) \
if (var != def.var) \
settings_ptr->setValue(QLatin1String(name), var); \
else \
@@ -1401,13 +1403,13 @@ void Settings::save() {
settings_ptr->remove(d);
}
settings_ptr->endGroup();
-
+
// Plugins
- foreach(const QString &pluginHash, qhPluginSettings.keys()) {
- QString savePath = QString::fromLatin1("plugins/");
+ foreach (const QString &pluginHash, qhPluginSettings.keys()) {
+ QString savePath = QString::fromLatin1("plugins/");
const PluginSetting settings = qhPluginSettings.value(pluginHash);
const QFileInfo info(settings.path);
- QString baseName = info.baseName(); // Get the filename without file extensions
+ QString baseName = info.baseName(); // Get the filename without file extensions
const bool containsNonASCII = baseName.contains(QRegularExpression(QStringLiteral("[^\\x{0000}-\\x{007F}]")));
if (containsNonASCII || baseName.isEmpty()) {
@@ -1428,14 +1430,14 @@ void Settings::save() {
settings_ptr->setValue(QLatin1String("allowKeyboardMonitoring"), settings.allowKeyboardMonitoring);
settings_ptr->endGroup();
}
-
+
settings_ptr->beginGroup(QLatin1String("overlay"));
os.save(settings_ptr);
settings_ptr->endGroup();
}
-QDataStream& operator>>(QDataStream &arch, PluginSetting &setting) {
+QDataStream &operator>>(QDataStream &arch, PluginSetting &setting) {
arch >> setting.enabled;
arch >> setting.positionalDataEnabled;
arch >> setting.allowKeyboardMonitoring;
@@ -1443,7 +1445,7 @@ QDataStream& operator>>(QDataStream &arch, PluginSetting &setting) {
return arch;
}
-QDataStream& operator<<(QDataStream &arch, const PluginSetting &setting) {
+QDataStream &operator<<(QDataStream &arch, const PluginSetting &setting) {
arch << setting.enabled;
arch << setting.positionalDataEnabled;
arch << setting.allowKeyboardMonitoring;
diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h
index ab46e5391..18c5b9edb 100644
--- a/src/mumble/Settings.h
+++ b/src/mumble/Settings.h
@@ -65,8 +65,8 @@ struct PluginSetting {
bool positionalDataEnabled;
bool allowKeyboardMonitoring;
};
-QDataStream& operator>>(QDataStream &arch, PluginSetting &setting);
-QDataStream& operator<<(QDataStream &arch, const PluginSetting &setting);
+QDataStream &operator>>(QDataStream &arch, PluginSetting &setting);
+QDataStream &operator<<(QDataStream &arch, const PluginSetting &setting);
Q_DECLARE_METATYPE(PluginSetting);
diff --git a/src/mumble/TalkingUI.cpp b/src/mumble/TalkingUI.cpp
index 03ff76b88..92a0a6e58 100644
--- a/src/mumble/TalkingUI.cpp
+++ b/src/mumble/TalkingUI.cpp
@@ -235,7 +235,7 @@ void TalkingUI::setupUI() {
}
void TalkingUI::setFontSize(MultiStyleWidgetWrapper &widgetWrapper) {
- const double fontFactor = Global::get().s.iTalkingUI_RelativeFontSize / 100.0;
+ const double fontFactor = Global::get().s.iTalkingUI_RelativeFontSize / 100.0;
const int origLineHeight = QFontMetrics(font()).height();
if (font().pixelSize() >= 0) {
@@ -244,7 +244,7 @@ void TalkingUI::setFontSize(MultiStyleWidgetWrapper &widgetWrapper) {
widgetWrapper.setFontSize(pixelSize, true);
} else {
// font specified in points
- uint32_t pointSize = static_cast< uint32_t >(std::max(fontFactor * font().pointSize(), 1.0));
+ uint32_t pointSize = static_cast< uint32_t >(std::max(fontFactor * font().pointSize(), 1.0));
widgetWrapper.setFontSize(pointSize, false);
}
@@ -329,11 +329,11 @@ QString createChannelName(const Channel *chan, bool abbreviateName, int minPrefi
void TalkingUI::addChannel(const Channel *channel) {
if (findContainer(channel->iId, ContainerType::CHANNEL) < 0) {
// Create a QGroupBox for this channel
- const QString channelName =
- createChannelName(channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
- Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
- Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
- Global::get().s.qsTalkingUI_AbbreviationReplacement, Global::get().s.bTalkingUI_AbbreviateCurrentChannel);
+ const QString channelName = createChannelName(
+ channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
+ Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
+ Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
+ Global::get().s.qsTalkingUI_AbbreviationReplacement, Global::get().s.bTalkingUI_AbbreviateCurrentChannel);
std::unique_ptr< TalkingUIChannel > channelContainer =
std::make_unique< TalkingUIChannel >(channel->iId, channelName, *this);
@@ -391,7 +391,7 @@ TalkingUIUser *TalkingUI::findOrAddUser(const ClientUser *user) {
}
std::unique_ptr< TalkingUIUser > userEntry = std::make_unique< TalkingUIUser >(*user);
- TalkingUIUser *newUserEntry = userEntry.get();
+ TalkingUIUser *newUserEntry = userEntry.get();
// * 1000 as the setting is in seconds whereas the timer expects milliseconds
userEntry->setLifeTime(Global::get().s.iTalkingUI_SilentUserLifeTime * 1000);
@@ -552,7 +552,8 @@ void TalkingUI::mousePressEvent(QMouseEvent *event) {
// resulting in the proper context menu being shown at the position of the mouse which in this case is in
// the TalkingUI.
QMetaObject::invokeMethod(Global::get().mw, "on_qtvUsers_customContextMenuRequested", Qt::QueuedConnection,
- Q_ARG(QPoint, Global::get().mw->qtvUsers->mapFromGlobal(event->globalPos())), Q_ARG(bool, false));
+ Q_ARG(QPoint, Global::get().mw->qtvUsers->mapFromGlobal(event->globalPos())),
+ Q_ARG(bool, false));
}
} else {
// Clear selection
@@ -725,11 +726,12 @@ void TalkingUI::on_settingsChanged() {
if (channel) {
// Update
- channelContainer->setName(
- createChannelName(channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
- Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
- Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
- Global::get().s.qsTalkingUI_AbbreviationReplacement, Global::get().s.bTalkingUI_AbbreviateCurrentChannel));
+ channelContainer->setName(createChannelName(
+ channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
+ Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
+ Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
+ Global::get().s.qsTalkingUI_AbbreviationReplacement,
+ Global::get().s.bTalkingUI_AbbreviateCurrentChannel));
} else {
qCritical("TalkingUI: Can't find channel for stored ID");
}
diff --git a/src/mumble/Translations.cpp b/src/mumble/Translations.cpp
index 377732c23..87332cd06 100644
--- a/src/mumble/Translations.cpp
+++ b/src/mumble/Translations.cpp
@@ -14,12 +14,13 @@
namespace Mumble {
namespace Translations {
- LifetimeGuard::LifetimeGuard(LifetimeGuard &&old) : m_bundledTranslator(old.m_bundledTranslator),
- m_overwriteTranslator(old.m_overwriteTranslator), m_qtTranslator(old.m_qtTranslator) {
+ LifetimeGuard::LifetimeGuard(LifetimeGuard &&old)
+ : m_bundledTranslator(old.m_bundledTranslator), m_overwriteTranslator(old.m_overwriteTranslator),
+ m_qtTranslator(old.m_qtTranslator) {
// Reset values of old
- old.m_bundledTranslator = nullptr;
+ old.m_bundledTranslator = nullptr;
old.m_overwriteTranslator = nullptr;
- old.m_qtTranslator = nullptr;
+ old.m_qtTranslator = nullptr;
}
LifetimeGuard::~LifetimeGuard() {
@@ -121,9 +122,11 @@ namespace Translations {
app.installTranslator(guard.m_qtTranslator);
} else if (guard.m_qtTranslator->load(locale, ":/mumble_overwrite_qtbase_")) {
app.installTranslator(guard.m_qtTranslator);
- } else if (guard.m_qtTranslator->load(locale, "qt_", prefix, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
+ } else if (guard.m_qtTranslator->load(locale, "qt_", prefix,
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
app.installTranslator(guard.m_qtTranslator);
- } else if (guard.m_qtTranslator->load(locale, "qtbase_", prefix, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
+ } else if (guard.m_qtTranslator->load(locale, "qtbase_", prefix,
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
app.installTranslator(guard.m_qtTranslator);
} else if (guard.m_qtTranslator->load(locale, ":/qt_")) {
app.installTranslator(guard.m_qtTranslator);
diff --git a/src/mumble/Translations.h b/src/mumble/Translations.h
index 2a0b8f3d7..ebb2d0650 100644
--- a/src/mumble/Translations.h
+++ b/src/mumble/Translations.h
@@ -19,9 +19,9 @@ namespace Translations {
* A lifetime guard for translators. Basically a smart-pointer for an ensemble of translators
*/
struct LifetimeGuard {
- QTranslator *m_bundledTranslator = nullptr;
+ QTranslator *m_bundledTranslator = nullptr;
QTranslator *m_overwriteTranslator = nullptr;
- QTranslator *m_qtTranslator = nullptr;
+ QTranslator *m_qtTranslator = nullptr;
LifetimeGuard() = default;
LifetimeGuard(LifetimeGuard &&old);
diff --git a/src/mumble/Usage.cpp b/src/mumble/Usage.cpp
index 94a313bd6..af8ba0199 100644
--- a/src/mumble/Usage.cpp
+++ b/src/mumble/Usage.cpp
@@ -30,7 +30,8 @@ Usage::Usage(QObject *p) : QObject(p) {
void Usage::registerUsage() {
if (!Global::get().s.bUsage
- || Global::get().s.uiUpdateCounter == 0) // Only register usage if allowed by the user and first wizard run has finished
+ || Global::get().s.uiUpdateCounter
+ == 0) // Only register usage if allowed by the user and first wizard run has finished
return;
QDomDocument doc;
diff --git a/src/mumble/UserInformation.cpp b/src/mumble/UserInformation.cpp
index 1ecc996e9..70925e7c3 100644
--- a/src/mumble/UserInformation.cpp
+++ b/src/mumble/UserInformation.cpp
@@ -104,7 +104,8 @@ void UserInformation::update(const MumbleProto::UserStats &msg) {
if (alts.contains(QSsl::EmailEntry))
qlCertificate->setText(QStringList(alts.values(QSsl::EmailEntry)).join(tr(", ")));
else
- qlCertificate->setText(Mumble::QtUtils::decode_first_utf8_qssl_string(cert.subjectInfo(QSslCertificate::CommonName)));
+ qlCertificate->setText(
+ Mumble::QtUtils::decode_first_utf8_qssl_string(cert.subjectInfo(QSslCertificate::CommonName)));
if (msg.strong_certificate()) {
QFont f = qfCertificateFont;
diff --git a/src/mumble/UserLocalNicknameDialog.cpp b/src/mumble/UserLocalNicknameDialog.cpp
index bb2dea4e1..c5bea6ad0 100644
--- a/src/mumble/UserLocalNicknameDialog.cpp
+++ b/src/mumble/UserLocalNicknameDialog.cpp
@@ -13,8 +13,7 @@
#include <QtWidgets/QPushButton>
UserLocalNicknameDialog::UserLocalNicknameDialog(
- unsigned int sessionId,
- std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker)
+ unsigned int sessionId, std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker)
: QDialog(nullptr), m_clientSession(sessionId), m_qmUserNicknameTracker(qmUserNicknameTracker) {
setupUi(this);
@@ -44,16 +43,16 @@ void UserLocalNicknameDialog::closeEvent(QCloseEvent *event) {
event->accept();
}
-void UserLocalNicknameDialog::present(
- unsigned int sessionId,
- std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker) {
+void UserLocalNicknameDialog::present(unsigned int sessionId,
+ std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker) {
if (qmUserNicknameTracker.find(sessionId) != qmUserNicknameTracker.end()) {
qmUserNicknameTracker.at(sessionId)->show();
qmUserNicknameTracker.at(sessionId)->raise();
} else {
// Make sure to use the custom deleter for QObjects that calls deleteLater() on them instead of using
// delete directly as the latter can lead to segmentation faults.
- NicknameDialogPtr userNickname(new UserLocalNicknameDialog(sessionId, qmUserNicknameTracker), Mumble::QtUtils::deleteQObject);
+ NicknameDialogPtr userNickname(new UserLocalNicknameDialog(sessionId, qmUserNicknameTracker),
+ Mumble::QtUtils::deleteQObject);
userNickname->show();
qmUserNicknameTracker.insert(std::make_pair(sessionId, std::move(userNickname)));
}
diff --git a/src/mumble/UserLocalNicknameDialog.h b/src/mumble/UserLocalNicknameDialog.h
index 06083f848..830851019 100644
--- a/src/mumble/UserLocalNicknameDialog.h
+++ b/src/mumble/UserLocalNicknameDialog.h
@@ -40,12 +40,10 @@ public slots:
void reject();
public:
- static void
- present(unsigned int sessionId,
- std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker);
- UserLocalNicknameDialog(
- unsigned int sessionId,
- std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker);
+ static void present(unsigned int sessionId,
+ std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker);
+ UserLocalNicknameDialog(unsigned int sessionId,
+ std::unordered_map< unsigned int, NicknameDialogPtr > &qmUserNicknameTracker);
};
#endif
diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp
index ceb7c1dd4..474585eb2 100644
--- a/src/mumble/UserModel.cpp
+++ b/src/mumble/UserModel.cpp
@@ -1176,7 +1176,8 @@ void UserModel::setComment(ClientUser *cu, const QString &comment) {
QWhatsThis::showText(Global::get().mw->qtvUsers->viewport()->mapToGlobal(r.bottomRight()),
data(index(cu, 0), Qt::ToolTipRole).toString(), Global::get().mw->qtvUsers);
} else {
- QToolTip::showText(QCursor::pos(), data(index(cu, 0), Qt::ToolTipRole).toString(), Global::get().mw->qtvUsers);
+ QToolTip::showText(QCursor::pos(), data(index(cu, 0), Qt::ToolTipRole).toString(),
+ Global::get().mw->qtvUsers);
}
} else if (cu->uiSession == ~uiSessionComment) {
uiSessionComment = 0;
@@ -1241,7 +1242,8 @@ void UserModel::setComment(Channel *c, const QString &comment) {
QWhatsThis::showText(Global::get().mw->qtvUsers->viewport()->mapToGlobal(r.bottomRight()),
data(index(c, 0), Qt::ToolTipRole).toString(), Global::get().mw->qtvUsers);
} else {
- QToolTip::showText(QCursor::pos(), data(index(c, 0), Qt::ToolTipRole).toString(), Global::get().mw->qtvUsers);
+ QToolTip::showText(QCursor::pos(), data(index(c, 0), Qt::ToolTipRole).toString(),
+ Global::get().mw->qtvUsers);
}
} else {
item->bCommentSeen = Global::get().db->seenComment(item->hash(), c->qbaDescHash);
@@ -1784,16 +1786,17 @@ bool UserModel::dropMimeData(const QMimeData *md, Qt::DropAction, int row, int c
int ret;
switch (Global::get().s.ceUserDrag) {
case Settings::Ask:
- ret =
- QMessageBox::question(Global::get().mw, QLatin1String("Mumble"), tr("Are you sure you want to drag this user?"),
- QMessageBox::Yes, QMessageBox::No);
+ ret = QMessageBox::question(Global::get().mw, QLatin1String("Mumble"),
+ tr("Are you sure you want to drag this user?"), QMessageBox::Yes,
+ QMessageBox::No);
if (ret == QMessageBox::No)
return false;
break;
case Settings::DoNothing:
- Global::get().l->log(Log::Information,
- MainWindow::tr("You have User Dragging set to \"Do Nothing\" so the user wasn't moved."));
+ Global::get().l->log(
+ Log::Information,
+ MainWindow::tr("You have User Dragging set to \"Do Nothing\" so the user wasn't moved."));
return false;
break;
case Settings::Move:
@@ -1824,7 +1827,8 @@ bool UserModel::dropMimeData(const QMimeData *md, Qt::DropAction, int row, int c
case Settings::Move:
break;
default:
- Global::get().l->log(Log::CriticalError, MainWindow::tr("Unknown Channel Drag mode in UserModel::dropMimeData."));
+ Global::get().l->log(Log::CriticalError,
+ MainWindow::tr("Unknown Channel Drag mode in UserModel::dropMimeData."));
return false;
break;
}
@@ -2004,7 +2008,8 @@ QString UserModel::createDisplayString(const ClientUser &user, bool isChannelLis
displayString += " " + friendTag;
}
- if (!Global::get().s.bShowNicknamesOnly && !nickname.isEmpty() && user.qsName.compare(nickname, Qt::CaseInsensitive) != 0) {
+ if (!Global::get().s.bShowNicknamesOnly && !nickname.isEmpty()
+ && user.qsName.compare(nickname, Qt::CaseInsensitive) != 0) {
displayString += " " + QString::fromLatin1("[%1]").arg(nickname);
}
diff --git a/src/mumble/VersionCheck.cpp b/src/mumble/VersionCheck.cpp
index 3fb90caf7..123665e57 100644
--- a/src/mumble/VersionCheck.cpp
+++ b/src/mumble/VersionCheck.cpp
@@ -54,8 +54,9 @@ VersionCheck::VersionCheck(bool autocheck, QObject *p, bool focus) : QObject(p),
if (autocheck)
queryItems << qMakePair(QString::fromLatin1("auto"), QString::fromLatin1("1"));
- queryItems << qMakePair(QString::fromLatin1("locale"),
- Global::get().s.qsLanguage.isEmpty() ? QLocale::system().name() : Global::get().s.qsLanguage);
+ queryItems << qMakePair(QString::fromLatin1("locale"), Global::get().s.qsLanguage.isEmpty()
+ ? QLocale::system().name()
+ : Global::get().s.qsLanguage);
QFile f(qApp->applicationFilePath());
if (!f.open(QIODevice::ReadOnly)) {
@@ -105,8 +106,8 @@ void VersionCheck::fetched(QByteArray a, QUrl url) {
if (!fetch.isValid()) {
Global::get().mw->msgBox(QString::fromUtf8(a));
} else {
- QString filename =
- Global::get().qdBasePath.absoluteFilePath(QLatin1String("Snapshots/") + QFileInfo(fetch.path()).fileName());
+ QString filename = Global::get().qdBasePath.absoluteFilePath(QLatin1String("Snapshots/")
+ + QFileInfo(fetch.path()).fileName());
QFile qf(filename);
if (qf.exists()) {
@@ -157,15 +158,16 @@ void VersionCheck::fetched(QByteArray a, QUrl url) {
}
} else {
- Global::get().mw->msgBox(tr("Corrupt download of new version detected. Automatically removed."));
+ Global::get().mw->msgBox(
+ tr("Corrupt download of new version detected. Automatically removed."));
qf.remove();
}
// Delete all but the N most recent snapshots
size_t numberOfSnapshotsToKeep = 1;
- QDir snapdir(Global::get().qdBasePath.absolutePath() + QLatin1String("/Snapshots/"), QString(), QDir::Name,
- QDir::Files);
+ QDir snapdir(Global::get().qdBasePath.absolutePath() + QLatin1String("/Snapshots/"), QString(),
+ QDir::Name, QDir::Files);
foreach (const QFileInfo fileInfo,
snapdir.entryInfoList(QStringList(), QDir::NoFilter, QDir::Time)) {
@@ -180,14 +182,14 @@ void VersionCheck::fetched(QByteArray a, QUrl url) {
}
} else {
Global::get().mw->msgBox(tr("Downloading new snapshot from %1 to %2")
- .arg(fetch.toString().toHtmlEscaped(), filename.toHtmlEscaped()));
+ .arg(fetch.toString().toHtmlEscaped(), filename.toHtmlEscaped()));
WebFetch::fetch(QLatin1String("dl"), fetch, this, SLOT(fetched(QByteArray, QUrl)));
return;
}
}
} else {
- QString filename =
- Global::get().qdBasePath.absoluteFilePath(QLatin1String("Snapshots/") + QFileInfo(url.path()).fileName());
+ QString filename = Global::get().qdBasePath.absoluteFilePath(QLatin1String("Snapshots/")
+ + QFileInfo(url.path()).fileName());
QFile qf(filename);
if (qf.open(QIODevice::WriteOnly)) {
diff --git a/src/mumble/VoiceRecorderDialog.cpp b/src/mumble/VoiceRecorderDialog.cpp
index e3d9ddc12..0f8c1d8c8 100644
--- a/src/mumble/VoiceRecorderDialog.cpp
+++ b/src/mumble/VoiceRecorderDialog.cpp
@@ -96,7 +96,7 @@ void VoiceRecorderDialog::closeEvent(QCloseEvent *evt) {
else
Global::get().s.rmRecordingMode = Settings::RecordingMultichannel;
- int i = qcbFormat->currentIndex();
+ int i = qcbFormat->currentIndex();
Global::get().s.iRecordingFormat = (i == -1) ? 0 : i;
reset();
diff --git a/src/mumble/WASAPI.cpp b/src/mumble/WASAPI.cpp
index bdc3d1ee6..91f071f14 100644
--- a/src/mumble/WASAPI.cpp
+++ b/src/mumble/WASAPI.cpp
@@ -208,8 +208,8 @@ void WASAPIInputRegistrar::setDeviceChoice(const QVariant &choice, Settings &s)
}
bool WASAPIInputRegistrar::canEcho(EchoCancelOptionID echoOptionIDs, const QString &outputSystem) const {
- return (echoOptionIDs == EchoCancelOptionID::SPEEX_MIXED
- || echoOptionIDs == EchoCancelOptionID::SPEEX_MULTICHANNEL) && (outputSystem == name);
+ return (echoOptionIDs == EchoCancelOptionID::SPEEX_MIXED || echoOptionIDs == EchoCancelOptionID::SPEEX_MULTICHANNEL)
+ && (outputSystem == name);
}
bool WASAPIInputRegistrar::canExclusive() const {
@@ -485,8 +485,9 @@ void WASAPIInput::run() {
qWarning("WASAPIInput: Mic Initialize failed: hr=0x%08lx", hr);
if (hr == E_ACCESSDENIED) {
WASAPIInputRegistrar::hasOSPermissionDenied = true;
- Global::get().mw->msgBox(tr("Access to the microphone was denied. Please check that your operating system's "
- "microphone settings allow Mumble to use the microphone."));
+ Global::get().mw->msgBox(
+ tr("Access to the microphone was denied. Please check that your operating system's "
+ "microphone settings allow Mumble to use the microphone."));
}
goto cleanup;
}
@@ -885,10 +886,11 @@ void WASAPIOutput::run() {
int ns = 0;
unsigned int chanmasks[32];
QMap< DWORD, float > qmVolumes;
- bool lastspoke = false;
- REFERENCE_TIME bufferDuration = (Global::get().s.iOutputDelay > 1) ? (Global::get().s.iOutputDelay + 1) * 100000 : 0;
- bool exclusive = false;
- bool mixed = false;
+ bool lastspoke = false;
+ REFERENCE_TIME bufferDuration =
+ (Global::get().s.iOutputDelay > 1) ? (Global::get().s.iOutputDelay + 1) * 100000 : 0;
+ bool exclusive = false;
+ bool mixed = false;
CoInitialize(nullptr);
@@ -1015,7 +1017,8 @@ void WASAPIOutput::run() {
iMixerFreq = pwfx->nSamplesPerSec;
qWarning("WASAPIOutput: Periods %lldus %lldus (latency %lldus)", def / 10LL, min / 10LL, latency / 10LL);
- qWarning("WASAPIOutput: Buffer is %dus (%d)", (bufferFrameCount * 1000000) / iMixerFreq, Global::get().s.iOutputDelay);
+ qWarning("WASAPIOutput: Buffer is %dus (%d)", (bufferFrameCount * 1000000) / iMixerFreq,
+ Global::get().s.iOutputDelay);
hr = pAudioClient->GetService(__uuidof(IAudioRenderClient), (void **) &pRenderClient);
if (FAILED(hr)) {
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index a1ef34826..a0d3f337d 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -11,8 +11,6 @@
#include "AudioWizard.h"
#include "Cert.h"
#include "Database.h"
-#include "Log.h"
-#include "LogEmitter.h"
#include "DeveloperConsole.h"
#include "LCD.h"
#include "Log.h"
@@ -37,22 +35,22 @@
#include "License.h"
#include "MumbleApplication.h"
#include "NetworkConfig.h"
+#include "PluginInstaller.h"
+#include "PluginManager.h"
#include "SSL.h"
#include "SocketRPC.h"
#include "TalkingUI.h"
-#include "Translations.h"
#include "Themes.h"
+#include "Translations.h"
#include "UserLockFile.h"
#include "VersionCheck.h"
-#include "PluginInstaller.h"
-#include "PluginManager.h"
#include "Global.h"
+#include <QLocale>
+#include <QScreen>
#include <QtCore/QProcess>
#include <QtGui/QDesktopServices>
#include <QtWidgets/QMessageBox>
-#include <QLocale>
-#include <QScreen>
#ifdef USE_DBUS
# include <QtDBus/QDBusInterface>
@@ -75,7 +73,7 @@ extern void os_init();
extern char *os_lang;
QScreen *screenAt(QPoint point) {
-#if QT_VERSION >= QT_VERSION_CHECK(5,10,0)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// screenAt was only introduced in Qt 5.10
return QGuiApplication::screenAt(point);
#else
@@ -95,14 +93,16 @@ bool positionIsOnScreen(QPoint point) {
QPoint getTalkingUIPosition() {
QPoint talkingUIPos = QPoint(0, 0);
- if (Global::get().s.qpTalkingUI_Position != Settings::UNSPECIFIED_POSITION && positionIsOnScreen(Global::get().s.qpTalkingUI_Position)) {
+ if (Global::get().s.qpTalkingUI_Position != Settings::UNSPECIFIED_POSITION
+ && positionIsOnScreen(Global::get().s.qpTalkingUI_Position)) {
// Restore last position
talkingUIPos = Global::get().s.qpTalkingUI_Position;
} else {
// Place the TalkingUI next to the MainWindow by default
const QPoint mainWindowPos = Global::get().mw->pos();
const int horizontalBuffer = 10;
- const QPoint defaultPos = QPoint(mainWindowPos.x() + Global::get().mw->size().width() + horizontalBuffer, mainWindowPos.y());
+ const QPoint defaultPos =
+ QPoint(mainWindowPos.x() + Global::get().mw->size().width() + horizontalBuffer, mainWindowPos.y());
if (positionIsOnScreen(defaultPos)) {
talkingUIPos = defaultPos;
@@ -115,8 +115,8 @@ QPoint getTalkingUIPosition() {
const QSize talkingUISize = Global::get().talkingUI->size();
// The screen should always be found at this point as we have chosen to pos to be on a screen
- const QScreen *screen = screenAt(talkingUIPos);
- const QRect screenGeom = screen ? screen->availableGeometry() : QRect(0,0,0,0);
+ const QScreen *screen = screenAt(talkingUIPos);
+ const QRect screenGeom = screen ? screen->availableGeometry() : QRect(0, 0, 0, 0);
// Check whether the TalkingUI fits on the screen in x-direction
if (!positionIsOnScreen(talkingUIPos + QPoint(talkingUISize.width(), 0))) {
@@ -340,12 +340,12 @@ int main(int argc, char **argv) {
} else if (args.at(i) == QLatin1String("-m") || args.at(i) == QLatin1String("--multiple")) {
bAllowMultiple = true;
} else if (args.at(i) == QLatin1String("-n") || args.at(i) == QLatin1String("--noidentity")) {
- suppressIdentity = true;
+ suppressIdentity = true;
Global::get().s.bSuppressIdentity = true;
} else if (args.at(i) == QLatin1String("-jn") || args.at(i) == QLatin1String("--jackname")) {
if (i + 1 < args.count()) {
Global::get().s.qsJackClientName = QString(args.at(i + 1));
- customJackClientName = true;
+ customJackClientName = true;
++i;
} else {
qCritical("Missing argument for --jackname!");
@@ -428,15 +428,16 @@ int main(int argc, char **argv) {
QString infoString = QObject::tr("The directories in which Mumble searches for extra translation files are:\n");
int counter = 1;
- for (const QString &currentTranslationDir : Mumble::Translations::getTranslationDirectories(a, extraTranslationDirs)) {
+ for (const QString &currentTranslationDir :
+ Mumble::Translations::getTranslationDirectories(a, extraTranslationDirs)) {
infoString += QString::fromLatin1("%1. ").arg(counter) + currentTranslationDir + "\n";
counter++;
}
#if defined(Q_OS_WIN)
- QMessageBox::information(nullptr, QObject::tr("Invocation"), infoString);
+ QMessageBox::information(nullptr, QObject::tr("Invocation"), infoString);
#else
- printf("%s", qUtf8Printable(infoString));
+ printf("%s", qUtf8Printable(infoString));
#endif
return 0;
@@ -594,24 +595,23 @@ int main(int argc, char **argv) {
}
if (!pluginsToBeInstalled.isEmpty()) {
-
- foreach(QString currentPlugin, pluginsToBeInstalled) {
-
+ foreach (QString currentPlugin, pluginsToBeInstalled) {
try {
PluginInstaller installer(currentPlugin);
installer.exec();
- } catch(const PluginInstallException& e) {
+ } catch (const PluginInstallException &e) {
qCritical() << qUtf8Printable(e.getMessage());
}
-
}
return 0;
}
- qWarning("Locale is \"%s\" (System: \"%s\")", qUtf8Printable(settingsLocale.name()), qUtf8Printable(systemLocale.name()));
+ qWarning("Locale is \"%s\" (System: \"%s\")", qUtf8Printable(settingsLocale.name()),
+ qUtf8Printable(systemLocale.name()));
- Mumble::Translations::LifetimeGuard translationGuard = Mumble::Translations::installTranslators(settingsLocale, a, extraTranslationDirs);
+ Mumble::Translations::LifetimeGuard translationGuard =
+ Mumble::Translations::installTranslators(settingsLocale, a, extraTranslationDirs);
// Initialize proxy settings
NetworkConfig::SetupProxy();
@@ -631,7 +631,7 @@ int main(int argc, char **argv) {
// Initialize zeroconf
Global::get().zeroconf = new Zeroconf();
#endif
-
+
// PluginManager
Global::get().pluginManager = new PluginManager();
Global::get().pluginManager->rescanPlugins();
@@ -661,12 +661,15 @@ int main(int argc, char **argv) {
// window's frame to be included in the positioning calculation on X11 (at least using KDE Plasma)
Global::get().talkingUI->setVisible(Global::get().s.bShowTalkingUI);
- QObject::connect(Global::get().mw, &MainWindow::userAddedChannelListener, Global::get().talkingUI, &TalkingUI::on_channelListenerAdded);
- QObject::connect(Global::get().mw, &MainWindow::userRemovedChannelListener, Global::get().talkingUI, &TalkingUI::on_channelListenerRemoved);
+ QObject::connect(Global::get().mw, &MainWindow::userAddedChannelListener, Global::get().talkingUI,
+ &TalkingUI::on_channelListenerAdded);
+ QObject::connect(Global::get().mw, &MainWindow::userRemovedChannelListener, Global::get().talkingUI,
+ &TalkingUI::on_channelListenerRemoved);
QObject::connect(&ChannelListener::get(), &ChannelListener::localVolumeAdjustmentsChanged, Global::get().talkingUI,
&TalkingUI::on_channelListenerLocalVolumeAdjustmentChanged);
- QObject::connect(Global::get().mw, &MainWindow::serverSynchronized, Global::get().talkingUI, &TalkingUI::on_serverSynchronized);
+ QObject::connect(Global::get().mw, &MainWindow::serverSynchronized, Global::get().talkingUI,
+ &TalkingUI::on_serverSynchronized);
// Initialize logger
// Log::log() needs the MainWindow to already exist. Thus creating the Log instance
@@ -708,7 +711,7 @@ int main(int argc, char **argv) {
Global::get().s.iaeIdleAction = Settings::Nothing;
} else {
Global::get().s.iIdleTime = 60 * qRound(Global::get().s.iIdleTime / 60.); // Round to minutes
- Global::get().s.iaeIdleAction = Settings::Deafen; // Old behavior
+ Global::get().s.iaeIdleAction = Settings::Deafen; // Old behavior
}
}
@@ -745,9 +748,10 @@ int main(int argc, char **argv) {
}
if (QDateTime::currentDateTime().daysTo(Global::get().s.kpCertificate.first.first().expiryDate()) < 14)
- Global::get().l->log(Log::Warning,
- CertWizard::tr("<b>Certificate Expiry:</b> Your certificate is about to expire. You need to renew it, "
- "or you will no longer be able to connect to servers you are registered on."));
+ Global::get().l->log(
+ Log::Warning,
+ CertWizard::tr("<b>Certificate Expiry:</b> Your certificate is about to expire. You need to renew it, "
+ "or you will no longer be able to connect to servers you are registered on."));
#ifdef QT_NO_DEBUG
// Only perform the version-check for non-debug builds
@@ -766,7 +770,7 @@ int main(int argc, char **argv) {
if (Global::get().s.bPluginCheck) {
Global::get().pluginManager->checkForPluginUpdates();
}
-#else // QT_NO_DEBUG
+#else // QT_NO_DEBUG
Global::get().mw->msgBox(MainWindow::tr("Skipping version check in debug mode."));
#endif // QT_NO_DEBUG
@@ -832,7 +836,7 @@ int main(int argc, char **argv) {
Global::get().sh.reset();
- while (sh && ! sh.unique())
+ while (sh && !sh.unique())
QThread::yieldCurrentThread();
sh.reset();
diff --git a/src/mumble/os_win.cpp b/src/mumble/os_win.cpp
index 6cfd95f34..0e5ac74de 100644
--- a/src/mumble/os_win.cpp
+++ b/src/mumble/os_win.cpp
@@ -278,9 +278,8 @@ void os_init() {
}
}
- QString comment =
- QString::fromLatin1("%1\n%2\n%3")
- .arg(QString::fromLatin1(MUMBLE_RELEASE), QString::fromLatin1(MUMTEXT(MUMBLE_VERSION)), hash);
+ QString comment = QString::fromLatin1("%1\n%2\n%3")
+ .arg(QString::fromLatin1(MUMBLE_RELEASE), QString::fromLatin1(MUMTEXT(MUMBLE_VERSION)), hash);
wcscpy_s(wcComment, DUMP_BUFFER_SIZE, comment.toStdWString().c_str());
musComment.Type = CommentStreamW;
diff --git a/src/mumble/widgets/MultiStyleWidgetWrapper.cpp b/src/mumble/widgets/MultiStyleWidgetWrapper.cpp
index 288c094b9..be5950df3 100644
--- a/src/mumble/widgets/MultiStyleWidgetWrapper.cpp
+++ b/src/mumble/widgets/MultiStyleWidgetWrapper.cpp
@@ -5,13 +5,13 @@
#include "MultiStyleWidgetWrapper.h"
-#include <QWidget>
#include <QFont>
#include <QFontMetrics>
+#include <QWidget>
const uint32_t MultiStyleWidgetWrapper::UNSET_FONTSIZE = 0;
-const QString MultiStyleWidgetWrapper::UNSET_COLOR = "";
-const QString MultiStyleWidgetWrapper::UNSET_SELECTOR = "*";
+const QString MultiStyleWidgetWrapper::UNSET_COLOR = "";
+const QString MultiStyleWidgetWrapper::UNSET_SELECTOR = "*";
MultiStyleWidgetWrapper::MultiStyleWidgetWrapper(QWidget *widget) : m_widget(widget) {
}
diff --git a/src/mumble/widgets/MultiStyleWidgetWrapper.h b/src/mumble/widgets/MultiStyleWidgetWrapper.h
index 1cdfa4fdd..f158e2031 100644
--- a/src/mumble/widgets/MultiStyleWidgetWrapper.h
+++ b/src/mumble/widgets/MultiStyleWidgetWrapper.h
@@ -16,37 +16,37 @@ class QWidget;
/// set single properties within a widget's stylesheet without potentially overwriting other
/// properties set through it.
class MultiStyleWidgetWrapper {
- public:
- void setFontSize(uint32_t fontSize, bool isPixels = true);
- void setFontSizeSelector(const QString &selector);
- void setBackgroundColor(const QString &color);
- void setBackgroundColorSelector(const QString &selector);
-
- void clearFontSize();
- void clearFontSizeSelector();
- void clearBackgroundColor();
- void clearBackgroundColorSelector();
-
- QWidget *operator->();
-
- MultiStyleWidgetWrapper(QWidget *widget);
-
- protected:
- static const uint32_t UNSET_FONTSIZE;
- static const QString UNSET_COLOR;
- static const QString UNSET_SELECTOR;
- /// The wrapped widget
- QWidget *m_widget;
- /// The current font size in pixels
- uint32_t m_fontSize = UNSET_FONTSIZE;
- /// The CSS selector to be applied to the font size
- QString m_fontSizeSelector = UNSET_SELECTOR;
- /// The current background color
- QString m_backgroundColor = UNSET_COLOR;
- /// The CSS selector to be applied to the background color
- QString m_backgroundColorSelector = UNSET_SELECTOR;
-
- void updateStyleSheet();
+public:
+ void setFontSize(uint32_t fontSize, bool isPixels = true);
+ void setFontSizeSelector(const QString &selector);
+ void setBackgroundColor(const QString &color);
+ void setBackgroundColorSelector(const QString &selector);
+
+ void clearFontSize();
+ void clearFontSizeSelector();
+ void clearBackgroundColor();
+ void clearBackgroundColorSelector();
+
+ QWidget *operator->();
+
+ MultiStyleWidgetWrapper(QWidget *widget);
+
+protected:
+ static const uint32_t UNSET_FONTSIZE;
+ static const QString UNSET_COLOR;
+ static const QString UNSET_SELECTOR;
+ /// The wrapped widget
+ QWidget *m_widget;
+ /// The current font size in pixels
+ uint32_t m_fontSize = UNSET_FONTSIZE;
+ /// The CSS selector to be applied to the font size
+ QString m_fontSizeSelector = UNSET_SELECTOR;
+ /// The current background color
+ QString m_backgroundColor = UNSET_COLOR;
+ /// The CSS selector to be applied to the background color
+ QString m_backgroundColorSelector = UNSET_SELECTOR;
+
+ void updateStyleSheet();
};
#endif // MUMBLE_MUMBLE_WIDGETS_MULTISTYLEWIDGETWRAPPER_H_