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
path: root/src
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2007-07-18 03:12:38 +0400
committerThorvald Natvig <slicer@users.sourceforge.net>2007-07-18 03:12:38 +0400
commit1b265ffa8c28e2cd72419dce4e6536a8c01aa8ec (patch)
treeab0df84081ff0f3f269920beedb84f4ec2ad334f /src
parentd9ca67edda65faffd1d7e8bd0088d93d10852cf8 (diff)
reindenting all the code
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@622 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'src')
-rw-r--r--src/ACL.cpp30
-rw-r--r--src/ACL.h2
-rw-r--r--src/Channel.cpp10
-rw-r--r--src/Channel.h4
-rw-r--r--src/Connection.cpp62
-rw-r--r--src/Connection.h10
-rw-r--r--src/Group.cpp8
-rw-r--r--src/Message.cpp14
-rw-r--r--src/Message.h104
-rw-r--r--src/PacketDataStream.h18
-rw-r--r--src/Player.cpp18
-rw-r--r--src/Player.h8
-rw-r--r--src/mumble/ACLEditor.cpp120
-rw-r--r--src/mumble/ACLEditor.h2
-rw-r--r--src/mumble/ALSAAudio.cpp749
-rw-r--r--src/mumble/ALSAAudio.h10
-rw-r--r--src/mumble/ASIOInput.cpp151
-rw-r--r--src/mumble/ASIOInput.h4
-rw-r--r--src/mumble/About.cpp48
-rw-r--r--src/mumble/About.h4
-rw-r--r--src/mumble/Audio.cpp64
-rw-r--r--src/mumble/Audio.h22
-rw-r--r--src/mumble/AudioConfigDialog.cpp170
-rw-r--r--src/mumble/AudioConfigDialog.h2
-rw-r--r--src/mumble/AudioInput.cpp36
-rw-r--r--src/mumble/AudioInput.h14
-rw-r--r--src/mumble/AudioOutput.cpp164
-rw-r--r--src/mumble/AudioOutput.h44
-rw-r--r--src/mumble/AudioStats.cpp136
-rw-r--r--src/mumble/AudioStats.h8
-rw-r--r--src/mumble/AudioWizard.cpp682
-rw-r--r--src/mumble/AudioWizard.h130
-rw-r--r--src/mumble/BanEditor.cpp42
-rw-r--r--src/mumble/BanEditor.h2
-rw-r--r--src/mumble/ConfigDialog.cpp113
-rw-r--r--src/mumble/ConfigDialog.h16
-rw-r--r--src/mumble/ConnectDialog.cpp240
-rw-r--r--src/mumble/ConnectDialog.h12
-rw-r--r--src/mumble/DXAudioInput.cpp109
-rw-r--r--src/mumble/DXAudioInput.h2
-rw-r--r--src/mumble/DXAudioOutput.cpp211
-rw-r--r--src/mumble/DXAudioOutput.h6
-rw-r--r--src/mumble/DXConfigDialog.cpp54
-rw-r--r--src/mumble/DXConfigDialog.h2
-rw-r--r--src/mumble/Database.cpp36
-rw-r--r--src/mumble/Database.h4
-rw-r--r--src/mumble/FMODAudio.cpp104
-rw-r--r--src/mumble/FMODAudio.h26
-rw-r--r--src/mumble/Global.h2
-rw-r--r--src/mumble/GlobalShortcut.h28
-rw-r--r--src/mumble/GlobalShortcut_unix.cpp454
-rw-r--r--src/mumble/GlobalShortcut_unix.h20
-rw-r--r--src/mumble/GlobalShortcut_win.cpp95
-rw-r--r--src/mumble/GlobalShortcut_win.h6
-rw-r--r--src/mumble/Log.cpp26
-rw-r--r--src/mumble/Log.h6
-rw-r--r--src/mumble/LookConfig.cpp28
-rw-r--r--src/mumble/LookConfig.h2
-rw-r--r--src/mumble/MainWindow.cpp301
-rw-r--r--src/mumble/MainWindow.h6
-rw-r--r--src/mumble/Overlay.cpp302
-rw-r--r--src/mumble/Overlay.h34
-rw-r--r--src/mumble/Overlay_unix.cpp22
-rw-r--r--src/mumble/Overlay_win.cpp18
-rw-r--r--src/mumble/PlayerModel.cpp182
-rw-r--r--src/mumble/PlayerModel.h140
-rw-r--r--src/mumble/Plugins.cpp68
-rw-r--r--src/mumble/Plugins.h6
-rw-r--r--src/mumble/ServerHandler.cpp46
-rw-r--r--src/mumble/ServerHandler.h8
-rw-r--r--src/mumble/TextToSpeech.h6
-rw-r--r--src/mumble/TextToSpeech_win.cpp6
-rw-r--r--src/mumble/VersionCheck.cpp4
-rw-r--r--src/mumble/VersionCheck.h2
-rw-r--r--src/mumble/iasiothiscallresolver.h248
-rw-r--r--src/mumble/main.cpp39
-rw-r--r--src/mumble/mumble_pch.h198
-rw-r--r--src/mumble/os_win.cpp7
-rw-r--r--src/murmur/Cert.cpp301
-rw-r--r--src/murmur/Cert.h20
-rw-r--r--src/murmur/DBus.cpp922
-rw-r--r--src/murmur/DBus_fake.h34
-rw-r--r--src/murmur/DBus_real.h208
-rw-r--r--src/murmur/Register.cpp154
-rw-r--r--src/murmur/Register.h20
-rw-r--r--src/murmur/Server.cpp128
-rw-r--r--src/murmur/Server.h22
-rw-r--r--src/murmur/ServerDB.cpp32
-rw-r--r--src/murmur/ServerDB.h2
-rw-r--r--src/murmur/Tray.cpp52
-rw-r--r--src/murmur/Tray.h30
-rw-r--r--src/murmur/murmur.cpp106
92 files changed, 4061 insertions, 4107 deletions
diff --git a/src/ACL.cpp b/src/ACL.cpp
index 49a9684e9..c98530218 100644
--- a/src/ACL.cpp
+++ b/src/ACL.cpp
@@ -183,37 +183,37 @@ QString ChanACL::whatsThis(Perm p) {
return tr("This represents no privileges.");
case Write:
return tr("This represents total access to the channel, including the ability to change group and ACL information. "
- "This privilege implies all other privileges.");
+ "This privilege implies all other privileges.");
case Traverse:
return tr("This represents the permission to traverse the channel. If a user is denied this privilege, he will be "
- "unable to access this channel and any sub-channels in any way, regardless of other permissions in the "
- "sub-channels.");
+ "unable to access this channel and any sub-channels in any way, regardless of other permissions in the "
+ "sub-channels.");
case Enter:
return tr("This represents the permission to join the channel. If you have a hierarchical channel structure, you "
- "might want to give everyone Traverse, but restrict Enter in the root of your hierarchy.");
+ "might want to give everyone Traverse, but restrict Enter in the root of your hierarchy.");
case Speak:
return tr("This represents the permission to speak in a channel. Users without this privilege will be suppressed by "
- "the server (seen as muted), and will be unable to speak until they are unmuted by someone with the "
- "appropriate privileges.");
+ "the server (seen as muted), and will be unable to speak until they are unmuted by someone with the "
+ "appropriate privileges.");
case AltSpeak:
return tr("This represents the permission to speak in a channel with flagged speech. This works exactly like the <i>speak</i> "
- "privilege, but applies to packets spoken with AltPushToTalk held down. This may be used to broadcast to a hierarchy "
- "of channels without linking.");
+ "privilege, but applies to packets spoken with AltPushToTalk held down. This may be used to broadcast to a hierarchy "
+ "of channels without linking.");
case MuteDeafen:
return tr("This represents the permission to mute and deafen other players. Once muted, a player will stay muted "
- "until he is unmuted by another privileged player or reconnects to the server.");
+ "until he is unmuted by another privileged player or reconnects to the server.");
case MoveKick:
return tr("This represents the permission to move a player to another channel or kick him from the server. To actually "
- "move the player, either the moving player must have Move/Kick privileges in the destination channel, or "
- "the player must normally be allowed to enter the channel. Players with this privilege can move players "
- "into channels the target player normally wouldn't have permission to enter.");
+ "move the player, either the moving player must have Move/Kick privileges in the destination channel, or "
+ "the player must normally be allowed to enter the channel. Players with this privilege can move players "
+ "into channels the target player normally wouldn't have permission to enter.");
case MakeChannel:
return tr("This represents the permission to make sub-channels. The player making the sub-channel will be added to the "
- "admin group of the sub-channel.");
+ "admin group of the sub-channel.");
case LinkChannel:
return tr("This represents the permission to link channels. Players in linked channels hear each other, as long as "
- "the speaking player has the <i>speak</i> privilege in the channel of the listener. You need the link "
- "privilege in both channels to create a link, but just in either channel to remove it.");
+ "the speaking player has the <i>speak</i> privilege in the channel of the listener. You need the link "
+ "privilege in both channels to create a link, but just in either channel to remove it.");
default:
break;
}
diff --git a/src/ACL.h b/src/ACL.h
index 4162aadaa..b246c616e 100644
--- a/src/ACL.h
+++ b/src/ACL.h
@@ -37,7 +37,7 @@ class Channel;
class Player;
class ChanACL : public QObject {
- Q_OBJECT
+ Q_OBJECT
public:
enum Perm {
None = 0x0,
diff --git a/src/Channel.cpp b/src/Channel.cpp
index 098dac82e..8af592b78 100644
--- a/src/Channel.cpp
+++ b/src/Channel.cpp
@@ -51,11 +51,11 @@ Channel::Channel(int id, QString name, QObject *p) : QObject(p) {
Channel::~Channel() {
foreach(ChanACL *acl, qlACL)
- delete acl;
+ delete acl;
foreach(Group *g, qhGroups)
- delete g;
+ delete g;
foreach(Channel *l, qhLinks.keys())
- unlink(l);
+ unlink(l);
Q_ASSERT(qlChannels.count() == 0);
Q_ASSERT(qlPlayers.count() == 0);
@@ -110,7 +110,7 @@ void Channel::unlink(Channel *l) {
}
} else {
foreach(Channel *c, qhLinks.keys())
- unlink(c);
+ unlink(c);
}
}
@@ -138,7 +138,7 @@ void Channel::playerUnlink(Channel *l, Player *p) {
if (qhLinks[l] == 0)
qhLinks.remove(l);
if (l->qhLinks[this] == 0);
- l->qhLinks.remove(this);
+ l->qhLinks.remove(this);
}
QSet<Channel *> Channel::allLinks() {
diff --git a/src/Channel.h b/src/Channel.h
index 4de980cee..8b8016c3b 100644
--- a/src/Channel.h
+++ b/src/Channel.h
@@ -38,10 +38,10 @@ class Group;
class ChanACL;
class Channel : public QObject {
- Q_OBJECT
+ Q_OBJECT
private:
QSet<Channel *> qsUnseen;
- public:
+ public:
int iId;
Channel *cParent;
QString qsName;
diff --git a/src/Connection.cpp b/src/Connection.cpp
index fb7c80a2b..9bb6579e3 100644
--- a/src/Connection.cpp
+++ b/src/Connection.cpp
@@ -47,45 +47,45 @@ Connection::Connection(QObject *p, QSslSocket *qtsSock) : QObject(p) {
qtsSocket->setParent(this);
iPacketLength = -1;
bDisconnectedEmitted = false;
- connect(qtsSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
- connect(qtsSocket, SIGNAL(readyRead()), this, SLOT(socketRead()));
- connect(qtsSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
- connect(qtsSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(socketSslErrors(const QList<QSslError> &)));
- qtLastPacket.restart();
+ connect(qtsSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
+ connect(qtsSocket, SIGNAL(readyRead()), this, SLOT(socketRead()));
+ connect(qtsSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
+ connect(qtsSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(socketSslErrors(const QList<QSslError> &)));
+ qtLastPacket.restart();
}
Connection::~Connection() {
}
int Connection::activityTime() const {
- return qtLastPacket.elapsed();
+ return qtLastPacket.elapsed();
}
void Connection::socketRead() {
- int iAvailable;
- while (1) {
- iAvailable = qtsSocket->bytesAvailable();
-
- if (iPacketLength == -1) {
- if (iAvailable < 3)
- return;
-
- unsigned char a_ucBuffer[3];
-
- qtsSocket->read(reinterpret_cast<char *>(a_ucBuffer), 3);
- iPacketLength = ((a_ucBuffer[0] << 16) & 0xff0000) + ((a_ucBuffer[1] << 8) & 0xff00) + a_ucBuffer[2];
- iAvailable -= 3;
- }
-
- if ((iPacketLength != -1) && (iAvailable >= iPacketLength)) {
- QByteArray qbaBuffer = qtsSocket->read(iPacketLength);
- emit message(qbaBuffer);
- iPacketLength = -1;
- qtLastPacket.restart();
- } else {
- return;
- }
- }
+ int iAvailable;
+ while (1) {
+ iAvailable = qtsSocket->bytesAvailable();
+
+ if (iPacketLength == -1) {
+ if (iAvailable < 3)
+ return;
+
+ unsigned char a_ucBuffer[3];
+
+ qtsSocket->read(reinterpret_cast<char *>(a_ucBuffer), 3);
+ iPacketLength = ((a_ucBuffer[0] << 16) & 0xff0000) + ((a_ucBuffer[1] << 8) & 0xff00) + a_ucBuffer[2];
+ iAvailable -= 3;
+ }
+
+ if ((iPacketLength != -1) && (iAvailable >= iPacketLength)) {
+ QByteArray qbaBuffer = qtsSocket->read(iPacketLength);
+ emit message(qbaBuffer);
+ iPacketLength = -1;
+ qtLastPacket.restart();
+ } else {
+ return;
+ }
+ }
}
void Connection::socketError(QAbstractSocket::SocketError) {
@@ -166,5 +166,5 @@ quint16 Connection::peerPort() const {
}
QSslCertificate Connection::peerCertificate() const {
- return qtsSocket->peerCertificate();
+ return qtsSocket->peerCertificate();
}
diff --git a/src/Connection.h b/src/Connection.h
index 46e87b7b5..d6e5400e6 100644
--- a/src/Connection.h
+++ b/src/Connection.h
@@ -36,7 +36,7 @@
class Message;
class Connection : public QObject {
- Q_OBJECT
+ Q_OBJECT
protected:
QSslSocket *qtsSocket;
QTime qtLastPacket;
@@ -44,11 +44,11 @@ class Connection : public QObject {
bool bDisconnectedEmitted;
protected slots:
void socketRead();
- void socketError(QAbstractSocket::SocketError);
- void socketDisconnected();
- void socketSslErrors(const QList<QSslError> &errors);
+ void socketError(QAbstractSocket::SocketError);
+ void socketDisconnected();
+ void socketSslErrors(const QList<QSslError> &errors);
public slots:
- void proceedAnyway();
+ void proceedAnyway();
signals:
void connectionClosed(QString reason);
void message(QByteArray &);
diff --git a/src/Group.cpp b/src/Group.cpp
index af48dce2a..5f4468fb0 100644
--- a/src/Group.cpp
+++ b/src/Group.cpp
@@ -64,9 +64,9 @@ QSet<int> Group::members() {
while (! s.isEmpty()) {
g = s.pop();
foreach(i, g->qsAdd)
- m.insert(i);
+ m.insert(i);
foreach(i, g->qsRemove)
- m.remove(i);
+ m.remove(i);
}
return m;
@@ -154,7 +154,7 @@ bool Group::isMember(Channel *curChan, Channel *aclChan, QString name, Player *p
int maxdesc = 1000;
int minpath = 0;
QStringList args = name.split(QLatin1String(","));
- switch(args.count()) {
+ switch (args.count()) {
default:
case 3:
maxdesc = args[2].isEmpty() ? maxdesc : args[2].toInt();
@@ -183,7 +183,7 @@ bool Group::isMember(Channel *curChan, Channel *aclChan, QString name, Player *p
}
int cofs = groupChain.indexOf(c);
- Q_ASSERT( cofs != -1);
+ Q_ASSERT(cofs != -1);
cofs += minpath;
diff --git a/src/Message.cpp b/src/Message.cpp
index fb06f8746..60b8bd260 100644
--- a/src/Message.cpp
+++ b/src/Message.cpp
@@ -62,7 +62,7 @@ Message *Message::networkToMessage(QByteArray &qbaIn) {
short sPlayerId;
qdsIn >> iMessageType;
qdsIn >> sPlayerId;
- switch(iMessageType) {
+ switch (iMessageType) {
case Speex:
mMsg = new MessageSpeex();
break;
@@ -177,7 +177,7 @@ MessageServerAuthenticate::MessageServerAuthenticate() {
iMaxBandwidth = 100000;
}
-void MessageServerAuthenticate::saveStream(PacketDataStream &qdsOut) const{
+void MessageServerAuthenticate::saveStream(PacketDataStream &qdsOut) const {
qdsOut << iVersion;
qdsOut << iMaxBandwidth;
qdsOut << qsUsername;
@@ -502,7 +502,7 @@ bool MessageQueryUsers::isValid() const {
return false;
int i;
- for(i=0;i<qlIds.count();i++) {
+ for (i=0;i<qlIds.count();i++) {
if ((qlIds[i] == -1) && (qlNames[i].isEmpty()))
return false;
}
@@ -522,7 +522,7 @@ void MessageTexture::restoreStream(PacketDataStream &qdsIn) {
qdsIn >> qbaTexture;
}
-PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::GroupStruct &gs ) {
+PacketDataStream & operator<< (PacketDataStream & out, const MessageEditACL::GroupStruct &gs) {
out << gs.qsName;
out << gs.bInherited;
out << gs.bInherit;
@@ -533,7 +533,7 @@ PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::Gr
return out;
}
-PacketDataStream & operator>> ( PacketDataStream & in, MessageEditACL::GroupStruct &gs ) {
+PacketDataStream & operator>> (PacketDataStream & in, MessageEditACL::GroupStruct &gs) {
in >> gs.qsName;
in >> gs.bInherited;
in >> gs.bInherit;
@@ -544,7 +544,7 @@ PacketDataStream & operator>> ( PacketDataStream & in, MessageEditACL::GroupStru
return in;
}
-PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::ACLStruct &as ) {
+PacketDataStream & operator<< (PacketDataStream & out, const MessageEditACL::ACLStruct &as) {
out << as.bApplyHere;
out << as.bApplySubs;
out << as.bInherited;
@@ -555,7 +555,7 @@ PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::AC
return out;
}
-PacketDataStream & operator>> ( PacketDataStream & in, MessageEditACL::ACLStruct &as ) {
+PacketDataStream & operator>> (PacketDataStream & in, MessageEditACL::ACLStruct &as) {
int v;
in >> as.bApplyHere;
diff --git a/src/Message.h b/src/Message.h
index 389c07726..b682b8a54 100644
--- a/src/Message.h
+++ b/src/Message.h
@@ -67,7 +67,9 @@ class MessageSpeex : public Message {
// Flags is in first byte of packet.
QByteArray qbaSpeexPacket;
MessageSpeex();
- Message::MessageType messageType() const { return Speex; };
+ Message::MessageType messageType() const {
+ return Speex;
+ };
void process(Connection *);
bool isValid() const;
};
@@ -82,14 +84,18 @@ class MessageServerAuthenticate : public Message {
QString qsUsername;
QString qsPassword;
MessageServerAuthenticate();
- Message::MessageType messageType() const { return ServerAuthenticate; };
+ Message::MessageType messageType() const {
+ return ServerAuthenticate;
+ };
void process(Connection *);
};
class MessagePing : public Message {
public:
MessagePing();
- Message::MessageType messageType() const { return Ping; };
+ Message::MessageType messageType() const {
+ return Ping;
+ };
void process(Connection *);
};
@@ -102,7 +108,9 @@ class MessageServerReject : public Message {
QString qsReason;
RejectType rtType;
MessageServerReject();
- Message::MessageType messageType() const { return ServerReject; };
+ Message::MessageType messageType() const {
+ return ServerReject;
+ };
void process(Connection *);
};
@@ -114,7 +122,9 @@ class MessageServerSync : public Message {
int iMaxBandwidth;
QString qsWelcomeText;
MessageServerSync();
- Message::MessageType messageType() const { return ServerSync; };
+ Message::MessageType messageType() const {
+ return ServerSync;
+ };
void process(Connection *);
};
@@ -126,13 +136,17 @@ class MessageServerJoin : public Message {
QString qsPlayerName;
int iId;
MessageServerJoin();
- Message::MessageType messageType() const { return ServerJoin; };
+ Message::MessageType messageType() const {
+ return ServerJoin;
+ };
void process(Connection *);
};
class MessageServerLeave : public Message {
public:
- Message::MessageType messageType() const { return ServerLeave; };
+ Message::MessageType messageType() const {
+ return ServerLeave;
+ };
void process(Connection *);
};
@@ -144,7 +158,9 @@ class MessagePlayerMute : public Message {
short sVictim;
bool bMute;
MessagePlayerMute();
- Message::MessageType messageType() const { return PlayerMute; };
+ Message::MessageType messageType() const {
+ return PlayerMute;
+ };
void process(Connection *);
};
@@ -156,7 +172,9 @@ class MessagePlayerDeaf : public Message {
short sVictim;
bool bDeaf;
MessagePlayerDeaf();
- Message::MessageType messageType() const { return PlayerDeaf; };
+ Message::MessageType messageType() const {
+ return PlayerDeaf;
+ };
void process(Connection *);
};
@@ -168,7 +186,9 @@ class MessagePlayerSelfMuteDeaf : public Message {
bool bMute;
bool bDeaf;
MessagePlayerSelfMuteDeaf();
- Message::MessageType messageType() const { return PlayerSelfMuteDeaf; };
+ Message::MessageType messageType() const {
+ return PlayerSelfMuteDeaf;
+ };
void process(Connection *);
};
@@ -180,7 +200,9 @@ class MessagePlayerKick : public Message {
short sVictim;
QString qsReason;
MessagePlayerKick();
- Message::MessageType messageType() const { return PlayerKick; };
+ Message::MessageType messageType() const {
+ return PlayerKick;
+ };
void process(Connection *);
};
@@ -192,7 +214,9 @@ class MessagePlayerBan : public Message {
short sVictim;
QString qsReason;
MessagePlayerBan();
- Message::MessageType messageType() const { return PlayerBan; };
+ Message::MessageType messageType() const {
+ return PlayerBan;
+ };
void process(Connection *);
};
@@ -204,7 +228,9 @@ class MessagePlayerMove : public Message {
short sVictim;
int iChannelId;
MessagePlayerMove();
- Message::MessageType messageType() const { return PlayerMove; };
+ Message::MessageType messageType() const {
+ return PlayerMove;
+ };
void process(Connection *);
};
@@ -215,7 +241,9 @@ class MessagePlayerRename : public Message {
public:
QString qsName;
MessagePlayerRename();
- Message::MessageType messageType() const { return PlayerRename; };
+ Message::MessageType messageType() const {
+ return PlayerRename;
+ };
void process(Connection *);
};
@@ -228,7 +256,9 @@ class MessageChannelAdd : public Message {
int iParent;
QString qsName;
MessageChannelAdd();
- Message::MessageType messageType() const { return ChannelAdd; };
+ Message::MessageType messageType() const {
+ return ChannelAdd;
+ };
void process(Connection *);
};
@@ -239,7 +269,9 @@ class MessageChannelRemove : public Message {
public:
int iId;
MessageChannelRemove();
- Message::MessageType messageType() const { return ChannelRemove; };
+ Message::MessageType messageType() const {
+ return ChannelRemove;
+ };
void process(Connection *);
};
@@ -251,7 +283,9 @@ class MessageChannelMove : public Message {
int iId;
int iParent;
MessageChannelMove();
- Message::MessageType messageType() const { return ChannelMove; };
+ Message::MessageType messageType() const {
+ return ChannelMove;
+ };
void process(Connection *);
};
@@ -267,7 +301,9 @@ class MessageChannelLink : public Message {
LinkType ltType;
QList<int> qlTargets;
MessageChannelLink();
- Message::MessageType messageType() const { return ChannelLink; };
+ Message::MessageType messageType() const {
+ return ChannelLink;
+ };
void process(Connection *);
};
@@ -279,7 +315,9 @@ class MessageServerBanList : public Message {
bool bQuery;
QList<QPair<quint32, int> > qlBans;
MessageServerBanList();
- Message::MessageType messageType() const { return ServerBanList; };
+ Message::MessageType messageType() const {
+ return ServerBanList;
+ };
void process(Connection *);
};
@@ -291,7 +329,9 @@ class MessageTextMessage : public Message {
short sVictim;
QString qsMessage;
MessageTextMessage();
- Message::MessageType messageType() const { return TextMessage; };
+ Message::MessageType messageType() const {
+ return TextMessage;
+ };
void process(Connection *);
};
@@ -302,7 +342,9 @@ class MessagePermissionDenied : public Message {
public:
QString qsReason;
MessagePermissionDenied();
- Message::MessageType messageType() const { return PermissionDenied; };
+ Message::MessageType messageType() const {
+ return PermissionDenied;
+ };
void process(Connection *);
};
@@ -337,14 +379,16 @@ class MessageEditACL : public Message {
QList<GroupStruct> groups;
QList<ACLStruct> acls;
MessageEditACL();
- Message::MessageType messageType() const { return EditACL; };
+ Message::MessageType messageType() const {
+ return EditACL;
+ };
void process(Connection *);
};
-PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::GroupStruct &gs );
-PacketDataStream & operator>> ( PacketDataStream & in, MessageEditACL::GroupStruct &gs );
-PacketDataStream & operator<< ( PacketDataStream & out, const MessageEditACL::ACLStruct &gs );
-PacketDataStream & operator>> ( PacketDataStream & in, MessageEditACL::ACLStruct &gs );
+PacketDataStream & operator<< (PacketDataStream & out, const MessageEditACL::GroupStruct &gs);
+PacketDataStream & operator>> (PacketDataStream & in, MessageEditACL::GroupStruct &gs);
+PacketDataStream & operator<< (PacketDataStream & out, const MessageEditACL::ACLStruct &gs);
+PacketDataStream & operator>> (PacketDataStream & in, MessageEditACL::ACLStruct &gs);
class MessageQueryUsers : public Message {
protected:
@@ -354,7 +398,9 @@ class MessageQueryUsers : public Message {
QList<int> qlIds;
QList<QString> qlNames;
MessageQueryUsers();
- Message::MessageType messageType() const { return QueryUsers; };
+ Message::MessageType messageType() const {
+ return QueryUsers;
+ };
void process(Connection *);
bool isValid() const;
};
@@ -367,7 +413,9 @@ class MessageTexture : public Message {
int iPlayerId;
QByteArray qbaTexture;
MessageTexture();
- Message::MessageType messageType() const { return PlayerTexture; }
+ Message::MessageType messageType() const {
+ return PlayerTexture;
+ }
void process(Connection *);
};
diff --git a/src/PacketDataStream.h b/src/PacketDataStream.h
index 56f901d88..3bd788355 100644
--- a/src/PacketDataStream.h
+++ b/src/PacketDataStream.h
@@ -136,19 +136,19 @@ class PacketDataStream {
PacketDataStream &operator <<(const quint32 i) {
if (i < 0x80) {
- // Need top bit clear
+ // Need top bit clear
append(i);
} else if (i < 0x4000) {
- // Need top two bits clear
+ // Need top two bits clear
append((i >> 8) | 0x80);
append(i & 0xFF);
} else if (i < 0x200000) {
- // Need top three bits clear
+ // Need top three bits clear
append((i >> 16) | 0xC0);
append((i >> 8) & 0xFF);
append(i & 0xFF);
} else if (i < 0x10000000) {
- // Need top four bits clear
+ // Need top four bits clear
append((i >> 24) | 0xE0);
append((i >> 16) & 0xFF);
append((i >> 8) & 0xFF);
@@ -172,7 +172,7 @@ class PacketDataStream {
} else if ((v & 0xE0) == 0xC0) {
i=(v & 0x1F) << 16 | next() << 8 | next();
} else if ((v & 0xC0) == 0x80) {
- i=(v & 0x3F) << 8 | next();
+ i=(v & 0x3F) << 8 | next();
} else {
i=(v & 0x7F);
}
@@ -250,7 +250,7 @@ class PacketDataStream {
template <typename T>
PacketDataStream &operator <<(const QList<T> &l) {
*this << l.size();
- for(int i=0;i < l.size();i++)
+ for (int i=0;i < l.size();i++)
*this << l.at(i);
return *this;
}
@@ -264,7 +264,7 @@ class PacketDataStream {
len = left();
ok = false;
}
- for(quint32 i=0;i<len;i++) {
+ for (quint32 i=0;i<len;i++) {
if (left() == 0) {
ok = false;
break;
@@ -281,7 +281,7 @@ class PacketDataStream {
template <typename T>
PacketDataStream &operator <<(const QSet<T> &s) {
*this << s.size();
- for(typename QSet<T>::const_iterator i=s.constBegin();i!=s.constEnd();++i)
+ for (typename QSet<T>::const_iterator i=s.constBegin();i!=s.constEnd();++i)
*this << *i;
return *this;
}
@@ -295,7 +295,7 @@ class PacketDataStream {
len = left();
ok = false;
}
- for(quint32 i=0;i<len;i++) {
+ for (quint32 i=0;i<len;i++) {
if (left() == 0) {
ok = false;
break;
diff --git a/src/Player.cpp b/src/Player.cpp
index 00fbea57b..75f72fb12 100644
--- a/src/Player.cpp
+++ b/src/Player.cpp
@@ -35,15 +35,15 @@ QHash<short, Player *> Player::c_qmPlayers;
QReadWriteLock Player::c_qrwlPlayers;
Player::Player(QObject *p) : QObject(p) {
- sState = Player::Connected;
- sId = 0;
- iId = -1;
- bMute = bDeaf = false;
- bSelfMute = bSelfDeaf = false;
- bTalking = bAltSpeak = false;
- bLocalMute = false;
- bSuppressed = false;
- cChannel = 0;
+ sState = Player::Connected;
+ sId = 0;
+ iId = -1;
+ bMute = bDeaf = false;
+ bSelfMute = bSelfDeaf = false;
+ bTalking = bAltSpeak = false;
+ bLocalMute = false;
+ bSuppressed = false;
+ cChannel = 0;
}
Player *Player::get(short sId) {
diff --git a/src/Player.h b/src/Player.h
index 94ba962fc..3ffd03727 100644
--- a/src/Player.h
+++ b/src/Player.h
@@ -36,10 +36,10 @@
class Channel;
class Player : public QObject {
- Q_OBJECT
- public:
- enum State { Connected, Authenticated };
- State sState;
+ Q_OBJECT
+ public:
+ enum State { Connected, Authenticated };
+ State sState;
short sId;
int iId;
QString qsName;
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp
index f759accc9..a296c96a0 100644
--- a/src/mumble/ACLEditor.cpp
+++ b/src/mumble/ACLEditor.cpp
@@ -132,7 +132,7 @@ ACLEditor::ACLEditor(const MessageEditACL *mea, QWidget *p) : QDialog(p) {
int perm=1;
int idx=1;
QString name;
- while (! (name = ChanACL::permName(static_cast<ChanACL::Perm>(perm))).isEmpty()) {
+ while (!(name = ChanACL::permName(static_cast<ChanACL::Perm>(perm))).isEmpty()) {
QCheckBox *qcb;
l = new QLabel(name);
grid->addWidget(l,idx,0);
@@ -242,39 +242,39 @@ ACLEditor::ACLEditor(const MessageEditACL *mea, QWidget *p) : QDialog(p) {
qtwTab->addTab(groupEditor, tr("&Groups"));
qtwTab->addTab(aclEditor, tr("&ACL"));
- QPushButton *okButton = new QPushButton(tr("&OK"));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- okButton->setDefault(false);
- okButton->setAutoDefault(false);
- okButton->setToolTip(tr("Accept changes"));
- okButton->setWhatsThis(tr("This button will accept current groups/ACLs and send them to "
- "the server. Note that if you mistakenly remove write permission "
- "from yourself, the server will add it."));
- QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ QPushButton *okButton = new QPushButton(tr("&OK"));
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ okButton->setDefault(false);
+ okButton->setAutoDefault(false);
+ okButton->setToolTip(tr("Accept changes"));
+ okButton->setWhatsThis(tr("This button will accept current groups/ACLs and send them to "
+ "the server. Note that if you mistakenly remove write permission "
+ "from yourself, the server will add it."));
+ QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
cancelButton->setDefault(false);
cancelButton->setAutoDefault(false);
cancelButton->setToolTip(tr("Reject changes"));
cancelButton->setWhatsThis(tr("This button will cancel all changes and closes the dialog without "
- "updating the ACLs or groups on the server."));
+ "updating the ACLs or groups on the server."));
- QHBoxLayout *buttons = new QHBoxLayout;
- buttons->addStretch(1);
- buttons->addWidget(okButton);
- buttons->addWidget(cancelButton);
+ QHBoxLayout *buttons = new QHBoxLayout;
+ buttons->addStretch(1);
+ buttons->addWidget(okButton);
+ buttons->addWidget(cancelButton);
- QVBoxLayout *ml = new QVBoxLayout;
- ml->addWidget(qtwTab);
- ml->addStretch(1);
- ml->addSpacing(12);
- ml->addLayout(buttons);
- setLayout(ml);
+ QVBoxLayout *ml = new QVBoxLayout;
+ ml->addWidget(qtwTab);
+ ml->addStretch(1);
+ ml->addSpacing(12);
+ ml->addLayout(buttons);
+ setLayout(ml);
- foreach (as, mea->acls) {
+ foreach(as, mea->acls) {
asp = new MessageEditACL::ACLStruct(as);
acls << asp;
}
- foreach (gs, mea->groups) {
+ foreach(gs, mea->groups) {
gsp = new MessageEditACL::GroupStruct(gs);
groups << gsp;
}
@@ -293,11 +293,11 @@ ACLEditor::ACLEditor(const MessageEditACL *mea, QWidget *p) : QDialog(p) {
foreach(gsp, groups) {
int id;
foreach(id, gsp->qsAdd)
- addQuery(GroupAdd, id);
+ addQuery(GroupAdd, id);
foreach(id, gsp->qsRemove)
- addQuery(GroupRemove, id);
+ addQuery(GroupRemove, id);
foreach(id, gsp->qsInheritedMembers)
- addQuery(GroupInherit, id);
+ addQuery(GroupInherit, id);
}
refill(GroupAdd);
@@ -307,7 +307,7 @@ ACLEditor::ACLEditor(const MessageEditACL *mea, QWidget *p) : QDialog(p) {
doneQuery();
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
refillGroupNames();
@@ -334,48 +334,48 @@ ACLEditor::~ACLEditor() {
void ACLEditor::addToolTipsWhatsThis() {
qlwACLs->setToolTip(tr("List of entries"));
qlwACLs->setWhatsThis(tr("This shows all the entries active on this channel. Entries inherited from parent channels will be "
- "show in italics."));
+ "show in italics."));
qcbACLInherit->setToolTip(tr("Inherit ACL of parent?"));
qcbACLInherit->setWhatsThis(tr("This sets whether or not the ACL up the chain of parent channels are applied to this object. "
- "Only those entries that are marked in the parent as \"Apply to sub-channels\" will be inherited."));
+ "Only those entries that are marked in the parent as \"Apply to sub-channels\" will be inherited."));
qpbACLAdd->setToolTip(tr("Add new entry"));
qpbACLAdd->setWhatsThis(tr("This adds a new entry, initially set with no permissions and applying to all."));
qpbACLRemove->setToolTip(tr("Remove entry"));
qpbACLRemove->setWhatsThis(tr("This removes the currently selected entry."));
qpbACLUp->setToolTip(tr("Move entry up"));
qpbACLUp->setWhatsThis(tr("This moves the entry up in the list. As entries are evaluated in order, this may change "
- "the effective permissions of users. You cannot move an entry above an inherited entry, if you "
- "really need that you'll have to duplicate the inherited entry."));
+ "the effective permissions of users. You cannot move an entry above an inherited entry, if you "
+ "really need that you'll have to duplicate the inherited entry."));
qpbACLDown->setToolTip(tr("Move entry down"));
qpbACLDown->setWhatsThis(tr("This moves the entry down in the list. As entries are evaluated in order, this may change "
- "the effective permissions of users."));
+ "the effective permissions of users."));
qcbACLApplyHere->setToolTip(tr("Entry should apply to this channel"));
qcbACLApplyHere->setWhatsThis(tr("This makes the entry apply to this channel."));
qcbACLApplySubs->setToolTip(tr("Entry should apply to sub-channels."));
qcbACLApplySubs->setWhatsThis(tr("This makes the entry apply to sub-channels of this channel."));
qcbACLGroup->setToolTip(tr("Group this entry applies to"));
qcbACLGroup->setWhatsThis(tr("This controls which group of users this entry applies to.<br />Note that the group is evaluated "
- "in the context of the channel the entry is used in. For example, the default ACL on the Root "
- "channel gives <i>Write</i> permission to the <i>admin</i> group. This entry, if inherited by a "
- "channel, will give a user write privileges if he belongs to the <i>admin</i> group in that channel, "
- "even if he doesn't belong to the <i>admin</i> group in the channel where the ACL originated.<br />"
- "If a group name starts with a !, its membership is negated, and if it starts with a ~, it is evaluated in the channel the ACL was defined in, rather than "
- "the channel the ACL is active in. Order is important; <i>!~in</i> is valid, but <i>~!in</i> is not.<br />"
- "A few special predefined groups are:<br />"
- "<b>all</b> - Everyone will match.<br />"
- "<b>auth</b> - All authenticated users will match.<br />"
- "<b>sub,a,b,c</b> - User currently in a sub-channel minimum <i>a</i> common parents, and between <i>b</i> and <i>c</i> channels down the chain. "
- "See the website for more extensive documentation on this one.<br />"
- "<b>in</b> - Users currently in the channel will match (convenience for <i>sub,0,0,0</i>).<br />"
- "<b>out</b> - Users outside the channel will match (convenience for <i>!sub,0,0,0</i>).<br />"
- "Note that an entry applies to either a user or a group, not both."));
+ "in the context of the channel the entry is used in. For example, the default ACL on the Root "
+ "channel gives <i>Write</i> permission to the <i>admin</i> group. This entry, if inherited by a "
+ "channel, will give a user write privileges if he belongs to the <i>admin</i> group in that channel, "
+ "even if he doesn't belong to the <i>admin</i> group in the channel where the ACL originated.<br />"
+ "If a group name starts with a !, its membership is negated, and if it starts with a ~, it is evaluated in the channel the ACL was defined in, rather than "
+ "the channel the ACL is active in. Order is important; <i>!~in</i> is valid, but <i>~!in</i> is not.<br />"
+ "A few special predefined groups are:<br />"
+ "<b>all</b> - Everyone will match.<br />"
+ "<b>auth</b> - All authenticated users will match.<br />"
+ "<b>sub,a,b,c</b> - User currently in a sub-channel minimum <i>a</i> common parents, and between <i>b</i> and <i>c</i> channels down the chain. "
+ "See the website for more extensive documentation on this one.<br />"
+ "<b>in</b> - Users currently in the channel will match (convenience for <i>sub,0,0,0</i>).<br />"
+ "<b>out</b> - Users outside the channel will match (convenience for <i>!sub,0,0,0</i>).<br />"
+ "Note that an entry applies to either a user or a group, not both."));
qleACLUser->setToolTip(tr("User this entry applies to"));
qleACLUser->setWhatsThis(tr("This controls which user this entry applies to. Just type in the user name and hit enter "
- "to query the server for a match."));
+ "to query the server for a match."));
int idx;
int p = 0x1;
- for(idx=0;idx<qlACLAllow.count();idx++) {
+ for (idx=0;idx<qlACLAllow.count();idx++) {
ChanACL::Perm prm=static_cast<ChanACL::Perm>(p);
QString perm = ChanACL::permName(prm);
qlACLAllow[idx]->setToolTip(tr("Allow %1").arg(perm));
@@ -387,19 +387,19 @@ void ACLEditor::addToolTipsWhatsThis() {
qcbGroupList->setToolTip(tr("List of groups"));
qcbGroupList->setWhatsThis(tr("This is all the groups currently defined for the channel. To create a new group, just type in the "
- "name and press enter."));
+ "name and press enter."));
qpbGroupRemove->setToolTip(tr("Remove selected group"));
qpbGroupRemove->setWhatsThis(tr("This removes the currently selected group. If the group was inherited, it will not be removed "
- "from the list, but all local information about the group will be cleared."));
+ "from the list, but all local information about the group will be cleared."));
qcbGroupInherit->setToolTip(tr("Inherit group members from parent"));
qcbGroupInherit->setWhatsThis(tr("This inherits all the members in the group from the parent, if the group is marked as "
- "<i>Inheritable</i> in the parent channel."));
+ "<i>Inheritable</i> in the parent channel."));
qcbGroupInheritable->setToolTip(tr("Make group inheritable to sub-channels"));
qcbGroupInheritable->setWhatsThis(tr("This makes this group inheritable to sub-channels. If the group is non-inheritable, "
- "sub-channels are still free to create a new group with the same name."));
+ "sub-channels are still free to create a new group with the same name."));
qcbGroupInherited->setToolTip(tr("Group was inherited from parent channel"));
qcbGroupInherited->setWhatsThis(tr("This indicates that the group was inherited from the parent channel. You cannot edit "
- "this flag, it's just for information."));
+ "this flag, it's just for information."));
qleGroupAdd->setToolTip(tr("Add member to group"));
qleGroupAdd->setWhatsThis(tr("Type in the name of a player you wish to add to the group and press enter."));
qleGroupRemove->setToolTip(tr("Remove member from group"));
@@ -484,7 +484,7 @@ void ACLEditor::cleanQuery() {
void ACLEditor::returnQuery(const MessageQueryUsers *mqu) {
int i;
- for(i=0;i<mqu->qlIds.count();i++) {
+ for (i=0;i<mqu->qlIds.count();i++) {
int id = mqu->qlIds[i];
QString name = mqu->qlNames[i];
qhIDCache[name] = id;
@@ -578,7 +578,7 @@ void ACLEditor::refillGroupNames() {
foreach(QString name, qsl) {
qcbGroupList->addItem(name);
- }
+ }
int wantindex = qcbGroupList->findText(text, Qt::MatchExactly);
qcbGroupList->setCurrentIndex(wantindex);
@@ -738,7 +738,7 @@ void ACLEditor::ACLEnableCheck() {
qleACLUser->setEnabled(ena);
int idx;
- for(idx=0;idx<qlACLAllow.count();idx++) {
+ for (idx=0;idx<qlACLAllow.count();idx++) {
qlACLAllow[idx]->setEnabled(ena);
qlACLDeny[idx]->setEnabled(ena);
}
@@ -747,7 +747,7 @@ void ACLEditor::ACLEnableCheck() {
qcbACLApplyHere->setChecked(as->bApplyHere);
qcbACLApplySubs->setChecked(as->bApplySubs);
int p = 0x1;
- for(idx=0;idx<qlACLAllow.count();idx++) {
+ for (idx=0;idx<qlACLAllow.count();idx++) {
qlACLAllow[idx]->setChecked(static_cast<int>(as->pAllow) & p);
qlACLDeny[idx]->setChecked(static_cast<int>(as->pDeny) & p);
p = p * 2;
@@ -763,7 +763,7 @@ void ACLEditor::ACLEnableCheck() {
qcbACLGroup->addItem(QLatin1String("~sub"));
qcbACLGroup->addItem(QLatin1String("~out"));
foreach(gs, groups)
- qcbACLGroup->addItem(gs->qsName);
+ qcbACLGroup->addItem(gs->qsName);
if (as->iPlayerId == -1) {
qleACLUser->setText(QString());
qcbACLGroup->addItem(as->qsGroup);
@@ -898,7 +898,7 @@ void ACLEditor::ACLPermissions_clicked() {
d = 0;
p = 0x1;
- for(idx=0;idx<qlACLAllow.count();idx++) {
+ for (idx=0;idx<qlACLAllow.count();idx++) {
if (qlACLAllow[idx]->isChecked() && qlACLDeny[idx]->isChecked()) {
if (source == qlACLAllow[idx])
qlACLDeny[idx]->setChecked(false);
diff --git a/src/mumble/ACLEditor.h b/src/mumble/ACLEditor.h
index c16320f95..eed7d3e8c 100644
--- a/src/mumble/ACLEditor.h
+++ b/src/mumble/ACLEditor.h
@@ -34,7 +34,7 @@
#include "Message.h"
class ACLEditor : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
protected:
enum WaitID {
GroupAdd, GroupRemove, GroupInherit, ACLList
diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp
index f06e75310..6520ec673 100644
--- a/src/mumble/ALSAAudio.cpp
+++ b/src/mumble/ALSAAudio.cpp
@@ -40,28 +40,28 @@
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
class ALSAEnumerator {
- public:
- QHash<QString,QString> qhInput;
- QHash<QString,QString> qhOutput;
- ALSAEnumerator();
+ public:
+ QHash<QString,QString> qhInput;
+ QHash<QString,QString> qhOutput;
+ ALSAEnumerator();
};
static ALSAEnumerator cards;
class ALSAAudioInputRegistrar : public AudioInputRegistrar {
- public:
- ALSAAudioInputRegistrar();
- virtual AudioInput *create();
- virtual const QList<audioDevice> getDeviceChoices();
- virtual void setDeviceChoice(const QVariant &);
+ public:
+ ALSAAudioInputRegistrar();
+ virtual AudioInput *create();
+ virtual const QList<audioDevice> getDeviceChoices();
+ virtual void setDeviceChoice(const QVariant &);
};
class ALSAAudioOutputRegistrar : public AudioOutputRegistrar {
- public:
- ALSAAudioOutputRegistrar();
- virtual AudioOutput *create();
- virtual const QList<audioDevice> getDeviceChoices();
- virtual void setDeviceChoice(const QVariant &);
+ public:
+ ALSAAudioOutputRegistrar();
+ virtual AudioOutput *create();
+ virtual const QList<audioDevice> getDeviceChoices();
+ virtual void setDeviceChoice(const QVariant &);
};
static ALSAAudioInputRegistrar airALSA;
@@ -71,22 +71,22 @@ ALSAAudioInputRegistrar::ALSAAudioInputRegistrar() : AudioInputRegistrar(QLatin1
}
AudioInput *ALSAAudioInputRegistrar::create() {
- return new ALSAAudioInput();
+ return new ALSAAudioInput();
}
const QList<audioDevice> ALSAAudioInputRegistrar::getDeviceChoices() {
- QList<audioDevice> qlReturn;
-
- QHash<QString,QString>::const_iterator i;
-
- for(i=cards.qhInput.constBegin();i!=cards.qhInput.constEnd();++i) {
- qlReturn << audioDevice(i.value(), i.key());
- }
- return qlReturn;
+ QList<audioDevice> qlReturn;
+
+ QHash<QString,QString>::const_iterator i;
+
+ for (i=cards.qhInput.constBegin();i!=cards.qhInput.constEnd();++i) {
+ qlReturn << audioDevice(i.value(), i.key());
+ }
+ return qlReturn;
}
void ALSAAudioInputRegistrar::setDeviceChoice(const QVariant &choice) {
- g.s.qsALSAInput = choice.toString();
+ g.s.qsALSAInput = choice.toString();
}
@@ -94,441 +94,434 @@ ALSAAudioOutputRegistrar::ALSAAudioOutputRegistrar() : AudioOutputRegistrar(QLat
}
AudioOutput *ALSAAudioOutputRegistrar::create() {
- return new ALSAAudioOutput();
+ return new ALSAAudioOutput();
}
const QList<audioDevice> ALSAAudioOutputRegistrar::getDeviceChoices() {
- QList<audioDevice> qlReturn;
-
- QHash<QString,QString>::const_iterator i;
-
- for(i=cards.qhOutput.constBegin();i!=cards.qhOutput.constEnd();++i) {
- qlReturn << audioDevice(i.value(), i.key());
- }
- return qlReturn;
+ QList<audioDevice> qlReturn;
+
+ QHash<QString,QString>::const_iterator i;
+
+ for (i=cards.qhOutput.constBegin();i!=cards.qhOutput.constEnd();++i) {
+ qlReturn << audioDevice(i.value(), i.key());
+ }
+ return qlReturn;
}
void ALSAAudioOutputRegistrar::setDeviceChoice(const QVariant &choice) {
- g.s.qsALSAOutput = choice.toString();
+ g.s.qsALSAOutput = choice.toString();
}
static ConfigWidget *ALSAConfigDialogNew() {
- return new ALSAConfig();
+ return new ALSAConfig();
}
static ConfigRegistrar registrar(20, ALSAConfigDialogNew);
ALSAEnumerator::ALSAEnumerator() {
- qhInput.insert(QLatin1String("default"), QLatin1String("Default ALSA Card"));
- qhOutput.insert(QLatin1String("default"), QLatin1String("Default ALSA Card"));
-
- int card=-1;
- snd_card_next(&card);
- while (card != -1) {
- char *name;
- snd_ctl_t *ctl=NULL;
- snd_card_get_longname(card, &name);
- QByteArray dev=QString::fromLatin1("hw:%1").arg(card).toUtf8();
- if (snd_ctl_open(&ctl, dev.data(), SND_CTL_READONLY) >= 0) {
- snd_pcm_info_t *info = NULL;
- snd_pcm_info_malloc(&info);
-
- char *cname = NULL;
- snd_card_get_name(card, &cname);
-
- int device = -1;
- snd_ctl_pcm_next_device(ctl, &device);
-
- bool play = false;
- bool cap = false;
-
- while (device != -1) {
- QString devname=QString::fromLatin1("hw:%1,%2").arg(card).arg(device);
- snd_pcm_info_set_device(info, device);
- snd_pcm_info_set_stream(info, SND_PCM_STREAM_CAPTURE);
- if (snd_ctl_pcm_info(ctl,info) == 0) {
- QString fname=QString::fromLatin1(snd_pcm_info_get_name(info));
- qhInput.insert(devname,fname);
- qhInput.insert(QString::fromLatin1("plug:\"")+devname+QString::fromLatin1("\""), fname);
- cap = true;
- }
-
- snd_pcm_info_set_stream(info, SND_PCM_STREAM_PLAYBACK);
- if (snd_ctl_pcm_info(ctl,info) == 0) {
- QString fname=QString::fromLatin1(snd_pcm_info_get_name(info));
- qhOutput.insert(devname,fname);
- qhOutput.insert(QString::fromLatin1("plug:")+devname, fname);
- play = true;
- }
-
- snd_ctl_pcm_next_device(ctl, &device);
- }
- if (play) {
- qhOutput.insert(QString::fromLatin1("plug:\"dmix:CARD=%1\"").arg(card),QLatin1String(cname));
- }
- if (cap) {
- qhInput.insert(QString::fromLatin1("plug:\"dsnoop:CARD=%1\"").arg(card),QLatin1String(cname));
- }
- snd_pcm_info_free(info);
- snd_ctl_close(ctl);
- }
- snd_card_next(&card);
- }
+ qhInput.insert(QLatin1String("default"), QLatin1String("Default ALSA Card"));
+ qhOutput.insert(QLatin1String("default"), QLatin1String("Default ALSA Card"));
+
+ int card=-1;
+ snd_card_next(&card);
+ while (card != -1) {
+ char *name;
+ snd_ctl_t *ctl=NULL;
+ snd_card_get_longname(card, &name);
+ QByteArray dev=QString::fromLatin1("hw:%1").arg(card).toUtf8();
+ if (snd_ctl_open(&ctl, dev.data(), SND_CTL_READONLY) >= 0) {
+ snd_pcm_info_t *info = NULL;
+ snd_pcm_info_malloc(&info);
+
+ char *cname = NULL;
+ snd_card_get_name(card, &cname);
+
+ int device = -1;
+ snd_ctl_pcm_next_device(ctl, &device);
+
+ bool play = false;
+ bool cap = false;
+
+ while (device != -1) {
+ QString devname=QString::fromLatin1("hw:%1,%2").arg(card).arg(device);
+ snd_pcm_info_set_device(info, device);
+ snd_pcm_info_set_stream(info, SND_PCM_STREAM_CAPTURE);
+ if (snd_ctl_pcm_info(ctl,info) == 0) {
+ QString fname=QString::fromLatin1(snd_pcm_info_get_name(info));
+ qhInput.insert(devname,fname);
+ qhInput.insert(QString::fromLatin1("plug:\"")+devname+QString::fromLatin1("\""), fname);
+ cap = true;
+ }
+
+ snd_pcm_info_set_stream(info, SND_PCM_STREAM_PLAYBACK);
+ if (snd_ctl_pcm_info(ctl,info) == 0) {
+ QString fname=QString::fromLatin1(snd_pcm_info_get_name(info));
+ qhOutput.insert(devname,fname);
+ qhOutput.insert(QString::fromLatin1("plug:")+devname, fname);
+ play = true;
+ }
+
+ snd_ctl_pcm_next_device(ctl, &device);
+ }
+ if (play) {
+ qhOutput.insert(QString::fromLatin1("plug:\"dmix:CARD=%1\"").arg(card),QLatin1String(cname));
+ }
+ if (cap) {
+ qhInput.insert(QString::fromLatin1("plug:\"dsnoop:CARD=%1\"").arg(card),QLatin1String(cname));
+ }
+ snd_pcm_info_free(info);
+ snd_ctl_close(ctl);
+ }
+ snd_card_next(&card);
+ }
}
ALSAConfig::ALSAConfig(QWidget *p) : ConfigWidget(p) {
- QGroupBox *qgbDevices, *qgbOutput;
- QGridLayout *grid;
- QVBoxLayout *v;
- QLabel *l;
-
- qcbInputDevice = new QComboBox();
- qcbOutputDevice = new QComboBox();
-
- QList<QString> qlOutputDevs = cards.qhOutput.keys();
- qSort(qlOutputDevs);
- QList<QString> qlInputDevs = cards.qhInput.keys();
- qSort(qlInputDevs);
-
- bool found;
-
-
- found = false;
- foreach(QString dev, qlInputDevs) {
- QString t=QString::fromLatin1("[%1] %2").arg(dev).arg(cards.qhInput[dev]);
- qcbInputDevice->addItem(t, dev);
- if (dev == g.s.qsALSAInput) {
- found = true;
- qcbInputDevice->setCurrentIndex(qcbInputDevice->count() - 1);
- }
- }
- if (! found) {
- qcbInputDevice->addItem(g.s.qsALSAInput, g.s.qsALSAInput);
- qcbInputDevice->setCurrentIndex(qcbInputDevice->count() - 1);
- }
-
- found = false;
- foreach(QString dev, qlOutputDevs) {
- QString t=QString::fromLatin1("[%1] %2").arg(dev).arg(cards.qhOutput[dev]);
- qcbOutputDevice->addItem(t, dev);
- if (dev == g.s.qsALSAOutput) {
- found = true;
- qcbOutputDevice->setCurrentIndex(qcbOutputDevice->count() - 1);
- }
- }
- if (! found) {
- qcbOutputDevice->addItem(g.s.qsALSAOutput, g.s.qsALSAOutput);
- qcbOutputDevice->setCurrentIndex(qcbOutputDevice->count() - 1);
- }
-
- qgbDevices = new QGroupBox(tr("Device selection"));
- grid=new QGridLayout();
-
- qcbInputDevice->setToolTip(tr("Device to use for microphone"));
- qcbInputDevice->setWhatsThis(tr("This set which device mumble should use. The <i>default</i> device is whatever you have configured in alsaconfig, the <i>hwplug</i> "
- "devices are specific hardware devices backed by the ALSA mixer and the <i>hw</i> devices are raw hardware access. Unless your soundcard "
- "supports hardware mixing of audio, using the <i>hw</i> device will exclude all other programs from using audio."));
- qcbOutputDevice->setToolTip(tr("Device to use for speakers/headphones"));
- qcbOutputDevice->setWhatsThis(qcbInputDevice->whatsThis());
-
- l = new QLabel(tr("Input"));
- l->setBuddy(qcbInputDevice);
- grid->addWidget(l, 0, 0);
- grid->addWidget(qcbInputDevice, 0, 1);
-
- l = new QLabel(tr("Output"));
- l->setBuddy(qcbOutputDevice);
- grid->addWidget(l, 1, 0);
- grid->addWidget(qcbOutputDevice, 1, 1);
-
- qgbDevices->setLayout(grid);
-
- qgbOutput = new QGroupBox(tr("Output Options"));
- grid = new QGridLayout();
-
- qsOutputDelay = new QSlider(Qt::Horizontal);
- qsOutputDelay->setRange(1, 6);
-
- qsOutputDelay->setSingleStep(1);
- qsOutputDelay->setPageStep(2);
- qsOutputDelay->setValue(g.s.iDXOutputDelay);
- qsOutputDelay->setObjectName(QLatin1String("OutputDelay"));
- l = new QLabel(tr("Output Delay"));
- l->setBuddy(qsOutputDelay);
- qlOutputDelay=new QLabel();
- qlOutputDelay->setMinimumWidth(30);
- on_OutputDelay_valueChanged(qsOutputDelay->value());
- qsOutputDelay->setToolTip(tr("Amount of data to buffer for ALSA"));
- qsOutputDelay->setWhatsThis(tr("This sets the amount of data to prebuffer in the output buffer. "
- "Experiment with different values and set it to the lowest which doesn't "
- "cause rapid jitter in the sound."));
- grid->addWidget(l, 0, 0);
- grid->addWidget(qsOutputDelay, 0, 1);
- grid->addWidget(qlOutputDelay, 0, 2);
-
- qgbOutput->setLayout(grid);
-
- v = new QVBoxLayout();
- v->addWidget(qgbDevices);
- v->addWidget(qgbOutput);
- v->addStretch(1);
- setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QGroupBox *qgbDevices, *qgbOutput;
+ QGridLayout *grid;
+ QVBoxLayout *v;
+ QLabel *l;
+
+ qcbInputDevice = new QComboBox();
+ qcbOutputDevice = new QComboBox();
+
+ QList<QString> qlOutputDevs = cards.qhOutput.keys();
+ qSort(qlOutputDevs);
+ QList<QString> qlInputDevs = cards.qhInput.keys();
+ qSort(qlInputDevs);
+
+ bool found;
+
+
+ found = false;
+ foreach(QString dev, qlInputDevs) {
+ QString t=QString::fromLatin1("[%1] %2").arg(dev).arg(cards.qhInput[dev]);
+ qcbInputDevice->addItem(t, dev);
+ if (dev == g.s.qsALSAInput) {
+ found = true;
+ qcbInputDevice->setCurrentIndex(qcbInputDevice->count() - 1);
+ }
+ }
+ if (! found) {
+ qcbInputDevice->addItem(g.s.qsALSAInput, g.s.qsALSAInput);
+ qcbInputDevice->setCurrentIndex(qcbInputDevice->count() - 1);
+ }
+
+ found = false;
+ foreach(QString dev, qlOutputDevs) {
+ QString t=QString::fromLatin1("[%1] %2").arg(dev).arg(cards.qhOutput[dev]);
+ qcbOutputDevice->addItem(t, dev);
+ if (dev == g.s.qsALSAOutput) {
+ found = true;
+ qcbOutputDevice->setCurrentIndex(qcbOutputDevice->count() - 1);
+ }
+ }
+ if (! found) {
+ qcbOutputDevice->addItem(g.s.qsALSAOutput, g.s.qsALSAOutput);
+ qcbOutputDevice->setCurrentIndex(qcbOutputDevice->count() - 1);
+ }
+
+ qgbDevices = new QGroupBox(tr("Device selection"));
+ grid=new QGridLayout();
+
+ qcbInputDevice->setToolTip(tr("Device to use for microphone"));
+ qcbInputDevice->setWhatsThis(tr("This set which device mumble should use. The <i>default</i> device is whatever you have configured in alsaconfig, the <i>hwplug</i> "
+ "devices are specific hardware devices backed by the ALSA mixer and the <i>hw</i> devices are raw hardware access. Unless your soundcard "
+ "supports hardware mixing of audio, using the <i>hw</i> device will exclude all other programs from using audio."));
+ qcbOutputDevice->setToolTip(tr("Device to use for speakers/headphones"));
+ qcbOutputDevice->setWhatsThis(qcbInputDevice->whatsThis());
+
+ l = new QLabel(tr("Input"));
+ l->setBuddy(qcbInputDevice);
+ grid->addWidget(l, 0, 0);
+ grid->addWidget(qcbInputDevice, 0, 1);
+
+ l = new QLabel(tr("Output"));
+ l->setBuddy(qcbOutputDevice);
+ grid->addWidget(l, 1, 0);
+ grid->addWidget(qcbOutputDevice, 1, 1);
+
+ qgbDevices->setLayout(grid);
+
+ qgbOutput = new QGroupBox(tr("Output Options"));
+ grid = new QGridLayout();
+
+ qsOutputDelay = new QSlider(Qt::Horizontal);
+ qsOutputDelay->setRange(1, 6);
+
+ qsOutputDelay->setSingleStep(1);
+ qsOutputDelay->setPageStep(2);
+ qsOutputDelay->setValue(g.s.iDXOutputDelay);
+ qsOutputDelay->setObjectName(QLatin1String("OutputDelay"));
+ l = new QLabel(tr("Output Delay"));
+ l->setBuddy(qsOutputDelay);
+ qlOutputDelay=new QLabel();
+ qlOutputDelay->setMinimumWidth(30);
+ on_OutputDelay_valueChanged(qsOutputDelay->value());
+ qsOutputDelay->setToolTip(tr("Amount of data to buffer for ALSA"));
+ qsOutputDelay->setWhatsThis(tr("This sets the amount of data to prebuffer in the output buffer. "
+ "Experiment with different values and set it to the lowest which doesn't "
+ "cause rapid jitter in the sound."));
+ grid->addWidget(l, 0, 0);
+ grid->addWidget(qsOutputDelay, 0, 1);
+ grid->addWidget(qlOutputDelay, 0, 2);
+
+ qgbOutput->setLayout(grid);
+
+ v = new QVBoxLayout();
+ v->addWidget(qgbDevices);
+ v->addWidget(qgbOutput);
+ v->addStretch(1);
+ setLayout(v);
+ QMetaObject::connectSlotsByName(this);
}
QString ALSAConfig::title() const {
- return tr("ALSA");
+ return tr("ALSA");
}
QIcon ALSAConfig::icon() const {
- return QIcon(QLatin1String("skin:config_dsound.png"));
+ return QIcon(QLatin1String("skin:config_dsound.png"));
}
void ALSAConfig::accept() {
- g.s.iDXOutputDelay = qsOutputDelay->value();
- g.s.qsALSAInput = qcbInputDevice->itemData(qcbInputDevice->currentIndex()).toString();
- g.s.qsALSAOutput = qcbOutputDevice->itemData(qcbOutputDevice->currentIndex()).toString();
+ g.s.iDXOutputDelay = qsOutputDelay->value();
+ g.s.qsALSAInput = qcbInputDevice->itemData(qcbInputDevice->currentIndex()).toString();
+ g.s.qsALSAOutput = qcbOutputDevice->itemData(qcbOutputDevice->currentIndex()).toString();
}
void ALSAConfig::on_OutputDelay_valueChanged(int v) {
- qlOutputDelay->setText(tr("%1ms").arg(v*20));
+ qlOutputDelay->setText(tr("%1ms").arg(v*20));
}
-ALSAAudioInput::ALSAAudioInput()
-{
+ALSAAudioInput::ALSAAudioInput() {
}
-ALSAAudioInput::~ALSAAudioInput()
-{
- // Signal input thread to end
- bRunning = false;
- wait();
+ALSAAudioInput::~ALSAAudioInput() {
+ // Signal input thread to end
+ bRunning = false;
+ wait();
}
#define ALSA_ERRBAIL(x) if (!bOk) {} else if ((err=(x)) != 0) bOk = false
-void ALSAAudioInput::run()
-{
- int readblapp;
+void ALSAAudioInput::run() {
+ int readblapp;
- QByteArray device_name = g.s.qsALSAInput.toLatin1();
- snd_pcm_hw_params_t *hw_params = NULL;
- snd_pcm_t *capture_handle = NULL;
- snd_pcm_uframes_t wantPeriod = iFrameSize;
- snd_pcm_uframes_t wantBuff = wantPeriod * 4;
+ QByteArray device_name = g.s.qsALSAInput.toLatin1();
+ snd_pcm_hw_params_t *hw_params = NULL;
+ snd_pcm_t *capture_handle = NULL;
+ snd_pcm_uframes_t wantPeriod = iFrameSize;
+ snd_pcm_uframes_t wantBuff = wantPeriod * 4;
- unsigned int rrate = SAMPLE_RATE;
- bool bOk = true;
+ unsigned int rrate = SAMPLE_RATE;
+ bool bOk = true;
- bRunning = true;
- int err = 0;
+ bRunning = true;
+ int err = 0;
- qWarning("ALSAAudioInput: Initing audiocapture %s.",device_name.data());
+ qWarning("ALSAAudioInput: Initing audiocapture %s.",device_name.data());
- ALSA_ERRBAIL(snd_pcm_open(&capture_handle, device_name.data(), SND_PCM_STREAM_CAPTURE, 0));
- ALSA_ERRBAIL(snd_pcm_hw_params_malloc(&hw_params));
- ALSA_ERRBAIL(snd_pcm_hw_params_any(capture_handle, hw_params));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_access(capture_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_format(capture_handle, hw_params, SND_PCM_FORMAT_S16_LE));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &rrate, NULL));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(capture_handle, hw_params, 1));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, NULL));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(capture_handle, hw_params, &wantBuff));
- ALSA_ERRBAIL(snd_pcm_hw_params(capture_handle, hw_params));
+ ALSA_ERRBAIL(snd_pcm_open(&capture_handle, device_name.data(), SND_PCM_STREAM_CAPTURE, 0));
+ ALSA_ERRBAIL(snd_pcm_hw_params_malloc(&hw_params));
+ ALSA_ERRBAIL(snd_pcm_hw_params_any(capture_handle, hw_params));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_access(capture_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_format(capture_handle, hw_params, SND_PCM_FORMAT_S16_LE));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(capture_handle, hw_params, &rrate, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(capture_handle, hw_params, 1));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(capture_handle, hw_params, &wantPeriod, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(capture_handle, hw_params, &wantBuff));
+ ALSA_ERRBAIL(snd_pcm_hw_params(capture_handle, hw_params));
- qWarning("ALSAAudioInput: Actual buffer %ld samples [%ld(%d) per period]",wantBuff,wantPeriod,iFrameSize);
+ qWarning("ALSAAudioInput: Actual buffer %ld samples [%ld(%d) per period]",wantBuff,wantPeriod,iFrameSize);
#ifdef ALSA_VERBOSE
- snd_output_t *log;
- snd_output_stdio_attach(&log, stderr,0 );
- if (capture_handle)
- snd_pcm_dump(capture_handle, log);
+ snd_output_t *log;
+ snd_output_stdio_attach(&log, stderr,0);
+ if (capture_handle)
+ snd_pcm_dump(capture_handle, log);
#endif
- ALSA_ERRBAIL(snd_pcm_prepare(capture_handle));
- ALSA_ERRBAIL(snd_pcm_start(capture_handle));
+ ALSA_ERRBAIL(snd_pcm_prepare(capture_handle));
+ ALSA_ERRBAIL(snd_pcm_start(capture_handle));
- if (hw_params)
- snd_pcm_hw_params_free(hw_params);
+ if (hw_params)
+ snd_pcm_hw_params_free(hw_params);
- if (! bOk) {
- if (capture_handle) {
- snd_pcm_drain(capture_handle);
- snd_pcm_close(capture_handle);
- capture_handle = NULL;
- }
- g.mw->msgBox(tr("Opening chosen ALSA Input failed: %1").arg(QLatin1String(snd_strerror(err))));
- return;
- }
+ if (! bOk) {
+ if (capture_handle) {
+ snd_pcm_drain(capture_handle);
+ snd_pcm_close(capture_handle);
+ capture_handle = NULL;
+ }
+ g.mw->msgBox(tr("Opening chosen ALSA Input failed: %1").arg(QLatin1String(snd_strerror(err))));
+ return;
+ }
- while (bRunning) {
+ while (bRunning) {
#ifdef ALSA_VERBOSE
- snd_pcm_status_malloc(&status);
- snd_pcm_status(capture_handle, status);
- snd_pcm_status_dump(status, log);
- snd_pcm_status_free(status);
+ snd_pcm_status_malloc(&status);
+ snd_pcm_status(capture_handle, status);
+ snd_pcm_status_dump(status, log);
+ snd_pcm_status_free(status);
#endif
- readblapp = snd_pcm_readi(capture_handle, psMic, iFrameSize);
- if (readblapp == -ESTRPIPE) {
- // suspend event - what to do?
- qWarning("ALSAAudioInput: %s", snd_strerror(readblapp));
- } else if (readblapp == -EPIPE) {
- err = snd_pcm_prepare(capture_handle);
- qWarning("ALSAAudioInput: %s: %s", snd_strerror(readblapp), snd_strerror(err));
- } else if (readblapp < 0) {
- err = snd_pcm_prepare(capture_handle);
- qWarning("ALSAAudioInput: %s: %s", snd_strerror(readblapp), snd_strerror(err));
- } else if (iFrameSize == readblapp) {
- encodeAudioFrame();
+ readblapp = snd_pcm_readi(capture_handle, psMic, iFrameSize);
+ if (readblapp == -ESTRPIPE) {
+ // suspend event - what to do?
+ qWarning("ALSAAudioInput: %s", snd_strerror(readblapp));
+ } else if (readblapp == -EPIPE) {
+ err = snd_pcm_prepare(capture_handle);
+ qWarning("ALSAAudioInput: %s: %s", snd_strerror(readblapp), snd_strerror(err));
+ } else if (readblapp < 0) {
+ err = snd_pcm_prepare(capture_handle);
+ qWarning("ALSAAudioInput: %s: %s", snd_strerror(readblapp), snd_strerror(err));
+ } else if (iFrameSize == readblapp) {
+ encodeAudioFrame();
+ }
}
- }
- snd_pcm_drain(capture_handle);
- snd_pcm_close(capture_handle);
+ snd_pcm_drain(capture_handle);
+ snd_pcm_close(capture_handle);
- qWarning("ALSAAudioInput: Releasing ALSA Mic.");
+ qWarning("ALSAAudioInput: Releasing ALSA Mic.");
}
-void ALSAAudioOutput::initialize(snd_pcm_t * &pcm_handle, int period)
-{
- int err = 0;
- bool bOk = true;
+void ALSAAudioOutput::initialize(snd_pcm_t * &pcm_handle, int period) {
+ int err = 0;
+ bool bOk = true;
- if (pcm_handle)
+ if (pcm_handle)
return;
- short zerobuff[period];
- for(int i=0;i<period;i++)
- zerobuff[i]=0;
-
- unsigned int rate = SAMPLE_RATE;
- snd_pcm_uframes_t period_size = period;
- snd_pcm_uframes_t buffer_size = period * (g.s.iDXOutputDelay + 1);
-
- snd_pcm_hw_params_t *hw_params = NULL;
- snd_pcm_sw_params_t *sw_params = NULL;
- QByteArray device_name = g.s.qsALSAOutput.toLatin1();
-
- ALSA_ERRBAIL(snd_pcm_open(&pcm_handle, device_name.data(), SND_PCM_STREAM_PLAYBACK, 0));
- ALSA_ERRBAIL(snd_pcm_hw_params_malloc(&hw_params));
- ALSA_ERRBAIL(snd_pcm_sw_params_malloc(&sw_params));
-
- ALSA_ERRBAIL(snd_pcm_hw_params_any(pcm_handle, hw_params));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_access(pcm_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_format(pcm_handle, hw_params, SND_PCM_FORMAT_S16_LE));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rate, NULL));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(pcm_handle, hw_params, 1));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hw_params, &buffer_size));
- ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(pcm_handle, hw_params, &period_size, NULL));
-
- ALSA_ERRBAIL(snd_pcm_hw_params(pcm_handle, hw_params));
-
- ALSA_ERRBAIL(snd_pcm_sw_params_current(pcm_handle, sw_params));
- ALSA_ERRBAIL(snd_pcm_sw_params_set_start_threshold(pcm_handle, sw_params, 0));
- ALSA_ERRBAIL(snd_pcm_sw_params_set_avail_min(pcm_handle, sw_params, period_size));
-
- ALSA_ERRBAIL(snd_pcm_sw_params(pcm_handle, sw_params));
-
- ALSA_ERRBAIL(snd_pcm_prepare(pcm_handle));
-
- // Fill one frame
- if (bOk && pcm_handle)
- for (int i = 0; i < g.s.iDXOutputDelay + 1; i++)
- snd_pcm_writei(pcm_handle, zerobuff, period);
-
- if (sw_params)
- snd_pcm_sw_params_free(sw_params);
- if (hw_params)
- snd_pcm_hw_params_free(hw_params);
-
- if (! bOk) {
- g.mw->msgBox(tr("Opening chosen ALSA Output failed: %1").arg(QLatin1String(snd_strerror(err))));
- if (pcm_handle) {
- snd_pcm_close(pcm_handle);
- pcm_handle = NULL;
- }
- return;
- }
+ short zerobuff[period];
+ for (int i=0;i<period;i++)
+ zerobuff[i]=0;
+
+ unsigned int rate = SAMPLE_RATE;
+ snd_pcm_uframes_t period_size = period;
+ snd_pcm_uframes_t buffer_size = period * (g.s.iDXOutputDelay + 1);
+
+ snd_pcm_hw_params_t *hw_params = NULL;
+ snd_pcm_sw_params_t *sw_params = NULL;
+ QByteArray device_name = g.s.qsALSAOutput.toLatin1();
+
+ ALSA_ERRBAIL(snd_pcm_open(&pcm_handle, device_name.data(), SND_PCM_STREAM_PLAYBACK, 0));
+ ALSA_ERRBAIL(snd_pcm_hw_params_malloc(&hw_params));
+ ALSA_ERRBAIL(snd_pcm_sw_params_malloc(&sw_params));
+
+ ALSA_ERRBAIL(snd_pcm_hw_params_any(pcm_handle, hw_params));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_access(pcm_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_format(pcm_handle, hw_params, SND_PCM_FORMAT_S16_LE));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rate, NULL));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(pcm_handle, hw_params, 1));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hw_params, &buffer_size));
+ ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(pcm_handle, hw_params, &period_size, NULL));
+
+ ALSA_ERRBAIL(snd_pcm_hw_params(pcm_handle, hw_params));
+
+ ALSA_ERRBAIL(snd_pcm_sw_params_current(pcm_handle, sw_params));
+ ALSA_ERRBAIL(snd_pcm_sw_params_set_start_threshold(pcm_handle, sw_params, 0));
+ ALSA_ERRBAIL(snd_pcm_sw_params_set_avail_min(pcm_handle, sw_params, period_size));
+
+ ALSA_ERRBAIL(snd_pcm_sw_params(pcm_handle, sw_params));
+
+ ALSA_ERRBAIL(snd_pcm_prepare(pcm_handle));
+
+ // Fill one frame
+ if (bOk && pcm_handle)
+ for (int i = 0; i < g.s.iDXOutputDelay + 1; i++)
+ snd_pcm_writei(pcm_handle, zerobuff, period);
+
+ if (sw_params)
+ snd_pcm_sw_params_free(sw_params);
+ if (hw_params)
+ snd_pcm_hw_params_free(hw_params);
+
+ if (! bOk) {
+ g.mw->msgBox(tr("Opening chosen ALSA Output failed: %1").arg(QLatin1String(snd_strerror(err))));
+ if (pcm_handle) {
+ snd_pcm_close(pcm_handle);
+ pcm_handle = NULL;
+ }
+ return;
+ }
}
-ALSAAudioOutput::ALSAAudioOutput()
-{
- qWarning("ALSAAudioOutput: Initialized");
+ALSAAudioOutput::ALSAAudioOutput() {
+ qWarning("ALSAAudioOutput: Initialized");
}
-ALSAAudioOutput::~ALSAAudioOutput()
-{
- bRunning = false;
- // Call destructor of all children
- wipe();
- // Wait for terminate
- wait();
- qWarning("ALSAAudioOutput: Destroyed");
+ALSAAudioOutput::~ALSAAudioOutput() {
+ bRunning = false;
+ // Call destructor of all children
+ wipe();
+ // Wait for terminate
+ wait();
+ qWarning("ALSAAudioOutput: Destroyed");
}
-void ALSAAudioOutput::run()
-{
- snd_pcm_t *pcm_handle = NULL;
- struct pollfd fds[16];
- int count;
- bool stillRun = true;
+void ALSAAudioOutput::run() {
+ snd_pcm_t *pcm_handle = NULL;
+ struct pollfd fds[16];
+ int count;
+ bool stillRun = true;
- initialize(pcm_handle, iFrameSize);
+ initialize(pcm_handle, iFrameSize);
- bRunning = true;
+ bRunning = true;
- if (! pcm_handle)
- return;
+ if (! pcm_handle)
+ return;
- short buffer[iFrameSize] __attribute__ ((aligned (16)));
+ short buffer[iFrameSize] __attribute__((aligned(16)));
- short zerobuff[iFrameSize];
- for(int i=0;i<iFrameSize;i++)
- zerobuff[i]=0;
+ short zerobuff[iFrameSize];
+ for (int i=0;i<iFrameSize;i++)
+ zerobuff[i]=0;
- count = snd_pcm_poll_descriptors_count(pcm_handle);
- snd_pcm_poll_descriptors(pcm_handle, fds, count);
+ count = snd_pcm_poll_descriptors_count(pcm_handle);
+ snd_pcm_poll_descriptors(pcm_handle, fds, count);
- while (bRunning) {
- poll(fds, count, 20);
- unsigned short revents;
+ while (bRunning) {
+ poll(fds, count, 20);
+ unsigned short revents;
- snd_pcm_poll_descriptors_revents(pcm_handle, fds, count, &revents);
- if (revents & POLLERR) {
- snd_pcm_prepare(pcm_handle);
- } else if (revents & POLLOUT) {
- int avail = snd_pcm_avail_update(pcm_handle);
- while (avail >= iFrameSize) {
- stillRun = mixAudio(buffer);
- int w=snd_pcm_writei(pcm_handle, buffer, iFrameSize);
- if (w == -EPIPE) {
- qWarning("ALSAAudioOutput: %s", snd_strerror(w));
- snd_pcm_prepare(pcm_handle);
- for(int i=0;i<g.s.iDXOutputDelay;i++)
- snd_pcm_writei(pcm_handle, zerobuff, iFrameSize);
- }
- avail = snd_pcm_avail_update(pcm_handle);
- }
+ snd_pcm_poll_descriptors_revents(pcm_handle, fds, count, &revents);
+ if (revents & POLLERR) {
+ snd_pcm_prepare(pcm_handle);
+ } else if (revents & POLLOUT) {
+ int avail = snd_pcm_avail_update(pcm_handle);
+ while (avail >= iFrameSize) {
+ stillRun = mixAudio(buffer);
+ int w=snd_pcm_writei(pcm_handle, buffer, iFrameSize);
+ if (w == -EPIPE) {
+ qWarning("ALSAAudioOutput: %s", snd_strerror(w));
+ snd_pcm_prepare(pcm_handle);
+ for (int i=0;i<g.s.iDXOutputDelay;i++)
+ snd_pcm_writei(pcm_handle, zerobuff, iFrameSize);
+ }
+ avail = snd_pcm_avail_update(pcm_handle);
+ }
- if (! stillRun) {
- snd_pcm_drain(pcm_handle);
+ if (! stillRun) {
+ snd_pcm_drain(pcm_handle);
- while (! mixAudio(buffer) && bRunning)
- this->usleep(20);
+ while (! mixAudio(buffer) && bRunning)
+ this->usleep(20);
- if (! bRunning)
- break;
+ if (! bRunning)
+ break;
- snd_pcm_prepare(pcm_handle);
+ snd_pcm_prepare(pcm_handle);
- // Fill one frame
- for (int i = 0; i < g.s.iDXOutputDelay; i++)
- snd_pcm_writei(pcm_handle, zerobuff, iFrameSize);
- }
- }
- }
+ // Fill one frame
+ for (int i = 0; i < g.s.iDXOutputDelay; i++)
+ snd_pcm_writei(pcm_handle, zerobuff, iFrameSize);
+ }
+ }
+ }
}
diff --git a/src/mumble/ALSAAudio.h b/src/mumble/ALSAAudio.h
index af32db05b..879e9f61e 100644
--- a/src/mumble/ALSAAudio.h
+++ b/src/mumble/ALSAAudio.h
@@ -39,7 +39,7 @@ class ALSAAudioOutput;
class ALSAAudioInput;
class ALSAConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QComboBox *qcbInputDevice;
QComboBox *qcbOutputDevice;
@@ -55,7 +55,7 @@ class ALSAConfig : public ConfigWidget {
};
class ALSAAudioInput : public AudioInput {
- Q_OBJECT
+ Q_OBJECT
protected:
void release();
public:
@@ -65,10 +65,10 @@ class ALSAAudioInput : public AudioInput {
};
class ALSAAudioOutput : public AudioOutput {
- friend class ALSAOutputPlayer;
- Q_OBJECT
+ friend class ALSAOutputPlayer;
+ Q_OBJECT
protected:
- static void initialize(snd_pcm_t * &pcm_handle, int period);
+ static void initialize(snd_pcm_t * &pcm_handle, int period);
public:
ALSAAudioOutput();
~ALSAAudioOutput();
diff --git a/src/mumble/ASIOInput.cpp b/src/mumble/ASIOInput.cpp
index 52684418e..b0d42e525 100644
--- a/src/mumble/ASIOInput.cpp
+++ b/src/mumble/ASIOInput.cpp
@@ -40,8 +40,8 @@
*/
class ASIOAudioInputRegistrar : public AudioInputRegistrar {
- public:
- ASIOAudioInputRegistrar();
+ public:
+ ASIOAudioInputRegistrar();
virtual AudioInput *create();
virtual const QList<audioDevice> getDeviceChoices();
virtual void setDeviceChoice(const QVariant &);
@@ -63,7 +63,7 @@ const QList<audioDevice> ASIOAudioInputRegistrar::getDeviceChoices() {
}
void ASIOAudioInputRegistrar::setDeviceChoice(const QVariant &choice) {
- qWarning("ASIOInputRegistrar::setDeviceChoice was called");
+ qWarning("ASIOInputRegistrar::setDeviceChoice was called");
}
static ConfigWidget *ASIOConfigDialogNew() {
@@ -111,7 +111,7 @@ ASIOConfig::ASIOConfig(QWidget *p) : ConfigWidget(p) {
RegCloseKey(hkDevs);
}
- bOk = false;
+ bOk = false;
QGroupBox *qgbDevices, *qgbCapab, *qgbChannels;
QGridLayout *grid;
@@ -135,31 +135,31 @@ ASIOConfig::ASIOConfig(QWidget *p) : ConfigWidget(p) {
qgbChannels = new QGroupBox(tr("Channels"));
qgbChannels->setToolTip(tr("Configure input channels"));
qgbChannels->setWhatsThis(tr("This will configure the input channels for ASIO. Make sure you select at least one "
- "channel as microphone and speaker. <i>Microphone</i> should be where your microphone is attached, "
- "and <i>Speaker</i> should be a channel that samples \"What you hear\".<br />"
- "For example, on the Audigy 2 ZS, a good selection for Microphone would be \"Mic L\" while "
- "Speaker should be \"Mix L\" and \"Mix R\""));
+ "channel as microphone and speaker. <i>Microphone</i> should be where your microphone is attached, "
+ "and <i>Speaker</i> should be a channel that samples \"What you hear\".<br />"
+ "For example, on the Audigy 2 ZS, a good selection for Microphone would be \"Mic L\" while "
+ "Speaker should be \"Mix L\" and \"Mix R\""));
grid=new QGridLayout();
qcbDevice->setToolTip(tr("Device to use for microphone"));
qcbDevice->setWhatsThis(tr("This chooses what device to query. You still need to actually query the device and "
- "select which channels to use."));
+ "select which channels to use."));
l = new QLabel(tr("Device"));
QPushButton *queryButton=new QPushButton(tr("&Query"));
queryButton->setObjectName("Query");
queryButton->setToolTip(tr("Query selected device"));
queryButton->setWhatsThis(tr("This queries the selected device for channels. Be aware that many ASIO drivers are "
- "buggy to the extreme, and querying them might cause a crash of either the application "
- "or the system."));
+ "buggy to the extreme, and querying them might cause a crash of either the application "
+ "or the system."));
QPushButton *configButton=new QPushButton(tr("&Configure"));
configButton->setObjectName("Config");
configButton->setToolTip(tr("Configure selected device"));
configButton->setWhatsThis(tr("This configures the selected device. Be aware that many ASIO drivers are "
- "buggy to the extreme, and querying them might cause a crash of either the application "
- "or the system."));
+ "buggy to the extreme, and querying them might cause a crash of either the application "
+ "or the system."));
grid->addWidget(l, 0, 0);
grid->addWidget(qcbDevice, 0, 1);
@@ -260,7 +260,7 @@ ASIOConfig::ASIOConfig(QWidget *p) : ConfigWidget(p) {
setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
#include "iasiothiscallresolver.h"
@@ -315,7 +315,7 @@ void ASIOConfig::on_Query_clicked() {
bOk = true;
} else if (granSize == -1) {
long v = minSize;
- for(int i=0;i<100;i++) {
+ for (int i=0;i<100;i++) {
if (v == 1920) {
bOk = true;
break;
@@ -352,16 +352,15 @@ void ASIOConfig::on_Query_clicked() {
long cnum;
bool match = (g.s.qsASIOclass == qsCls);
- for(cnum=0;cnum<ichannels;cnum++) {
+ for (cnum=0;cnum<ichannels;cnum++) {
ASIOChannelInfo aci;
aci.channel = cnum;
aci.isInput = true;
iasio.getChannelInfo(&aci);
SleepEx(10, false);
- switch(aci.type) {
+ switch (aci.type) {
case ASIOSTInt32LSB:
- case ASIOSTInt16LSB:
- {
+ case ASIOSTInt16LSB: {
QListWidget *widget = qlwUnused;
QVariant v = static_cast<int>(cnum);
if (match && g.s.qlASIOmic.contains(v))
@@ -469,7 +468,7 @@ void ASIOConfig::accept() {
QList<QVariant> list;
- for(int i=0;i<qlwMic->count();i++) {
+ for (int i=0;i<qlwMic->count();i++) {
QListWidgetItem *item = qlwMic->item(i);
list << item->data(Qt::UserRole);
}
@@ -478,7 +477,7 @@ void ASIOConfig::accept() {
list.clear();
- for(int i=0;i<qlwSpeaker->count();i++) {
+ for (int i=0;i<qlwSpeaker->count();i++) {
QListWidgetItem *item = qlwSpeaker->item(i);
list << item->data(Qt::UserRole);
}
@@ -519,7 +518,7 @@ ASIOInput::ASIOInput() {
pdMicDelayLine = new double[MUMBLE_SFP_LENGTH];
pdSpeakerDelayLine = new double[MUMBLE_SFP_LENGTH];
- for(i=0;i<MUMBLE_SFP_LENGTH;i++)
+ for (i=0;i<MUMBLE_SFP_LENGTH;i++)
pdMicDelayLine[i]=pdSpeakerDelayLine[i] = 0.0;
// Sanity check things first.
@@ -529,7 +528,7 @@ ASIOInput::ASIOInput() {
if ((iNumMic == 0) || (iNumSpeaker == 0)) {
QMessageBox::warning(NULL, tr("Mumble"), tr("You need to select at least one microphone and one speaker source to use ASIO. "
- "If you just need microphone sampling, use DirectSound."), QMessageBox::Ok, QMessageBox::NoButton);
+ "If you just need microphone sampling, use DirectSound."), QMessageBox::Ok, QMessageBox::NoButton);
return;
}
@@ -544,7 +543,7 @@ ASIOInput::ASIOInput() {
abiInfo = new ASIOBufferInfo[iNumMic + iNumSpeaker];
aciInfo = new ASIOChannelInfo[iNumMic + iNumSpeaker];
idx = 0;
- for(i=0;i<iNumMic;i++) {
+ for (i=0;i<iNumMic;i++) {
abiInfo[idx].isInput = true;
abiInfo[idx].channelNum = g.s.qlASIOmic[i].toInt();
@@ -555,7 +554,7 @@ ASIOInput::ASIOInput() {
idx++;
}
- for(i=0;i<iNumSpeaker;i++) {
+ for (i=0;i<iNumSpeaker;i++) {
abiInfo[idx].isInput = true;
abiInfo[idx].channelNum = g.s.qlASIOspeaker[i].toInt();
@@ -598,7 +597,7 @@ ASIOInput::ASIOInput() {
}
QMessageBox::critical(NULL, tr("Mumble"), tr("Opening selected ASIO device failed. No input will be done."),
- QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::Ok, QMessageBox::NoButton);
}
@@ -641,17 +640,15 @@ ASIOTime *ASIOInput::bufferSwitchTimeInfo(ASIOTime *timeInfo, long index, ASIOBo
void ASIOInput::addBuffer(ASIOSampleType sampType, void *src, double *dst) {
switch (sampType) {
- case ASIOSTInt16LSB:
- {
+ case ASIOSTInt16LSB: {
short *buf=static_cast<short *>(src);
- for(int i=0;i<960;i++)
+ for (int i=0;i<960;i++)
dst[i]+=buf[i];
}
break;
- case ASIOSTInt32LSB:
- {
+ case ASIOSTInt32LSB: {
int *buf=static_cast<int *>(src);
- for(int i=0;i<960;i++)
+ for (int i=0;i<960;i++)
dst[i]+=(buf[i] >> 16);
}
break;
@@ -663,69 +660,65 @@ void ASIOInput::bufferReady(long buffindex) {
// Microphone inputs
ZeroMemory(pdInputBuffer, sizeof(double) * 960);
- for(c=0;c<iNumMic;c++)
+ for (c=0;c<iNumMic;c++)
addBuffer(aciInfo[c].type, abiInfo[c].buffers[buffindex], pdInputBuffer);
double mul = 1.0 / (32768.0 * iNumMic);
- for(i=0;i<960;i++) {
+ for (i=0;i<960;i++) {
pdInputBuffer[i] *= mul;
}
decim(pdInputBuffer, pdOutputBuffer, pdMicDelayLine);
- for(i=0;i<320;i++)
+ for (i=0;i<320;i++)
psMic[i] = static_cast<short>(pdOutputBuffer[i] * 32768.0);
// Speaker inputs
ZeroMemory(pdInputBuffer, sizeof(double) * 960);
- for(c=0;c<iNumMic;c++)
+ for (c=0;c<iNumMic;c++)
addBuffer(aciInfo[iNumMic+c].type, abiInfo[iNumMic+c].buffers[buffindex], pdInputBuffer);
mul = 1.0 / (32768.0 * iNumSpeaker);
- for(i=0;i<960;i++) {
+ for (i=0;i<960;i++) {
pdInputBuffer[i] *= mul;
}
decim(pdInputBuffer, pdOutputBuffer, pdSpeakerDelayLine);
- for(i=0;i<320;i++)
+ for (i=0;i<320;i++)
psSpeaker[i] = static_cast<short>(pdOutputBuffer[i] * 32768.0);
encodeAudioFrame();
}
-void ASIOInput::bufferSwitch(long index, ASIOBool processNow)
-{
+void ASIOInput::bufferSwitch(long index, ASIOBool processNow) {
ASIOTime timeInfo;
- memset (&timeInfo, 0, sizeof (timeInfo));
+ memset(&timeInfo, 0, sizeof(timeInfo));
- if(aiSelf->iasio->getSamplePosition(&timeInfo.timeInfo.samplePosition, &timeInfo.timeInfo.systemTime) == ASE_OK)
+ if (aiSelf->iasio->getSamplePosition(&timeInfo.timeInfo.samplePosition, &timeInfo.timeInfo.systemTime) == ASE_OK)
timeInfo.timeInfo.flags = kSystemTimeValid | kSamplePositionValid;
- bufferSwitchTimeInfo (&timeInfo, index, processNow);
+ bufferSwitchTimeInfo(&timeInfo, index, processNow);
}
-void ASIOInput::sampleRateChanged(ASIOSampleRate sRate)
-{
+void ASIOInput::sampleRateChanged(ASIOSampleRate sRate) {
qFatal("ASIOInput: sampleRateChanged");
}
-long ASIOInput::asioMessages(long selector, long value, void* message, double* opt)
-{
+long ASIOInput::asioMessages(long selector, long value, void* message, double* opt) {
long ret = 0;
- switch(selector)
- {
+ switch (selector) {
case kAsioSelectorSupported:
- if(value == kAsioResetRequest
- || value == kAsioEngineVersion
- || value == kAsioResyncRequest
- || value == kAsioLatenciesChanged
- || value == kAsioSupportsTimeInfo
- || value == kAsioSupportsTimeCode
- || value == kAsioSupportsInputMonitor)
+ if (value == kAsioResetRequest
+ || value == kAsioEngineVersion
+ || value == kAsioResyncRequest
+ || value == kAsioLatenciesChanged
+ || value == kAsioSupportsTimeInfo
+ || value == kAsioSupportsTimeCode
+ || value == kAsioSupportsInputMonitor)
ret = 1L;
break;
case kAsioResetRequest:
@@ -783,27 +776,27 @@ long ASIOInput::asioMessages(long selector, long value, void* message, double* o
#define p_H mumble_sfp
void ASIOInput::decim(const double *p_inp, double *p_out, double *p_Z) {
- int tap;
- double sum;
- int num_inp = 960;
-
- while (num_inp >= factor_M) {
- /* shift Z delay line up to make room for next samples */
- for (tap = H_size - 1; tap >= factor_M; tap--) {
- p_Z[tap] = p_Z[tap - factor_M];
- }
-
- /* copy next samples from input buffer to bottom of Z delay line */
- for (tap = factor_M - 1; tap >= 0; tap--) {
- p_Z[tap] = *p_inp++;
- }
- num_inp -= factor_M;
-
- /* calculate FIR sum */
- sum = 0.0;
- for (tap = 0; tap < H_size; tap++) {
- sum += p_H[tap] * p_Z[tap];
- }
- *p_out++ = sum; /* store sum and point to next output */
- }
+ int tap;
+ double sum;
+ int num_inp = 960;
+
+ while (num_inp >= factor_M) {
+ /* shift Z delay line up to make room for next samples */
+ for (tap = H_size - 1; tap >= factor_M; tap--) {
+ p_Z[tap] = p_Z[tap - factor_M];
+ }
+
+ /* copy next samples from input buffer to bottom of Z delay line */
+ for (tap = factor_M - 1; tap >= 0; tap--) {
+ p_Z[tap] = *p_inp++;
+ }
+ num_inp -= factor_M;
+
+ /* calculate FIR sum */
+ sum = 0.0;
+ for (tap = 0; tap < H_size; tap++) {
+ sum += p_H[tap] * p_Z[tap];
+ }
+ *p_out++ = sum; /* store sum and point to next output */
+ }
}
diff --git a/src/mumble/ASIOInput.h b/src/mumble/ASIOInput.h
index 1fcf1ab6e..fbc2c76c4 100644
--- a/src/mumble/ASIOInput.h
+++ b/src/mumble/ASIOInput.h
@@ -39,7 +39,7 @@
typedef QPair<QString, QString> ASIODev;
class ASIOConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QList<ASIODev> qlDevs;
QComboBox *qcbDevice;
@@ -68,7 +68,7 @@ class ASIOConfig : public ConfigWidget {
class IASIOThiscallResolver;
class ASIOInput : public AudioInput {
- Q_OBJECT
+ Q_OBJECT
protected:
IASIO *iaOriginal;
IASIOThiscallResolver *iasio;
diff --git a/src/mumble/About.cpp b/src/mumble/About.cpp
index 2eabb4e7c..d8801106e 100644
--- a/src/mumble/About.cpp
+++ b/src/mumble/About.cpp
@@ -34,7 +34,7 @@
AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
QTabWidget *qtwTab = new QTabWidget(this);
- QVBoxLayout *vblMain = new QVBoxLayout(this);
+ QVBoxLayout *vblMain = new QVBoxLayout(this);
QTextEdit *qteLicense=new QTextEdit();
qteLicense->setReadOnly(true);
@@ -47,11 +47,11 @@ AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
QLabel *text=new QLabel(about);
text->setText(tr(
- "<h3>Mumble v%1</h3>"
- "<p>Copyright 2005-2007 Thorvald Natvig<br />slicer@users.sourceforge.net</p>"
- "<p><b>A voice-chat utility for gamers</b></p>"
- "<p><tt>http://mumble.sourceforge.net/</tt></p>"
- ).arg(QLatin1String(MUMBLE_RELEASE)));
+ "<h3>Mumble v%1</h3>"
+ "<p>Copyright 2005-2007 Thorvald Natvig<br />slicer@users.sourceforge.net</p>"
+ "<p><b>A voice-chat utility for gamers</b></p>"
+ "<p><tt>http://mumble.sourceforge.net/</tt></p>"
+ ).arg(QLatin1String(MUMBLE_RELEASE)));
QHBoxLayout *qhbl=new QHBoxLayout();
qhbl->addWidget(icon);
qhbl->addWidget(text);
@@ -60,13 +60,13 @@ AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
qtwTab->addTab(about, tr("&About Mumble"));
qtwTab->addTab(qteLicense, tr("&License"));
- QPushButton *okButton = new QPushButton(tr("OK"));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ QPushButton *okButton = new QPushButton(tr("OK"));
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- vblMain->addWidget(qtwTab);
- vblMain->addWidget(okButton);
+ vblMain->addWidget(qtwTab);
+ vblMain->addWidget(okButton);
- setLayout(vblMain);
+ setLayout(vblMain);
}
AboutSpeexDialog::AboutSpeexDialog(QWidget *p) : QDialog(p) {
@@ -75,22 +75,22 @@ AboutSpeexDialog::AboutSpeexDialog(QWidget *p) : QDialog(p) {
QLabel *text=new QLabel();
text->setText(tr(
- "<h3>About Speex</h3>"
- "<p><tt>http://www.speex.org/</tt></p>"
- "<p>This program uses Speex version %1</p>"
- "<p>Speex is used for echo cancellation, noise<br />"
- "filtering, voice activity detection and speech<br />"
- "compression.</p>"
- ).arg(QLatin1String(verptr)));
-
- QPushButton *okButton = new QPushButton(tr("OK"));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
-
- QVBoxLayout *vblMain = new QVBoxLayout();
+ "<h3>About Speex</h3>"
+ "<p><tt>http://www.speex.org/</tt></p>"
+ "<p>This program uses Speex version %1</p>"
+ "<p>Speex is used for echo cancellation, noise<br />"
+ "filtering, voice activity detection and speech<br />"
+ "compression.</p>"
+ ).arg(QLatin1String(verptr)));
+
+ QPushButton *okButton = new QPushButton(tr("OK"));
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+
+ QVBoxLayout *vblMain = new QVBoxLayout();
QHBoxLayout *qhbl=new QHBoxLayout();
qhbl->addWidget(text);
vblMain->addLayout(qhbl);
vblMain->addWidget(okButton);
- setLayout(vblMain);
+ setLayout(vblMain);
}
diff --git a/src/mumble/About.h b/src/mumble/About.h
index fc3334b18..6912058ae 100644
--- a/src/mumble/About.h
+++ b/src/mumble/About.h
@@ -32,13 +32,13 @@
#define _ABOUT_H
class AboutDialog : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
public:
AboutDialog(QWidget *parent);
};
class AboutSpeexDialog : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
public:
AboutSpeexDialog(QWidget *parent);
};
diff --git a/src/mumble/Audio.cpp b/src/mumble/Audio.cpp
index f9ed0abb8..0620fb092 100644
--- a/src/mumble/Audio.cpp
+++ b/src/mumble/Audio.cpp
@@ -52,52 +52,52 @@ LoopPlayer::LoopPlayer() {
}
void LoopPlayer::addFrame(const QByteArray &packet, int seq) {
- if (DOUBLE_RAND < g.dPacketLoss)
- return;
+ if (DOUBLE_RAND < g.dPacketLoss)
+ return;
- bool restart = (qtLastFetch.elapsed() > 100);
+ bool restart = (qtLastFetch.elapsed() > 100);
- {
- QMutexLocker l(&qmLock);
+ {
+ QMutexLocker l(&qmLock);
- double time = qtTicker.elapsed();
+ double time = qtTicker.elapsed();
- double r;
- if (restart)
- r = 0.0;
- else
- r = DOUBLE_RAND * g.dMaxPacketDelay;
+ double r;
+ if (restart)
+ r = 0.0;
+ else
+ r = DOUBLE_RAND * g.dMaxPacketDelay;
- qmPackets.insert(time + r, Packet(seq, packet));
- }
+ qmPackets.insert(time + r, Packet(seq, packet));
+ }
- // Restart check
- if (qtLastFetch.elapsed() > 100) {
- AudioOutputPtr ao = g.ao;
- if (ao) {
- ao->addFrameToBuffer(this, QByteArray(), 0);
+ // Restart check
+ if (qtLastFetch.elapsed() > 100) {
+ AudioOutputPtr ao = g.ao;
+ if (ao) {
+ ao->addFrameToBuffer(this, QByteArray(), 0);
+ }
}
- }
}
void LoopPlayer::fetchFrames() {
- QMutexLocker l(&qmLock);
+ QMutexLocker l(&qmLock);
- AudioOutputPtr ao = g.ao;
- if (!ao || qmPackets.isEmpty())
- return;
+ AudioOutputPtr ao = g.ao;
+ if (!ao || qmPackets.isEmpty())
+ return;
- double cmp = qtTicker.elapsed();
+ double cmp = qtTicker.elapsed();
- QMultiMap<double, Packet>::iterator i = qmPackets.begin();
+ QMultiMap<double, Packet>::iterator i = qmPackets.begin();
- while(i != qmPackets.end()) {
- if (i.key() > cmp)
- break;
- ao->addFrameToBuffer(this, i.value().second, i.value().first);
- i = qmPackets.erase(i);
- }
+ while (i != qmPackets.end()) {
+ if (i.key() > cmp)
+ break;
+ ao->addFrameToBuffer(this, i.value().second, i.value().first);
+ i = qmPackets.erase(i);
+ }
- qtLastFetch.restart();
+ qtLastFetch.restart();
}
diff --git a/src/mumble/Audio.h b/src/mumble/Audio.h
index cd0ac1feb..0f09e0f9f 100644
--- a/src/mumble/Audio.h
+++ b/src/mumble/Audio.h
@@ -39,17 +39,17 @@
typedef QPair<QString,QVariant> audioDevice;
class LoopPlayer : public Player {
- protected:
- typedef QPair<quint32, QByteArray> Packet;
- QMutex qmLock;
- QTime qtTicker;
- QTime qtLastFetch;
- QMultiMap<double, Packet> qmPackets;
- LoopPlayer();
- public:
- static LoopPlayer lpLoopy;
- void addFrame(const QByteArray &packet, int seq);
- void fetchFrames();
+ protected:
+ typedef QPair<quint32, QByteArray> Packet;
+ QMutex qmLock;
+ QTime qtTicker;
+ QTime qtLastFetch;
+ QMultiMap<double, Packet> qmPackets;
+ LoopPlayer();
+ public:
+ static LoopPlayer lpLoopy;
+ void addFrame(const QByteArray &packet, int seq);
+ void fetchFrames();
};
#endif
diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp
index 06393802c..1815383d9 100644
--- a/src/mumble/AudioConfigDialog.cpp
+++ b/src/mumble/AudioConfigDialog.cpp
@@ -107,9 +107,9 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbTransmit->setToolTip(tr("When to transmit your speech"));
qcbTransmit->setWhatsThis(tr("<b>This sets when speech should be transmitted.</b><br />"
- "<i>Continuous</i> - All the time<br />"
- "<i>Voice Activity</i> - When you are speaking clearly.<br />"
- "<i>Push To Talk</i> - When you hold down the hotkey set under <i>Shortcuts</i>."));
+ "<i>Continuous</i> - All the time<br />"
+ "<i>Voice Activity</i> - When you are speaking clearly.<br />"
+ "<i>Push To Talk</i> - When you hold down the hotkey set under <i>Shortcuts</i>."));
grid->addWidget(l, 0, 0);
grid->addWidget(qcbTransmit, 0, 1, 1, 2);
@@ -129,8 +129,8 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsTransmitHold->setToolTip(tr("How long to keep transmitting after silence"));
qsTransmitHold->setWhatsThis(tr("<b>This selects how long after a perceived stop in speech transmission should continue.</b><br />"
- "Set this higher if your voice breaks up when you speak (seen by a rapidly blinking voice icon next to your name).<br />"
- "Only makes sense when used with Voice Activity transmission."));
+ "Set this higher if your voice breaks up when you speak (seen by a rapidly blinking voice icon next to your name).<br />"
+ "Only makes sense when used with Voice Activity transmission."));
grid->addWidget(l, 1, 0);
grid->addWidget(qsTransmitHold, 1, 1);
@@ -154,8 +154,8 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsFrames->setToolTip(tr("How many audio frames to send per packet"));
qsFrames->setWhatsThis(tr("<b>This selects how many audio frames should be put in one packet.</b><br />"
- "Increasing this will increase the "
- "latency of your voice, but will also reduce bandwidth requirements."));
+ "Increasing this will increase the "
+ "latency of your voice, but will also reduce bandwidth requirements."));
grid->addWidget(l, 2, 0);
grid->addWidget(qsFrames, 2, 1);
grid->addWidget(qlFrames, 2, 2);
@@ -164,24 +164,24 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbPushClick->setChecked(g.s.bPushClick);
qcbPushClick->setToolTip(tr("Audible audio cue when push-to-talk pressed and released"));
qcbPushClick->setWhatsThis(tr("<b>This enables the audio cues for push to talk.</b><br />"
- "Setting this will give you a short audio beep when push to talk is pressed and released."));
+ "Setting this will give you a short audio beep when push to talk is pressed and released."));
qcbTCP = new QCheckBox(tr("Use TCP mode"));
qcbTCP->setChecked(g.s.bTCPCompat);
qcbTCP->setToolTip(tr("Use TCP Compatibility mode"));
qcbTCP->setWhatsThis(tr("<b>Enable TCP Compatibility mode</b>.<br />"
- "This will make Mumble use only TCP when communicating with the server. "
- "This will increase overhead and cause lost packets to produce noticeable "
- "pauses in communication, so this should only be used if you are unable to "
- "use the default (which uses UDP for voice and TCP for control)."));
+ "This will make Mumble use only TCP when communicating with the server. "
+ "This will increase overhead and cause lost packets to produce noticeable "
+ "pauses in communication, so this should only be used if you are unable to "
+ "use the default (which uses UDP for voice and TCP for control)."));
qcbReconnect = new QCheckBox(tr("Automatic Reconnect"));
qcbReconnect->setChecked(g.s.bReconnect);
qcbReconnect->setToolTip(tr("Reconnect when disconnected"));
qcbReconnect->setWhatsThis(tr("<b>Reconnect when disconnected</b>.<br />"
- "This will make Mumble try to automatically reconnect after 10 "
- "seconds if your server "
- "connection fails."));
+ "This will make Mumble try to automatically reconnect after 10 "
+ "seconds if your server "
+ "connection fails."));
QHBoxLayout *qhbl=new QHBoxLayout();
qhbl->addWidget(qcbPushClick);
@@ -192,10 +192,10 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qlBitrate = new QLabel();
qlBitrate->setToolTip(tr("Maximum bandwidth used for sent audio"));
qlBitrate->setWhatsThis(tr("<b>This shows peak outgoing bandwidth used.</b><br />"
- "This shows the peak amount of bandwidth sent out from your machine. Audio bitrate "
- "is the maximum bitrate (as we use VBR) for the audio data alone. Position "
- "is the bitrate used for positional information. Overhead is our framing and the "
- "IP packet headers (IP and UDP is 90% of this overhead)."));
+ "This shows the peak amount of bandwidth sent out from your machine. Audio bitrate "
+ "is the maximum bitrate (as we use VBR) for the audio data alone. Position "
+ "is the bitrate used for positional information. Overhead is our framing and the "
+ "IP packet headers (IP and UDP is 90% of this overhead)."));
l = new QLabel(tr("Outgoing Bitrate"));
l->setBuddy(qlBitrate);
@@ -224,7 +224,7 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsQuality->setToolTip(tr("Quality of compression (peak bandwidth)"));
qsQuality->setWhatsThis(tr("<b>This sets the quality of compression.</b><br />"
- "This determines how much bandwidth Mumble is allowed to use for outgoing audio."));
+ "This determines how much bandwidth Mumble is allowed to use for outgoing audio."));
grid->addWidget(l, 0, 0);
grid->addWidget(qsQuality, 0, 1);
@@ -245,8 +245,8 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsComplexity->setToolTip(tr("Complexity of compression (CPU)"));
qsComplexity->setWhatsThis(tr("<b>This sets the complexity of compression.</b><br />"
- "This determines how much CPU Mumble is allowed to use to increase transmitted "
- "voice quality. Settings above 5 give only marginal gain."));
+ "This determines how much CPU Mumble is allowed to use to increase transmitted "
+ "voice quality. Settings above 5 give only marginal gain."));
grid->addWidget(l, 1, 0);
grid->addWidget(qsComplexity, 1, 1);
@@ -267,16 +267,16 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsAmp->setToolTip(tr("Maximum amplification of input sound"));
qsAmp->setWhatsThis(tr(
- "<b>Maximum amplification of input.</b><br />"
- "Mumble normalizes the input volume before compressing, and this sets how much it's allowed to amplify.<br />"
- "The actual level is continually updated based on your current speech pattern, but it will never go "
- "above the level specified here.<br />"
- "If the <i>Microphone loudness</i> level of the audio statistics hover around 100%, you probably want to set this to 2.0 "
- "or so, but if, like most people, you are unable to reach 100%, set this to something much higher.<br />"
- "Ideally, set it so <i>Microphone Loudness * Amplification Factor >= 100</i>, even when you're speaking really soft.<br /><br />"
- "Note that there is no harm in setting this to maximum, but Mumble will start picking up other conversations "
- "if you leave it to auto-tune to that level."
- ));
+ "<b>Maximum amplification of input.</b><br />"
+ "Mumble normalizes the input volume before compressing, and this sets how much it's allowed to amplify.<br />"
+ "The actual level is continually updated based on your current speech pattern, but it will never go "
+ "above the level specified here.<br />"
+ "If the <i>Microphone loudness</i> level of the audio statistics hover around 100%, you probably want to set this to 2.0 "
+ "or so, but if, like most people, you are unable to reach 100%, set this to something much higher.<br />"
+ "Ideally, set it so <i>Microphone Loudness * Amplification Factor >= 100</i>, even when you're speaking really soft.<br /><br />"
+ "Note that there is no harm in setting this to maximum, but Mumble will start picking up other conversations "
+ "if you leave it to auto-tune to that level."
+ ));
grid->addWidget(l, 2, 0);
grid->addWidget(qsAmp, 2, 1);
@@ -303,12 +303,12 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsJitter->setToolTip(tr("How long to prebuffer on first packet"));
qsJitter->setWhatsThis(tr("<b>This sets the default buffer size for the jitter buffer</b>.<br />"
- "All incoming audio is buffered, and the jitter buffer continually tries to "
- "push the buffer to the minimum sustainable by your network, so latency can "
- "be as low as possible. This sets the default buffer size to use on the first "
- "packet to arrive from a new speaker, or when a speaker using Voice Activity or "
- "Push-To-Talk just started talking again. If the start of sentences you hear is "
- "very jittery, increase this value."));
+ "All incoming audio is buffered, and the jitter buffer continually tries to "
+ "push the buffer to the minimum sustainable by your network, so latency can "
+ "be as low as possible. This sets the default buffer size to use on the first "
+ "packet to arrive from a new speaker, or when a speaker using Voice Activity or "
+ "Push-To-Talk just started talking again. If the start of sentences you hear is "
+ "very jittery, increase this value."));
grid->addWidget(l, 0, 0);
grid->addWidget(qsJitter, 0, 1);
grid->addWidget(qlJitter, 0, 2);
@@ -329,12 +329,12 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbLoopback->setToolTip(tr("Desired loopback mode"));
qcbLoopback->setWhatsThis(tr("<b>This enables one of the loopback testmodes.</b><br />"
- "<i>None</i> - Loopback disabled<br />"
- "<i>Local</i> - Emulate a local server.<br />"
- "<i>Server</i> - Request loopback from server.<br />"
- "Please note than when loopback is enabled, no other players will hear your voice. "
- "This setting is not saved on application exit."
- ));
+ "<i>None</i> - Loopback disabled<br />"
+ "<i>Local</i> - Emulate a local server.<br />"
+ "<i>Server</i> - Request loopback from server.<br />"
+ "Please note than when loopback is enabled, no other players will hear your voice. "
+ "This setting is not saved on application exit."
+ ));
grid->addWidget(l, 0, 0);
grid->addWidget(qcbLoopback, 0, 1, 1, 2);
@@ -355,10 +355,10 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsPacketDelay->setToolTip(tr("Variance in packet latency"));
qsPacketDelay->setWhatsThis(tr("<b>This sets the packet latency variance for loopback testing</b><br />"
- "Most audio paths contain some variable latency. This allows you set that variance for loopback "
- "mode testing. For example, if you set this to 15ms, this will emulate a network with 20-35ms ping latency "
- "or one with 80-95ms latency. Most domestic net connections have a variance of about 5ms"
- ));
+ "Most audio paths contain some variable latency. This allows you set that variance for loopback "
+ "mode testing. For example, if you set this to 15ms, this will emulate a network with 20-35ms ping latency "
+ "or one with 80-95ms latency. Most domestic net connections have a variance of about 5ms"
+ ));
grid->addWidget(l, 1, 0);
grid->addWidget(qsPacketDelay, 1, 1);
@@ -380,9 +380,9 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qsPacketLoss->setToolTip(tr("Packet loss for loopback mode"));
qsPacketLoss->setWhatsThis(tr("<b>This sets the packet loss for loopback mode.</b><br />"
- "This will be the ratio of packets lost. Unless your outgoing bandwidth is peaked or "
- "there's something wrong with your network connection, this will be 0%%"
- ));
+ "This will be the ratio of packets lost. Unless your outgoing bandwidth is peaked or "
+ "there's something wrong with your network connection, this will be 0%%"
+ ));
grid->addWidget(l, 2, 0);
grid->addWidget(qsPacketLoss, 2, 1);
@@ -390,19 +390,19 @@ AudioConfigDialog::AudioConfigDialog(QWidget *p) : ConfigWidget(p) {
qgbLoop->setLayout(grid);
- v = new QVBoxLayout;
- v->addWidget(qgbInterface);
- v->addWidget(qgbTransmit);
- v->addWidget(qgbCompress);
- v->addWidget(qgbJitter);
- v->addWidget(qgbLoop);
- v->addStretch(1);
- setLayout(v);
+ v = new QVBoxLayout;
+ v->addWidget(qgbInterface);
+ v->addWidget(qgbTransmit);
+ v->addWidget(qgbCompress);
+ v->addWidget(qgbJitter);
+ v->addWidget(qgbLoop);
+ v->addStretch(1);
+ setLayout(v);
- on_Transmit_currentIndexChanged(qcbTransmit->currentIndex());
- on_Loopback_currentIndexChanged(qcbLoopback->currentIndex());
+ on_Transmit_currentIndexChanged(qcbTransmit->currentIndex());
+ on_Loopback_currentIndexChanged(qcbLoopback->currentIndex());
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
@@ -522,30 +522,30 @@ void AudioConfigDialog::updateBitrate() {
}
void AudioConfigDialog::on_Transmit_currentIndexChanged(int v) {
- bool cue = false;
- bool hold = false;
-
- switch(v) {
- case 1:
- hold = true;
- break;
- case 2:
- cue = true;
- break;
- }
-
- qcbPushClick->setEnabled(cue);
- qsTransmitHold->setEnabled(hold);
- qlTransmitHold->setEnabled(hold);
+ bool cue = false;
+ bool hold = false;
+
+ switch (v) {
+ case 1:
+ hold = true;
+ break;
+ case 2:
+ cue = true;
+ break;
+ }
+
+ qcbPushClick->setEnabled(cue);
+ qsTransmitHold->setEnabled(hold);
+ qlTransmitHold->setEnabled(hold);
}
void AudioConfigDialog::on_Loopback_currentIndexChanged(int v) {
- bool ena = false;
- if (v == 1)
- ena = true;
-
- qsPacketDelay->setEnabled(ena);
- qlPacketDelay->setEnabled(ena);
- qsPacketLoss->setEnabled(ena);
- qlPacketLoss->setEnabled(ena);
+ bool ena = false;
+ if (v == 1)
+ ena = true;
+
+ qsPacketDelay->setEnabled(ena);
+ qlPacketDelay->setEnabled(ena);
+ qsPacketLoss->setEnabled(ena);
+ qlPacketLoss->setEnabled(ena);
}
diff --git a/src/mumble/AudioConfigDialog.h b/src/mumble/AudioConfigDialog.h
index 7b4a113ac..2782bdadc 100644
--- a/src/mumble/AudioConfigDialog.h
+++ b/src/mumble/AudioConfigDialog.h
@@ -34,7 +34,7 @@
#include "ConfigDialog.h"
class AudioConfigDialog : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QComboBox *qcbInput, *qcbOutput;
QComboBox *qcbTransmit;
diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp
index 883a164c1..ad2aefb16 100644
--- a/src/mumble/AudioInput.cpp
+++ b/src/mumble/AudioInput.cpp
@@ -85,8 +85,7 @@ AudioInputPtr AudioInputRegistrar::newFromChoice(QString choice) {
}
-AudioInput::AudioInput()
-{
+AudioInput::AudioInput() {
speex_bits_init(&sbBits);
speex_bits_reset(&sbBits);
iFrames = 0;
@@ -128,8 +127,7 @@ AudioInput::AudioInput()
bRunning = false;
}
-AudioInput::~AudioInput()
-{
+AudioInput::~AudioInput() {
bRunning = false;
wait();
speex_bits_destroy(&sbBits);
@@ -194,12 +192,12 @@ void AudioInput::encodeAudioFrame() {
static double framhist[10];
- for(int i=0;i<9;i++)
+ for (int i=0;i<9;i++)
framhist[i]=framhist[i+1];
- framhist[9]=1+(int) (310.0*rand()/(RAND_MAX+1.0));
+ framhist[9]=1+(int)(310.0*rand()/(RAND_MAX+1.0));
// Sine wave test
- for(i=0;i<iFrameSize;i++) {
+ for (i=0;i<iFrameSize;i++) {
psMic[i] += (sin((framhist[0] * M_PI * i) / (iFrameSize * 1.0)) * 4096.0);
psSpeaker[i] = (sin((framhist[4] * M_PI * i) / (iFrameSize * 1.0)) * 8192.0);
// psSpeaker[i] = psMic[i] * 2;
@@ -209,7 +207,7 @@ void AudioInput::encodeAudioFrame() {
max=1;
- for(i=0;i<iFrameSize;i++)
+ for (i=0;i<iFrameSize;i++)
if (abs(psMic[i]) > max)
max=abs(psMic[i]);
dPeakMic=20.0*log10((max * 1.0L) / 32768.0L);
@@ -217,7 +215,7 @@ void AudioInput::encodeAudioFrame() {
if (bHasSpeaker) {
max=1;
- for(i=0;i<iFrameSize;i++)
+ for (i=0;i<iFrameSize;i++)
if (abs(psSpeaker[i]) > max)
max=abs(psSpeaker[i]);
dPeakSpeaker=20.0*log10((max * 1.0L) / 32768.0L);
@@ -281,7 +279,7 @@ void AudioInput::encodeAudioFrame() {
}
max=1;
- for(i=0;i<iFrameSize;i++)
+ for (i=0;i<iFrameSize;i++)
if (abs(psSource[i]) > max)
max=abs(psSource[i]);
dPeakSignal=20.0*log10((max * 1.0L) / 32768.0L);
@@ -336,12 +334,12 @@ void AudioInput::encodeAudioFrame() {
p->setTalking(iIsSpeech, g.bAltSpeak);
if (g.s.bPushClick && (g.s.atTransmit == Settings::PushToTalk)) {
- AudioOutputPtr ao = g.ao;
+ AudioOutputPtr ao = g.ao;
if (iIsSpeech && ! bPreviousVoice && ao)
- ao->playSine(400,1200,5);
- else if (ao && !iIsSpeech && bPreviousVoice && ao)
- ao->playSine(620,-1200,5);
- }
+ ao->playSine(400,1200,5);
+ else if (ao && !iIsSpeech && bPreviousVoice && ao)
+ ao->playSine(620,-1200,5);
+ }
if (! iIsSpeech && ! bPreviousVoice) {
iBitrate = 0;
return;
@@ -366,7 +364,7 @@ void AudioInput::encodeAudioFrame() {
speex_bits_pack(&sbBits, q.size(), 4);
const unsigned char *d=reinterpret_cast<const unsigned char*>(q.data());
- for(i=0;i<q.size();i++) {
+ for (i=0;i<q.size();i++) {
speex_bits_pack(&sbBits, d[i], 8);
}
}
@@ -381,8 +379,8 @@ void AudioInput::encodeAudioFrame() {
}
void AudioInput::flushCheck() {
- if (bPreviousVoice && iFrames < g.s.iFramesPerPacket)
- return;
+ if (bPreviousVoice && iFrames < g.s.iFramesPerPacket)
+ return;
unsigned char flags = 0;
if (g.bAltSpeak)
@@ -406,7 +404,7 @@ void AudioInput::flushCheck() {
msPacket.iSeq = iFrameCounter;
if (g.lmLoopMode == Global::Local) {
- LoopPlayer::lpLoopy.addFrame(qba, msPacket.iSeq);
+ LoopPlayer::lpLoopy.addFrame(qba, msPacket.iSeq);
} else if (g.sh) {
g.sh->sendMessage(&msPacket);
}
diff --git a/src/mumble/AudioInput.h b/src/mumble/AudioInput.h
index 84498e885..de33b5ba2 100644
--- a/src/mumble/AudioInput.h
+++ b/src/mumble/AudioInput.h
@@ -52,11 +52,11 @@ class AudioInputRegistrar {
};
class AudioInput : public QThread {
- friend class AudioNoiseWidget;
- friend class AudioEchoWidget;
- friend class AudioStats;
- friend class FMODSystem;
- Q_OBJECT
+ friend class AudioNoiseWidget;
+ friend class AudioEchoWidget;
+ friend class AudioStats;
+ friend class FMODSystem;
+ Q_OBJECT
protected:
int iFrameSize;
int iByteSize;
@@ -91,7 +91,9 @@ class AudioInput : public QThread {
double dPeakMic, dPeakSpeaker, dPeakSignal;
double dSNR;
- bool isTransmitting() { return bPreviousVoice; };
+ bool isTransmitting() {
+ return bPreviousVoice;
+ };
int getMaxBandwidth();
diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp
index e8df67cd8..41be678c1 100644
--- a/src/mumble/AudioOutput.cpp
+++ b/src/mumble/AudioOutput.cpp
@@ -87,9 +87,9 @@ AudioOutputPtr AudioOutputRegistrar::newFromChoice(QString choice) {
}
AudioOutputPlayer::AudioOutputPlayer(const QString name) : qsName(name) {
- iFrameSize = 0;
- psBuffer = NULL;
- fPos[0]=fPos[1]=fPos[2]=0.0;
+ iFrameSize = 0;
+ psBuffer = NULL;
+ fPos[0]=fPos[1]=fPos[2]=0.0;
}
AudioOutputSpeech::AudioOutputSpeech(Player *player) : AudioOutputPlayer(player->qsName) {
@@ -114,7 +114,7 @@ AudioOutputSpeech::AudioOutputSpeech(Player *player) : AudioOutputPlayer(player-
psBuffer = new short[iFrameSize];
bSpeech = false;
- for(unsigned int i=0;i<iFrameSize;i++)
+ for (unsigned int i=0;i<iFrameSize;i++)
psBuffer[i]=0;
iMissCount = 0;
iMissedFrames = 0;
@@ -135,22 +135,22 @@ AudioOutputSpeech::~AudioOutputSpeech() {
}
int AudioOutputSpeech::speexCallback(SpeexBits *bits, void *, void *data) {
- AudioOutputSpeech *aos=reinterpret_cast<AudioOutputSpeech *>(data);
+ AudioOutputSpeech *aos=reinterpret_cast<AudioOutputSpeech *>(data);
- int len=speex_bits_unpack_unsigned(bits, 4);
+ int len=speex_bits_unpack_unsigned(bits, 4);
- QByteArray qba(len, 0);
- unsigned char *ptr = reinterpret_cast<unsigned char *>(qba.data());
+ QByteArray qba(len, 0);
+ unsigned char *ptr = reinterpret_cast<unsigned char *>(qba.data());
- for(int i=0;i<len;i++)
- ptr[i]=speex_bits_unpack_unsigned(bits, 8);
- QDataStream ds(qba);
- ds >> aos->fPos[0];
- ds >> aos->fPos[1];
- ds >> aos->fPos[2];
- aos->iMissCount = 0;
+ for (int i=0;i<len;i++)
+ ptr[i]=speex_bits_unpack_unsigned(bits, 8);
+ QDataStream ds(qba);
+ ds >> aos->fPos[0];
+ ds >> aos->fPos[1];
+ ds >> aos->fPos[2];
+ aos->iMissCount = 0;
- return 0;
+ return 0;
}
void AudioOutputSpeech::addFrameToBuffer(const QByteArray &qbaPacket, int iSeq) {
@@ -174,12 +174,12 @@ void AudioOutputSpeech::addFrameToBuffer(const QByteArray &qbaPacket, int iSeq)
bool AudioOutputSpeech::decodeNextFrame() {
bool alive = true;
- if(p == &LoopPlayer::lpLoopy)
+ if (p == &LoopPlayer::lpLoopy)
LoopPlayer::lpLoopy.fetchFrames();
if (speex_decode_int(dsDecState, &sbBits, psBuffer) == 0) {
- jitter_buffer_tick(jbJitter);
- } else {
+ jitter_buffer_tick(jbJitter);
+ } else {
QMutexLocker lock(&qmJitter);
char data[4096];
@@ -187,32 +187,32 @@ bool AudioOutputSpeech::decodeNextFrame() {
jbp.data = data;
if (jitter_buffer_get(jbJitter, &jbp, NULL) == JITTER_BUFFER_OK) {
- ucFlags = jbp.data[0];
- fPos[0] = fPos[1] = fPos[2] = 0.0;
- speex_bits_read_from(&sbBits, jbp.data + 1, jbp.len - 1);
- speex_decode_int(dsDecState, &sbBits, psBuffer);
+ ucFlags = jbp.data[0];
+ fPos[0] = fPos[1] = fPos[2] = 0.0;
+ speex_bits_read_from(&sbBits, jbp.data + 1, jbp.len - 1);
+ speex_decode_int(dsDecState, &sbBits, psBuffer);
} else {
- if (ucFlags & MessageSpeex::EndSpeech) {
- memset(psBuffer, 0, iFrameSize*2);
- alive = false;
- } else {
- iMissCount++;
- if (iMissCount < 5) {
- speex_decode_int(dsDecState, NULL, psBuffer);
- } else {
+ if (ucFlags & MessageSpeex::EndSpeech) {
memset(psBuffer, 0, iFrameSize*2);
alive = false;
- }
- }
+ } else {
+ iMissCount++;
+ if (iMissCount < 5) {
+ speex_decode_int(dsDecState, NULL, psBuffer);
+ } else {
+ memset(psBuffer, 0, iFrameSize*2);
+ alive = false;
+ }
+ }
}
int activity;
- speex_decoder_ctl(dsDecState, SPEEX_GET_ACTIVITY, &activity);
- if (activity < 30)
- jitter_buffer_update_delay(jbJitter, &jbp, NULL);
+ speex_decoder_ctl(dsDecState, SPEEX_GET_ACTIVITY, &activity);
+ if (activity < 30)
+ jitter_buffer_update_delay(jbJitter, &jbp, NULL);
- jitter_buffer_tick(jbJitter);
- }
+ jitter_buffer_tick(jbJitter);
+ }
if (p)
p->setTalking(alive, ((ucFlags & MessageSpeex::AltSpeak) ? true : false));
@@ -236,16 +236,16 @@ void AudioOutput::newPlayer(AudioOutputPlayer *) {
}
void AudioOutput::wipe() {
- foreach(const Player *p, qmOutputs.keys())
- removeBuffer(p);
+ foreach(const Player *p, qmOutputs.keys())
+ removeBuffer(p);
}
void AudioOutput::playSine(float hz, float i, unsigned int frames) {
- qrwlOutputs.lockForWrite();
- AudioSine *as = new AudioSine(hz,i,frames);
- qmOutputs.insert(NULL, as);
- newPlayer(as);
- qrwlOutputs.unlock();
+ qrwlOutputs.lockForWrite();
+ AudioSine *as = new AudioSine(hz,i,frames);
+ qmOutputs.insert(NULL, as);
+ newPlayer(as);
+ qrwlOutputs.unlock();
}
void AudioOutput::addFrameToBuffer(Player *player, const QByteArray &qbaPacket, int iSeq) {
@@ -265,19 +265,19 @@ void AudioOutput::addFrameToBuffer(Player *player, const QByteArray &qbaPacket,
}
void AudioOutput::removeBuffer(const Player *player) {
- removeBuffer(qmOutputs.value(player));
+ removeBuffer(qmOutputs.value(player));
}
void AudioOutput::removeBuffer(AudioOutputPlayer *aop) {
QWriteLocker locker(&qrwlOutputs);
QMultiHash<const Player *, AudioOutputPlayer *>::iterator i=qmOutputs.begin();
- while(i != qmOutputs.end()) {
- if (i.value() == aop) {
- qmOutputs.erase(i);
- delete aop;
- break;
- }
- ++i;
+ while (i != qmOutputs.end()) {
+ if (i.value() == aop) {
+ qmOutputs.erase(i);
+ delete aop;
+ break;
+ }
+ ++i;
}
}
@@ -300,27 +300,27 @@ bool AudioOutput::mixAudio(short *buffer) {
__m64 *out=reinterpret_cast<__m64 *>(buffer);
__m64 zero=_mm_cvtsi32_si64(0);
- for(int i=0;i<iFrameSize/4;i++)
+ for (int i=0;i<iFrameSize/4;i++)
out[i]=zero;
foreach(aop, qlMix) {
__m64 *in=reinterpret_cast<__m64 *>(aop->psBuffer);
- for(int i=0;i<iFrameSize/4;i++)
+ for (int i=0;i<iFrameSize/4;i++)
out[i]=_mm_adds_pi16(in[i],out[i]);
}
_mm_empty();
#else
int t[iFrameSize];
- for(int i=0;i<iFrameSize;i++)
+ for (int i=0;i<iFrameSize;i++)
t[i]=0;
foreach(aop, qlMix)
- for(int i=0;i<iFrameSize;i++)
- t[i] += aop->psBuffer[i];
+ for (int i=0;i<iFrameSize;i++)
+ t[i] += aop->psBuffer[i];
- for(int i=0;i<iFrameSize;i++)
+ for (int i=0;i<iFrameSize;i++)
buffer[i]=qMax(-32727,qMin(32767,t[i]));
#endif
@@ -328,39 +328,39 @@ bool AudioOutput::mixAudio(short *buffer) {
foreach(aop, qlDel)
- removeBuffer(aop);
+ removeBuffer(aop);
return (! qlMix.isEmpty());
}
AudioSine::AudioSine(float hz, float i, unsigned int frm) : AudioOutputPlayer(QLatin1String("Sine")) {
- v = 0.0;
- inc = M_PI * hz / 8000.0;
- dinc = M_PI * i / (8000.0 * 8000.0);
- frames = frm;
- iFrameSize = 320;
- psBuffer = new short[iFrameSize];
+ v = 0.0;
+ inc = M_PI * hz / 8000.0;
+ dinc = M_PI * i / (8000.0 * 8000.0);
+ frames = frm;
+ iFrameSize = 320;
+ psBuffer = new short[iFrameSize];
}
AudioSine::~AudioSine() {
- delete [] psBuffer;
+ delete [] psBuffer;
}
bool AudioSine::decodeNextFrame() {
- if (frames > 0) {
- frames--;
-
- float t = v;
- v += iFrameSize * inc + 0.5 * dinc * iFrameSize * iFrameSize;
-
- for(unsigned int i=0;i<iFrameSize;i++) {
- psBuffer[i]=static_cast<short>(sin(t) * 10000.0);
- inc+=dinc;
- t+=inc;
- }
- return true;
- } else {
- memset(psBuffer, 0, iFrameSize*2);
- return false;
+ if (frames > 0) {
+ frames--;
+
+ float t = v;
+ v += iFrameSize * inc + 0.5 * dinc * iFrameSize * iFrameSize;
+
+ for (unsigned int i=0;i<iFrameSize;i++) {
+ psBuffer[i]=static_cast<short>(sin(t) * 10000.0);
+ inc+=dinc;
+ t+=inc;
+ }
+ return true;
+ } else {
+ memset(psBuffer, 0, iFrameSize*2);
+ return false;
}
}
diff --git a/src/mumble/AudioOutput.h b/src/mumble/AudioOutput.h
index 61d76bcb3..61447a0aa 100644
--- a/src/mumble/AudioOutput.h
+++ b/src/mumble/AudioOutput.h
@@ -60,20 +60,20 @@ class AudioOutputRegistrar {
};
class AudioOutputPlayer : public QObject {
- friend class AudioOutput;
- Q_OBJECT
- public:
- AudioOutputPlayer(const QString name);
- const QString qsName;
- unsigned int iFrameSize;
- short *psBuffer;
- float fPos[3];
- virtual bool decodeNextFrame() = 0;
+ friend class AudioOutput;
+ Q_OBJECT
+ public:
+ AudioOutputPlayer(const QString name);
+ const QString qsName;
+ unsigned int iFrameSize;
+ short *psBuffer;
+ float fPos[3];
+ virtual bool decodeNextFrame() = 0;
};
class AudioOutputSpeech : public AudioOutputPlayer {
- friend class AudioOutput;
- Q_OBJECT
+ friend class AudioOutput;
+ Q_OBJECT
protected:
SpeexBits sbBits;
@@ -102,20 +102,20 @@ class AudioOutputSpeech : public AudioOutputPlayer {
class AudioSine : public AudioOutputPlayer {
- Q_OBJECT
- protected:
- float v;
- float inc;
- float dinc;
- unsigned int frames;
- public:
- bool decodeNextFrame();
- AudioSine(float hz, float i, unsigned int frm);
- ~AudioSine();
+ Q_OBJECT
+ protected:
+ float v;
+ float inc;
+ float dinc;
+ unsigned int frames;
+ public:
+ bool decodeNextFrame();
+ AudioSine(float hz, float i, unsigned int frm);
+ ~AudioSine();
};
class AudioOutput : public QThread {
- Q_OBJECT
+ Q_OBJECT
protected:
bool bRunning;
int iFrameSize;
diff --git a/src/mumble/AudioStats.cpp b/src/mumble/AudioStats.cpp
index 855a53b23..8bf0d3ce8 100644
--- a/src/mumble/AudioStats.cpp
+++ b/src/mumble/AudioStats.cpp
@@ -38,21 +38,21 @@ AudioEchoWidget::AudioEchoWidget(QWidget *p) : QGLWidget(p) {
}
void AudioEchoWidget::initializeGL() {
- glDisable(GL_LIGHTING);
+ glDisable(GL_LIGHTING);
glClearColor(0,0,0,0);
- glShadeModel(GL_SMOOTH);
+ glShadeModel(GL_SMOOTH);
- glEnable(GL_COLOR_MATERIAL);
- glDisable(GL_CULL_FACE);
+ glEnable(GL_COLOR_MATERIAL);
+ glDisable(GL_CULL_FACE);
}
void AudioEchoWidget::resizeGL(int w, int h) {
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
@@ -92,18 +92,18 @@ void AudioEchoWidget::paintGL() {
CloneSpeexEchoState *st = reinterpret_cast<CloneSpeexEchoState *>(ai->sesEcho);
- int N = st->window_size;
- int n = N / 2;
- int M = st->M;
+ int N = st->window_size;
+ int n = N / 2;
+ int M = st->M;
- double xscale = 1.0 / n;
- double yscale = 1.0 / M;
+ double xscale = 1.0 / n;
+ double yscale = 1.0 / M;
- glBegin(GL_QUADS);
+ glBegin(GL_QUADS);
- for(int j = 0; j < M; j++) {
- for(int i=0;i < n; i++) {
+ for (int j = 0; j < M; j++) {
+ for (int i=0;i < n; i++) {
double xa = i * xscale;
double ya = j * yscale;
@@ -178,7 +178,7 @@ void AudioNoiseWidget::paintEvent(QPaintEvent *) {
#else
float fftmul = 1.0 / (32768.0);
#endif
- for(int i=0; i < st->ps_size; i++) {
+ for (int i=0; i < st->ps_size; i++) {
qreal xp, yp;
xp = i * sx;
yp = sqrt(st->noise[i]) - 1;
@@ -197,7 +197,7 @@ void AudioNoiseWidget::paintEvent(QPaintEvent *) {
poly.clear();
- for(int i=0;i < st->ps_size; i++) {
+ for (int i=0;i < st->ps_size; i++) {
qreal xp, yp;
xp = i * sx;
yp = sqrt(st->ps[i]) - 1;
@@ -216,9 +216,9 @@ AudioStats::AudioStats(QWidget *p) : QDialog(p) {
setWindowTitle(tr("Mumble"));
- QLabel *lab;
+ QLabel *lab;
QGridLayout *l=new QGridLayout;
- setLayout(l);
+ setLayout(l);
lab = new QLabel(tr("Peak microphone level"), this);
l->addWidget(lab, 0, 0);
@@ -302,77 +302,77 @@ AudioStats::AudioStats(QWidget *p) : QDialog(p) {
qlMicLevel->setToolTip(tr("Peak power in last frame"));
qlMicLevel->setWhatsThis(tr("This shows the peak power in the last frame (20 ms), and is the same measurement "
- "as you would usually find displayed as \"input power\". Please disregard this and "
- "look at <b>Loudness</b> instead, which is much more steady and disregards outliers."
- ));
+ "as you would usually find displayed as \"input power\". Please disregard this and "
+ "look at <b>Loudness</b> instead, which is much more steady and disregards outliers."
+ ));
qlSpeakerLevel->setToolTip(tr("Peak power in last frame"));
qlSpeakerLevel->setWhatsThis(tr("This shows the peak power in the last frame (20 ms) of the speakers. Unless you "
- "are using a multi-channel sampling method (such as ASIO) with speaker channels "
- "configured, this will be 0. If you have such a setup configured, and this still "
- "shows 0 while you're playing audio from other programs, your setup is not working."));
+ "are using a multi-channel sampling method (such as ASIO) with speaker channels "
+ "configured, this will be 0. If you have such a setup configured, and this still "
+ "shows 0 while you're playing audio from other programs, your setup is not working."));
qlSpeakerLevel->setToolTip(tr("Peak power in last frame"));
qlSpeakerLevel->setWhatsThis(tr("This shows the peak power in the last frame (20 ms) after all processing. Ideally, "
- "this should be -96 dB when you're not talking. In reality, a sound studio should see "
- "-60 dB, and you should hopefully see somewhere around -20 dB. When you are talking, this "
- "should rise to somewhere between -5 and -10 dB.<br />"
- "If you are using echo cancellation, and this rises to more than -15 dB when you're not "
- "talking, your setup is not working, and you'll annoy other players with echoes."));
+ "this should be -96 dB when you're not talking. In reality, a sound studio should see "
+ "-60 dB, and you should hopefully see somewhere around -20 dB. When you are talking, this "
+ "should rise to somewhere between -5 and -10 dB.<br />"
+ "If you are using echo cancellation, and this rises to more than -15 dB when you're not "
+ "talking, your setup is not working, and you'll annoy other players with echoes."));
qlMicVolume->setToolTip(tr("How close the current input level is to ideal"));
qlMicVolume->setWhatsThis(tr("This shows how close your current input volume is to the ideal. To adjust your "
- "microphone level, open whatever program you use to adjust the recording volume, "
- "and look at the value here while talking.<br />"
- "<b>Talk loud, as you would when you're upset over getting fragged by a noob.</b><br />"
- "Adjust the volume until this value is close to 100%, but make sure it doesn't go above. "
- "If it does go above, you are likely to get clipping in parts of your speech, which will "
- "degrade sound quality"));
+ "microphone level, open whatever program you use to adjust the recording volume, "
+ "and look at the value here while talking.<br />"
+ "<b>Talk loud, as you would when you're upset over getting fragged by a noob.</b><br />"
+ "Adjust the volume until this value is close to 100%, but make sure it doesn't go above. "
+ "If it does go above, you are likely to get clipping in parts of your speech, which will "
+ "degrade sound quality"));
qlMicSNR->setToolTip(tr("Signal-To-Noise ratio from the microphone"));
qlMicSNR->setWhatsThis(tr("This is the Signal-To-Noise Ratio (SNR) of the microphone in the last frame (20 ms). "
- "It shows how much clearer "
- "the voice is compared to the noise.<br />If this value is below 1.0, there's more noise "
- "than voice in the signal, and so quality is reduced.<br />There is no upper limit to this "
- "value, but don't expect to see much above 40-50 without a sound studio."));
+ "It shows how much clearer "
+ "the voice is compared to the noise.<br />If this value is below 1.0, there's more noise "
+ "than voice in the signal, and so quality is reduced.<br />There is no upper limit to this "
+ "value, but don't expect to see much above 40-50 without a sound studio."));
qlSpeechProb->setToolTip(tr("Probability of speech"));
qlSpeechProb->setWhatsThis(tr("This is the probability that the last frame (20 ms) was speech and not environment noise.<br />"
- "Voice activity transmission depends on this being right. The trick with this is that the middle "
- "of a sentence is always detected as speech; the problem is the pauses between words and the "
- "start of speech. It's hard to distinguish a sigh from a word starting with 'h'.<br />"
- "If this is in bold font, it means Mumble is currently transmitting (if you're connected)."));
+ "Voice activity transmission depends on this being right. The trick with this is that the middle "
+ "of a sentence is always detected as speech; the problem is the pauses between words and the "
+ "start of speech. It's hard to distinguish a sigh from a word starting with 'h'.<br />"
+ "If this is in bold font, it means Mumble is currently transmitting (if you're connected)."));
qlBitrate->setToolTip(tr("Bitrate of last frame"));
qlBitrate->setWhatsThis(tr("This is the audio bitrate of the last compressed frame (20 ms), and as such will jump up and down "
- "as the VBR adjusts the quality. To adjust the peak bitrate, adjust <b>Compression Complexity</b> "
- "in the Settings dialog."));
+ "as the VBR adjusts the quality. To adjust the peak bitrate, adjust <b>Compression Complexity</b> "
+ "in the Settings dialog."));
anwNoise->setToolTip(tr("Power spectrum of input signal and noise estimate"));
anwNoise->setWhatsThis(tr("This shows the power spectrum of the current input signal (red line) and the current noise estimate "
- "(filled blue).<br />"
- "All amplitudes are multiplied by 30 to show the interesting parts (how much more signal than noise "
- "is present in each waveband).<br />"
- "This is probably only of interest if you're trying to fine-tune noise conditions on your microphone. "
- "Under good conditions, there should be just a tiny flutter of blue at the bottom. If the blue is more than "
- "halfway up on the graph, you have a seriously noisy environment."));
+ "(filled blue).<br />"
+ "All amplitudes are multiplied by 30 to show the interesting parts (how much more signal than noise "
+ "is present in each waveband).<br />"
+ "This is probably only of interest if you're trying to fine-tune noise conditions on your microphone. "
+ "Under good conditions, there should be just a tiny flutter of blue at the bottom. If the blue is more than "
+ "halfway up on the graph, you have a seriously noisy environment."));
if (aewEcho) {
aewEcho->setToolTip(tr("Weights of the echo canceller"));
aewEcho->setWhatsThis(tr("This shows the weights of the echo canceller, with time increasing downwards and frequency increasing to the right.<br />"
- "Ideally, this should be black, indicating no echo exists at all. More commonly, you'll have one or more horizontal stripes "
- "of bluish color representing time delayed echo. You should be able to see the weights updated in real time.<br />"
- "Please note that as long as you have nothing to echo off, you won't see much useful data here. Play some music and "
- "things should stabilize. <br />"
- "You can choose to view the real or imaginary parts of the frequency-domain weights, or alternately the computed modulus and "
- "phase. The most useful of these will likely be modulus, which is the amplitude of the echo, and shows you how much of the "
- "outgoing signal is being removed at that time step. The other viewing modes are mostly useful to people who want to tune the "
- "echo cancellation algorithms.<br />"
- "Please note: If the entire image fluctuates massively while in modulus mode, "
- "the echo canceller fails to find any correlation whatsoever between the two input "
- "sources (speakers and microphone). Either you have a very long delay on the echo, or one of the input sources is configured wrong."
- ));
+ "Ideally, this should be black, indicating no echo exists at all. More commonly, you'll have one or more horizontal stripes "
+ "of bluish color representing time delayed echo. You should be able to see the weights updated in real time.<br />"
+ "Please note that as long as you have nothing to echo off, you won't see much useful data here. Play some music and "
+ "things should stabilize. <br />"
+ "You can choose to view the real or imaginary parts of the frequency-domain weights, or alternately the computed modulus and "
+ "phase. The most useful of these will likely be modulus, which is the amplitude of the echo, and shows you how much of the "
+ "outgoing signal is being removed at that time step. The other viewing modes are mostly useful to people who want to tune the "
+ "echo cancellation algorithms.<br />"
+ "Please note: If the entire image fluctuates massively while in modulus mode, "
+ "the echo canceller fails to find any correlation whatsoever between the two input "
+ "sources (speakers and microphone). Either you have a very long delay on the echo, or one of the input sources is configured wrong."
+ ));
}
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
bTalking = false;
- on_Tick_timeout();
+ on_Tick_timeout();
}
void AudioStats::on_Tick_timeout() {
diff --git a/src/mumble/AudioStats.h b/src/mumble/AudioStats.h
index 1da5bceba..c4aeb77f4 100644
--- a/src/mumble/AudioStats.h
+++ b/src/mumble/AudioStats.h
@@ -32,7 +32,7 @@
#define _AUDIOSTATS_H
class AudioEchoWidget : public QGLWidget {
- Q_OBJECT
+ Q_OBJECT
public:
enum Mode { REAL, IMAGINARY, MODULUS, PHASE };
Mode mode;
@@ -44,15 +44,15 @@ class AudioEchoWidget : public QGLWidget {
};
class AudioNoiseWidget : public QWidget {
- Q_OBJECT
+ Q_OBJECT
public:
AudioNoiseWidget(QWidget *parent);
protected slots:
- void paintEvent (QPaintEvent *event);
+ void paintEvent(QPaintEvent *event);
};
class AudioStats : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QLabel *qlMicLevel, *qlSpeakerLevel, *qlSignalLevel, *qlMicVolume, *qlMicSNR, *qlSpeechProb, *qlBitrate;
QMap<QObject *, AudioEchoWidget::Mode> qmEchoMode;
diff --git a/src/mumble/AudioWizard.cpp b/src/mumble/AudioWizard.cpp
index 9b001483b..a2597b3f8 100644
--- a/src/mumble/AudioWizard.cpp
+++ b/src/mumble/AudioWizard.cpp
@@ -35,99 +35,99 @@
#include "Settings.h"
AudioBar::AudioBar(QWidget *p) : QWidget(p) {
- qcBelow = Qt::yellow;
- qcAbove = Qt::red;
- qcInside = Qt::green;
- iMin = 0;
- iMax = 32768;
- iBelow = 2000;
- iAbove = 22000;
- iValue = 1000;
- setMinimumSize(100,20);
+ qcBelow = Qt::yellow;
+ qcAbove = Qt::red;
+ qcInside = Qt::green;
+ iMin = 0;
+ iMax = 32768;
+ iBelow = 2000;
+ iAbove = 22000;
+ iValue = 1000;
+ setMinimumSize(100,20);
}
void AudioBar::paintEvent(QPaintEvent *) {
- QPainter p(this);
+ QPainter p(this);
- if (iBelow > iAbove)
- iBelow = iAbove;
+ if (iBelow > iAbove)
+ iBelow = iAbove;
- if (iValue < iMin)
- iValue = iMin;
- else if (iValue > iMax)
- iValue = iMax;
+ if (iValue < iMin)
+ iValue = iMin;
+ else if (iValue > iMax)
+ iValue = iMax;
// p.fillRect(QRect(0,0, 10, 10), Qt::blue);
- double scale = (width() * 1.0) / (iMax - iMin);
- int h = height();
-
- p.scale(scale, h);
-
- p.fillRect(QRect(0,0, 10, 10), Qt::blue);
-
- if (iValue <= iBelow) {
- p.fillRect(0, 0, iValue-1, 1, qcBelow);
- p.fillRect(iValue, 0, iBelow-iValue, 1, qcBelow.darker(300));
- p.fillRect(iBelow, 0, iAbove-iBelow, 1, qcInside.darker(300));
- p.fillRect(iAbove, 0, iMax-iAbove, 1, qcAbove.darker(300));
- } else if (iValue <= iAbove) {
- p.fillRect(0, 0, iBelow, 1, qcBelow);
- p.fillRect(iBelow, 0, iValue-iBelow, 1, qcInside);
- p.fillRect(iValue, 0, iAbove-iValue, 1, qcInside.darker(300));
- p.fillRect(iAbove, 0, iMax-iAbove, 1, qcAbove.darker(300));
- } else {
- p.fillRect(0, 0, iBelow, 1, qcBelow);
- p.fillRect(iBelow, 0, iAbove-iBelow, 1, qcInside);
- p.fillRect(iAbove, 0, iValue-iAbove, 1, qcAbove);
- p.fillRect(iValue, 0, iMax-iValue, 1, qcAbove.darker(300));
- }
-
- if ((iPeak >= iMin) && (iPeak <= iMax)) {
- if (iPeak <= iBelow)
- p.setPen(qcBelow.lighter(150));
- else if (iPeak <= iAbove)
- p.setPen(qcInside.lighter(150));
- else
- p.setPen(qcAbove.lighter(150));
- p.drawLine(iPeak, 0, iPeak, 1);
- }
+ double scale = (width() * 1.0) / (iMax - iMin);
+ int h = height();
+
+ p.scale(scale, h);
+
+ p.fillRect(QRect(0,0, 10, 10), Qt::blue);
+
+ if (iValue <= iBelow) {
+ p.fillRect(0, 0, iValue-1, 1, qcBelow);
+ p.fillRect(iValue, 0, iBelow-iValue, 1, qcBelow.darker(300));
+ p.fillRect(iBelow, 0, iAbove-iBelow, 1, qcInside.darker(300));
+ p.fillRect(iAbove, 0, iMax-iAbove, 1, qcAbove.darker(300));
+ } else if (iValue <= iAbove) {
+ p.fillRect(0, 0, iBelow, 1, qcBelow);
+ p.fillRect(iBelow, 0, iValue-iBelow, 1, qcInside);
+ p.fillRect(iValue, 0, iAbove-iValue, 1, qcInside.darker(300));
+ p.fillRect(iAbove, 0, iMax-iAbove, 1, qcAbove.darker(300));
+ } else {
+ p.fillRect(0, 0, iBelow, 1, qcBelow);
+ p.fillRect(iBelow, 0, iAbove-iBelow, 1, qcInside);
+ p.fillRect(iAbove, 0, iValue-iAbove, 1, qcAbove);
+ p.fillRect(iValue, 0, iMax-iValue, 1, qcAbove.darker(300));
+ }
+
+ if ((iPeak >= iMin) && (iPeak <= iMax)) {
+ if (iPeak <= iBelow)
+ p.setPen(qcBelow.lighter(150));
+ else if (iPeak <= iAbove)
+ p.setPen(qcInside.lighter(150));
+ else
+ p.setPen(qcAbove.lighter(150));
+ p.drawLine(iPeak, 0, iPeak, 1);
+ }
}
AudioWizard::AudioWizard() {
- bInit = true;
+ bInit = true;
- addPage(introPage());
- addPage(devicePage());
- addPage(deviceTuningPage());
- addPage(volumePage());
- addPage(triggerPage());
- addPage(donePage());
- setWindowTitle(tr("Audio Tuning Wizard"));
+ addPage(introPage());
+ addPage(devicePage());
+ addPage(deviceTuningPage());
+ addPage(volumePage());
+ addPage(triggerPage());
+ addPage(donePage());
+ setWindowTitle(tr("Audio Tuning Wizard"));
- sOldSettings = g.s;
+ sOldSettings = g.s;
- g.lmLoopMode = Global::Local;
- g.dPacketLoss = 0.0;
- g.dMaxPacketDelay = 0.0;
+ g.lmLoopMode = Global::Local;
+ g.dPacketLoss = 0.0;
+ g.dMaxPacketDelay = 0.0;
- g.s.atTransmit = Settings::Continous;
+ g.s.atTransmit = Settings::Continous;
- iMaxPeak = 0;
- iTicks = 0;
+ iMaxPeak = 0;
+ iTicks = 0;
- ticker = new QTimer(this);
- ticker->setObjectName(QLatin1String("Ticker"));
+ ticker = new QTimer(this);
+ ticker->setObjectName(QLatin1String("Ticker"));
- setObjectName(QLatin1String("Wizard"));
- connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(showPage(int)));
+ setObjectName(QLatin1String("Wizard"));
+ connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(showPage(int)));
- QMetaObject::connectSlotsByName(this);
- bInit = false;
- resize(700, 500);
- ticker->setSingleShot(false);
- ticker->start(20);
+ QMetaObject::connectSlotsByName(this);
+ bInit = false;
+ resize(700, 500);
+ ticker->setSingleShot(false);
+ ticker->start(20);
}
QWizardPage *AudioWizard::introPage() {
@@ -136,12 +136,12 @@ QWizardPage *AudioWizard::introPage() {
qwpage->setSubTitle(tr("Welcome to the Mumble Audio Wizard"));
QVBoxLayout *v=new QVBoxLayout;
QLabel *label=new QLabel(tr("This is the audio tuning wizard for Mumble. This will help you correctly set the input levels of your sound card, and also set the correct "
- "parameters for sound processing in Mumble."));
+ "parameters for sound processing in Mumble."));
label->setWordWrap(true);
v->addWidget(label);
label=new QLabel(tr("Please be aware that as long as this wizard is active, audio will be looped locally to allow you to listen to it, and no audio will be sent to the "
- "server."));
+ "server."));
label->setWordWrap(true);
v->addWidget(label);
@@ -180,12 +180,12 @@ QWizardPage *AudioWizard::devicePage() {
qcbInput = new QComboBox();
foreach(AudioInputRegistrar *air, *AudioInputRegistrar::qmNew) {
- qcbInput->addItem(air->name);
- if (air->name == AudioInputRegistrar::current)
- qcbInput->setCurrentIndex(qcbInput->count() - 1);
- QList<audioDevice> ql= air->getDeviceChoices();
- if (ql.count() > 0)
- qhOldInputDevice.insert(air->name, ql.at(0).second);
+ qcbInput->addItem(air->name);
+ if (air->name == AudioInputRegistrar::current)
+ qcbInput->setCurrentIndex(qcbInput->count() - 1);
+ QList<audioDevice> ql= air->getDeviceChoices();
+ if (ql.count() > 0)
+ qhOldInputDevice.insert(air->name, ql.at(0).second);
}
l = new QLabel(tr("System"));
@@ -196,7 +196,7 @@ QWizardPage *AudioWizard::devicePage() {
qcbInput->setObjectName(QLatin1String("Input"));
if (qcbInput->count() < 2) {
- qcbInput->setEnabled(false);
+ qcbInput->setEnabled(false);
}
grid->addWidget(l, 1, 0);
@@ -227,12 +227,12 @@ QWizardPage *AudioWizard::devicePage() {
qcbOutput = new QComboBox();
foreach(AudioOutputRegistrar *aor, *AudioOutputRegistrar::qmNew) {
- qcbOutput->addItem(aor->name);
- if (aor->name == AudioOutputRegistrar::current)
- qcbOutput->setCurrentIndex(qcbOutput->count() - 1);
- QList<audioDevice> ql= aor->getDeviceChoices();
- if (ql.count() > 0)
- qhOldOutputDevice.insert(aor->name, ql.at(0).second);
+ qcbOutput->addItem(aor->name);
+ if (aor->name == AudioOutputRegistrar::current)
+ qcbOutput->setCurrentIndex(qcbOutput->count() - 1);
+ QList<audioDevice> ql= aor->getDeviceChoices();
+ if (ql.count() > 0)
+ qhOldOutputDevice.insert(aor->name, ql.at(0).second);
}
l = new QLabel(tr("System"));
@@ -243,7 +243,7 @@ QWizardPage *AudioWizard::devicePage() {
qcbOutput->setObjectName(QLatin1String("Output"));
if (qcbOutput->count() < 2) {
- qcbOutput->setEnabled(false);
+ qcbOutput->setEnabled(false);
}
grid->addWidget(l, 1, 0);
@@ -272,209 +272,209 @@ QWizardPage *AudioWizard::devicePage() {
on_Input_activated(qcbInput->currentIndex());
on_Output_activated(qcbOutput->currentIndex());
- return qwpage;
+ return qwpage;
}
QWizardPage *AudioWizard::volumePage() {
- QWizardPage *qwpage = new QWizardPage;
- qwpage->setTitle(tr("Volume tuning"));
- qwpage->setSubTitle(tr("Tuning microphone hardware volume to optimal settings."));
-
- QVBoxLayout *v = new QVBoxLayout();
- QLabel *l;
-
- l = new QLabel(tr("Open your sound control panel and go to the recording settings. "
- "Make sure the microphone is selected as active input with maximum recording volume. If there's an option to enable a \"Microphone boost\" make sure it's checked."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- l = new QLabel(tr("Speak loudly, as when you are annoyed or excited. "
- "Decrease the volume in the sound control panel until the bar below stays as high as possible in the blue and green "
- "but <b>not</b> the red "
- "zone while you speak."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- abAmplify = new AudioBar();
- abAmplify->qcBelow = Qt::blue;
- v->addWidget(abAmplify);
-
- l = new QLabel(tr("Now talk softly, as you would when talking late at night and you don't want to disturb anyone. "
- "Adjust the slider below so that the bar moves into green when you talk, but stays blue while you're silent."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- qsMaxAmp = new QSlider(Qt::Horizontal);
- qsMaxAmp->setRange(1, 32767);
- qsMaxAmp->setSingleStep(100);
- qsMaxAmp->setPageStep(1000);
- qsMaxAmp->setValue(g.s.iMinLoudness);
- qsMaxAmp->setObjectName(QLatin1String("MaxAmp"));
-
- v->addWidget(qsMaxAmp);
-
- qwpage->setLayout(v);
-
- return qwpage;
+ QWizardPage *qwpage = new QWizardPage;
+ qwpage->setTitle(tr("Volume tuning"));
+ qwpage->setSubTitle(tr("Tuning microphone hardware volume to optimal settings."));
+
+ QVBoxLayout *v = new QVBoxLayout();
+ QLabel *l;
+
+ l = new QLabel(tr("Open your sound control panel and go to the recording settings. "
+ "Make sure the microphone is selected as active input with maximum recording volume. If there's an option to enable a \"Microphone boost\" make sure it's checked."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ l = new QLabel(tr("Speak loudly, as when you are annoyed or excited. "
+ "Decrease the volume in the sound control panel until the bar below stays as high as possible in the blue and green "
+ "but <b>not</b> the red "
+ "zone while you speak."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ abAmplify = new AudioBar();
+ abAmplify->qcBelow = Qt::blue;
+ v->addWidget(abAmplify);
+
+ l = new QLabel(tr("Now talk softly, as you would when talking late at night and you don't want to disturb anyone. "
+ "Adjust the slider below so that the bar moves into green when you talk, but stays blue while you're silent."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ qsMaxAmp = new QSlider(Qt::Horizontal);
+ qsMaxAmp->setRange(1, 32767);
+ qsMaxAmp->setSingleStep(100);
+ qsMaxAmp->setPageStep(1000);
+ qsMaxAmp->setValue(g.s.iMinLoudness);
+ qsMaxAmp->setObjectName(QLatin1String("MaxAmp"));
+
+ v->addWidget(qsMaxAmp);
+
+ qwpage->setLayout(v);
+
+ return qwpage;
}
QWizardPage *AudioWizard::triggerPage() {
- QWizardPage *qwpage = new QWizardPage;
- qwpage->setTitle(tr("Voice Activity Detection"));
- qwpage->setSubTitle(tr("Letting Mumble figure out when you're talking and when you're silent."));
-
- QVBoxLayout *v = new QVBoxLayout();
- QLabel *l;
-
- l = new QLabel(tr("This will help Mumble figure out when you are talking. The first step is selecting which data value to use."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- qrAmplitude = new QRadioButton(tr("Raw amplitude from input"));
- qrAmplitude->setObjectName(QLatin1String("Amplitude"));
- v->addWidget(qrAmplitude);
-
- qrSNR = new QRadioButton(tr("Signal-To-Noise ratio"));
- qrSNR->setObjectName(QLatin1String("SNR"));
- v->addWidget(qrSNR);
-
- switch(g.s.vsVAD) {
- case Settings::Amplitude:
- qrAmplitude->setChecked(true);
- break;
- case Settings::SignalToNoise:
- qrSNR->setChecked(true);
- break;
- }
-
- abVAD = new AudioBar();
- abVAD->qcBelow = Qt::red;
- abVAD->qcInside = Qt::yellow;
- abVAD->qcAbove = Qt::green;
-
- v->addWidget(abVAD);
-
- l = new QLabel(tr("Next you need to adjust the following two sliders. The first few utterances you say should end up in the "
- "green area (definitive speech). While talking, you should stay inside the yellow (might be speech) and when you're "
- "not talking, everything should be in the red (definitively not speech)."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- qsMinVAD = new QSlider(Qt::Horizontal);
- qsMinVAD->setRange(1, 32767);
- qsMinVAD->setSingleStep(100);
- qsMinVAD->setPageStep(1000);
- qsMinVAD->setValue(static_cast<int>(g.s.fVADmin * 32767.0));
- qsMinVAD->setObjectName(QLatin1String("VADmin"));
-
- v->addWidget(qsMinVAD);
-
- qsMaxVAD = new QSlider(Qt::Horizontal);
- qsMaxVAD->setRange(1, 32767);
- qsMaxVAD->setSingleStep(100);
- qsMaxVAD->setPageStep(1000);
- qsMaxVAD->setValue(static_cast<int>(g.s.fVADmax * 32767));
- qsMaxVAD->setObjectName(QLatin1String("VADmax"));
-
- v->addWidget(qsMaxVAD);
-
- l = new QLabel(tr("Last, you need to adjust the grace time. Mumble may detect this much non-speech and still keep transmitting before "
- "it breaks off. This allows you to catch your breath while speaking."));
- l->setWordWrap(true);
- v->addWidget(l);
-
- QHBoxLayout *h = new QHBoxLayout;
-
- qsHoldtime = new QSlider(Qt::Horizontal);
- qsHoldtime->setRange(20, 250);
- qsHoldtime->setSingleStep(5);
- qsHoldtime->setPageStep(25);
- qsHoldtime->setValue(g.s.iVoiceHold);
- qsHoldtime->setObjectName(QLatin1String("Holdtime"));
-
- qlHoldtime = new QLabel();
- qlHoldtime->setMinimumWidth(40);
- on_Holdtime_valueChanged(qsHoldtime->value());
-
- h->addWidget(qsHoldtime);
- h->addWidget(qlHoldtime);
-
- v->addLayout(h);
-
- qwpage->setLayout(v);
-
- return qwpage;
+ QWizardPage *qwpage = new QWizardPage;
+ qwpage->setTitle(tr("Voice Activity Detection"));
+ qwpage->setSubTitle(tr("Letting Mumble figure out when you're talking and when you're silent."));
+
+ QVBoxLayout *v = new QVBoxLayout();
+ QLabel *l;
+
+ l = new QLabel(tr("This will help Mumble figure out when you are talking. The first step is selecting which data value to use."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ qrAmplitude = new QRadioButton(tr("Raw amplitude from input"));
+ qrAmplitude->setObjectName(QLatin1String("Amplitude"));
+ v->addWidget(qrAmplitude);
+
+ qrSNR = new QRadioButton(tr("Signal-To-Noise ratio"));
+ qrSNR->setObjectName(QLatin1String("SNR"));
+ v->addWidget(qrSNR);
+
+ switch (g.s.vsVAD) {
+ case Settings::Amplitude:
+ qrAmplitude->setChecked(true);
+ break;
+ case Settings::SignalToNoise:
+ qrSNR->setChecked(true);
+ break;
+ }
+
+ abVAD = new AudioBar();
+ abVAD->qcBelow = Qt::red;
+ abVAD->qcInside = Qt::yellow;
+ abVAD->qcAbove = Qt::green;
+
+ v->addWidget(abVAD);
+
+ l = new QLabel(tr("Next you need to adjust the following two sliders. The first few utterances you say should end up in the "
+ "green area (definitive speech). While talking, you should stay inside the yellow (might be speech) and when you're "
+ "not talking, everything should be in the red (definitively not speech)."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ qsMinVAD = new QSlider(Qt::Horizontal);
+ qsMinVAD->setRange(1, 32767);
+ qsMinVAD->setSingleStep(100);
+ qsMinVAD->setPageStep(1000);
+ qsMinVAD->setValue(static_cast<int>(g.s.fVADmin * 32767.0));
+ qsMinVAD->setObjectName(QLatin1String("VADmin"));
+
+ v->addWidget(qsMinVAD);
+
+ qsMaxVAD = new QSlider(Qt::Horizontal);
+ qsMaxVAD->setRange(1, 32767);
+ qsMaxVAD->setSingleStep(100);
+ qsMaxVAD->setPageStep(1000);
+ qsMaxVAD->setValue(static_cast<int>(g.s.fVADmax * 32767));
+ qsMaxVAD->setObjectName(QLatin1String("VADmax"));
+
+ v->addWidget(qsMaxVAD);
+
+ l = new QLabel(tr("Last, you need to adjust the grace time. Mumble may detect this much non-speech and still keep transmitting before "
+ "it breaks off. This allows you to catch your breath while speaking."));
+ l->setWordWrap(true);
+ v->addWidget(l);
+
+ QHBoxLayout *h = new QHBoxLayout;
+
+ qsHoldtime = new QSlider(Qt::Horizontal);
+ qsHoldtime->setRange(20, 250);
+ qsHoldtime->setSingleStep(5);
+ qsHoldtime->setPageStep(25);
+ qsHoldtime->setValue(g.s.iVoiceHold);
+ qsHoldtime->setObjectName(QLatin1String("Holdtime"));
+
+ qlHoldtime = new QLabel();
+ qlHoldtime->setMinimumWidth(40);
+ on_Holdtime_valueChanged(qsHoldtime->value());
+
+ h->addWidget(qsHoldtime);
+ h->addWidget(qlHoldtime);
+
+ v->addLayout(h);
+
+ qwpage->setLayout(v);
+
+ return qwpage;
}
QWizardPage *AudioWizard::deviceTuningPage() {
- QWizardPage *qwpage = new QWizardPage;
- qwpage->setTitle(tr("Device tuning"));
- qwpage->setSubTitle(tr("Changing hardware output delays to their minimum value."));
-
- QGridLayout *grid = new QGridLayout();
-
- QLabel *l = new QLabel(tr("To keep latency to an absolute minium, it's important to buffer as little audio as possible on the soundcard. "
- "However, many soundcards report that they require a much smaller buffer than what they can actually work with, "
- "so the only way to set this value is to try and fail."));
- l->setWordWrap(true);
- grid->addWidget(l, 0, 0, 1, 2);
-
- l = new QLabel(tr("You should hear a multitone chord. Change the slider below to the lowest value which gives <b>no</b> interruptions or jitter "
- "in the sound."));
- l->setWordWrap(true);
- grid->addWidget(l, 1, 0, 1, 2);
-
- qsOutputDelay = new QSlider(Qt::Horizontal);
- qsOutputDelay->setRange(1, 6);
-
- qsOutputDelay->setSingleStep(1);
- qsOutputDelay->setPageStep(2);
- qsOutputDelay->setValue(g.s.iDXOutputDelay);
- qsOutputDelay->setObjectName(QLatin1String("OutputDelay"));
-
- qlOutputDelay=new QLabel();
- qlOutputDelay->setMinimumWidth(30);
- on_OutputDelay_valueChanged(qsOutputDelay->value());
- qsOutputDelay->setToolTip(tr("Amount of data to buffer."));
- qsOutputDelay->setWhatsThis(tr("This sets the amount of data to prebuffer in the output buffer. "
- "Experiment with different values and set it to the lowest which doesn't "
- "cause rapid jitter in the sound."));
- grid->addWidget(qsOutputDelay, 2, 1);
- grid->addWidget(qlOutputDelay, 2, 2);
-
- qwpage->setLayout(grid);
- return qwpage;
+ QWizardPage *qwpage = new QWizardPage;
+ qwpage->setTitle(tr("Device tuning"));
+ qwpage->setSubTitle(tr("Changing hardware output delays to their minimum value."));
+
+ QGridLayout *grid = new QGridLayout();
+
+ QLabel *l = new QLabel(tr("To keep latency to an absolute minium, it's important to buffer as little audio as possible on the soundcard. "
+ "However, many soundcards report that they require a much smaller buffer than what they can actually work with, "
+ "so the only way to set this value is to try and fail."));
+ l->setWordWrap(true);
+ grid->addWidget(l, 0, 0, 1, 2);
+
+ l = new QLabel(tr("You should hear a multitone chord. Change the slider below to the lowest value which gives <b>no</b> interruptions or jitter "
+ "in the sound."));
+ l->setWordWrap(true);
+ grid->addWidget(l, 1, 0, 1, 2);
+
+ qsOutputDelay = new QSlider(Qt::Horizontal);
+ qsOutputDelay->setRange(1, 6);
+
+ qsOutputDelay->setSingleStep(1);
+ qsOutputDelay->setPageStep(2);
+ qsOutputDelay->setValue(g.s.iDXOutputDelay);
+ qsOutputDelay->setObjectName(QLatin1String("OutputDelay"));
+
+ qlOutputDelay=new QLabel();
+ qlOutputDelay->setMinimumWidth(30);
+ on_OutputDelay_valueChanged(qsOutputDelay->value());
+ qsOutputDelay->setToolTip(tr("Amount of data to buffer."));
+ qsOutputDelay->setWhatsThis(tr("This sets the amount of data to prebuffer in the output buffer. "
+ "Experiment with different values and set it to the lowest which doesn't "
+ "cause rapid jitter in the sound."));
+ grid->addWidget(qsOutputDelay, 2, 1);
+ grid->addWidget(qlOutputDelay, 2, 2);
+
+ qwpage->setLayout(grid);
+ return qwpage;
}
void AudioWizard::on_Input_activated(int) {
- qcbInputDevice->clear();
+ qcbInputDevice->clear();
- AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
- QList<audioDevice> ql = air->getDeviceChoices();
+ AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
+ QList<audioDevice> ql = air->getDeviceChoices();
- foreach(audioDevice d, ql) {
- qcbInputDevice->addItem(d.first, d.second);
- }
+ foreach(audioDevice d, ql) {
+ qcbInputDevice->addItem(d.first, d.second);
+ }
- qcbInputDevice->setEnabled(ql.count() > 1);
+ qcbInputDevice->setEnabled(ql.count() > 1);
- on_InputDevice_activated(0);
+ on_InputDevice_activated(0);
}
void AudioWizard::on_InputDevice_activated(int) {
- if (bInit)
- return;
+ if (bInit)
+ return;
boost::weak_ptr<AudioInput> wai(g.ai);
g.ai.reset();
- while(! wai.expired()) {
+ while (! wai.expired()) {
}
AudioInputRegistrar *air = AudioInputRegistrar::qmNew->value(qcbInput->currentText());
int idx = qcbInputDevice->currentIndex();
if (idx > -1) {
- air->setDeviceChoice(qcbInputDevice->itemData(idx));
+ air->setDeviceChoice(qcbInputDevice->itemData(idx));
}
g.ai = AudioInputPtr(air->create());
@@ -482,34 +482,34 @@ void AudioWizard::on_InputDevice_activated(int) {
}
void AudioWizard::on_Output_activated(int) {
- qcbOutputDevice->clear();
+ qcbOutputDevice->clear();
- AudioOutputRegistrar *aor = AudioOutputRegistrar::qmNew->value(qcbOutput->currentText());
- QList<audioDevice> ql = aor->getDeviceChoices();
+ AudioOutputRegistrar *aor = AudioOutputRegistrar::qmNew->value(qcbOutput->currentText());
+ QList<audioDevice> ql = aor->getDeviceChoices();
- foreach(audioDevice d, ql) {
- qcbOutputDevice->addItem(d.first, d.second);
- }
+ foreach(audioDevice d, ql) {
+ qcbOutputDevice->addItem(d.first, d.second);
+ }
- qcbOutputDevice->setEnabled(ql.count() > 1);
+ qcbOutputDevice->setEnabled(ql.count() > 1);
- on_OutputDevice_activated(0);
+ on_OutputDevice_activated(0);
}
void AudioWizard::on_OutputDevice_activated(int) {
- if (bInit)
- return;
+ if (bInit)
+ return;
boost::weak_ptr<AudioOutput> wai(g.ao);
g.ao.reset();
- while(! wai.expired()) {
+ while (! wai.expired()) {
}
AudioOutputRegistrar *aor = AudioOutputRegistrar::qmNew->value(qcbOutput->currentText());
int idx = qcbOutputDevice->currentIndex();
if (idx > -1) {
- aor->setDeviceChoice(qcbOutputDevice->itemData(idx));
+ aor->setDeviceChoice(qcbOutputDevice->itemData(idx));
}
g.ao = AudioOutputPtr(aor->create());
@@ -517,7 +517,7 @@ void AudioWizard::on_OutputDevice_activated(int) {
}
void AudioWizard::on_OutputDelay_valueChanged(int v) {
- qlOutputDelay->setText(tr("%1ms").arg(v*20));
+ qlOutputDelay->setText(tr("%1ms").arg(v*20));
g.s.iDXOutputDelay = v;
on_OutputDevice_activated(0);
if (! bInit)
@@ -525,22 +525,22 @@ void AudioWizard::on_OutputDelay_valueChanged(int v) {
}
void AudioWizard::on_MaxAmp_valueChanged(int v) {
- g.s.iMinLoudness = qMin(v, 20000);
+ g.s.iMinLoudness = qMin(v, 20000);
}
void AudioWizard::showPage(int v) {
- AudioOutputPtr ao = g.ao;
- ao->wipe();
+ AudioOutputPtr ao = g.ao;
+ ao->wipe();
- if (v == 2)
- playChord();
+ if (v == 2)
+ playChord();
}
void AudioWizard::playChord() {
- AudioOutputPtr ao = g.ao;
- ao->playSine(261.63);
- ao->playSine(329.63);
- ao->playSine(392.00);
+ AudioOutputPtr ao = g.ao;
+ ao->playSine(261.63);
+ ao->playSine(329.63);
+ ao->playSine(392.00);
}
void AudioWizard::restartAudio() {
@@ -550,7 +550,7 @@ void AudioWizard::restartAudio() {
g.ai.reset();
g.ao.reset();
- while(! wai.expired() || ! wao.expired()) {
+ while (! wai.expired() || ! wao.expired()) {
// Where is QThread::yield() ?
}
@@ -564,75 +564,75 @@ void AudioWizard::restartAudio() {
}
void AudioWizard::reject() {
- g.s = sOldSettings;
+ g.s = sOldSettings;
- foreach(AudioInputRegistrar *air, *AudioInputRegistrar::qmNew) {
- const QString &name = air->name;
- if (qhOldInputDevice.contains(name))
- air->setDeviceChoice(qhOldInputDevice.value(name));
- }
+ foreach(AudioInputRegistrar *air, *AudioInputRegistrar::qmNew) {
+ const QString &name = air->name;
+ if (qhOldInputDevice.contains(name))
+ air->setDeviceChoice(qhOldInputDevice.value(name));
+ }
- foreach(AudioOutputRegistrar *aor, *AudioOutputRegistrar::qmNew) {
- const QString &name = aor->name;
- if (qhOldOutputDevice.contains(name))
- aor->setDeviceChoice(qhOldOutputDevice.value(name));
- }
+ foreach(AudioOutputRegistrar *aor, *AudioOutputRegistrar::qmNew) {
+ const QString &name = aor->name;
+ if (qhOldOutputDevice.contains(name))
+ aor->setDeviceChoice(qhOldOutputDevice.value(name));
+ }
- g.lmLoopMode = Global::None;
- restartAudio();
+ g.lmLoopMode = Global::None;
+ restartAudio();
- QWizard::reject();
+ QWizard::reject();
}
void AudioWizard::accept() {
- g.s.atTransmit = sOldSettings.atTransmit;
- g.lmLoopMode = Global::None;
- restartAudio();
- QWizard::accept();
+ g.s.atTransmit = sOldSettings.atTransmit;
+ g.lmLoopMode = Global::None;
+ restartAudio();
+ QWizard::accept();
}
void AudioWizard::on_Ticker_timeout() {
- AudioInputPtr ai = g.ai;
- if (! ai)
- return;
-
- int iPeak = static_cast<int>(32767 * pow(10.0, (ai->dPeakMic / 20.0)));
-
- if (iTicks++ >= 50) {
- iMaxPeak = 0;
- iTicks = 0;
- }
- if (iPeak > iMaxPeak)
- iMaxPeak = iPeak;
-
- abAmplify->iBelow = qsMaxAmp->value();
- abAmplify->iValue = iPeak;
- abAmplify->iPeak = iMaxPeak;
- abAmplify->update();
-
- abVAD->iBelow = qsMinVAD->value();
- abVAD->iAbove = qsMaxVAD->value();
-
- if (g.s.vsVAD == Settings::Amplitude) {
- abVAD->iValue = iPeak;
- abVAD->iPeak = iMaxPeak;
- } else {
- abVAD->iValue = static_cast<int>(ai->dSNR * 1000.0);
- abVAD->iPeak = -1;
- }
- abVAD->update();
+ AudioInputPtr ai = g.ai;
+ if (! ai)
+ return;
+
+ int iPeak = static_cast<int>(32767 * pow(10.0, (ai->dPeakMic / 20.0)));
+
+ if (iTicks++ >= 50) {
+ iMaxPeak = 0;
+ iTicks = 0;
+ }
+ if (iPeak > iMaxPeak)
+ iMaxPeak = iPeak;
+
+ abAmplify->iBelow = qsMaxAmp->value();
+ abAmplify->iValue = iPeak;
+ abAmplify->iPeak = iMaxPeak;
+ abAmplify->update();
+
+ abVAD->iBelow = qsMinVAD->value();
+ abVAD->iAbove = qsMaxVAD->value();
+
+ if (g.s.vsVAD == Settings::Amplitude) {
+ abVAD->iValue = iPeak;
+ abVAD->iPeak = iMaxPeak;
+ } else {
+ abVAD->iValue = static_cast<int>(ai->dSNR * 1000.0);
+ abVAD->iPeak = -1;
+ }
+ abVAD->update();
}
void AudioWizard::on_VADmin_valueChanged(int v) {
- g.s.fVADmin = v / 32767.0;
+ g.s.fVADmin = v / 32767.0;
}
void AudioWizard::on_VADmax_valueChanged(int v) {
- g.s.fVADmax = v / 32767.0;
+ g.s.fVADmax = v / 32767.0;
}
void AudioWizard::on_Holdtime_valueChanged(int v) {
- g.s.iVoiceHold = v;
+ g.s.iVoiceHold = v;
double val = v * 20;
val = val / 1000.0;
@@ -640,11 +640,11 @@ void AudioWizard::on_Holdtime_valueChanged(int v) {
}
void AudioWizard::on_SNR_clicked(bool on) {
- if (on)
- g.s.vsVAD = Settings::SignalToNoise;
+ if (on)
+ g.s.vsVAD = Settings::SignalToNoise;
}
void AudioWizard::on_Amplitude_clicked(bool on) {
- if (on)
- g.s.vsVAD = Settings::Amplitude;
+ if (on)
+ g.s.vsVAD = Settings::Amplitude;
}
diff --git a/src/mumble/AudioWizard.h b/src/mumble/AudioWizard.h
index 4e9397938..ab23d1e47 100644
--- a/src/mumble/AudioWizard.h
+++ b/src/mumble/AudioWizard.h
@@ -34,74 +34,74 @@
#include "Settings.h"
class AudioBar : public QWidget {
- Q_OBJECT
- protected:
- void paintEvent (QPaintEvent *event);
- public:
- AudioBar(QWidget *parent = NULL);
- int iMin, iMax;
- int iBelow, iAbove;
- int iValue, iPeak;
- QColor qcBelow, qcInside, qcAbove;
+ Q_OBJECT
+ protected:
+ void paintEvent(QPaintEvent *event);
+ public:
+ AudioBar(QWidget *parent = NULL);
+ int iMin, iMax;
+ int iBelow, iAbove;
+ int iValue, iPeak;
+ QColor qcBelow, qcInside, qcAbove;
};
class AudioWizard: public QWizard {
- Q_OBJECT
- protected:
- QComboBox *qcbInput, *qcbInputDevice;
- QComboBox *qcbOutput, *qcbOutputDevice;
-
- QSlider *qsOutputDelay;
- QLabel *qlOutputDelay;
-
- AudioBar *abAmplify;
- QSlider *qsMaxAmp;
-
- AudioBar *abVAD;
- QRadioButton *qrAmplitude, *qrSNR;
- QSlider *qsMinVAD, *qsMaxVAD;
-
- QSlider *qsHoldtime;
- QLabel *qlHoldtime;
-
- QWizardPage *introPage();
- QWizardPage *devicePage();
- QWizardPage *volumePage();
- QWizardPage *triggerPage();
- QWizardPage *deviceTuningPage();
- QWizardPage *donePage();
-
- QHash<QString, QVariant> qhOldInputDevice;
- QHash<QString, QVariant> qhOldOutputDevice;
- Settings sOldSettings;
-
- QTimer *ticker;
-
- bool bInit;
-
- int iMaxPeak;
- int iTicks;
-
- void restartAudio();
- void playChord();
- public slots:
- void on_Input_activated(int);
- void on_InputDevice_activated(int);
- void on_Output_activated(int);
- void on_OutputDevice_activated(int);
- void on_OutputDelay_valueChanged(int);
- void on_MaxAmp_valueChanged(int);
- void on_Ticker_timeout();
- void on_VADmin_valueChanged(int);
- void on_VADmax_valueChanged(int);
- void on_Holdtime_valueChanged(int);
- void on_Amplitude_clicked(bool);
- void on_SNR_clicked(bool);
- void showPage(int);
- public:
- AudioWizard();
- void reject();
- void accept();
+ Q_OBJECT
+ protected:
+ QComboBox *qcbInput, *qcbInputDevice;
+ QComboBox *qcbOutput, *qcbOutputDevice;
+
+ QSlider *qsOutputDelay;
+ QLabel *qlOutputDelay;
+
+ AudioBar *abAmplify;
+ QSlider *qsMaxAmp;
+
+ AudioBar *abVAD;
+ QRadioButton *qrAmplitude, *qrSNR;
+ QSlider *qsMinVAD, *qsMaxVAD;
+
+ QSlider *qsHoldtime;
+ QLabel *qlHoldtime;
+
+ QWizardPage *introPage();
+ QWizardPage *devicePage();
+ QWizardPage *volumePage();
+ QWizardPage *triggerPage();
+ QWizardPage *deviceTuningPage();
+ QWizardPage *donePage();
+
+ QHash<QString, QVariant> qhOldInputDevice;
+ QHash<QString, QVariant> qhOldOutputDevice;
+ Settings sOldSettings;
+
+ QTimer *ticker;
+
+ bool bInit;
+
+ int iMaxPeak;
+ int iTicks;
+
+ void restartAudio();
+ void playChord();
+ public slots:
+ void on_Input_activated(int);
+ void on_InputDevice_activated(int);
+ void on_Output_activated(int);
+ void on_OutputDevice_activated(int);
+ void on_OutputDelay_valueChanged(int);
+ void on_MaxAmp_valueChanged(int);
+ void on_Ticker_timeout();
+ void on_VADmin_valueChanged(int);
+ void on_VADmax_valueChanged(int);
+ void on_Holdtime_valueChanged(int);
+ void on_Amplitude_clicked(bool);
+ void on_SNR_clicked(bool);
+ void showPage(int);
+ public:
+ AudioWizard();
+ void reject();
+ void accept();
};
#endif
diff --git a/src/mumble/BanEditor.cpp b/src/mumble/BanEditor.cpp
index c504d86c8..04716bf07 100644
--- a/src/mumble/BanEditor.cpp
+++ b/src/mumble/BanEditor.cpp
@@ -47,8 +47,8 @@ BanEditor::BanEditor(const MessageServerBanList *msbl, QWidget *p) : QDialog(p)
qleIP->setObjectName(QLatin1String("IP"));
QRegExp rx(QLatin1String("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"));
- QValidator *validator = new QRegExpValidator(rx, this);
- qleIP->setValidator(validator);
+ QValidator *validator = new QRegExpValidator(rx, this);
+ qleIP->setValidator(validator);
qsbMask->setObjectName(QLatin1String("Mask"));
qsbMask->setRange(8,32);
@@ -66,33 +66,33 @@ BanEditor::BanEditor(const MessageServerBanList *msbl, QWidget *p) : QDialog(p)
grid->addWidget(qpbUpdate,1,2);
grid->addWidget(qpbRemove,1,3);
- QPushButton *okButton = new QPushButton(tr("&OK"));
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- okButton->setToolTip(tr("Accept changes"));
- okButton->setWhatsThis(tr("This button will accept current groups/ACLs and send them to "
- "the server. Note that if you mistakenly remove write permission "
- "from yourself, the server will add it."));
- QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ QPushButton *okButton = new QPushButton(tr("&OK"));
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ okButton->setToolTip(tr("Accept changes"));
+ okButton->setWhatsThis(tr("This button will accept current groups/ACLs and send them to "
+ "the server. Note that if you mistakenly remove write permission "
+ "from yourself, the server will add it."));
+ QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
cancelButton->setToolTip(tr("Reject changes"));
cancelButton->setWhatsThis(tr("This button will cancels all changes and closes the dialog without "
- "updating the ACLs or groups on the server."));
+ "updating the ACLs or groups on the server."));
- QHBoxLayout *buttons = new QHBoxLayout;
- buttons->addStretch(1);
- buttons->addWidget(okButton);
- buttons->addWidget(cancelButton);
+ QHBoxLayout *buttons = new QHBoxLayout;
+ buttons->addStretch(1);
+ buttons->addWidget(okButton);
+ buttons->addWidget(cancelButton);
- QVBoxLayout *ml = new QVBoxLayout;
- ml->addLayout(grid);
- ml->addSpacing(12);
- ml->addLayout(buttons);
- setLayout(ml);
+ QVBoxLayout *ml = new QVBoxLayout;
+ ml->addLayout(grid);
+ ml->addSpacing(12);
+ ml->addLayout(buttons);
+ setLayout(ml);
qlBans = msbl->qlBans;
refreshBanList();
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
addToolTipsWhatsThis();
}
diff --git a/src/mumble/BanEditor.h b/src/mumble/BanEditor.h
index dd565a78e..7113628de 100644
--- a/src/mumble/BanEditor.h
+++ b/src/mumble/BanEditor.h
@@ -34,7 +34,7 @@
#include "Message.h"
class BanEditor : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QList<QPair<quint32, int> > qlBans;
diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp
index 4f7812e2a..6cbad8722 100644
--- a/src/mumble/ConfigDialog.cpp
+++ b/src/mumble/ConfigDialog.cpp
@@ -54,31 +54,31 @@ QIcon ConfigWidget::icon() const {
}
ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) {
- setWindowTitle(tr("Mumble Configuration"));
-
- qlwIcons = new QListWidget();
- qswPages = new QStackedWidget();
-
- qlwIcons->setViewMode(QListView::IconMode);
- qlwIcons->setIconSize(QSize(96, 84));
- qlwIcons->setMovement(QListView::Static);
- qlwIcons->setMaximumWidth(128);
- qlwIcons->setSpacing(12);
- qlwIcons->setObjectName(QLatin1String("Icons"));
-
- QPushButton *okButton = new QPushButton(tr("&OK"));
- okButton->setDefault(true);
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- okButton->setToolTip(tr("Accept changes"));
- okButton->setWhatsThis(tr("This button will accept current settings and return to the application.<br />"
- "The settings will be stored to disk when you leave the application."));
- QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ setWindowTitle(tr("Mumble Configuration"));
+
+ qlwIcons = new QListWidget();
+ qswPages = new QStackedWidget();
+
+ qlwIcons->setViewMode(QListView::IconMode);
+ qlwIcons->setIconSize(QSize(96, 84));
+ qlwIcons->setMovement(QListView::Static);
+ qlwIcons->setMaximumWidth(128);
+ qlwIcons->setSpacing(12);
+ qlwIcons->setObjectName(QLatin1String("Icons"));
+
+ QPushButton *okButton = new QPushButton(tr("&OK"));
+ okButton->setDefault(true);
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ okButton->setToolTip(tr("Accept changes"));
+ okButton->setWhatsThis(tr("This button will accept current settings and return to the application.<br />"
+ "The settings will be stored to disk when you leave the application."));
+ QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
cancelButton->setToolTip(tr("Reject changes"));
cancelButton->setWhatsThis(tr("This button will reject all changes and return to the application.<br />"
- "The settings will be reset to the previous positions."));
- QPushButton *applyButton = new QPushButton(tr("&Apply"));
- connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
+ "The settings will be reset to the previous positions."));
+ QPushButton *applyButton = new QPushButton(tr("&Apply"));
+ connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
applyButton->setToolTip(tr("Apply changes"));
applyButton->setWhatsThis(tr("This button will immediately apply all changes."));
@@ -87,45 +87,45 @@ ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) {
addPage(cwn());
}
- QHBoxLayout *buttons = new QHBoxLayout;
- buttons->addStretch(1);
- buttons->addWidget(applyButton);
- buttons->addWidget(okButton);
- buttons->addWidget(cancelButton);
+ QHBoxLayout *buttons = new QHBoxLayout;
+ buttons->addStretch(1);
+ buttons->addWidget(applyButton);
+ buttons->addWidget(okButton);
+ buttons->addWidget(cancelButton);
- QVBoxLayout *l = new QVBoxLayout;
- l->addWidget(qswPages, 1);
- l->addSpacing(12);
- l->addLayout(buttons);
+ QVBoxLayout *l = new QVBoxLayout;
+ l->addWidget(qswPages, 1);
+ l->addSpacing(12);
+ l->addLayout(buttons);
- QHBoxLayout *top = new QHBoxLayout;
- top->addWidget(qlwIcons);
- top->addLayout(l);
+ QHBoxLayout *top = new QHBoxLayout;
+ top->addWidget(qlwIcons);
+ top->addLayout(l);
- setLayout(top);
+ setLayout(top);
qlwIcons->scrollTo(qlwIcons->currentIndex(), QAbstractItemView::PositionAtTop);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
- qlwIcons->setCurrentRow(0);
+ qlwIcons->setCurrentRow(0);
}
void ConfigDialog::addPage(ConfigWidget *cw) {
- QDesktopWidget dw;
- QRect ds=dw.availableGeometry();
- QSize ms=cw->minimumSizeHint();
- ms.rwidth() += 128;
- ms.rheight() += 64;
- if ((ms.width() > ds.width()) || (ms.height() > ds.height())) {
- QScrollArea *qsa=new QScrollArea(this);
- qsa->setWidget(cw);
- qswPages->addWidget(qsa);
- qWarning("Widget %s has size %d %d", qPrintable(cw->title()), ms.width(), ms.height());
- } else {
+ QDesktopWidget dw;
+ QRect ds=dw.availableGeometry();
+ QSize ms=cw->minimumSizeHint();
+ ms.rwidth() += 128;
+ ms.rheight() += 64;
+ if ((ms.width() > ds.width()) || (ms.height() > ds.height())) {
+ QScrollArea *qsa=new QScrollArea(this);
+ qsa->setWidget(cw);
+ qswPages->addWidget(qsa);
+ qWarning("Widget %s has size %d %d", qPrintable(cw->title()), ms.width(), ms.height());
+ } else {
qswPages->addWidget(cw);
- }
+ }
QListWidgetItem *i = new QListWidgetItem(qlwIcons);
i->setIcon(cw->icon());
i->setText(cw->title());
@@ -135,17 +135,16 @@ void ConfigDialog::addPage(ConfigWidget *cw) {
widgets << cw;
}
-void ConfigDialog::on_Icons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
-{
- if (!current)
- current = previous;
+void ConfigDialog::on_Icons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous) {
+ if (!current)
+ current = previous;
- qswPages->setCurrentIndex(qlwIcons->row(current));
+ qswPages->setCurrentIndex(qlwIcons->row(current));
}
void ConfigDialog::apply() {
foreach(ConfigWidget *cw, widgets)
- cw->accept();
+ cw->accept();
boost::weak_ptr<AudioInput> wai(g.ai);
boost::weak_ptr<AudioOutput> wao(g.ao);
@@ -153,7 +152,7 @@ void ConfigDialog::apply() {
g.ai.reset();
g.ao.reset();
- while(! wai.expired() || ! wao.expired()) {
+ while (! wai.expired() || ! wao.expired()) {
// Where is QThread::yield() ?
}
diff --git a/src/mumble/ConfigDialog.h b/src/mumble/ConfigDialog.h
index ec6e30c22..2724a878c 100644
--- a/src/mumble/ConfigDialog.h
+++ b/src/mumble/ConfigDialog.h
@@ -32,7 +32,7 @@
#define _CONFIGDIALOG_H
class ConfigWidget : public QWidget {
- Q_OBJECT
+ Q_OBJECT
public:
ConfigWidget(QWidget *p = NULL);
virtual QString title() const;
@@ -44,7 +44,7 @@ class ConfigWidget : public QWidget {
typedef ConfigWidget *(*ConfigWidgetNew)();
class ConfigRegistrar {
- friend class ConfigDialog;
+ friend class ConfigDialog;
protected:
static QMap<int, ConfigWidgetNew> *c_qmNew;
public:
@@ -52,17 +52,17 @@ class ConfigRegistrar {
};
class ConfigDialog : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QList<ConfigWidget *> widgets;
- QListWidget *qlwIcons;
- QStackedWidget *qswPages;
- void addPage(ConfigWidget *aw);
+ QListWidget *qlwIcons;
+ QStackedWidget *qswPages;
+ void addPage(ConfigWidget *aw);
public:
ConfigDialog(QWidget *p = NULL);
public slots:
- void on_Icons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
- void apply();
+ void on_Icons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
+ void apply();
void accept();
};
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp
index 8f1a31f3b..614efd8c2 100644
--- a/src/mumble/ConnectDialog.cpp
+++ b/src/mumble/ConnectDialog.cpp
@@ -34,35 +34,35 @@
QList<PublicInfo> ConnectDialog::qlPublicServers;
ConnectDialog::ConnectDialog(QWidget *p) : QDialog(p) {
- QWidget *local = createLocal();
- QWidget *remote = createRemote();
+ QWidget *local = createLocal();
+ QWidget *remote = createRemote();
- qhList = new QHttp(QLatin1String("mumble.hive.no"), 80, this);
- qhList->setObjectName(QLatin1String("Request"));
+ qhList = new QHttp(QLatin1String("mumble.hive.no"), 80, this);
+ qhList->setObjectName(QLatin1String("Request"));
- bPublicInit = false;
+ bPublicInit = false;
- QVBoxLayout *vbl = new QVBoxLayout;
+ QVBoxLayout *vbl = new QVBoxLayout;
- qtwTab = new QTabWidget();
- qtwTab->addTab(local, tr("&Custom Servers"));
- qtwTab->addTab(remote, tr("Server &Browser"));
- qtwTab->setObjectName(QLatin1String("Tab"));
+ qtwTab = new QTabWidget();
+ qtwTab->addTab(local, tr("&Custom Servers"));
+ qtwTab->addTab(remote, tr("Server &Browser"));
+ qtwTab->setObjectName(QLatin1String("Tab"));
- vbl->addWidget(qtwTab);
- setLayout(vbl);
+ vbl->addWidget(qtwTab);
+ setLayout(vbl);
- if (qstmServers->rowCount() < 1) {
- qtwTab->setCurrentIndex(1);
- initList();
- }
+ if (qstmServers->rowCount() < 1) {
+ qtwTab->setCurrentIndex(1);
+ initList();
+ }
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QWidget *ConnectDialog::createLocal() {
- QWidget *w = new QWidget();
+ QWidget *w = new QWidget();
QGridLayout *l=new QGridLayout;
QVBoxLayout *vbl = new QVBoxLayout;
@@ -129,18 +129,18 @@ QWidget *ConnectDialog::createLocal() {
l->addWidget(lab, 4, 1);
l->addWidget(qlePassword, 4,2);
- QPushButton *okButton = new QPushButton(tr("&Connect"));
- okButton->setDefault(true);
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
+ QPushButton *okButton = new QPushButton(tr("&Connect"));
+ okButton->setDefault(true);
+ connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- QPushButton *cancelButton = new QPushButton(tr("Cancel"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ QPushButton *cancelButton = new QPushButton(tr("Cancel"));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
- QPushButton *addButton = new QPushButton(tr("&Add"));
- addButton->setObjectName(QLatin1String("Add"));
+ QPushButton *addButton = new QPushButton(tr("&Add"));
+ addButton->setObjectName(QLatin1String("Add"));
- QPushButton *removeButton = new QPushButton(tr("&Remove"));
- removeButton->setObjectName(QLatin1String("Remove"));
+ QPushButton *removeButton = new QPushButton(tr("&Remove"));
+ removeButton->setObjectName(QLatin1String("Remove"));
vbh->addWidget(okButton);
vbh->addWidget(cancelButton);
@@ -159,46 +159,46 @@ QWidget *ConnectDialog::createLocal() {
if (idx.isValid())
qlwServers->setCurrentIndex(idx);
- w->setLayout(vbl);
- return w;
+ w->setLayout(vbl);
+ return w;
}
QWidget *ConnectDialog::createRemote() {
- QWidget *w=new QWidget();
- QVBoxLayout *vbl = new QVBoxLayout;
- QHBoxLayout *vbh = new QHBoxLayout();
+ QWidget *w=new QWidget();
+ QVBoxLayout *vbl = new QVBoxLayout;
+ QHBoxLayout *vbh = new QHBoxLayout();
- qtwServers = new QTableWidget(0, 3);
- QStringList labels;
- labels << tr("Name");
- labels << tr("Address");
- labels << tr("URL");
- qtwServers->setHorizontalHeaderLabels(labels);
- qtwServers->setObjectName(QLatin1String("Servers"));
+ qtwServers = new QTableWidget(0, 3);
+ QStringList labels;
+ labels << tr("Name");
+ labels << tr("Address");
+ labels << tr("URL");
+ qtwServers->setHorizontalHeaderLabels(labels);
+ qtwServers->setObjectName(QLatin1String("Servers"));
- QPushButton *connectButton = new QPushButton(tr("&Connect"));
- connectButton->setDefault(true);
- connect(connectButton, SIGNAL(clicked()), this, SLOT(accept()));
+ QPushButton *connectButton = new QPushButton(tr("&Connect"));
+ connectButton->setDefault(true);
+ connect(connectButton, SIGNAL(clicked()), this, SLOT(accept()));
- QPushButton *copyButton = new QPushButton(tr("C&opy to custom"));
- copyButton->setObjectName(QLatin1String("Copy"));
+ QPushButton *copyButton = new QPushButton(tr("C&opy to custom"));
+ copyButton->setObjectName(QLatin1String("Copy"));
- QPushButton *urlButton = new QPushButton(tr("&View Webpage"));
- urlButton->setObjectName(QLatin1String("URL"));
+ QPushButton *urlButton = new QPushButton(tr("&View Webpage"));
+ urlButton->setObjectName(QLatin1String("URL"));
- vbh->addWidget(connectButton);
- vbh->addWidget(copyButton);
- vbh->addWidget(urlButton);
+ vbh->addWidget(connectButton);
+ vbh->addWidget(copyButton);
+ vbh->addWidget(urlButton);
- vbl->addWidget(qtwServers);
- vbl->addLayout(vbh);
- w->setLayout(vbl);
- return w;
+ vbl->addWidget(qtwServers);
+ vbl->addLayout(vbh);
+ w->setLayout(vbl);
+ return w;
}
void ConnectDialog::accept() {
- if (qtwTab->currentIndex() == 1) {
+ if (qtwTab->currentIndex() == 1) {
int row = qtwServers->currentRow();
if (row == -1)
return;
@@ -217,30 +217,29 @@ void ConnectDialog::accept() {
iPort = a.at(1).toInt();
} else {
- if (bDirty && qlwServers->currentIndex().isValid()) {
- QSqlRecord r;
- r = toRecord();
- qstmServers->setRecord(qlwServers->currentIndex().row(), r);
- qstmServers->submitAll();
- }
+ if (bDirty && qlwServers->currentIndex().isValid()) {
+ QSqlRecord r;
+ r = toRecord();
+ qstmServers->setRecord(qlwServers->currentIndex().row(), r);
+ qstmServers->submitAll();
+ }
- qsServer = qleServer->text();
- qsUsername = qleUsername->text();
- qsPassword = qlePassword->text();
- iPort = qlePort->text().toInt();
+ qsServer = qleServer->text();
+ qsUsername = qleUsername->text();
+ qsPassword = qlePassword->text();
+ iPort = qlePort->text().toInt();
- g.qs->setValue(QLatin1String("ServerRow"), qlwServers->currentIndex().row());
- }
+ g.qs->setValue(QLatin1String("ServerRow"), qlwServers->currentIndex().row());
+ }
QDialog::accept();
}
void ConnectDialog::on_Servers_itemDoubleClicked(QTableWidgetItem *) {
- accept();
+ accept();
}
-QSqlRecord ConnectDialog::toRecord() const
-{
+QSqlRecord ConnectDialog::toRecord() const {
QSqlRecord r = qstmServers->record();
r.setValue(QLatin1String("name"), qleName->text());
r.setValue(QLatin1String("hostname"), qleServer->text());
@@ -251,28 +250,28 @@ QSqlRecord ConnectDialog::toRecord() const
}
void ConnectDialog::initList() {
- if (bPublicInit || (qlPublicServers.count() > 0))
- return;
+ if (bPublicInit || (qlPublicServers.count() > 0))
+ return;
- bPublicInit = true;
+ bPublicInit = true;
- qhList->get(QString::fromLatin1("/list.cgi?version=%1").arg(MUMBLE_RELEASE));
+ qhList->get(QString::fromLatin1("/list.cgi?version=%1").arg(MUMBLE_RELEASE));
}
void ConnectDialog::fillList() {
- for(int i=0;i<qtwServers->rowCount();i++)
- qtwServers->removeRow(0);
-
- qtwServers->setSortingEnabled(false);
-
- foreach(PublicInfo pi, qlPublicServers) {
- qtwServers->insertRow(0);
- qtwServers->setItem(0, 0, new QTableWidgetItem(pi.name));
- qtwServers->setItem(0, 1, new QTableWidgetItem(QString::fromLatin1("%1:%2").arg(pi.ip).arg(pi.port)));
- qtwServers->setItem(0, 2, new QTableWidgetItem(pi.url.toString()));
- }
- qtwServers->resizeColumnsToContents();
- qtwServers->setSortingEnabled(true);
+ for (int i=0;i<qtwServers->rowCount();i++)
+ qtwServers->removeRow(0);
+
+ qtwServers->setSortingEnabled(false);
+
+ foreach(PublicInfo pi, qlPublicServers) {
+ qtwServers->insertRow(0);
+ qtwServers->setItem(0, 0, new QTableWidgetItem(pi.name));
+ qtwServers->setItem(0, 1, new QTableWidgetItem(QString::fromLatin1("%1:%2").arg(pi.ip).arg(pi.port)));
+ qtwServers->setItem(0, 2, new QTableWidgetItem(pi.url.toString()));
+ }
+ qtwServers->resizeColumnsToContents();
+ qtwServers->setSortingEnabled(true);
}
void ConnectDialog::on_URL_clicked() {
@@ -302,38 +301,37 @@ void ConnectDialog::on_Copy_clicked() {
}
void ConnectDialog::on_Request_done(bool err) {
- if (err) {
- QMessageBox::warning(this, tr("Mumble"), tr("Failed to fetch server list"), QMessageBox::Ok);
- return;
- }
-
- QDomDocument doc;
- doc.setContent(qhList->readAll());
-
- qlPublicServers.clear();
-
- QDomElement root=doc.documentElement();
- QDomNode n = root.firstChild();
- while (!n.isNull()) {
- QDomElement e = n.toElement();
- if (!e.isNull()) {
- if (e.tagName() == QLatin1String("server")) {
- PublicInfo pi;
- pi.name = e.attribute(QLatin1String("name"));
- pi.url = e.attribute(QLatin1String("url"));
- pi.ip = e.attribute(QLatin1String("ip"));
- pi.port = e.attribute(QLatin1String("port")).toInt();
- qlPublicServers << pi;
- }
+ if (err) {
+ QMessageBox::warning(this, tr("Mumble"), tr("Failed to fetch server list"), QMessageBox::Ok);
+ return;
}
- n = n.nextSibling();
- }
- fillList();
+ QDomDocument doc;
+ doc.setContent(qhList->readAll());
+
+ qlPublicServers.clear();
+
+ QDomElement root=doc.documentElement();
+ QDomNode n = root.firstChild();
+ while (!n.isNull()) {
+ QDomElement e = n.toElement();
+ if (!e.isNull()) {
+ if (e.tagName() == QLatin1String("server")) {
+ PublicInfo pi;
+ pi.name = e.attribute(QLatin1String("name"));
+ pi.url = e.attribute(QLatin1String("url"));
+ pi.ip = e.attribute(QLatin1String("ip"));
+ pi.port = e.attribute(QLatin1String("port")).toInt();
+ qlPublicServers << pi;
+ }
+ }
+ n = n.nextSibling();
+ }
+
+ fillList();
}
-void ConnectDialog::onSelection_Changed(const QModelIndex &index, const QModelIndex &previndex)
-{
+void ConnectDialog::onSelection_Changed(const QModelIndex &index, const QModelIndex &previndex) {
QSqlRecord r;
if (bDirty) {
@@ -353,16 +351,14 @@ void ConnectDialog::onSelection_Changed(const QModelIndex &index, const QModelIn
}
}
-void ConnectDialog::on_Add_clicked()
-{
+void ConnectDialog::on_Add_clicked() {
bDirty = false;
QSqlRecord r = toRecord();
qstmServers->insertRecord(-1, r);
qstmServers->submitAll();
}
-void ConnectDialog::on_Remove_clicked()
-{
+void ConnectDialog::on_Remove_clicked() {
qstmServers->removeRows(qlwServers->currentIndex().row(), 1, QModelIndex());
qstmServers->submitAll();
}
@@ -372,9 +368,9 @@ void ConnectDialog::onDirty(const QString &) {
}
void ConnectDialog::on_Tab_currentChanged(int idx) {
- if (idx != 1)
- return;
+ if (idx != 1)
+ return;
- initList();
- fillList();
+ initList();
+ fillList();
}
diff --git a/src/mumble/ConnectDialog.h b/src/mumble/ConnectDialog.h
index 83fb35036..54f4fdb4b 100644
--- a/src/mumble/ConnectDialog.h
+++ b/src/mumble/ConnectDialog.h
@@ -32,21 +32,21 @@
#define _CONNECTDIALOG_H
struct PublicInfo {
- QString name;
- QUrl url;
- QString ip;
- int port;
+ QString name;
+ QUrl url;
+ QString ip;
+ int port;
};
class ConnectDialog : public QDialog {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QTabWidget *qtwTab;
static QList<PublicInfo> qlPublicServers;
bool bPublicInit;
QSqlTableModel *qstmServers;
QListView *qlwServers;
- QTableWidget *qtwServers;
+ QTableWidget *qtwServers;
QLineEdit *qleName, *qleServer, *qlePort, *qleUsername, *qlePassword;
QCheckBox *qcbUdp;
QModelIndex qmiDirty;
diff --git a/src/mumble/DXAudioInput.cpp b/src/mumble/DXAudioInput.cpp
index c6ed4effd..7f738065b 100644
--- a/src/mumble/DXAudioInput.cpp
+++ b/src/mumble/DXAudioInput.cpp
@@ -36,8 +36,8 @@
#define FAILED(Status) (static_cast<HRESULT>(Status)<0)
class DXAudioInputRegistrar : public AudioInputRegistrar {
- public:
- DXAudioInputRegistrar();
+ public:
+ DXAudioInputRegistrar();
virtual AudioInput *create();
virtual const QList<audioDevice> getDeviceChoices();
virtual void setDeviceChoice(const QVariant &);
@@ -57,10 +57,8 @@ AudioInput *DXAudioInputRegistrar::create() {
typedef QPair<QString, GUID> dsDevice;
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, const WCHAR* lpszDesc,
- const WCHAR* lpszDrvName, void *ctx)
-{
- if ( lpGUID )
- {
+ const WCHAR* lpszDrvName, void *ctx) {
+ if (lpGUID) {
QList<dsDevice> *l =reinterpret_cast<QList<dsDevice> *>(ctx);
*l << dsDevice(QString::fromUtf16(reinterpret_cast<const ushort*>(lpszDesc)), *lpGUID);
}
@@ -81,18 +79,18 @@ const QList<audioDevice> DXAudioInputRegistrar::getDeviceChoices() {
if (! g.s.qbaDXInput.isEmpty()) {
lpguid = reinterpret_cast<LPGUID>(g.s.qbaDXInput.data());
} else {
- lpguid = &DSDEVID_DefaultVoiceCapture;
+ lpguid = &DSDEVID_DefaultVoiceCapture;
}
foreach(dsDevice d, qlInput) {
- if (d.second == *lpguid) {
- qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
- }
+ if (d.second == *lpguid) {
+ qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
+ }
}
foreach(dsDevice d, qlInput) {
- if (d.second != *lpguid) {
- qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
- }
+ if (d.second != *lpguid) {
+ qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
+ }
}
return qlReturn;
}
@@ -104,12 +102,12 @@ void DXAudioInputRegistrar::setDeviceChoice(const QVariant &choice) {
#define NBUFFBLOCKS 50
DXAudioInput::DXAudioInput() {
- HRESULT hr;
- WAVEFORMATEX wfx;
- DSCBUFFERDESC dscbd;
- DSBPOSITIONNOTIFY aPosNotify[ NBUFFBLOCKS ];
+ HRESULT hr;
+ WAVEFORMATEX wfx;
+ DSCBUFFERDESC dscbd;
+ DSBPOSITIONNOTIFY aPosNotify[ NBUFFBLOCKS ];
- hNotificationEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
+ hNotificationEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
pDSCapture = NULL;
pDSCaptureBuffer = NULL;
@@ -119,45 +117,44 @@ DXAudioInput::DXAudioInput() {
bool failed = false;
- ZeroMemory( &wfx, sizeof(wfx) );
+ ZeroMemory(&wfx, sizeof(wfx));
wfx.wFormatTag = WAVE_FORMAT_PCM;
- ZeroMemory( &dscbd, sizeof(dscbd) );
- dscbd.dwSize = sizeof(dscbd);
+ ZeroMemory(&dscbd, sizeof(dscbd));
+ dscbd.dwSize = sizeof(dscbd);
- dscbd.dwBufferBytes = dwBufferSize = iByteSize * NBUFFBLOCKS;
- dscbd.lpwfxFormat = &wfx;
+ dscbd.dwBufferBytes = dwBufferSize = iByteSize * NBUFFBLOCKS;
+ dscbd.lpwfxFormat = &wfx;
- wfx.nChannels = 1;
- wfx.nSamplesPerSec = SAMPLE_RATE;
- wfx.nBlockAlign = 2;
- wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
- wfx.wBitsPerSample = 16;
+ wfx.nChannels = 1;
+ wfx.nSamplesPerSec = SAMPLE_RATE;
+ wfx.nBlockAlign = 2;
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
+ wfx.wBitsPerSample = 16;
- for( int i = 0; i < NBUFFBLOCKS; i++ )
- {
- aPosNotify[i].dwOffset = (iByteSize * (i+1)) -1;
- aPosNotify[i].hEventNotify = hNotificationEvent;
- }
+ for (int i = 0; i < NBUFFBLOCKS; i++) {
+ aPosNotify[i].dwOffset = (iByteSize * (i+1)) -1;
+ aPosNotify[i].hEventNotify = hNotificationEvent;
+ }
- // Create IDirectSoundCapture using the preferred capture device
+ // Create IDirectSoundCapture using the preferred capture device
if (! g.s.qbaDXInput.isEmpty()) {
LPGUID lpguid = reinterpret_cast<LPGUID>(g.s.qbaDXInput.data());
- if( FAILED( hr = DirectSoundCaptureCreate8(lpguid, &pDSCapture, NULL))) {
+ if (FAILED(hr = DirectSoundCaptureCreate8(lpguid, &pDSCapture, NULL))) {
failed = true;
}
}
- if (! pDSCapture && FAILED( hr = DirectSoundCaptureCreate8(&DSDEVID_DefaultVoiceCapture, &pDSCapture, NULL ) ) )
- qWarning("DXAudioInput: DirectSoundCaptureCreate");
- else if( FAILED( hr = pDSCapture->CreateCaptureBuffer( &dscbd, &pDSCaptureBuffer, NULL)))
+ if (! pDSCapture && FAILED(hr = DirectSoundCaptureCreate8(&DSDEVID_DefaultVoiceCapture, &pDSCapture, NULL)))
+ qWarning("DXAudioInput: DirectSoundCaptureCreate");
+ else if (FAILED(hr = pDSCapture->CreateCaptureBuffer(&dscbd, &pDSCaptureBuffer, NULL)))
qWarning("DXAudioInput: CreateCaptureBuffer");
- else if( FAILED( hr = pDSCaptureBuffer->QueryInterface( IID_IDirectSoundNotify, reinterpret_cast<VOID**>(&pDSNotify) ) ) )
+ else if (FAILED(hr = pDSCaptureBuffer->QueryInterface(IID_IDirectSoundNotify, reinterpret_cast<VOID**>(&pDSNotify))))
qWarning("DXAudioInput: QueryInterface (Notify)");
- else if( FAILED( hr = pDSNotify->SetNotificationPositions( NBUFFBLOCKS, aPosNotify ) ) )
- qWarning("DXAudioInput: SetNotificationPositions");
- else
- bOk = true;
+ else if (FAILED(hr = pDSNotify->SetNotificationPositions(NBUFFBLOCKS, aPosNotify)))
+ qWarning("DXAudioInput: SetNotificationPositions");
+ else
+ bOk = true;
if (! bOk) {
@@ -186,19 +183,19 @@ DXAudioInput::~DXAudioInput() {
}
void DXAudioInput::run() {
- HRESULT hr;
+ HRESULT hr;
DWORD dwReadyBytes;
DWORD dwLastReadPos = 0;
DWORD dwReadPosition;
DWORD dwCapturePosition;
- LPVOID aptr1, aptr2;
- DWORD nbytes1, nbytes2;
+ LPVOID aptr1, aptr2;
+ DWORD nbytes1, nbytes2;
if (! bOk)
return;
- if( FAILED( hr = pDSCaptureBuffer->Start( DSCBSTART_LOOPING ) ) )
+ if (FAILED(hr = pDSCaptureBuffer->Start(DSCBSTART_LOOPING)))
qFatal("DXAudioInput: Start");
bRunning = true;
@@ -206,7 +203,7 @@ void DXAudioInput::run() {
while (bRunning) {
do {
- if( FAILED( hr = pDSCaptureBuffer->GetCurrentPosition(&dwCapturePosition, &dwReadPosition ) ) )
+ if (FAILED(hr = pDSCaptureBuffer->GetCurrentPosition(&dwCapturePosition, &dwReadPosition)))
qFatal("DXAudioInput: GetCurrentPosition");
if (dwReadPosition < dwLastReadPos)
dwReadyBytes = (dwBufferSize - dwLastReadPos) + dwReadPosition;
@@ -218,17 +215,17 @@ void DXAudioInput::run() {
}
} while (static_cast<int>(dwReadyBytes) < iByteSize);
- if (FAILED( hr = pDSCaptureBuffer->Lock(dwLastReadPos, iByteSize, &aptr1, &nbytes1, &aptr2, &nbytes2, 0)))
- qFatal("DXAudioInput: Lock from %ld (%d bytes)",dwLastReadPos, iByteSize);
+ if (FAILED(hr = pDSCaptureBuffer->Lock(dwLastReadPos, iByteSize, &aptr1, &nbytes1, &aptr2, &nbytes2, 0)))
+ qFatal("DXAudioInput: Lock from %ld (%d bytes)",dwLastReadPos, iByteSize);
- if (aptr1 && nbytes1)
- CopyMemory(psMic, aptr1, nbytes1);
+ if (aptr1 && nbytes1)
+ CopyMemory(psMic, aptr1, nbytes1);
- if (aptr2 && nbytes2)
- CopyMemory(psMic+nbytes1/2, aptr2, nbytes2);
+ if (aptr2 && nbytes2)
+ CopyMemory(psMic+nbytes1/2, aptr2, nbytes2);
- if (FAILED( hr = pDSCaptureBuffer->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
- qFatal("DXAudioInput: Unlock");
+ if (FAILED(hr = pDSCaptureBuffer->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
+ qFatal("DXAudioInput: Unlock");
dwLastReadPos = (dwLastReadPos + iByteSize) % dwBufferSize;
diff --git a/src/mumble/DXAudioInput.h b/src/mumble/DXAudioInput.h
index 496fbeb6d..ee18dbaa7 100644
--- a/src/mumble/DXAudioInput.h
+++ b/src/mumble/DXAudioInput.h
@@ -35,7 +35,7 @@
#include <dsound.h>
class DXAudioInput : public AudioInput {
- Q_OBJECT
+ Q_OBJECT
protected:
LPDIRECTSOUNDCAPTURE8 pDSCapture;
LPDIRECTSOUNDCAPTUREBUFFER pDSCaptureBuffer;
diff --git a/src/mumble/DXAudioOutput.cpp b/src/mumble/DXAudioOutput.cpp
index 89f8eb122..19c16aa00 100644
--- a/src/mumble/DXAudioOutput.cpp
+++ b/src/mumble/DXAudioOutput.cpp
@@ -47,8 +47,8 @@
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
class DXAudioOutputRegistrar : public AudioOutputRegistrar {
- public:
- DXAudioOutputRegistrar();
+ public:
+ DXAudioOutputRegistrar();
virtual AudioOutput *create();
virtual const QList<audioDevice> getDeviceChoices();
virtual void setDeviceChoice(const QVariant &);
@@ -68,10 +68,8 @@ AudioOutput *DXAudioOutputRegistrar::create() {
typedef QPair<QString, GUID> dsDevice;
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, const WCHAR* lpszDesc,
- const WCHAR* lpszDrvName, void *ctx)
-{
- if ( lpGUID )
- {
+ const WCHAR* lpszDrvName, void *ctx) {
+ if (lpGUID) {
QList<dsDevice> *l =reinterpret_cast<QList<dsDevice> *>(ctx);
*l << dsDevice(QString::fromUtf16(reinterpret_cast<const ushort*>(lpszDesc)), *lpGUID);
}
@@ -92,18 +90,18 @@ const QList<audioDevice> DXAudioOutputRegistrar::getDeviceChoices() {
if (! g.s.qbaDXOutput.isEmpty()) {
lpguid = reinterpret_cast<LPGUID>(g.s.qbaDXOutput.data());
} else {
- lpguid = &DSDEVID_DefaultVoicePlayback;
+ lpguid = &DSDEVID_DefaultVoicePlayback;
}
foreach(dsDevice d, qlOutput) {
- if (d.second == *lpguid) {
- qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
- }
+ if (d.second == *lpguid) {
+ qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
+ }
}
foreach(dsDevice d, qlOutput) {
- if (d.second != *lpguid) {
- qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
- }
+ if (d.second != *lpguid) {
+ qlReturn << audioDevice(d.first, QByteArray(reinterpret_cast<const char *>(&d.second), sizeof(GUID)));
+ }
}
return qlReturn;
}
@@ -124,61 +122,61 @@ DXAudioOutputPlayer::DXAudioOutputPlayer(DXAudioOutput *ao, AudioOutputPlayer *a
iByteSize = aop->iFrameSize * 2;
- hNotificationEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
+ hNotificationEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
void DXAudioOutputPlayer::setupAudioDevice() {
- DSBUFFERDESC dsbd;
- WAVEFORMATEX wfx;
- HRESULT hr;
-
- ZeroMemory( &wfx, sizeof(wfx) );
- wfx.wFormatTag = WAVE_FORMAT_PCM;
- wfx.nChannels = 1;
- wfx.nBlockAlign = 2;
- wfx.nSamplesPerSec = SAMPLE_RATE;
- wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
- wfx.wBitsPerSample = 16;
-
- ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
- dsbd.dwSize = sizeof(DSBUFFERDESC);
- dsbd.dwFlags = DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2;
+ DSBUFFERDESC dsbd;
+ WAVEFORMATEX wfx;
+ HRESULT hr;
+
+ ZeroMemory(&wfx, sizeof(wfx));
+ wfx.wFormatTag = WAVE_FORMAT_PCM;
+ wfx.nChannels = 1;
+ wfx.nBlockAlign = 2;
+ wfx.nSamplesPerSec = SAMPLE_RATE;
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
+ wfx.wBitsPerSample = 16;
+
+ ZeroMemory(&dsbd, sizeof(DSBUFFERDESC));
+ dsbd.dwSize = sizeof(DSBUFFERDESC);
+ dsbd.dwFlags = DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2;
dsbd.dwFlags |= DSBCAPS_CTRLPOSITIONNOTIFY;
if (dxAudio->p3DListener)
dsbd.dwFlags |= DSBCAPS_CTRL3D;
- dsbd.dwBufferBytes = aop->iFrameSize * 2 * NBLOCKS;
- dsbd.lpwfxFormat = &wfx;
+ dsbd.dwBufferBytes = aop->iFrameSize * 2 * NBLOCKS;
+ dsbd.lpwfxFormat = &wfx;
if (dxAudio->p3DListener) {
switch (g.s.a3dModel) {
case Settings::None:
case Settings::Panning:
- dsbd.guid3DAlgorithm = DS3DALG_NO_VIRTUALIZATION;
- break;
+ dsbd.guid3DAlgorithm = DS3DALG_NO_VIRTUALIZATION;
+ break;
case Settings::Light:
- dsbd.guid3DAlgorithm = DS3DALG_HRTF_LIGHT;
- break;
+ dsbd.guid3DAlgorithm = DS3DALG_HRTF_LIGHT;
+ break;
case Settings::Full:
- dsbd.guid3DAlgorithm = DS3DALG_HRTF_FULL;
- break;
+ dsbd.guid3DAlgorithm = DS3DALG_HRTF_FULL;
+ break;
}
}
- // Create the DirectSound buffer
- if( FAILED( hr = dxAudio->pDS->CreateSoundBuffer( &dsbd, &pDSBOutput, NULL ) ) )
- qFatal("DXAudioOutputPlayer: CreateSoundBuffer (Secondary): 0x%08lx", hr);
+ // Create the DirectSound buffer
+ if (FAILED(hr = dxAudio->pDS->CreateSoundBuffer(&dsbd, &pDSBOutput, NULL)))
+ qFatal("DXAudioOutputPlayer: CreateSoundBuffer (Secondary): 0x%08lx", hr);
DSBPOSITIONNOTIFY aPosNotify[NBLOCKS];
- for(int i=0;i<NBLOCKS;i++) {
+ for (int i=0;i<NBLOCKS;i++) {
aPosNotify[i].dwOffset = aop->iFrameSize * 2 * i;
aPosNotify[i].hEventNotify = hNotificationEvent;
}
- if( FAILED( hr = pDSBOutput->QueryInterface( IID_IDirectSoundNotify, reinterpret_cast<VOID**>(&pDSNotify) ) ) )
+ if (FAILED(hr = pDSBOutput->QueryInterface(IID_IDirectSoundNotify, reinterpret_cast<VOID**>(&pDSNotify))))
qFatal("DXAudioOutputPlayer: QueryInterface (Notify)");
- if( FAILED( hr = pDSNotify->SetNotificationPositions( NBLOCKS, aPosNotify ) ) )
- qFatal("DXAudioOutputPlayer: SetNotificationPositions");
+ if (FAILED(hr = pDSNotify->SetNotificationPositions(NBLOCKS, aPosNotify)))
+ qFatal("DXAudioOutputPlayer: SetNotificationPositions");
if (dxAudio->p3DListener) {
if (FAILED(pDSBOutput->QueryInterface(IID_IDirectSound3DBuffer8, reinterpret_cast<void **>(&pDS3dBuffer))))
@@ -208,29 +206,29 @@ bool DXAudioOutputPlayer::playFrames() {
int playblock;
int nowriteblock;
DWORD dwPlayPosition, dwWritePosition;
- HRESULT hr;
+ HRESULT hr;
- LPVOID aptr1, aptr2;
- DWORD nbytes1, nbytes2;
+ LPVOID aptr1, aptr2;
+ DWORD nbytes1, nbytes2;
- bool alive = true;
+ bool alive = true;
DWORD dwApply = MY_DEFERRED;
if (! pDSBOutput) {
setupAudioDevice();
- if (FAILED( hr = pDSBOutput->Lock(0, 0, &aptr1, &nbytes1, &aptr2, &nbytes2, DSBLOCK_ENTIREBUFFER)))
- qFatal("DXAudioOutputPlayer: Initial Lock");
+ if (FAILED(hr = pDSBOutput->Lock(0, 0, &aptr1, &nbytes1, &aptr2, &nbytes2, DSBLOCK_ENTIREBUFFER)))
+ qFatal("DXAudioOutputPlayer: Initial Lock");
- dwBufferSize = nbytes1 + nbytes2;
- if (aptr1)
- ZeroMemory(aptr1, nbytes1);
- if (aptr2)
- ZeroMemory(aptr2, nbytes2);
+ dwBufferSize = nbytes1 + nbytes2;
+ if (aptr1)
+ ZeroMemory(aptr1, nbytes1);
+ if (aptr2)
+ ZeroMemory(aptr2, nbytes2);
- if (FAILED( hr = pDSBOutput->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
- qFatal("DXAudioOutputPlayer: Initial Unlock");
+ if (FAILED(hr = pDSBOutput->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
+ qFatal("DXAudioOutputPlayer: Initial Unlock");
dwApply = DS3D_IMMEDIATE;
@@ -241,19 +239,19 @@ bool DXAudioOutputPlayer::playFrames() {
iLastwriteblock = (NBLOCKS - 1 + g.s.iDXOutputDelay) % NBLOCKS;
}
- if( FAILED( hr = pDSBOutput->GetCurrentPosition(&dwPlayPosition, &dwWritePosition ) ) )
+ if (FAILED(hr = pDSBOutput->GetCurrentPosition(&dwPlayPosition, &dwWritePosition)))
qFatal("DXAudioOutputPlayer: GetCurrentPosition");
playblock = dwWritePosition / iByteSize;
nowriteblock = (playblock + g.s.iDXOutputDelay + 1) % NBLOCKS;
- for(int block=(iLastwriteblock + 1) % NBLOCKS;alive && (block!=nowriteblock);block=(block + 1) % NBLOCKS) {
+ for (int block=(iLastwriteblock + 1) % NBLOCKS;alive && (block!=nowriteblock);block=(block + 1) % NBLOCKS) {
// Apparantly, even high end cards can sometimes move the play cursor BACKWARDS in 3D mode.
// If that happens, let's just say we're in synch.
bool broken = false;
- for(int i=0;i<10;i++)
+ for (int i=0;i<10;i++)
if ((nowriteblock + i)%NBLOCKS == iLastwriteblock)
broken = true;
@@ -301,19 +299,19 @@ bool DXAudioOutputPlayer::playFrames() {
}
}
- if (FAILED( hr = pDSBOutput->Lock(block * iByteSize, iByteSize, &aptr1, &nbytes1, &aptr2, &nbytes2, 0)))
- qFatal("DXAudioOutput: Lock block %d (%d bytes)",block, iByteSize);
+ if (FAILED(hr = pDSBOutput->Lock(block * iByteSize, iByteSize, &aptr1, &nbytes1, &aptr2, &nbytes2, 0)))
+ qFatal("DXAudioOutput: Lock block %d (%d bytes)",block, iByteSize);
if (aptr1 && nbytes1)
CopyMemory(aptr1, aop->psBuffer, MIN(iByteSize, nbytes1));
if (aptr2 && nbytes2)
CopyMemory(aptr2, aop->psBuffer+(nbytes1/2), MIN(iByteSize-nbytes1, nbytes2));
- if (FAILED( hr = pDSBOutput->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
- qFatal("DXAudioOutput: Unlock");
+ if (FAILED(hr = pDSBOutput->Unlock(aptr1, nbytes1, aptr2, nbytes2)))
+ qFatal("DXAudioOutput: Unlock");
// If we get another while we're working, we're already taking care of it.
ResetEvent(hNotificationEvent);
- if( FAILED( hr = pDSBOutput->GetCurrentPosition(&dwPlayPosition, &dwWritePosition ) ) )
+ if (FAILED(hr = pDSBOutput->GetCurrentPosition(&dwPlayPosition, &dwWritePosition)))
qFatal("DXAudioOutputPlayer: GetCurrentPosition");
playblock = dwWritePosition / iByteSize;
@@ -322,9 +320,9 @@ bool DXAudioOutputPlayer::playFrames() {
if (! bPlaying) {
- if (FAILED( hr = pDSBOutput->Play(0, 0, DSBPLAY_LOOPING)))
- qFatal("DXAUdioOutputPlayer: Play");
- bPlaying = true;
+ if (FAILED(hr = pDSBOutput->Play(0, 0, DSBPLAY_LOOPING)))
+ qFatal("DXAUdioOutputPlayer: Play");
+ bPlaying = true;
}
return true;
@@ -333,9 +331,9 @@ bool DXAudioOutputPlayer::playFrames() {
DXAudioOutput::DXAudioOutput() {
HRESULT hr;
- DSBUFFERDESC dsbdesc;
- WAVEFORMATEX wfx;
- WAVEFORMATEX wfxSet;
+ DSBUFFERDESC dsbdesc;
+ WAVEFORMATEX wfx;
+ WAVEFORMATEX wfxSet;
pDS = NULL;
@@ -343,47 +341,47 @@ DXAudioOutput::DXAudioOutput() {
bOk = false;
- ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) );
- dsbdesc.dwSize = sizeof(DSBUFFERDESC);
- dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
- if (g.s.a3dModel != Settings::None)
- dsbdesc.dwFlags |= DSBCAPS_CTRL3D;
+ ZeroMemory(&dsbdesc, sizeof(DSBUFFERDESC));
+ dsbdesc.dwSize = sizeof(DSBUFFERDESC);
+ dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
+ if (g.s.a3dModel != Settings::None)
+ dsbdesc.dwFlags |= DSBCAPS_CTRL3D;
- ZeroMemory( &wfxSet, sizeof(wfxSet) );
- wfxSet.wFormatTag = WAVE_FORMAT_PCM;
+ ZeroMemory(&wfxSet, sizeof(wfxSet));
+ wfxSet.wFormatTag = WAVE_FORMAT_PCM;
- ZeroMemory( &wfx, sizeof(wfx) );
- wfx.wFormatTag = WAVE_FORMAT_PCM;
+ ZeroMemory(&wfx, sizeof(wfx));
+ wfx.wFormatTag = WAVE_FORMAT_PCM;
- wfx.nChannels = 1;
- wfx.nSamplesPerSec = SAMPLE_RATE;
- wfx.nBlockAlign = 2;
- wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
- wfx.wBitsPerSample = 16;
+ wfx.nChannels = 1;
+ wfx.nSamplesPerSec = SAMPLE_RATE;
+ wfx.nBlockAlign = 2;
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
+ wfx.wBitsPerSample = 16;
pDS = NULL;
pDSBPrimary = NULL;
p3DListener = NULL;
- hNotificationEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
+ hNotificationEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (! g.s.qbaDXOutput.isEmpty()) {
LPGUID lpguid = reinterpret_cast<LPGUID>(g.s.qbaDXOutput.data());
- if( FAILED( hr = DirectSoundCreate8(lpguid, &pDS, NULL))) {
+ if (FAILED(hr = DirectSoundCreate8(lpguid, &pDS, NULL))) {
failed = true;
}
}
- if (! pDS && FAILED( hr = DirectSoundCreate8( &DSDEVID_DefaultVoicePlayback, &pDS, NULL ) ) )
+ if (! pDS && FAILED(hr = DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback, &pDS, NULL)))
qWarning("DXAudioOutput: DirectSoundCreate");
- else if( FAILED( hr = pDS->SetCooperativeLevel( g.mw->winId(), DSSCL_PRIORITY ) ) )
+ else if (FAILED(hr = pDS->SetCooperativeLevel(g.mw->winId(), DSSCL_PRIORITY)))
qWarning("DXAudioOutput: SetCooperativeLevel");
- else if( FAILED( hr = pDS->CreateSoundBuffer( &dsbdesc, &pDSBPrimary, NULL ) ) )
- qWarning("DXAudioOutput: CreateSoundBuffer (Primary) : 0x%08lx", hr);
- else if( FAILED( hr = pDSBPrimary->SetFormat( &wfx ) ) )
- qFatal("DXAudioOutput: SetFormat");
- else if( FAILED( hr = pDSBPrimary->GetFormat( &wfxSet, sizeof(wfxSet), NULL ) ) )
- qFatal("DXAudioOutput: GetFormat");
+ else if (FAILED(hr = pDS->CreateSoundBuffer(&dsbdesc, &pDSBPrimary, NULL)))
+ qWarning("DXAudioOutput: CreateSoundBuffer (Primary) : 0x%08lx", hr);
+ else if (FAILED(hr = pDSBPrimary->SetFormat(&wfx)))
+ qFatal("DXAudioOutput: SetFormat");
+ else if (FAILED(hr = pDSBPrimary->GetFormat(&wfxSet, sizeof(wfxSet), NULL)))
+ qFatal("DXAudioOutput: GetFormat");
else if (g.s.a3dModel != Settings::None) {
if (FAILED(hr = pDSBPrimary->QueryInterface(IID_IDirectSound3DListener8, reinterpret_cast<void **>(&p3DListener)))) {
qWarning("DXAudioOutput: QueryInterface (DirectSound3DListener8): 0x%08lx",hr);
@@ -447,23 +445,23 @@ void DXAudioOutput::updateListener() {
// the 3d mode for the buffers will be disabled, so don't bother with updates.
p3DListener->SetPosition(p->fPosition[0], p->fPosition[1], p->fPosition[2], MY_DEFERRED);
p3DListener->SetOrientation(p->fFront[0], p->fFront[1], p->fFront[2],
- p->fTop[0], p->fTop[1], p->fTop[2], MY_DEFERRED);
+ p->fTop[0], p->fTop[1], p->fTop[2], MY_DEFERRED);
}
if (FAILED(hr =p3DListener->CommitDeferredSettings()))
qWarning("DXAudioOutputPlayer: CommitDeferrredSettings failed 0x%08lx", hr);
-/*
- float a[3], b[3];
- p3DListener->GetOrientation((D3DVECTOR *) a, (D3DVECTOR *) b);
- qWarning("%f %f %f -- %f %f %f", a[0], a[1], a[2], b[0], b[1], b[2]);
-*/
+ /*
+ float a[3], b[3];
+ p3DListener->GetOrientation((D3DVECTOR *) a, (D3DVECTOR *) b);
+ qWarning("%f %f %f -- %f %f %f", a[0], a[1], a[2], b[0], b[1], b[2]);
+ */
}
void DXAudioOutput::removeBuffer(AudioOutputPlayer *aop) {
- DXAudioOutputPlayer *dxaop=qhPlayers.take(aop);
- if (dxaop)
- delete dxaop;
- AudioOutput::removeBuffer(aop);
+ DXAudioOutputPlayer *dxaop=qhPlayers.take(aop);
+ if (dxaop)
+ delete dxaop;
+ AudioOutput::removeBuffer(aop);
}
void DXAudioOutput::run() {
@@ -476,7 +474,8 @@ void DXAudioOutput::run() {
LARGE_INTEGER ticksPerSecond;
LARGE_INTEGER ticksPerFrame;
LARGE_INTEGER ticksNow;
- LARGE_INTEGER ticksNext = {QuadPart: 0L};
+LARGE_INTEGER ticksNext = {QuadPart:
+ 0L};
bool found;
bool alive;
diff --git a/src/mumble/DXAudioOutput.h b/src/mumble/DXAudioOutput.h
index 6adce0dc2..be6aa2b50 100644
--- a/src/mumble/DXAudioOutput.h
+++ b/src/mumble/DXAudioOutput.h
@@ -37,7 +37,7 @@
class DXAudioOutput;
class DXAudioOutputPlayer {
- friend class DXAudioOutput;
+ friend class DXAudioOutput;
protected:
LPDIRECTSOUNDBUFFER pDSBOutput;
LPDIRECTSOUNDNOTIFY8 pDSNotify;
@@ -66,8 +66,8 @@ class DXAudioOutputPlayer {
class DXAudioOutput : public AudioOutput {
- friend class DXAudioOutputPlayer;
- Q_OBJECT
+ friend class DXAudioOutputPlayer;
+ Q_OBJECT
protected:
LPDIRECTSOUND8 pDS;
LPDIRECTSOUNDBUFFER pDSBPrimary;
diff --git a/src/mumble/DXConfigDialog.cpp b/src/mumble/DXConfigDialog.cpp
index e3021cee1..942569ed1 100644
--- a/src/mumble/DXConfigDialog.cpp
+++ b/src/mumble/DXConfigDialog.cpp
@@ -39,10 +39,8 @@ static ConfigRegistrar registrar(20, DXConfigDialogNew);
static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, const WCHAR* lpszDesc,
- const WCHAR* lpszDrvName, void *ctx)
-{
- if ( lpGUID )
- {
+ const WCHAR* lpszDrvName, void *ctx) {
+ if (lpGUID) {
QList<dsDevice> *l =reinterpret_cast<QList<dsDevice> *>(ctx);
*l << dsDevice(QString::fromUtf16(reinterpret_cast<const ushort*>(lpszDesc)), *lpGUID);
}
@@ -86,7 +84,7 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbInputDevice->setToolTip(tr("Device to use for microphone"));
qcbInputDevice->setWhatsThis(tr("This sets the input device to use, which is where you have connected the "
- "microphone."));
+ "microphone."));
l = new QLabel(tr("Input"));
l->setBuddy(qcbInputDevice);
grid->addWidget(l, 0, 0);
@@ -94,7 +92,7 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbOutputDevice->setToolTip(tr("Device to use for speakers/headphones"));
qcbOutputDevice->setWhatsThis(tr("This sets the output device to use, which is where you have connected your "
- "speakers or your headset."));
+ "speakers or your headset."));
l = new QLabel(tr("Output"));
l->setBuddy(qcbOutputDevice);
grid->addWidget(l, 1, 0);
@@ -118,8 +116,8 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
on_OutputDelay_valueChanged(qsOutputDelay->value());
qsOutputDelay->setToolTip(tr("Amount of data to buffer for DirectSound"));
qsOutputDelay->setWhatsThis(tr("This sets the amount of data to prebuffer in the DirectSound buffer. "
- "Experiment with different values and set it to the lowest which doesn't "
- "cause rapid jitter in the sound."));
+ "Experiment with different values and set it to the lowest which doesn't "
+ "cause rapid jitter in the sound."));
grid->addWidget(l, 0, 0);
grid->addWidget(qsOutputDelay, 0, 1);
grid->addWidget(qlOutputDelay, 0, 2);
@@ -140,13 +138,13 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
qcbMethod->setToolTip(tr("3D Sound Algorithm"));
qcbMethod->setWhatsThis(tr("This sets what 3D Sound algorithm to use.<br />"
- "<b>None</b> - Disable 3D Sound (least CPU).<br />"
- "<b>Panning</b> - Just use stereo panning (some CPU).<br />"
- "<b>Light/Full HRTF</b> - Head-Related Transfer Functions enabled. "
- "This may use a small amount of CPU.<br />"
- "Note that if you have a soundcard with <i>hardware</i> 3D processing, HRTF "
- "processing will be done on the soundcard and will use practically no processing "
- "power."));
+ "<b>None</b> - Disable 3D Sound (least CPU).<br />"
+ "<b>Panning</b> - Just use stereo panning (some CPU).<br />"
+ "<b>Light/Full HRTF</b> - Head-Related Transfer Functions enabled. "
+ "This may use a small amount of CPU.<br />"
+ "Note that if you have a soundcard with <i>hardware</i> 3D processing, HRTF "
+ "processing will be done on the soundcard and will use practically no processing "
+ "power."));
l = new QLabel(tr("Method"));
l->setBuddy(qcbMethod);
grid->addWidget(l, 0, 0);
@@ -169,7 +167,7 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
on_MinDistance_valueChanged(qsMinDistance->value());
qsMinDistance->setToolTip(tr("Minimum distance to player before sound decreases"));
qsMinDistance->setWhatsThis(tr("This sets the minimum distance for sound calculations. The volume of other players' "
- "speech will not decrease until they are at least this far away from you."));
+ "speech will not decrease until they are at least this far away from you."));
grid->addWidget(l, 1, 0);
grid->addWidget(qsMinDistance, 1, 1);
grid->addWidget(qlMinDistance, 1, 2);
@@ -186,7 +184,7 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
on_MaxDistance_valueChanged(qsMaxDistance->value());
qsMaxDistance->setToolTip(tr("Maximum distance, beyond which sound won't decrease"));
qsMaxDistance->setWhatsThis(tr("This sets the maximum distance for sound calculations. When farther away than this, "
- "other players' sound volume will not decrease any more."));
+ "other players' sound volume will not decrease any more."));
grid->addWidget(l, 2, 0);
grid->addWidget(qsMaxDistance, 2, 1);
grid->addWidget(qlMaxDistance, 2, 2);
@@ -203,8 +201,8 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
on_RollOff_valueChanged(qsRollOff->value());
qsRollOff->setToolTip(tr("Factor for sound volume decrease"));
qsRollOff->setWhatsThis(tr("How fast should sound volume drop when passing beyond the minimum distance. The normal (1.0) is that "
- "sound volume halves each time the distance doubles. Increasing this value means sound volume "
- "drops faster, while decreasing it means it drops slower."));
+ "sound volume halves each time the distance doubles. Increasing this value means sound volume "
+ "drops faster, while decreasing it means it drops slower."));
grid->addWidget(l, 3, 0);
grid->addWidget(qsRollOff, 3, 1);
grid->addWidget(qlRollOff, 3, 2);
@@ -221,9 +219,9 @@ DXConfigDialog::DXConfigDialog(QWidget *p) : ConfigWidget(p) {
setLayout(v);
- on_Method_currentIndexChanged(qcbMethod->currentIndex());
+ on_Method_currentIndexChanged(qcbMethod->currentIndex());
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
@@ -279,11 +277,11 @@ void DXConfigDialog::updateIntensity() {
}
void DXConfigDialog::on_Method_currentIndexChanged(int v) {
- bool ena = (v > 0);
- qsMinDistance->setEnabled(ena);
- qsMaxDistance->setEnabled(ena);
- qsRollOff->setEnabled(ena);
- qlMinDistance->setEnabled(ena);
- qlMaxDistance->setEnabled(ena);
- qlRollOff->setEnabled(ena);
+ bool ena = (v > 0);
+ qsMinDistance->setEnabled(ena);
+ qsMaxDistance->setEnabled(ena);
+ qsRollOff->setEnabled(ena);
+ qlMinDistance->setEnabled(ena);
+ qlMaxDistance->setEnabled(ena);
+ qlRollOff->setEnabled(ena);
}
diff --git a/src/mumble/DXConfigDialog.h b/src/mumble/DXConfigDialog.h
index 3b8f0f522..90a346076 100644
--- a/src/mumble/DXConfigDialog.h
+++ b/src/mumble/DXConfigDialog.h
@@ -38,7 +38,7 @@
typedef QPair<QString, GUID> dsDevice;
class DXConfigDialog : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QList<dsDevice> qlInput;
QList<dsDevice> qlOutput;
diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp
index 0cb85dc28..352a66906 100644
--- a/src/mumble/Database.cpp
+++ b/src/mumble/Database.cpp
@@ -43,7 +43,7 @@ Database::Database() {
datapaths << QDir::currentPath();
bool found = false;
- for(i = 0; (i < datapaths.size()) && ! found; i++) {
+ for (i = 0; (i < datapaths.size()) && ! found; i++) {
if (!datapaths[i].isEmpty()) {
QFile f(datapaths[i] + QLatin1String("/mumble.sqlite"));
if (f.exists()) {
@@ -60,7 +60,7 @@ Database::Database() {
}
if (! found) {
- for(i = 0; (i < datapaths.size()) && ! found; i++) {
+ for (i = 0; (i < datapaths.size()) && ! found; i++) {
if (!datapaths[i].isEmpty()) {
QFile f(datapaths[i] + QLatin1String("/.mumble.sqlite"));
db.setDatabaseName(f.fileName());
@@ -84,23 +84,23 @@ Database::Database() {
}
const QString Database::getDigest(const QString &hostname, unsigned short port) {
- QSqlQuery query;
-
- query.prepare("SELECT digest FROM cert WHERE hostname = ? AND port = ?");
- query.addBindValue(hostname);;
- query.addBindValue(port);
- query.exec();
- if (query.next()) {
- return query.value(0).toString();
- }
- return QString();
+ QSqlQuery query;
+
+ query.prepare("SELECT digest FROM cert WHERE hostname = ? AND port = ?");
+ query.addBindValue(hostname);;
+ query.addBindValue(port);
+ query.exec();
+ if (query.next()) {
+ return query.value(0).toString();
+ }
+ return QString();
}
void Database::setDigest(const QString &hostname, unsigned short port, const QString &digest) {
- QSqlQuery query;
- query.prepare("REPLACE INTO cert (hostname,port,digest) VALUES (?,?,?)");
- query.addBindValue(hostname);
- query.addBindValue(port);
- query.addBindValue(digest);
- query.exec();
+ QSqlQuery query;
+ query.prepare("REPLACE INTO cert (hostname,port,digest) VALUES (?,?,?)");
+ query.addBindValue(hostname);
+ query.addBindValue(port);
+ query.addBindValue(digest);
+ query.exec();
}
diff --git a/src/mumble/Database.h b/src/mumble/Database.h
index 7a6fa04b5..691d7cb55 100644
--- a/src/mumble/Database.h
+++ b/src/mumble/Database.h
@@ -31,8 +31,8 @@
#ifndef _DATABASE_H
#define _DATABASE_H
-class Database : public QObject{
- Q_OBJECT
+class Database : public QObject {
+ Q_OBJECT
public:
Database();
static const QString getDigest(const QString &hostname, unsigned short port);
diff --git a/src/mumble/FMODAudio.cpp b/src/mumble/FMODAudio.cpp
index a0a224118..456b81c4c 100644
--- a/src/mumble/FMODAudio.cpp
+++ b/src/mumble/FMODAudio.cpp
@@ -78,29 +78,29 @@ FMODSystemPtr FMODSystem::getSystem() {
}
void FMODSystem::run() {
- FMOD_RESULT result;
+ FMOD_RESULT result;
- result = FMOD_System_Create(&system);
- if (result != FMOD_OK)
- qWarning("FMODSystem: FMOD_System_Create %d", result);
+ result = FMOD_System_Create(&system);
+ if (result != FMOD_OK)
+ qWarning("FMODSystem: FMOD_System_Create %d", result);
+
+ FMOD_System_SetOutput(system, FMOD_OUTPUTTYPE_ALSA);
+ if (result != FMOD_OK)
+ qWarning("FMODSystem: FMOD_System_SetOutput %d", result);
- FMOD_System_SetOutput(system, FMOD_OUTPUTTYPE_ALSA);
- if (result != FMOD_OK)
- qWarning("FMODSystem: FMOD_System_SetOutput %d", result);
-
result = FMOD_System_Init(system, 4, FMOD_INIT_NORMAL, NULL);
- if (result != FMOD_OK)
- qWarning("FMODSystem: FMOD_System_Init %d: %s", result,FMOD_ErrorString(result));
+ if (result != FMOD_OK)
+ qWarning("FMODSystem: FMOD_System_Init %d: %s", result,FMOD_ErrorString(result));
qWarning("FMODSystem: System initialized");
while (bRunning) {
if (aoOutput) {
- if (! aoOutput->bRunning) {
- aoOutput->wipe();
- qwWait.wakeAll();
- } else
- aoOutput->frame(system);
+ if (! aoOutput->bRunning) {
+ aoOutput->wipe();
+ qwWait.wakeAll();
+ } else
+ aoOutput->frame(system);
}
if (aiInput) {
if (! aiInput->bRunning) {
@@ -113,10 +113,10 @@ void FMODSystem::run() {
msleep(10);
};
- result = FMOD_System_Close(system);
- result = FMOD_System_Release(system);
+ result = FMOD_System_Close(system);
+ result = FMOD_System_Release(system);
- qWarning("FMODSystem: Exiting");
+ qWarning("FMODSystem: Exiting");
}
FMODAudioInput::FMODAudioInput() {
@@ -153,18 +153,18 @@ void FMODAudioInput::run() {
void FMODAudioInput::frame(FMOD_SYSTEM *system) {
if (! sound) {
- FMOD_CREATESOUNDEXINFO exinfo;
- FMOD_RESULT result;
+ FMOD_CREATESOUNDEXINFO exinfo;
+ FMOD_RESULT result;
- memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
+ memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
- uiBufferSize = iFrameSize * sizeof(short) * 32;
+ uiBufferSize = iFrameSize * sizeof(short) * 32;
- exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
- exinfo.numchannels = 1;
- exinfo.format = FMOD_SOUND_FORMAT_PCM16;
- exinfo.defaultfrequency = SAMPLE_RATE;
- exinfo.length = uiBufferSize;
+ exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
+ exinfo.numchannels = 1;
+ exinfo.format = FMOD_SOUND_FORMAT_PCM16;
+ exinfo.defaultfrequency = SAMPLE_RATE;
+ exinfo.length = uiBufferSize;
result = FMOD_System_CreateSound(system, 0, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENUSER, &exinfo, &sound);
result = FMOD_System_RecordStart(system, sound, true);
@@ -183,19 +183,19 @@ void FMODAudioInput::frame(FMOD_SYSTEM *system) {
ready = (uiBufferSize - uiLastRead) + recordpos;
else
ready = recordpos - uiLastRead;
-
-
+
+
if (ready > iByteSize) {
- void *ptr1, *ptr2;
- unsigned int len1, len2;
+ void *ptr1, *ptr2;
+ unsigned int len1, len2;
FMOD_Sound_Lock(sound, uiLastRead, iByteSize, &ptr1, &ptr2, &len1, &len2);
- if (ptr1 && len1)
- CopyMemory(psMic, ptr1, len1);
+ if (ptr1 && len1)
+ CopyMemory(psMic, ptr1, len1);
- if (ptr2 && len2)
- CopyMemory(psMic+len1/2, ptr2, len2);
+ if (ptr2 && len2)
+ CopyMemory(psMic+len1/2, ptr2, len2);
FMOD_Sound_Unlock(sound, ptr1, ptr2, len1, len2);
@@ -204,7 +204,7 @@ void FMODAudioInput::frame(FMOD_SYSTEM *system) {
uiLastRead = (uiLastRead + iByteSize) % uiBufferSize;
}
- } while(ready >= iByteSize * 2);
+ } while (ready >= iByteSize * 2);
}
FMODOutputPlayer::FMODOutputPlayer(FMODAudioOutput *ao, Player *player) : AudioOutputPlayer(ao, player) {
@@ -219,25 +219,25 @@ void FMODOutputPlayer::setupSound(FMOD_SYSTEM *system) {
FMOD_RESULT result;
FMOD_MODE mode = FMOD_2D | FMOD_OPENUSER | FMOD_LOOP_NORMAL | FMOD_SOFTWARE | FMOD_CREATESTREAM;
memset(&createsoundexinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
- createsoundexinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); /* required. */
- createsoundexinfo.decodebuffersize = iFrameSize * 5; /* Chunk size of stream update in samples. This will be the amount of data passed to the user callback. */
- createsoundexinfo.length = iFrameSize * sizeof(signed short) * 10; /* Length of PCM data in bytes of whole song (for Sound::getLength) */
- createsoundexinfo.numchannels = 1; /* Number of channels in the sound. */
- createsoundexinfo.defaultfrequency = SAMPLE_RATE; /* Default playback rate of sound. */
- createsoundexinfo.format = FMOD_SOUND_FORMAT_PCM16; /* Data format of sound. */
- createsoundexinfo.pcmreadcallback = PCMReadCallback; /* User callback for reading. */
- createsoundexinfo.userdata = this;
+ createsoundexinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); /* required. */
+ createsoundexinfo.decodebuffersize = iFrameSize * 5; /* Chunk size of stream update in samples. This will be the amount of data passed to the user callback. */
+ createsoundexinfo.length = iFrameSize * sizeof(signed short) * 10; /* Length of PCM data in bytes of whole song (for Sound::getLength) */
+ createsoundexinfo.numchannels = 1; /* Number of channels in the sound. */
+ createsoundexinfo.defaultfrequency = SAMPLE_RATE; /* Default playback rate of sound. */
+ createsoundexinfo.format = FMOD_SOUND_FORMAT_PCM16; /* Data format of sound. */
+ createsoundexinfo.pcmreadcallback = PCMReadCallback; /* User callback for reading. */
+ createsoundexinfo.userdata = this;
bSetup = true;
- result = FMOD_System_CreateSound(system, 0, mode, &createsoundexinfo, &sound);
- if (result != FMOD_OK)
- qWarning("FMODOutputPlayer: FMOD_System_CreateSound %d", result);
- result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
- if (result != FMOD_OK)
- qWarning("FMODOutputPlayer: FMOD_System_PlaySound %d", result);
+ result = FMOD_System_CreateSound(system, 0, mode, &createsoundexinfo, &sound);
+ if (result != FMOD_OK)
+ qWarning("FMODOutputPlayer: FMOD_System_CreateSound %d", result);
+ result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, 0, &channel);
+ if (result != FMOD_OK)
+ qWarning("FMODOutputPlayer: FMOD_System_PlaySound %d", result);
- bSetup = false;
+ bSetup = false;
qWarning("FMODOutputPlayer: %s initialized", qPrintable(p->qsName));
@@ -272,7 +272,7 @@ void FMODOutputPlayer::ReadNextFrames(void *data, unsigned int datalen) {
bool alive;
- while(datalen) {
+ while (datalen) {
alive = decodeNextFrame();
psBuffer += iFrameSize;
datalen -= iByteSize;
diff --git a/src/mumble/FMODAudio.h b/src/mumble/FMODAudio.h
index acae53b4d..497c0f133 100644
--- a/src/mumble/FMODAudio.h
+++ b/src/mumble/FMODAudio.h
@@ -44,9 +44,9 @@ typedef boost::shared_ptr<FMODSystem> FMODSystemPtr;
typedef boost::weak_ptr<FMODSystem> WeakFMODSystemPtr;
class FMODSystem : public QThread {
- friend class FMODAudioOutput;
- friend class FMODAudioInput;
- Q_OBJECT
+ friend class FMODAudioOutput;
+ friend class FMODAudioInput;
+ Q_OBJECT
protected:
static QMutex qmSystem;
static WeakFMODSystemPtr fsSystem;
@@ -66,8 +66,8 @@ class FMODSystem : public QThread {
};
class FMODAudioInput : public AudioInput {
- friend class FMODSystem;
- Q_OBJECT
+ friend class FMODSystem;
+ Q_OBJECT
protected:
FMOD_SOUND *sound;
unsigned int uiLastRead;
@@ -82,8 +82,8 @@ class FMODAudioInput : public AudioInput {
class FMODAudioOutput;
class FMODOutputPlayer : public AudioOutputPlayer {
- friend class FMODAudioOutput;
- Q_OBJECT
+ friend class FMODAudioOutput;
+ Q_OBJECT
protected:
FMOD_SOUND *sound;
FMOD_CHANNEL *channel;
@@ -94,19 +94,19 @@ class FMODOutputPlayer : public AudioOutputPlayer {
void setupSound(FMOD_SYSTEM *system);
void ReadNextFrames(void *data, unsigned int datalen);
static FMOD_RESULT F_CALLBACK PCMReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen);
- public:
+ public:
FMODOutputPlayer(FMODAudioOutput *, Player *);
~FMODOutputPlayer();
};
class FMODAudioOutput : public AudioOutput {
- friend class FMODSystem;
- friend class FMODOutputPlayer;
- Q_OBJECT
+ friend class FMODSystem;
+ friend class FMODOutputPlayer;
+ Q_OBJECT
protected:
- virtual AudioOutputPlayer *getPlayer(Player *);
- void frame(FMOD_SYSTEM *system);
+ virtual AudioOutputPlayer *getPlayer(Player *);
+ void frame(FMOD_SYSTEM *system);
public:
FMODAudioOutput();
~FMODAudioOutput();
diff --git a/src/mumble/Global.h b/src/mumble/Global.h
index dadf20b4d..da3385826 100644
--- a/src/mumble/Global.h
+++ b/src/mumble/Global.h
@@ -54,7 +54,7 @@ class QSettings;
class Overlay;
struct Global {
- enum LoopMode { None, Local, Server };
+ enum LoopMode { None, Local, Server };
MainWindow *mw;
Settings s;
ServerHandler *sh;
diff --git a/src/mumble/GlobalShortcut.h b/src/mumble/GlobalShortcut.h
index 5b92c2841..59034cc49 100644
--- a/src/mumble/GlobalShortcut.h
+++ b/src/mumble/GlobalShortcut.h
@@ -37,13 +37,13 @@
#include <QVariant>
class GlobalShortcut : public QObject {
- friend class GlobalShortcutWin;
- friend class GlobalShortcutWinConfig;
- friend class GlobalShortcutX;
- friend class GlobalShortcutXConfig;
- Q_OBJECT
- Q_PROPERTY(QVariant data READ data WRITE setData)
- Q_PROPERTY(bool active READ active)
+ friend class GlobalShortcutWin;
+ friend class GlobalShortcutWinConfig;
+ friend class GlobalShortcutX;
+ friend class GlobalShortcutXConfig;
+ Q_OBJECT
+ Q_PROPERTY(QVariant data READ data WRITE setData)
+ Q_PROPERTY(bool active READ active)
protected:
QString name;
QVariant dv;
@@ -56,11 +56,17 @@ class GlobalShortcut : public QObject {
public:
GlobalShortcut(QObject *parent, int index, QString qsName);
~GlobalShortcut();
- QVariant data() const { return dv; };
- void setData(QVariant d) { dv = d; };
- bool active() const { return act; };
+ QVariant data() const {
+ return dv;
+ };
+ void setData(QVariant d) {
+ dv = d;
+ };
+ bool active() const {
+ return act;
+ };
private:
- Q_DISABLE_COPY(GlobalShortcut)
+ Q_DISABLE_COPY(GlobalShortcut)
};
#else
diff --git a/src/mumble/GlobalShortcut_unix.cpp b/src/mumble/GlobalShortcut_unix.cpp
index 05f4de3d4..9b2ed65f5 100644
--- a/src/mumble/GlobalShortcut_unix.cpp
+++ b/src/mumble/GlobalShortcut_unix.cpp
@@ -38,326 +38,324 @@
static GlobalShortcutX *gsx = NULL;
static ConfigWidget *GlobalShortcutXConfigDialogNew() {
- return new GlobalShortcutXConfig();
+ return new GlobalShortcutXConfig();
}
static ConfigRegistrar registrar(55, GlobalShortcutXConfigDialogNew);
XInputKeyWidget::XInputKeyWidget(QWidget *p) : QLineEdit(p) {
- setReadOnly(true);
- clearFocus();
- bModified = false;
- displayKeys();
+ setReadOnly(true);
+ clearFocus();
+ bModified = false;
+ displayKeys();
}
void XInputKeyWidget::setShortcut(GlobalShortcut *gs) {
- if (gsx->qhGlobalToX.contains(gs)) {
- Shortcut *s = gsx->qhGlobalToX[gs];
- qlButtons = s->qlButtons;
- displayKeys();
- }
+ if (gsx->qhGlobalToX.contains(gs)) {
+ Shortcut *s = gsx->qhGlobalToX[gs];
+ qlButtons = s->qlButtons;
+ displayKeys();
+ }
}
void XInputKeyWidget::focusInEvent(QFocusEvent *e) {
- if (e->reason() == Qt::MouseFocusReason) {
- setText(tr("Press Shortcut"));
+ if (e->reason() == Qt::MouseFocusReason) {
+ setText(tr("Press Shortcut"));
- QPalette pal=parentWidget()->palette();
- pal.setColor(QPalette::Base, pal.color(QPalette::Base).dark(120));
- setPalette(pal);
+ QPalette pal=parentWidget()->palette();
+ pal.setColor(QPalette::Base, pal.color(QPalette::Base).dark(120));
+ setPalette(pal);
- setForegroundRole(QPalette::Button);
+ setForegroundRole(QPalette::Button);
gsx->resetMap();
connect(gsx, SIGNAL(buttonPressed(bool)), this, SLOT(setButton(bool)));
- }
+ }
}
void XInputKeyWidget::focusOutEvent(QFocusEvent *) {
- setPalette(parentWidget()->palette());
- clearFocus();
+ setPalette(parentWidget()->palette());
+ clearFocus();
disconnect(gsx, SIGNAL(buttonPressed(bool)), this, SLOT(setButton(bool)));
- displayKeys();
+ displayKeys();
}
-void XInputKeyWidget::mouseDoubleClickEvent (QMouseEvent *) {
- bModified = true;
- qlButtons.clear();
- clearFocus();
- displayKeys();
+void XInputKeyWidget::mouseDoubleClickEvent(QMouseEvent *) {
+ bModified = true;
+ qlButtons.clear();
+ clearFocus();
+ displayKeys();
}
void XInputKeyWidget::setButton(bool last) {
- qlButtons = gsx->getCurrentButtons();
- bModified = true;
- if (last)
- clearFocus();
- else
- displayKeys();
+ qlButtons = gsx->getCurrentButtons();
+ bModified = true;
+ if (last)
+ clearFocus();
+ else
+ displayKeys();
}
void XInputKeyWidget::displayKeys() {
- QStringList sl;
- foreach(int key, qlButtons) {
- KeySym ks=XKeycodeToKeysym(QX11Info::display(), key, 0);
- if (ks == NoSymbol) {
- sl << QLatin1String("0x")+QString::number(key,16);
- } else {
- const char *str = XKeysymToString(ks);
- if (strlen(str) == 0) {
- sl << QLatin1String("KS0x")+QString::number(ks,16);
- } else {
- sl << QLatin1String(str);
- }
- }
- }
- setText(sl.join(QLatin1String(" ")));
+ QStringList sl;
+ foreach(int key, qlButtons) {
+ KeySym ks=XKeycodeToKeysym(QX11Info::display(), key, 0);
+ if (ks == NoSymbol) {
+ sl << QLatin1String("0x")+QString::number(key,16);
+ } else {
+ const char *str = XKeysymToString(ks);
+ if (strlen(str) == 0) {
+ sl << QLatin1String("KS0x")+QString::number(ks,16);
+ } else {
+ sl << QLatin1String(str);
+ }
+ }
+ }
+ setText(sl.join(QLatin1String(" ")));
}
GlobalShortcutXConfig::GlobalShortcutXConfig(QWidget *p) : ConfigWidget(p) {
- QGroupBox *qgbShortcuts = new QGroupBox(tr("Shortcuts"));
- QLabel *lab;
+ QGroupBox *qgbShortcuts = new QGroupBox(tr("Shortcuts"));
+ QLabel *lab;
- QGridLayout *l=new QGridLayout();
+ QGridLayout *l=new QGridLayout();
- lab=new QLabel(tr("Function"));
- l->addWidget(lab, 0, 0);
- lab=new QLabel(tr("Shortcut"));
- l->addWidget(lab, 0, 1);
+ lab=new QLabel(tr("Function"));
+ l->addWidget(lab, 0, 0);
+ lab=new QLabel(tr("Shortcut"));
+ l->addWidget(lab, 0, 1);
- int i=0;
+ int i=0;
- foreach(GlobalShortcut *gs, gsx->qmShortcuts) {
- XInputKeyWidget *dikw=new XInputKeyWidget();
- dikw->setShortcut(gs);
+ foreach(GlobalShortcut *gs, gsx->qmShortcuts) {
+ XInputKeyWidget *dikw=new XInputKeyWidget();
+ dikw->setShortcut(gs);
- lab=new QLabel(gs->name);
- l->addWidget(lab, i+1, 0);
- l->addWidget(dikw, i+1, 1);
+ lab=new QLabel(gs->name);
+ l->addWidget(lab, i+1, 0);
+ l->addWidget(dikw, i+1, 1);
- dikw->setToolTip(tr("Shortcut bound to %1.").arg(gs->name));
- dikw->setWhatsThis(tr("<b>This is the global shortcut bound to %1</b><br />"
- "Click this field and then the desired key combo "
- "to rebind. Double-click to clear.").arg(gs->name));
- qhKeys[gs]=dikw;
- i++;
- }
+ dikw->setToolTip(tr("Shortcut bound to %1.").arg(gs->name));
+ dikw->setWhatsThis(tr("<b>This is the global shortcut bound to %1</b><br />"
+ "Click this field and then the desired key combo "
+ "to rebind. Double-click to clear.").arg(gs->name));
+ qhKeys[gs]=dikw;
+ i++;
+ }
- qgbShortcuts->setLayout(l);
+ qgbShortcuts->setLayout(l);
- QVBoxLayout *v = new QVBoxLayout;
- v->addWidget(qgbShortcuts);
- v->addStretch(1);
- setLayout(v);
+ QVBoxLayout *v = new QVBoxLayout;
+ v->addWidget(qgbShortcuts);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QString GlobalShortcutXConfig::title() const {
- return tr("Shortcuts");
+ return tr("Shortcuts");
}
QIcon GlobalShortcutXConfig::icon() const {
- return QIcon(QLatin1String("skin:config_shortcuts.png"));
+ return QIcon(QLatin1String("skin:config_shortcuts.png"));
}
void GlobalShortcutXConfig::accept() {
- foreach(GlobalShortcut *gs, gsx->qmShortcuts) {
- XInputKeyWidget *dikw = qhKeys[gs];
- if (dikw->bModified) {
- QString base=QString::fromLatin1("GS%1_").arg(gs->idx);
- g.qs->setValue(base + QLatin1String("num"), dikw->qlButtons.count());
- int i=0;
- foreach(int bt, dikw->qlButtons) {
- g.qs->setValue(base + QString::fromLatin1("%1_Key").arg(i), bt);
- i++;
- }
- }
- }
- gsx->bNeedRemap = true;
+ foreach(GlobalShortcut *gs, gsx->qmShortcuts) {
+ XInputKeyWidget *dikw = qhKeys[gs];
+ if (dikw->bModified) {
+ QString base=QString::fromLatin1("GS%1_").arg(gs->idx);
+ g.qs->setValue(base + QLatin1String("num"), dikw->qlButtons.count());
+ int i=0;
+ foreach(int bt, dikw->qlButtons) {
+ g.qs->setValue(base + QString::fromLatin1("%1_Key").arg(i), bt);
+ i++;
+ }
+ }
+ }
+ gsx->bNeedRemap = true;
}
GlobalShortcutX::GlobalShortcutX() {
- gsx = this;
- ref = 0;
- bGrabbing = false;
- bNeedRemap = true;
- int min, maj;
- bRunning=false;
- display = XOpenDisplay(NULL);
-
- if (! display) {
- qWarning("GlobalShortcutX: Unable to open dedicated display connection.");
- return;
- }
+ gsx = this;
+ ref = 0;
+ bGrabbing = false;
+ bNeedRemap = true;
+ int min, maj;
+ bRunning=false;
+ display = XOpenDisplay(NULL);
+
+ if (! display) {
+ qWarning("GlobalShortcutX: Unable to open dedicated display connection.");
+ return;
+ }
- maj = 1;
- min = 1;
+ maj = 1;
+ min = 1;
- if (! XevieQueryVersion(display, &maj, &min)) {
- qWarning("GlobalShortcutX: XEVIE extension not found. Enable it in xorg.conf");
- return;
- }
+ if (! XevieQueryVersion(display, &maj, &min)) {
+ qWarning("GlobalShortcutX: XEVIE extension not found. Enable it in xorg.conf");
+ return;
+ }
- qWarning("GlobalShortcutX: XEVIE %d.%d", maj, min);
+ qWarning("GlobalShortcutX: XEVIE %d.%d", maj, min);
- // Here's the thing. If we're debugging, it doesn't do to have the xevie application hang.
+ // Here's the thing. If we're debugging, it doesn't do to have the xevie application hang.
#ifdef QT_NO_DEBUG
- if (! XevieStart(display)) {
- qWarning("GlobalShortcutX: Another client is already using XEVIE");
- return;
- }
+ if (! XevieStart(display)) {
+ qWarning("GlobalShortcutX: Another client is already using XEVIE");
+ return;
+ }
- XevieSelectInput(display, KeyPressMask | KeyReleaseMask);
+ XevieSelectInput(display, KeyPressMask | KeyReleaseMask);
#endif
- bRunning=true;
- start(QThread::TimeCriticalPriority);
+ bRunning=true;
+ start(QThread::TimeCriticalPriority);
}
void GlobalShortcutX::add(GlobalShortcut *gs) {
- qmShortcuts[gs->idx] = gs;
- bNeedRemap=true;
+ qmShortcuts[gs->idx] = gs;
+ bNeedRemap=true;
}
void GlobalShortcutX::remove(GlobalShortcut *gs) {
- qmShortcuts.remove(gs->idx);
- bNeedRemap=true;
+ qmShortcuts.remove(gs->idx);
+ bNeedRemap=true;
}
void GlobalShortcutX::grab() {
- bGrabbing = true;
+ bGrabbing = true;
}
void GlobalShortcutX::release() {
- bGrabbing = false;
+ bGrabbing = false;
}
GlobalShortcutX::~GlobalShortcutX() {
- bRunning = false;
- wait();
+ bRunning = false;
+ wait();
}
void GlobalShortcutX::remap() {
- bNeedRemap = false;
-
- foreach(Shortcut *s, qhGlobalToX) {
- delete s;
- }
- qhGlobalToX.clear();
- qmhKeyToShortcut.clear();
-
- foreach(GlobalShortcut *gs, qmShortcuts) {
-
- QString base=QString::fromLatin1("GS%1_").arg(gs->idx);
- QList<unsigned int> buttons;
- int nbuttons = g.qs->value(base + QLatin1String("num"), 0).toInt();
- for(int i=0;i<nbuttons;i++) {
- unsigned int key = g.qs->value(base + QString::fromLatin1("%1_Key").arg(i), 0xffffffff).toUInt();
- if (key != 0xffffffff) {
- buttons << key;
- }
- }
- if (buttons.count() > 0) {
- Shortcut *s = new Shortcut();
- s->gs = gs;
- s->bActive = false;
- s->iNumDown = 0;
- for(int i=0;i<buttons.count();i++) {
- s->qlButtons << buttons[i];
- qmhKeyToShortcut.insert(buttons[i], s);
- }
- qhGlobalToX[gs] = s;
- }
- }
+ bNeedRemap = false;
+
+ foreach(Shortcut *s, qhGlobalToX) {
+ delete s;
+ }
+ qhGlobalToX.clear();
+ qmhKeyToShortcut.clear();
+
+ foreach(GlobalShortcut *gs, qmShortcuts) {
+
+ QString base=QString::fromLatin1("GS%1_").arg(gs->idx);
+ QList<unsigned int> buttons;
+ int nbuttons = g.qs->value(base + QLatin1String("num"), 0).toInt();
+ for (int i=0;i<nbuttons;i++) {
+ unsigned int key = g.qs->value(base + QString::fromLatin1("%1_Key").arg(i), 0xffffffff).toUInt();
+ if (key != 0xffffffff) {
+ buttons << key;
+ }
+ }
+ if (buttons.count() > 0) {
+ Shortcut *s = new Shortcut();
+ s->gs = gs;
+ s->bActive = false;
+ s->iNumDown = 0;
+ for (int i=0;i<buttons.count();i++) {
+ s->qlButtons << buttons[i];
+ qmhKeyToShortcut.insert(buttons[i], s);
+ }
+ qhGlobalToX[gs] = s;
+ }
+ }
}
void GlobalShortcutX::resetMap() {
- for(int i=0;i<256;i++)
- touchMap[i]=false;
+ for (int i=0;i<256;i++)
+ touchMap[i]=false;
}
QList<int> GlobalShortcutX::getCurrentButtons() {
- QList<int> keys;
- for(int i=0;i<256;i++)
- if (touchMap[i])
- keys << i;
- return keys;
+ QList<int> keys;
+ for (int i=0;i<256;i++)
+ if (touchMap[i])
+ keys << i;
+ return keys;
}
void GlobalShortcutX::run() {
- fd_set in_fds;
- XEvent evt;
- struct timeval tv;
- while(bRunning) {
- if (bNeedRemap)
- remap();
- FD_ZERO(&in_fds);
- FD_SET(ConnectionNumber(display), &in_fds);
- tv.tv_sec = 0;
- tv.tv_usec = 100000;
- if(select(ConnectionNumber(display)+1, &in_fds, NULL, NULL, &tv)) {
- while (XPending(display)) {
- XNextEvent(display, &evt);
- XevieSendEvent(display, &evt, XEVIE_UNMODIFIED);
- switch(evt.type) {
- case KeyPress:
- case KeyRelease:
- {
- bool down = (evt.type == KeyPress);
-
- if (down == activeMap[evt.xkey.keycode])
- break;
- activeMap[evt.xkey.keycode] = down;
- if (down)
- touchMap[evt.xkey.keycode] = true;
- emit buttonPressed(!down);
- foreach(Shortcut *s, qmhKeyToShortcut.values(evt.xkey.keycode)) {
- if (down) {
- s->iNumDown++;
- if (s->iNumDown == s->qlButtons.count()) {
- s->bActive = true;
- emit s->gs->triggered(down);
- emit s->gs->down();
- }
- } else {
- s->iNumDown--;
- if (s->bActive) {
- s->bActive = false;
- emit s->gs->triggered(down);
- emit s->gs->up();
+ fd_set in_fds;
+ XEvent evt;
+ struct timeval tv;
+ while (bRunning) {
+ if (bNeedRemap)
+ remap();
+ FD_ZERO(&in_fds);
+ FD_SET(ConnectionNumber(display), &in_fds);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+ if (select(ConnectionNumber(display)+1, &in_fds, NULL, NULL, &tv)) {
+ while (XPending(display)) {
+ XNextEvent(display, &evt);
+ XevieSendEvent(display, &evt, XEVIE_UNMODIFIED);
+ switch (evt.type) {
+ case KeyPress:
+ case KeyRelease: {
+ bool down = (evt.type == KeyPress);
+
+ if (down == activeMap[evt.xkey.keycode])
+ break;
+ activeMap[evt.xkey.keycode] = down;
+ if (down)
+ touchMap[evt.xkey.keycode] = true;
+ emit buttonPressed(!down);
+ foreach(Shortcut *s, qmhKeyToShortcut.values(evt.xkey.keycode)) {
+ if (down) {
+ s->iNumDown++;
+ if (s->iNumDown == s->qlButtons.count()) {
+ s->bActive = true;
+ emit s->gs->triggered(down);
+ emit s->gs->down();
+ }
+ } else {
+ s->iNumDown--;
+ if (s->bActive) {
+ s->bActive = false;
+ emit s->gs->triggered(down);
+ emit s->gs->up();
+ }
+ }
+ }
+ }
+
+ break;
+ default:
+ qWarning("GlobalShortcutX: EVT %x", evt.type);
+ }
+ }
}
- }
- }
- }
-
- break;
- default:
- qWarning("GlobalShortcutX: EVT %x", evt.type);
}
- }
- }
- }
- XevieEnd(display);
- XCloseDisplay(display);
+ XevieEnd(display);
+ XCloseDisplay(display);
}
GlobalShortcut::GlobalShortcut(QObject *p, int index, QString qsName) : QObject(p) {
- if (! gsx)
- gsx = new GlobalShortcutX();
- gsx->ref++;
- idx = index;
- name=qsName;
- act = false;
- gsx->add(this);
+ if (! gsx)
+ gsx = new GlobalShortcutX();
+ gsx->ref++;
+ idx = index;
+ name=qsName;
+ act = false;
+ gsx->add(this);
}
-GlobalShortcut::~GlobalShortcut()
-{
- gsx->remove(this);
- gsx->ref--;
- if (gsx->ref == 0) {
- delete gsx;
- gsx = NULL;
- }
+GlobalShortcut::~GlobalShortcut() {
+ gsx->remove(this);
+ gsx->ref--;
+ if (gsx->ref == 0) {
+ delete gsx;
+ gsx = NULL;
+ }
}
diff --git a/src/mumble/GlobalShortcut_unix.h b/src/mumble/GlobalShortcut_unix.h
index 4ee5a18a1..8794eca22 100644
--- a/src/mumble/GlobalShortcut_unix.h
+++ b/src/mumble/GlobalShortcut_unix.h
@@ -34,14 +34,14 @@
typedef QPair<int, unsigned int> qpButton;
struct Shortcut {
- GlobalShortcut *gs;
- int iNumDown;
- bool bActive;
- QList<int> qlButtons;
+ GlobalShortcut *gs;
+ int iNumDown;
+ bool bActive;
+ QList<int> qlButtons;
};
class XInputKeyWidget : public QLineEdit {
- Q_OBJECT
+ Q_OBJECT
protected:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
@@ -52,12 +52,12 @@ class XInputKeyWidget : public QLineEdit {
XInputKeyWidget(QWidget *p = NULL);
void setShortcut(GlobalShortcut *gs);
public slots:
- void setButton(bool);
+ void setButton(bool);
void displayKeys();
};
class GlobalShortcutXConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QHash<GlobalShortcut *,XInputKeyWidget *> qhKeys;
public:
@@ -69,9 +69,9 @@ class GlobalShortcutXConfig : public ConfigWidget {
};
class GlobalShortcutX : public QThread {
- Q_OBJECT
+ Q_OBJECT
public:
- Display *display;
+ Display *display;
int ref;
bool bRunning;
bool activeMap[256];
@@ -93,6 +93,6 @@ class GlobalShortcutX : public QThread {
void add(GlobalShortcut *);
void remove(GlobalShortcut *);
QList<int> getCurrentButtons();
- signals:
+ signals:
void buttonPressed(bool);
};
diff --git a/src/mumble/GlobalShortcut_win.cpp b/src/mumble/GlobalShortcut_win.cpp
index e26929dc1..7f6a2fbd3 100644
--- a/src/mumble/GlobalShortcut_win.cpp
+++ b/src/mumble/GlobalShortcut_win.cpp
@@ -47,7 +47,7 @@ static ConfigRegistrar registrar(55, GlobalShortcutWinConfigDialogNew);
uint qHash(const GUID &a) {
uint val = a.Data1 ^ a.Data2 ^ a.Data3;
- for(int i=0;i<8;i++)
+ for (int i=0;i<8;i++)
val += a.Data4[i];
return val;
}
@@ -88,7 +88,7 @@ void DirectInputKeyWidget::focusOutEvent(QFocusEvent *) {
displayKeys();
}
-void DirectInputKeyWidget::mouseDoubleClickEvent (QMouseEvent *) {
+void DirectInputKeyWidget::mouseDoubleClickEvent(QMouseEvent *) {
bModified = true;
qlButtons.clear();
clearFocus();
@@ -149,20 +149,20 @@ GlobalShortcutWinConfig::GlobalShortcutWinConfig(QWidget *p) : ConfigWidget(p) {
dikw->setToolTip(tr("Shortcut bound to %1.").arg(gs->name));
dikw->setWhatsThis(tr("<b>This is the global shortcut bound to %1</b><br />"
- "Click this field and then the desired key/button combo "
- "to rebind. Double-click to clear.").arg(gs->name));
+ "Click this field and then the desired key/button combo "
+ "to rebind. Double-click to clear.").arg(gs->name));
qhKeys[gs]=dikw;
i++;
}
qgbShortcuts->setLayout(l);
- QVBoxLayout *v = new QVBoxLayout;
- v->addWidget(qgbShortcuts);
- v->addStretch(1);
- setLayout(v);
+ QVBoxLayout *v = new QVBoxLayout;
+ v->addWidget(qgbShortcuts);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QString GlobalShortcutWinConfig::title() const {
@@ -197,14 +197,13 @@ GlobalShortcutWin::GlobalShortcutWin() {
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timeTicked()));
- HRESULT hr;
+ HRESULT hr;
- pDI = NULL;
+ pDI = NULL;
- if(FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, reinterpret_cast<VOID**>(&pDI), NULL)))
- {
+ if (FAILED(hr = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, reinterpret_cast<VOID**>(&pDI), NULL))) {
qFatal("GlobalShortcutWin: Failed to create d8input");
- return;
+ return;
}
remap();
@@ -213,9 +212,8 @@ GlobalShortcutWin::GlobalShortcutWin() {
}
BOOL CALLBACK GlobalShortcutWin::EnumDeviceObjectsCallback(
- LPCDIDEVICEOBJECTINSTANCE lpddoi,
- LPVOID pvRef)
-{
+ LPCDIDEVICEOBJECTINSTANCE lpddoi,
+ LPVOID pvRef) {
InputDevice *id=static_cast<InputDevice *>(pvRef);
QString name = QString::fromUtf16(reinterpret_cast<const ushort *>(lpddoi->tszName));
// qWarning("%08lx %08lx %s",lpddoi->dwOfs,lpddoi->dwType, qPrintable(name));
@@ -224,8 +222,7 @@ BOOL CALLBACK GlobalShortcutWin::EnumDeviceObjectsCallback(
return DIENUM_CONTINUE;
}
-BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext)
-{
+BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext) {
GlobalShortcutWin *cbgsw=static_cast<GlobalShortcutWin *>(pContext);
HRESULT hr;
@@ -256,7 +253,7 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
df.dwDataSize = (nbuttons + 3) & (~0x3);
df.dwNumObjs = nbuttons;
df.rgodf = rgodf;
- for(int i=0;i<nbuttons;i++) {
+ for (int i=0;i<nbuttons;i++) {
ZeroMemory(& rgodf[i], sizeof(DIOBJECTDATAFORMAT));
DWORD dwType = types[i];
DWORD dwOfs = i;
@@ -267,22 +264,22 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
// qWarning("%4x %4x %s", dwType, dwOfs, qPrintable(id->qhNames[dwType]));
}
- if (FAILED(hr = id->pDID->SetCooperativeLevel( g.mw->winId(), DISCL_NONEXCLUSIVE|DISCL_BACKGROUND )))
+ if (FAILED(hr = id->pDID->SetCooperativeLevel(g.mw->winId(), DISCL_NONEXCLUSIVE|DISCL_BACKGROUND)))
qFatal("GlobalShortcutWin: SetCooperativeLevel: %lx", hr);
if (FAILED(hr = id->pDID->SetDataFormat(&df)))
qFatal("GlobalShortcutWin: SetDataFormat: %lx", hr);
- DIPROPDWORD dipdw;
+ DIPROPDWORD dipdw;
- dipdw.diph.dwSize = sizeof(DIPROPDWORD);
- dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
- dipdw.diph.dwObj = 0;
- dipdw.diph.dwHow = DIPH_DEVICE;
- dipdw.dwData = DX_SAMPLE_BUFFER_SIZE;
+ dipdw.diph.dwSize = sizeof(DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dipdw.diph.dwObj = 0;
+ dipdw.diph.dwHow = DIPH_DEVICE;
+ dipdw.dwData = DX_SAMPLE_BUFFER_SIZE;
- if(FAILED(hr = id->pDID->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)))
- qFatal("GlobalShortcutWin::SetProperty");
+ if (FAILED(hr = id->pDID->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)))
+ qFatal("GlobalShortcutWin::SetProperty");
qWarning("Adding device %s %s %s:%d", qPrintable(QUuid(id->guid).toString()),qPrintable(name),qPrintable(sname),id->qhNames.count());
@@ -292,7 +289,7 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
delete(id);
}
- return DIENUM_CONTINUE;
+ return DIENUM_CONTINUE;
}
void GlobalShortcutWin::add(GlobalShortcut *gs) {
@@ -308,7 +305,7 @@ void GlobalShortcutWin::remove(GlobalShortcut *gs) {
void GlobalShortcutWin::remap() {
HRESULT hr;
- bNeedRemap = false;
+ bNeedRemap = false;
unacquire();
@@ -335,7 +332,7 @@ void GlobalShortcutWin::remap() {
QList<QUuid> guids;
QList<DWORD> types;
int nbuttons = g.qs->value(base + QString("num"), 0).toInt();
- for(int i=0;i<nbuttons;i++) {
+ for (int i=0;i<nbuttons;i++) {
QUuid guid(g.qs->value(base + QString("%1_GUID").arg(i), QUuid(GUID_SysKeyboard).toString()).toString());
DWORD type = g.qs->value(base + QString("%1_Type").arg(i), 0xffffffff).toUInt();
if (! guid.isNull() && (type != 0xffffffff)) {
@@ -348,7 +345,7 @@ void GlobalShortcutWin::remap() {
s->gs = gs;
s->bActive = false;
s->iNumDown = 0;
- for(int i=0;i<guids.count();i++) {
+ for (int i=0;i<guids.count();i++) {
s->qlButtons << qpButton(guids[i], types[i]);
s->qlActive << false;
if (qhInputDevices.contains(guids[i])) {
@@ -383,24 +380,23 @@ void GlobalShortcutWin::unacquire() {
void GlobalShortcutWin::timeTicked() {
bool pressed = false;
- if (bNeedRemap)
- remap();
+ if (bNeedRemap)
+ remap();
foreach(InputDevice *id, qhInputDevices) {
- DIDEVICEOBJECTDATA rgdod[DX_SAMPLE_BUFFER_SIZE];
- DWORD dwItems = DX_SAMPLE_BUFFER_SIZE;
- HRESULT hr;
+ DIDEVICEOBJECTDATA rgdod[DX_SAMPLE_BUFFER_SIZE];
+ DWORD dwItems = DX_SAMPLE_BUFFER_SIZE;
+ HRESULT hr;
- id->pDID->Acquire();
- id->pDID->Poll();
+ id->pDID->Acquire();
+ id->pDID->Poll();
- hr = id->pDID->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), rgdod, &dwItems, 0 );
- if( FAILED(hr) )
- continue;
+ hr = id->pDID->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), rgdod, &dwItems, 0);
+ if (FAILED(hr))
+ continue;
- for( DWORD j=0; j<dwItems; j++ )
- {
+ for (DWORD j=0; j<dwItems; j++) {
// qWarning("%4x %4x", rgdod[j].dwOfs, rgdod[j].dwData);
if (!bIgnoreActive) {
@@ -418,8 +414,8 @@ void GlobalShortcutWin::timeTicked() {
foreach(Shortcut *s, id->qmhOfsToShortcut.values(rgdod[j].dwOfs)) {
qpButton button(id->guid, id->qhOfsToType[rgdod[j].dwOfs]);
int idx;
- for(idx=0;idx<s->qlButtons.count();idx++) {
- if(s->qlButtons[idx] == button) {
+ for (idx=0;idx<s->qlButtons.count();idx++) {
+ if (s->qlButtons[idx] == button) {
bool a = (rgdod[j].dwData & 0x80);
if (a != s->qlActive[idx]) {
s->qlActive[idx] = a;
@@ -472,7 +468,7 @@ QList<qpButton> GlobalShortcutWin::getCurrentButtons() {
GlobalShortcut::GlobalShortcut(QObject *p, int index, QString qsName) : QObject(p) {
if (! gsw)
- gsw = new GlobalShortcutWin();
+ gsw = new GlobalShortcutWin();
gsw->ref++;
idx = index;
name=qsName;
@@ -480,8 +476,7 @@ GlobalShortcut::GlobalShortcut(QObject *p, int index, QString qsName) : QObject(
gsw->add(this);
}
-GlobalShortcut::~GlobalShortcut()
-{
+GlobalShortcut::~GlobalShortcut() {
gsw->remove(this);
gsw->ref--;
if (gsw->ref == 0) {
diff --git a/src/mumble/GlobalShortcut_win.h b/src/mumble/GlobalShortcut_win.h
index 231c43a6c..f10ecc82b 100644
--- a/src/mumble/GlobalShortcut_win.h
+++ b/src/mumble/GlobalShortcut_win.h
@@ -66,7 +66,7 @@ struct InputDevice {
};
class DirectInputKeyWidget : public QLineEdit {
- Q_OBJECT
+ Q_OBJECT
protected:
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
@@ -82,7 +82,7 @@ class DirectInputKeyWidget : public QLineEdit {
};
class GlobalShortcutWinConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QHash<GlobalShortcut *,DirectInputKeyWidget *> qhKeys;
public:
@@ -94,7 +94,7 @@ class GlobalShortcutWinConfig : public ConfigWidget {
};
class GlobalShortcutWin : public QObject {
- Q_OBJECT
+ Q_OBJECT
public:
QTimer *timer;
int ref;
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp
index 1e16061e6..3f9d93245 100644
--- a/src/mumble/Log.cpp
+++ b/src/mumble/Log.cpp
@@ -58,7 +58,7 @@ LogConfig::LogConfig(QWidget *p) : ConfigWidget(p) {
lab=new QLabel(tr("TTS"));
l->addWidget(lab, 0, 2);
- for(int i=Log::firstMsgType;i<=Log::lastMsgType;++i) {
+ for (int i=Log::firstMsgType;i<=Log::lastMsgType;++i) {
QCheckBox *qcb;
Log::MsgType t=static_cast<Log::MsgType>(i);
MsgSettings *ms=g.l->qhSettings[t];
@@ -106,19 +106,19 @@ LogConfig::LogConfig(QWidget *p) : ConfigWidget(p) {
qsbThreshold->setObjectName(QLatin1String("Threshold"));
qsbThreshold->setToolTip(tr("Message length threshold for Text-To-Speech Engine"));
qsbThreshold->setWhatsThis(tr("<b>This is the length threshold used for the Text-To-Speech Engine.</b><br />"
- "Messages longer than this limit will not be read aloud in their full length."));
+ "Messages longer than this limit will not be read aloud in their full length."));
l->addWidget(qsbThreshold,1,1);
qgbTTS->setLayout(l);
- QVBoxLayout *v = new QVBoxLayout;
- v->addWidget(qgbMessages);
- v->addWidget(qgbTTS);
- v->addStretch(1);
- setLayout(v);
+ QVBoxLayout *v = new QVBoxLayout;
+ v->addWidget(qgbMessages);
+ v->addWidget(qgbTTS);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QString LogConfig::title() const {
@@ -130,7 +130,7 @@ QIcon LogConfig::icon() const {
}
void LogConfig::accept() {
- for(int i=Log::firstMsgType;i<=Log::lastMsgType;++i) {
+ for (int i=Log::firstMsgType;i<=Log::lastMsgType;++i) {
Log::MsgType t=static_cast<Log::MsgType>(i);
MsgSettings *ms=g.l->qhSettings[t];
ms->bConsole = (qlConsole[i]->checkState() == Qt::Checked);
@@ -148,7 +148,7 @@ MsgSettings::MsgSettings() {
}
Log::Log(QObject *p) : QObject(p) {
- for(int i=firstMsgType;i<=lastMsgType;++i)
+ for (int i=firstMsgType;i<=lastMsgType;++i)
qhSettings[static_cast<MsgType>(i)]=new MsgSettings();
tts=new TextToSpeech(this);
loadSettings();
@@ -189,11 +189,11 @@ void Log::setIgnore(MsgType t, int ignore) {
void Log::clearIgnore() {
foreach(MsgSettings *ms, qhSettings)
- ms->iIgnore=0;
+ ms->iIgnore=0;
}
void Log::loadSettings() {
- for(int i=firstMsgType;i<=lastMsgType;++i) {
+ for (int i=firstMsgType;i<=lastMsgType;++i) {
MsgType t=static_cast<MsgType>(i);
MsgSettings *ms=qhSettings[t];
QString key=QString::fromLatin1("msg%1").arg(QLatin1String(msgNames[t]));
@@ -205,7 +205,7 @@ void Log::loadSettings() {
}
void Log::saveSettings() const {
- for(int i=firstMsgType;i<=lastMsgType;++i) {
+ for (int i=firstMsgType;i<=lastMsgType;++i) {
MsgType t=static_cast<MsgType>(i);
MsgSettings *ms=qhSettings[t];
QString key=QString::fromLatin1("msg%1").arg(QLatin1String(msgNames[t]));
diff --git a/src/mumble/Log.h b/src/mumble/Log.h
index c30215f7d..108a5528d 100644
--- a/src/mumble/Log.h
+++ b/src/mumble/Log.h
@@ -44,7 +44,7 @@
class TextToSpeech;
class LogConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QList<QCheckBox *> qlConsole;
QList<QCheckBox *> qlTTS;
@@ -66,8 +66,8 @@ struct MsgSettings {
};
class Log : public QObject {
- friend class LogConfig;
- Q_OBJECT
+ friend class LogConfig;
+ Q_OBJECT
public:
enum MsgType { DebugInfo, CriticalError, Warning, Information, ServerConnected, ServerDisconnected, PlayerJoin, PlayerLeave, YouKicked, PlayerKicked, SelfMute, OtherSelfMute, YouMuted, YouMutedOther, OtherMutedOther, ChannelJoin, ChannelLeave, PermissionDenied, TextMessage };
static const MsgType firstMsgType = DebugInfo;
diff --git a/src/mumble/LookConfig.cpp b/src/mumble/LookConfig.cpp
index df6d11bde..07dcbe081 100644
--- a/src/mumble/LookConfig.cpp
+++ b/src/mumble/LookConfig.cpp
@@ -100,9 +100,9 @@ LookConfig::LookConfig(QWidget *p) : ConfigWidget(p) {
qpbCSS->setObjectName(QLatin1String("SkinFile"));
qleCSS->setToolTip(tr("Skin file to use"));
qleCSS->setWhatsThis(tr("<b>This sets which skin Mumble should use.</b><br />"
- "The skin is a style file applied on top of the basic widget style. "
- "If there are icons in the same directory as the style sheet, those will replace the default icons."
- ));
+ "The skin is a style file applied on top of the basic widget style. "
+ "If there are icons in the same directory as the style sheet, those will replace the default icons."
+ ));
qpbCSS->setToolTip(qleCSS->toolTip());
qpbCSS->setWhatsThis(qleCSS->whatsThis());
grid->addWidget(l,1,0);
@@ -129,13 +129,13 @@ LookConfig::LookConfig(QWidget *p) : ConfigWidget(p) {
qgbLook->setLayout(grid);
- v = new QVBoxLayout;
- v->addWidget(qgbLanguage);
- v->addWidget(qgbLook);
- v->addStretch(1);
- setLayout(v);
+ v = new QVBoxLayout;
+ v->addWidget(qgbLanguage);
+ v->addWidget(qgbLook);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QString LookConfig::title() const {
@@ -163,11 +163,11 @@ void LookConfig::accept() {
qApp->setStyleSheet(QString());
g.qs->remove(QLatin1String("Skin"));
} else {
- QFile file(qleCSS->text());
- file.open(QFile::ReadOnly);
- QString sheet = QLatin1String(file.readAll());
- if (! sheet.isEmpty())
- qApp->setStyleSheet(sheet);
+ QFile file(qleCSS->text());
+ file.open(QFile::ReadOnly);
+ QString sheet = QLatin1String(file.readAll());
+ if (! sheet.isEmpty())
+ qApp->setStyleSheet(sheet);
g.qs->setValue(QLatin1String("Skin"), qleCSS->text());
}
g.qs->setValue(QLatin1String("Horizontal"), qcbHorizontal->isChecked());
diff --git a/src/mumble/LookConfig.h b/src/mumble/LookConfig.h
index ef3ac6140..3d89ebe00 100644
--- a/src/mumble/LookConfig.h
+++ b/src/mumble/LookConfig.h
@@ -34,7 +34,7 @@
#include "ConfigDialog.h"
class LookConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QComboBox *qcbLanguage, *qcbStyle;
QLineEdit *qleCSS;
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index b05234260..d85f88203 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -51,7 +51,7 @@
#include "Global.h"
#include "Database.h"
-MessageBoxEvent::MessageBoxEvent(QString m) : QEvent(static_cast<QEvent::Type>(MB_QEVENT)){
+MessageBoxEvent::MessageBoxEvent(QString m) : QEvent(static_cast<QEvent::Type>(MB_QEVENT)) {
msg = m;
}
@@ -76,11 +76,11 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
}
void MainWindow::createActions() {
- qaQuit = new QAction(tr("&Quit"), this);
- qaQuit->setToolTip(tr("Closes the program"));
- qaQuit->setWhatsThis(tr("Exits the application."));
- qaQuit->setObjectName(QLatin1String("Quit"));
- qaQuit->setShortcut(tr("Ctrl+Q", "Quit"));
+ qaQuit = new QAction(tr("&Quit"), this);
+ qaQuit->setToolTip(tr("Closes the program"));
+ qaQuit->setWhatsThis(tr("Exits the application."));
+ qaQuit->setObjectName(QLatin1String("Quit"));
+ qaQuit->setShortcut(tr("Ctrl+Q", "Quit"));
qaServerConnect=new QAction(tr("&Connect"), this);
qaServerConnect->setToolTip(tr("Open the server connection dialog"));
@@ -143,8 +143,8 @@ void MainWindow::createActions() {
qaChannelLink->setObjectName(QLatin1String("ChannelLink"));
qaChannelLink->setToolTip(tr("Link your channel to another channel"));
qaChannelLink->setWhatsThis(tr("This links your current channel to the selected channel. If they have permission to speak in "
- "the other channel, players can now hear each other. This is a permanent link, and will last until "
- "manually unlinked or the server is restarted. Please see the shortcuts for push-to-link."));
+ "the other channel, players can now hear each other. This is a permanent link, and will last until "
+ "manually unlinked or the server is restarted. Please see the shortcuts for push-to-link."));
qaChannelUnlink=new QAction(tr("&Unlink"), this);
qaChannelUnlink->setObjectName(QLatin1String("ChannelUnlink"));
qaChannelUnlink->setToolTip(tr("Unlink your channel from another channel"));
@@ -158,8 +158,8 @@ void MainWindow::createActions() {
qaAudioReset->setObjectName(QLatin1String("AudioReset"));
qaAudioReset->setToolTip(tr("Reset audio preprocessor"));
qaAudioReset->setWhatsThis(tr("This will reset the audio preprocessor, including noise cancellation, automatic gain and voice activity detection. "
- "If something suddenly worsens the audio environment (like dropping the microphone) and it was temporary, "
- "use this to avoid having to wait for the preprocessor to readjust."));
+ "If something suddenly worsens the audio environment (like dropping the microphone) and it was temporary, "
+ "use this to avoid having to wait for the preprocessor to readjust."));
qaAudioMute=new QAction(tr("&Mute Self"), this);
qaAudioMute->setObjectName(QLatin1String("AudioMute"));
qaAudioMute->setCheckable(true);
@@ -186,7 +186,7 @@ void MainWindow::createActions() {
qaAudioUnlink->setObjectName(QLatin1String("AudioUnlink"));
qaAudioUnlink->setToolTip(tr("Forcibly unlink plugin"));
qaAudioUnlink->setWhatsThis(tr("This forces the current plugin to unlink, which is handy if it is reading "
- "completely wrong data."));
+ "completely wrong data."));
qaConfigDialog=new QAction(tr("&Settings"), this);
qaConfigDialog->setObjectName(QLatin1String("ConfigDialog"));
@@ -204,7 +204,7 @@ void MainWindow::createActions() {
qaHelpWhatsThis->setObjectName(QLatin1String("HelpWhatsThis"));
qaHelpWhatsThis->setToolTip(tr("Enter What's This? mode"));
qaHelpWhatsThis->setWhatsThis(tr("Click this to enter \"What's This?\" mode. Your cursor will turn into a question mark. Click "
- "on any button, menu choice or area to show a description of what it is."));
+ "on any button, menu choice or area to show a description of what it is."));
qaHelpWhatsThis->setShortcuts(QKeySequence::WhatsThis);
qaHelpAbout=new QAction(tr("&About"), this);
qaHelpAbout->setObjectName(QLatin1String("HelpAbout"));
@@ -222,7 +222,7 @@ void MainWindow::createActions() {
qaHelpVersionCheck->setObjectName(QLatin1String("HelpVersionCheck"));
qaHelpVersionCheck->setToolTip(tr("Check for new version of Mumble"));
qaHelpVersionCheck->setWhatsThis(tr("Connects to the Mumble webpage to check if a new version is available, and notifies "
- "you with an appropriate download URL if this is the case."));
+ "you with an appropriate download URL if this is the case."));
}
void MainWindow::setupGui() {
@@ -245,7 +245,7 @@ void MainWindow::setupGui() {
qteLog->setReadOnly(true);
qteLog->setToolTip(tr("Log of messages"));
qteLog->setWhatsThis(tr("This shows all recent activity. Connecting to servers, errors and information messages all show up here.<br />"
- "To configure exactly which messages show up here, use the <b>Settings</b> command from the menu."));
+ "To configure exactly which messages show up here, use the <b>Settings</b> command from the menu."));
qmServer = new QMenu(tr("&Server"), this);
qmPlayer = new QMenu(tr("&Player"), this);
@@ -341,7 +341,7 @@ void MainWindow::setupGui() {
gs->setData(0);
connect(gs, SIGNAL(triggered(bool)), this, SLOT(pushLink(bool)));
- for(int i = 1; i< 10;i++) {
+ for (int i = 1; i< 10;i++) {
gs = new GlobalShortcut(this, idx++, tr("Chan Sub#%1", "Global Shortcut").arg(i));
gs->setData(i);
connect(gs, SIGNAL(triggered(bool)), this, SLOT(pushLink(bool)));
@@ -406,8 +406,7 @@ void MainWindow::hideEvent(QHideEvent *e) {
QMainWindow::hideEvent(e);
}
-void MainWindow::appendLog(QString entry)
-{
+void MainWindow::appendLog(QString entry) {
qteLog->append(entry);
QTextCursor p=qteLog->textCursor();
p.movePosition(QTextCursor::End);
@@ -429,8 +428,8 @@ void MainWindow::on_Players_customContextMenuRequested(const QPoint &mpos) {
}
void MainWindow::on_Players_doubleClicked(const QModelIndex &idx) {
- Player *p = pmModel->getPlayer(idx);
- if (p) {
+ Player *p = pmModel->getPlayer(idx);
+ if (p) {
on_PlayerTextMessage_triggered();
return;
}
@@ -444,19 +443,17 @@ void MainWindow::on_Players_doubleClicked(const QModelIndex &idx) {
g.sh->sendMessage(&mpm);
}
-void MainWindow::on_ServerConnect_triggered()
-{
+void MainWindow::on_ServerConnect_triggered() {
ConnectDialog *cd = new ConnectDialog(this);
int res = cd->exec();
- if (g.sh && g.sh->isRunning() && res == QDialog::Accepted)
- {
+ if (g.sh && g.sh->isRunning() && res == QDialog::Accepted) {
on_ServerDisconnect_triggered();
g.sh->wait();
}
if (res == QDialog::Accepted) {
- rtLast = MessageServerReject::None;
+ rtLast = MessageServerReject::None;
qaServerDisconnect->setEnabled(true);
g.sh->setConnectionInfo(cd->qsServer, cd->iPort, cd->qsUsername, cd->qsPassword);
g.sh->start(QThread::TimeCriticalPriority);
@@ -464,22 +461,19 @@ void MainWindow::on_ServerConnect_triggered()
delete cd;
}
-void MainWindow::on_Reconnect_timeout()
-{
- g.l->log(Log::ServerDisconnected, tr("Reconnecting."));
- g.sh->start(QThread::TimeCriticalPriority);
+void MainWindow::on_Reconnect_timeout() {
+ g.l->log(Log::ServerDisconnected, tr("Reconnecting."));
+ g.sh->start(QThread::TimeCriticalPriority);
}
-void MainWindow::on_ServerDisconnect_triggered()
-{
+void MainWindow::on_ServerDisconnect_triggered() {
if (qtReconnect->isActive())
qtReconnect->stop();
if (g.sh && g.sh->isRunning())
g.sh->disconnect();
}
-void MainWindow::on_ServerBanList_triggered()
-{
+void MainWindow::on_ServerBanList_triggered() {
MessageServerBanList msbl;
msbl.bQuery = true;
g.sh->sendMessage(&msbl);
@@ -491,8 +485,7 @@ void MainWindow::on_ServerBanList_triggered()
}
}
-void MainWindow::on_PlayerMenu_aboutToShow()
-{
+void MainWindow::on_PlayerMenu_aboutToShow() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (! p) {
qaPlayerKick->setEnabled(false);
@@ -514,8 +507,7 @@ void MainWindow::on_PlayerMenu_aboutToShow()
}
}
-void MainWindow::on_PlayerMute_triggered()
-{
+void MainWindow::on_PlayerMute_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
return;
@@ -526,8 +518,7 @@ void MainWindow::on_PlayerMute_triggered()
g.sh->sendMessage(&mpmMsg);
}
-void MainWindow::on_PlayerLocalMute_triggered()
-{
+void MainWindow::on_PlayerLocalMute_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
return;
@@ -535,8 +526,7 @@ void MainWindow::on_PlayerLocalMute_triggered()
p->setLocalMute(qaPlayerLocalMute->isChecked());
}
-void MainWindow::on_PlayerDeaf_triggered()
-{
+void MainWindow::on_PlayerDeaf_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
return;
@@ -547,8 +537,7 @@ void MainWindow::on_PlayerDeaf_triggered()
g.sh->sendMessage(&mpdMsg);
}
-void MainWindow::on_PlayerKick_triggered()
-{
+void MainWindow::on_PlayerKick_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
return;
@@ -570,8 +559,7 @@ void MainWindow::on_PlayerKick_triggered()
}
}
-void MainWindow::on_PlayerBan_triggered()
-{
+void MainWindow::on_PlayerBan_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
return;
@@ -592,8 +580,7 @@ void MainWindow::on_PlayerBan_triggered()
}
}
-void MainWindow::on_PlayerTextMessage_triggered()
-{
+void MainWindow::on_PlayerTextMessage_triggered() {
Player *p = pmModel->getPlayer(qtvPlayers->currentIndex());
if (!p)
@@ -616,13 +603,11 @@ void MainWindow::on_PlayerTextMessage_triggered()
}
}
-void MainWindow::on_Quit_triggered()
-{
- qApp->closeAllWindows();
+void MainWindow::on_Quit_triggered() {
+ qApp->closeAllWindows();
}
-void MainWindow::on_ChannelMenu_aboutToShow()
-{
+void MainWindow::on_ChannelMenu_aboutToShow() {
QModelIndex idx = qtvPlayers->currentIndex();
bool add, remove, acl, link, unlink, unlinkall;
@@ -659,8 +644,7 @@ void MainWindow::on_ChannelMenu_aboutToShow()
qaChannelUnlinkAll->setEnabled(unlinkall);
}
-void MainWindow::on_ChannelAdd_triggered()
-{
+void MainWindow::on_ChannelAdd_triggered() {
bool ok;
Channel *c = pmModel->getChannel(qtvPlayers->currentIndex());
int iParent = c ? c->iId : 0;
@@ -678,8 +662,7 @@ void MainWindow::on_ChannelAdd_triggered()
}
}
-void MainWindow::on_ChannelRemove_triggered()
-{
+void MainWindow::on_ChannelRemove_triggered() {
int ret;
Channel *c = pmModel->getChannel(qtvPlayers->currentIndex());
if (! c)
@@ -693,15 +676,14 @@ void MainWindow::on_ChannelRemove_triggered()
if (!c)
return;
- if (ret == QMessageBox::Yes ) {
+ if (ret == QMessageBox::Yes) {
MessageChannelRemove mcr;
mcr.iId = c->iId;
g.sh->sendMessage(&mcr);
}
}
-void MainWindow::on_ChannelACL_triggered()
-{
+void MainWindow::on_ChannelACL_triggered() {
Channel *c = pmModel->getChannel(qtvPlayers->currentIndex());
int id = c ? c->iId : 0;
@@ -717,8 +699,7 @@ void MainWindow::on_ChannelACL_triggered()
}
}
-void MainWindow::on_ChannelLink_triggered()
-{
+void MainWindow::on_ChannelLink_triggered() {
Channel *c = Player::get(g.sId)->cChannel;
Channel *l = pmModel->getChannel(qtvPlayers->currentIndex());
if (! l)
@@ -731,8 +712,7 @@ void MainWindow::on_ChannelLink_triggered()
g.sh->sendMessage(&mcl);
}
-void MainWindow::on_ChannelUnlink_triggered()
-{
+void MainWindow::on_ChannelUnlink_triggered() {
Channel *c = Player::get(g.sId)->cChannel;
Channel *l = pmModel->getChannel(qtvPlayers->currentIndex());
if (! l)
@@ -745,8 +725,7 @@ void MainWindow::on_ChannelUnlink_triggered()
g.sh->sendMessage(&mcl);
}
-void MainWindow::on_ChannelUnlinkAll_triggered()
-{
+void MainWindow::on_ChannelUnlinkAll_triggered() {
Channel *c = Player::get(g.sId)->cChannel;
MessageChannelLink mcl;
@@ -755,15 +734,13 @@ void MainWindow::on_ChannelUnlinkAll_triggered()
g.sh->sendMessage(&mcl);
}
-void MainWindow::on_AudioReset_triggered()
-{
+void MainWindow::on_AudioReset_triggered() {
AudioInputPtr ai = g.ai;
if (ai)
ai->bResetProcessor = true;
}
-void MainWindow::on_AudioMute_triggered()
-{
+void MainWindow::on_AudioMute_triggered() {
g.s.bMute = qaAudioMute->isChecked();
if (! g.s.bMute && g.s.bDeaf) {
g.s.bDeaf = false;
@@ -781,8 +758,7 @@ void MainWindow::on_AudioMute_triggered()
g.sh->sendMessage(&mpsmd);
}
-void MainWindow::on_AudioDeaf_triggered()
-{
+void MainWindow::on_AudioDeaf_triggered() {
g.s.bDeaf = qaAudioDeaf->isChecked();
if (g.s.bDeaf && ! g.s.bMute) {
g.s.bMute = true;
@@ -800,78 +776,65 @@ void MainWindow::on_AudioDeaf_triggered()
g.sh->sendMessage(&mpsmd);
}
-void MainWindow::on_AudioTextToSpeech_triggered()
-{
+void MainWindow::on_AudioTextToSpeech_triggered() {
g.s.bTTS = qaAudioTTS->isChecked();
}
-void MainWindow::on_AudioStats_triggered()
-{
+void MainWindow::on_AudioStats_triggered() {
AudioStats *as=new AudioStats(this);
as->show();
}
-void MainWindow::on_AudioUnlink_triggered()
-{
+void MainWindow::on_AudioUnlink_triggered() {
g.p->bUnlink = true;
}
-void MainWindow::on_ConfigDialog_triggered()
-{
+void MainWindow::on_ConfigDialog_triggered() {
ConfigDialog dlg;
dlg.exec();
}
-void MainWindow::on_AudioWizard_triggered()
-{
+void MainWindow::on_AudioWizard_triggered() {
#ifdef Q_OS_WIN
- AudioWizard aw;
+ AudioWizard aw;
aw.exec();
#endif
}
-void MainWindow::on_HelpWhatsThis_triggered()
-{
+void MainWindow::on_HelpWhatsThis_triggered() {
QWhatsThis::enterWhatsThisMode();
}
-void MainWindow::on_HelpAbout_triggered()
-{
+void MainWindow::on_HelpAbout_triggered() {
AboutDialog adAbout(this);
adAbout.exec();
}
-void MainWindow::on_HelpAboutSpeex_triggered()
-{
+void MainWindow::on_HelpAboutSpeex_triggered() {
AboutSpeexDialog adAbout(this);
adAbout.exec();
}
-void MainWindow::on_HelpAboutQt_triggered()
-{
+void MainWindow::on_HelpAboutQt_triggered() {
QMessageBox::aboutQt(this, tr("About Qt"));
}
-void MainWindow::on_HelpVersionCheck_triggered()
-{
+void MainWindow::on_HelpVersionCheck_triggered() {
new VersionCheck(this);
}
-void MainWindow::on_PushToTalk_triggered(bool down)
-{
+void MainWindow::on_PushToTalk_triggered(bool down) {
if (down)
g.iPushToTalk++;
else
g.iPushToTalk--;
}
-void MainWindow::on_PushToMute_triggered(bool down)
-{
+void MainWindow::on_PushToMute_triggered(bool down) {
g.bPushToMute = down;
}
-void MainWindow::on_AltPushToTalk_triggered(bool down)
-{
+void MainWindow::on_AltPushToTalk_triggered(bool down) {
if (down)
g.iPushToTalk++;
else
@@ -880,8 +843,7 @@ void MainWindow::on_AltPushToTalk_triggered(bool down)
g.bAltSpeak = down;
}
-void MainWindow::on_CenterPos_triggered(bool down)
-{
+void MainWindow::on_CenterPos_triggered(bool down) {
g.bCenterPosition = down;
if (down)
@@ -890,8 +852,7 @@ void MainWindow::on_CenterPos_triggered(bool down)
g.iPushToTalk--;
}
-void MainWindow::pushLink(bool down)
-{
+void MainWindow::pushLink(bool down) {
if (down)
g.iPushToTalk++;
else
@@ -905,7 +866,7 @@ void MainWindow::pushLink(bool down)
Channel *home = Player::get(g.sId)->cChannel;
Channel *target = NULL;
- switch(idx) {
+ switch (idx) {
case 0:
target = home->cParent;
break;
@@ -935,9 +896,9 @@ void MainWindow::pushLink(bool down)
mcl.ltType = MessageChannelLink::PushUnlink;
if (idx == 10) {
foreach(Channel *l, home->qlChannels)
- mcl.qlTargets << l->iId;
+ mcl.qlTargets << l->iId;
} else if (target) {
- mcl.qlTargets << target->iId;
+ mcl.qlTargets << target->iId;
}
if (mcl.qlTargets.count() == 0)
return;
@@ -945,8 +906,7 @@ void MainWindow::pushLink(bool down)
}
}
-void MainWindow::serverConnected()
-{
+void MainWindow::serverConnected() {
g.sId = 0;
g.l->clearIgnore();
g.l->setIgnore(Log::PlayerJoin);
@@ -963,8 +923,7 @@ void MainWindow::serverConnected()
}
}
-void MainWindow::serverDisconnected(QString reason)
-{
+void MainWindow::serverDisconnected(QString reason) {
g.sId = 0;
qaServerDisconnect->setEnabled(false);
qaServerBanList->setEnabled(false);
@@ -988,71 +947,71 @@ void MainWindow::serverDisconnected(QString reason)
pmModel->removeAll();
if (! g.sh->qlErrors.isEmpty()) {
- foreach(QSslError e, g.sh->qlErrors)
- g.l->log(Log::ServerDisconnected, tr("SSL Verification failed: %1").arg(e.errorString()));
- if (! g.sh->qscCert.isNull()) {
- QSslCertificate c = g.sh->qscCert;
- QString basereason;
- if (! Database::getDigest(host, port).isNull()) {
- basereason = tr("<b>WARNING:</b> The server presented a certificate that was different from the stored one.");
- } else {
- basereason = tr("Sever presented a certificate which failed verification.");
- }
- QStringList qsl;
foreach(QSslError e, g.sh->qlErrors)
+ g.l->log(Log::ServerDisconnected, tr("SSL Verification failed: %1").arg(e.errorString()));
+ if (! g.sh->qscCert.isNull()) {
+ QSslCertificate c = g.sh->qscCert;
+ QString basereason;
+ if (! Database::getDigest(host, port).isNull()) {
+ basereason = tr("<b>WARNING:</b> The server presented a certificate that was different from the stored one.");
+ } else {
+ basereason = tr("Sever presented a certificate which failed verification.");
+ }
+ QStringList qsl;
+ foreach(QSslError e, g.sh->qlErrors)
qsl << QString::fromLatin1("<li>%1</li>").arg(e.errorString());
- QStringList det;
- det << tr("<li><b>Common Name:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::CommonName));
- det << tr("<li><b>Organization:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::Organization));
- det << tr("<li><b>Subunit:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::OrganizationalUnitName));
- det << tr("<li><b>Country:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::CountryName));
- det << tr("<li><b>Locality:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::LocalityName));
- det << tr("<li><b>State:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::StateOrProvinceName));
-
- if (QMessageBox::warning(this, tr("Mumble"),
- tr("<p>%1.<br />The specific errors with this certificate are: </p><ol>%2</ol>"
- "<p>The details for this certificate are as follows: %3</p>"
- "<p>Do you wish to accept this certificate anyway?<br />(It will also be stored so you won't be asked this again.)</p>"
- ).arg(basereason).arg(qsl.join(QString())).arg(det.join(QString())), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
- Database::setDigest(host, port, QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex()));
- qaServerDisconnect->setEnabled(true);
- g.sh->start(QThread::TimeCriticalPriority);
-
- }
- }
+ QStringList det;
+ det << tr("<li><b>Common Name:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::CommonName));
+ det << tr("<li><b>Organization:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::Organization));
+ det << tr("<li><b>Subunit:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::OrganizationalUnitName));
+ det << tr("<li><b>Country:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::CountryName));
+ det << tr("<li><b>Locality:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::LocalityName));
+ det << tr("<li><b>State:</b> %1</li>").arg(c.subjectInfo(QSslCertificate::StateOrProvinceName));
+
+ if (QMessageBox::warning(this, tr("Mumble"),
+ tr("<p>%1.<br />The specific errors with this certificate are: </p><ol>%2</ol>"
+ "<p>The details for this certificate are as follows: %3</p>"
+ "<p>Do you wish to accept this certificate anyway?<br />(It will also be stored so you won't be asked this again.)</p>"
+ ).arg(basereason).arg(qsl.join(QString())).arg(det.join(QString())), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
+ Database::setDigest(host, port, QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex()));
+ qaServerDisconnect->setEnabled(true);
+ g.sh->start(QThread::TimeCriticalPriority);
+
+ }
+ }
} else {
- bool ok = false;
- bool matched = false;
+ bool ok = false;
+ bool matched = false;
- if (! reason.isEmpty()) {
- g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(reason));
+ if (! reason.isEmpty()) {
+ g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(reason));
} else {
- g.l->log(Log::ServerDisconnected, tr("Disconnected from server."));
- }
-
- switch (rtLast) {
- case MessageServerReject::InvalidUsername:
- case MessageServerReject::UsernameInUse:
- matched = true;
- uname = QInputDialog::getText(this, tr("Invalid username"), (rtLast == MessageServerReject::InvalidUsername) ? tr("You connected with an invalid username, please try another one.") : tr("That username is already in use, please try another username."), QLineEdit::Normal, uname, &ok);
- break;
- case MessageServerReject::WrongUserPW:
- case MessageServerReject::WrongServerPW:
- matched = true;
- pw = QInputDialog::getText(this, tr("Wrong password"), (rtLast == MessageServerReject::WrongUserPW) ? tr("Wrong password for registered users, please try again.") : tr("Wrong server password for unregistered user account, please try again."), QLineEdit::Password, pw, &ok);
- break;
- default:
- break;
+ g.l->log(Log::ServerDisconnected, tr("Disconnected from server."));
+ }
+
+ switch (rtLast) {
+ case MessageServerReject::InvalidUsername:
+ case MessageServerReject::UsernameInUse:
+ matched = true;
+ uname = QInputDialog::getText(this, tr("Invalid username"), (rtLast == MessageServerReject::InvalidUsername) ? tr("You connected with an invalid username, please try another one.") : tr("That username is already in use, please try another username."), QLineEdit::Normal, uname, &ok);
+ break;
+ case MessageServerReject::WrongUserPW:
+ case MessageServerReject::WrongServerPW:
+ matched = true;
+ pw = QInputDialog::getText(this, tr("Wrong password"), (rtLast == MessageServerReject::WrongUserPW) ? tr("Wrong password for registered users, please try again.") : tr("Wrong server password for unregistered user account, please try again."), QLineEdit::Password, pw, &ok);
+ break;
+ default:
+ break;
+ }
+ if (ok && matched) {
+ qaServerDisconnect->setEnabled(true);
+ g.sh->setConnectionInfo(host, port, uname, pw);
+ g.sh->start(QThread::TimeCriticalPriority);
+ } else if (!matched && g.s.bReconnect && ! reason.isEmpty()) {
+ qaServerDisconnect->setEnabled(true);
+ qtReconnect->start();
}
- if (ok && matched) {
- qaServerDisconnect->setEnabled(true);
- g.sh->setConnectionInfo(host, port, uname, pw);
- g.sh->start(QThread::TimeCriticalPriority);
- } else if (!matched && g.s.bReconnect && ! reason.isEmpty()) {
- qaServerDisconnect->setEnabled(true);
- qtReconnect->start();
- }
}
}
@@ -1067,8 +1026,8 @@ void MainWindow::on_Icon_activated(QSystemTrayIcon::ActivationReason) {
void MainWindow::customEvent(QEvent *evt) {
if (evt->type() == TI_QEVENT) {
- hide();
- return;
+ hide();
+ return;
}
if (evt->type() == MB_QEVENT) {
MessageBoxEvent *mbe=static_cast<MessageBoxEvent *>(evt);
@@ -1284,7 +1243,7 @@ void MessageServerAuthenticate::process(Connection *) {
}
void MessageServerReject::process(Connection *) {
- g.mw->rtLast = rtType;
+ g.mw->rtLast = rtType;
g.l->log(Log::ServerDisconnected, MainWindow::tr("Server connection rejected: %1.").arg(qsReason));
g.l->setIgnore(Log::ServerDisconnected, 1);
}
@@ -1327,6 +1286,6 @@ void MessagePing::process(Connection *) {
}
void MessageTexture::process(Connection *) {
- if (! qbaTexture.isEmpty())
- g.o->textureResponse(iPlayerId,qbaTexture);
+ if (! qbaTexture.isEmpty())
+ g.o->textureResponse(iPlayerId,qbaTexture);
}
diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h
index b769dda29..dff7ef739 100644
--- a/src/mumble/MainWindow.h
+++ b/src/mumble/MainWindow.h
@@ -50,8 +50,8 @@ class MessageBoxEvent : public QEvent {
};
class MainWindow : public QMainWindow {
- friend class PlayerModel;
- Q_OBJECT
+ friend class PlayerModel;
+ Q_OBJECT
public:
PlayerModel *pmModel;
QMenu *qmServer, *qmPlayer, *qmChannel, *qmAudio, *qmConfig, *qmHelp;
@@ -87,7 +87,7 @@ class MainWindow : public QMainWindow {
void setupGui();
void customEvent(QEvent *evt);
virtual void closeEvent(QCloseEvent *e);
- virtual void hideEvent (QHideEvent *e);
+ virtual void hideEvent(QHideEvent *e);
public slots:
void on_Players_customContextMenuRequested(const QPoint &pos);
void on_Players_doubleClicked(const QModelIndex &idx);
diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp
index 75d41f594..a1a1398e1 100644
--- a/src/mumble/Overlay.cpp
+++ b/src/mumble/Overlay.cpp
@@ -55,11 +55,11 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qcbEnable->setObjectName(QLatin1String("Enable"));
qcbEnable->setToolTip(tr("Enable overlay."));
qcbEnable->setWhatsThis(tr("This sets whether the overlay is enabled or not. This setting is "
- "only checked with D3D9 applications are started, so make sure Mumble "
- "is running and this option is on before you start the application.<br />"
- "Please note that if you start the application after starting Mumble, "
- "or if you disable the overlay while running, there is no safe way "
- "to restart the overlay without also restarting the application."));
+ "only checked with D3D9 applications are started, so make sure Mumble "
+ "is running and this option is on before you start the application.<br />"
+ "Please note that if you start the application after starting Mumble, "
+ "or if you disable the overlay while running, there is no safe way "
+ "to restart the overlay without also restarting the application."));
qcbEnable->setChecked(g.s.bOverlayEnable);
grid->addWidget(qcbEnable, 0, 0, 1, 2);
@@ -72,11 +72,11 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
lab->setBuddy(qcbShow);
qcbShow->setToolTip(tr("Who to show on the overlay"));
qcbShow->setWhatsThis(tr("<b>This sets who to show in the in-game overlay.</b><br />"
- "If many people are connected to the same channel, the overlay list might be "
- "very long. Use this to shorten it.<br />"
- "<i>No one</i> - Don't show anyone (but leave overlay running).<br />"
- "<i>Only talking</i> - Only show talking people.<br />"
- "<i>Everyone</i> - Show everyone."));
+ "If many people are connected to the same channel, the overlay list might be "
+ "very long. Use this to shorten it.<br />"
+ "<i>No one</i> - Don't show anyone (but leave overlay running).<br />"
+ "<i>Only talking</i> - Only show talking people.<br />"
+ "<i>Everyone</i> - Show everyone."));
grid->addWidget(lab, 1, 0);
grid->addWidget(qcbShow, 1, 1, 1, 2);
@@ -84,9 +84,9 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qcbAlwaysSelf->setObjectName(QLatin1String("AlwaysSelf"));
qcbAlwaysSelf->setToolTip(tr("Always show yourself on overlay."));
qcbAlwaysSelf->setWhatsThis(tr("This sets whether to always show yourself or not. "
- "This setting is useful if you aren't showing everyone in the overlay, "
- "as then you would only see your own status if you were talking, which "
- "wouldn't let you see that you were deafened or muted."));
+ "This setting is useful if you aren't showing everyone in the overlay, "
+ "as then you would only see your own status if you were talking, which "
+ "wouldn't let you see that you were deafened or muted."));
qcbAlwaysSelf->setChecked(g.s.bOverlayAlwaysSelf);
grid->addWidget(qcbAlwaysSelf, 2, 0, 1, 2);
@@ -94,7 +94,7 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qcbUserTextures->setObjectName(QLatin1String("UserTextures"));
qcbUserTextures->setToolTip(tr("Show User custom textures instead of text on the overlay."));
qcbUserTextures->setWhatsThis(tr("This sets whether to download and use custom textures for registered users. "
- "If disabled, the regular outline text will be used instead."));
+ "If disabled, the regular outline text will be used instead."));
qcbUserTextures->setChecked(g.s.bOverlayUserTextures);
grid->addWidget(qcbUserTextures, 3, 0, 1, 2);
@@ -107,29 +107,29 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qcbLeft->setObjectName(QLatin1String("Left"));
qcbLeft->setToolTip(tr("Let overlay grow to the left"));
qcbLeft->setWhatsThis(tr("The overlay tries to stay as small as possible and at the position "
- "you have selected. This allows the overlay to grow to the left if "
- "needed."));
+ "you have selected. This allows the overlay to grow to the left if "
+ "needed."));
qcbLeft->setChecked(g.s.bOverlayLeft);
qcbRight = new QCheckBox(tr("Grow Right"));
qcbRight->setObjectName(QLatin1String("Right"));
qcbRight->setToolTip(tr("Let overlay grow to the Right"));
qcbRight->setWhatsThis(tr("The overlay tries to stay as small as possible and at the position "
- "you have selected. This allows the overlay to grow to the Right if "
- "needed."));
+ "you have selected. This allows the overlay to grow to the Right if "
+ "needed."));
qcbRight->setChecked(g.s.bOverlayRight);
qcbTop = new QCheckBox(tr("Grow Up"));
qcbTop->setObjectName(QLatin1String("Top"));
qcbTop->setToolTip(tr("Let overlay grow upwards"));
qcbTop->setWhatsThis(tr("The overlay tries to stay as small as possible and at the position "
- "you have selected. This allows the overlay to grow to the top if "
- "needed."));
+ "you have selected. This allows the overlay to grow to the top if "
+ "needed."));
qcbTop->setChecked(g.s.bOverlayTop);
qcbBottom = new QCheckBox(tr("Grow Down"));
qcbBottom->setObjectName(QLatin1String("Bottom"));
qcbBottom->setToolTip(tr("Let overlay grow downwards"));
qcbBottom->setWhatsThis(tr("The overlay tries to stay as small as possible and at the position "
- "you have selected. This allows the overlay to grow towards the bottom if "
- "needed."));
+ "you have selected. This allows the overlay to grow towards the bottom if "
+ "needed."));
qcbBottom->setChecked(g.s.bOverlayBottom);
qsX = new QSlider(Qt::Horizontal);
@@ -184,8 +184,8 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qsMaxHeight->setObjectName(QLatin1String("MaxHeight"));
qsMaxHeight->setToolTip(tr("Maximum height of names."));
qsMaxHeight->setWhatsThis(tr("This sets the maximum height of names shown, relative to the screen height. If your active 3D window is 800 pixels tall and this is set to 5%, each name will be 40 pixels "
- "tall. Note that the names will not be taller than 60 pixels "
- "no matter what you set here."));
+ "tall. Note that the names will not be taller than 60 pixels "
+ "no matter what you set here."));
qsMaxHeight->setRange(10, 200);
qsMaxHeight->setSingleStep(1);
qsMaxHeight->setPageStep(10);
@@ -254,22 +254,22 @@ OverlayConfig::OverlayConfig(QWidget *p) : ConfigWidget(p) {
qgbColors->setLayout(grid);
- v = new QVBoxLayout;
- v->addWidget(qgbOptions);
- v->addWidget(qgbPosition);
- v->addWidget(qgbColors);
- v->addStretch(1);
- setLayout(v);
+ v = new QVBoxLayout;
+ v->addWidget(qgbOptions);
+ v->addWidget(qgbPosition);
+ v->addWidget(qgbColors);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
void OverlayConfig::setColorLabel(QLabel *label, QColor col) {
label->setText(col.name());
- QPalette palette;
- palette.setColor(label->foregroundRole(), col);
- label->setPalette(palette);
+ QPalette palette;
+ palette.setColor(label->foregroundRole(), col);
+ label->setPalette(palette);
}
void OverlayConfig::on_SetFont_clicked() {
@@ -374,13 +374,13 @@ Overlay::Overlay() : QObject() {
qlOverlay->setFileName(path);
if (! qlOverlay->load()) {
QMessageBox::critical(NULL, tr("Mumble"), tr("Failed to load overlay library. This means either that:\n"
- "- the library (mumble_ol.dll) wasn't found in the directory you ran Mumble from\n"
- "- you're on an OS earlier than WinXP SP2\n"
- "- you do not have the June 2007 updated version of DX9.0c"), QMessageBox::Ok, QMessageBox::NoButton);
+ "- the library (mumble_ol.dll) wasn't found in the directory you ran Mumble from\n"
+ "- you're on an OS earlier than WinXP SP2\n"
+ "- you do not have the June 2007 updated version of DX9.0c"), QMessageBox::Ok, QMessageBox::NoButton);
qWarning("Overlay failure");
} else {
- sm.resolve(qlOverlay);
- }
+ sm.resolve(qlOverlay);
+ }
#else
sm.resolve(qlOverlay);
#endif
@@ -425,7 +425,7 @@ bool Overlay::isActive() const {
void Overlay::toggleShow() {
Settings::OverlayShow ns;
- switch(g.s.osOverlay) {
+ switch (g.s.osOverlay) {
case Settings::Nothing:
ns = Settings::All;
break;
@@ -469,27 +469,27 @@ void Overlay::forceSettings() {
}
void Overlay::textureResponse(int id, const QByteArray &texture) {
- QString s = qhQueried.value(id);
- if (s.isEmpty())
- return;
+ QString s = qhQueried.value(id);
+ if (s.isEmpty())
+ return;
- QByteArray t = qUncompress(texture);
+ QByteArray t = qUncompress(texture);
- if (t.size() != TEXTURE_SIZE)
- return;
+ if (t.size() != TEXTURE_SIZE)
+ return;
- const unsigned char *data = reinterpret_cast<const unsigned char *>(t.constData());
+ const unsigned char *data = reinterpret_cast<const unsigned char *>(t.constData());
- int width = 0;
- for(int y=0;y<TEXT_HEIGHT;y++) {
- for(int x=0;x<TEXT_WIDTH; x++) {
- if ((x > width) && (data[(y*TEXT_WIDTH+x)*4] != 0x00))
- width = x;
+ int width = 0;
+ for (int y=0;y<TEXT_HEIGHT;y++) {
+ for (int x=0;x<TEXT_WIDTH; x++) {
+ if ((x > width) && (data[(y*TEXT_WIDTH+x)*4] != 0x00))
+ width = x;
+ }
}
- }
- qhUserTextures[id] = UserTexture(width, t);
- qsForce.insert(id);
- setTexts(qlCurrentTexts);
+ qhUserTextures[id] = UserTexture(width, t);
+ qsForce.insert(id);
+ setTexts(qlCurrentTexts);
}
typedef QPair<QString, quint32> qpChanCol;
@@ -541,11 +541,11 @@ void Overlay::updateOverlay() {
foreach(Player *p, Player::get(g.sId)->cChannel->qlPlayers) {
if ((g.s.osOverlay == Settings::All) || p->bTalking || ((p == Player::get(g.sId)) && g.s.bOverlayAlwaysSelf)) {
- if (g.s.bOverlayUserTextures && (p->iId >= 0) && (! qhQueried.contains(p->iId))) {
- qhQueried.insert(p->iId, p->qsName);
- MessageTexture mt;
- mt.iPlayerId = p->iId;
- g.sh->sendMessage(&mt);
+ if (g.s.bOverlayUserTextures && (p->iId >= 0) && (! qhQueried.contains(p->iId))) {
+ qhQueried.insert(p->iId, p->qsName);
+ MessageTexture mt;
+ mt.iPlayerId = p->iId;
+ g.sh->sendMessage(&mt);
}
QString name = p->qsName;
Decoration dec = None;
@@ -568,8 +568,8 @@ void Overlay::updateOverlay() {
}
}
} else {
- qhUserTextures.clear();
- clearCache();
+ qhUserTextures.clear();
+ clearCache();
}
setTexts(lines);
}
@@ -582,64 +582,64 @@ void Overlay::updateOverlay() {
*/
void Overlay::fixFont() {
- g.s.qfOverlayFont.setStyleStrategy(QFont::ForceOutline);
+ g.s.qfOverlayFont.setStyleStrategy(QFont::ForceOutline);
- int psize = TEXT_HEIGHT;
+ int psize = TEXT_HEIGHT;
- QRectF br;
+ QRectF br;
- do {
- g.s.qfOverlayFont.setPixelSize(psize--);
- QPainterPath qp;
- qp.addText(0, 0, g.s.qfOverlayFont, QLatin1String("Üy"));
- br=qp.boundingRect();
- qWarning("Overlay: Attempt for pixelsize %d gave actual sizes %f %f", psize+1, br.height(),br.top());
- } while ((br.height()+2) > TEXT_HEIGHT);
+ do {
+ g.s.qfOverlayFont.setPixelSize(psize--);
+ QPainterPath qp;
+ qp.addText(0, 0, g.s.qfOverlayFont, QLatin1String("Üy"));
+ br=qp.boundingRect();
+ qWarning("Overlay: Attempt for pixelsize %d gave actual sizes %f %f", psize+1, br.height(),br.top());
+ } while ((br.height()+2) > TEXT_HEIGHT);
- fFontBase = fabs(br.top());
+ fFontBase = fabs(br.top());
- clearCache();
+ clearCache();
- qlCurrentTexts.clear();
+ qlCurrentTexts.clear();
}
void Overlay::clearCache() {
- foreach(unsigned char *ptr, qhTextures)
- delete [] ptr;
+ foreach(unsigned char *ptr, qhTextures)
+ delete [] ptr;
- qhTextures.clear();
- qhWidths.clear();
- qhQueried.clear();
+ qhTextures.clear();
+ qhWidths.clear();
+ qhQueried.clear();
}
void Overlay::setTexts(const QList<TextLine> &lines) {
foreach(const TextLine &e, lines) {
- if ((! e.qsText.isEmpty()) && (! qhTextures.contains(e.qsText)) && (! qhUserTextures.contains(e.iPlayer))) {
- unsigned char *td = new unsigned char[TEXTURE_SIZE];
- memset(td, 0, TEXTURE_SIZE);
+ if ((! e.qsText.isEmpty()) && (! qhTextures.contains(e.qsText)) && (! qhUserTextures.contains(e.iPlayer))) {
+ unsigned char *td = new unsigned char[TEXTURE_SIZE];
+ memset(td, 0, TEXTURE_SIZE);
- QImage qi(td, TEXT_WIDTH, TEXT_HEIGHT, QImage::Format_ARGB32);
+ QImage qi(td, TEXT_WIDTH, TEXT_HEIGHT, QImage::Format_ARGB32);
- QPainterPath qp;
- qp.addText(2, fFontBase, g.s.qfOverlayFont, e.qsText);
+ QPainterPath qp;
+ qp.addText(2, fFontBase, g.s.qfOverlayFont, e.qsText);
- QPainter p(&qi);
- p.setRenderHint(QPainter::Antialiasing);
- p.setRenderHint(QPainter::TextAntialiasing);
- p.setBrush(Qt::white);
+ QPainter p(&qi);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.setRenderHint(QPainter::TextAntialiasing);
+ p.setBrush(Qt::white);
- // Draw with big border, this will be the "outline"
- p.setPen(QPen(Qt::black, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
- p.drawPath(qp);
+ // Draw with big border, this will be the "outline"
+ p.setPen(QPen(Qt::black, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ p.drawPath(qp);
- // And again, all white with no border. This avoids thin fonts being just black outline.
- p.setPen(Qt::NoPen);
- p.drawPath(qp);
+ // And again, all white with no border. This avoids thin fonts being just black outline.
+ p.setPen(Qt::NoPen);
+ p.drawPath(qp);
- qhTextures[e.qsText] = td;
- qhWidths[e.qsText] = qMin(static_cast<int>(qp.boundingRect().width())+6, TEXT_WIDTH);
- }
+ qhTextures[e.qsText] = td;
+ qhWidths[e.qsText] = qMin(static_cast<int>(qp.boundingRect().width())+6, TEXT_WIDTH);
+ }
}
if (! sm.tryLock())
@@ -647,69 +647,69 @@ void Overlay::setTexts(const QList<TextLine> &lines) {
int i;
- for(i=0;i<lines.count();i++) {
- if (i >= NUM_TEXTS)
- break;
+ for (i=0;i<lines.count();i++) {
+ if (i >= NUM_TEXTS)
+ break;
- const TextLine &tl = lines.at(i);
- TextEntry *te = & sm.sm->texts[i];
+ const TextLine &tl = lines.at(i);
+ TextEntry *te = & sm.sm->texts[i];
wcscpy(te->text, reinterpret_cast<const wchar_t *>(tl.qsText.left(127).utf16()));
- te->color = lines[i].uiColor;
+ te->color = lines[i].uiColor;
if ((i >= qlCurrentTexts.count()) || (qlCurrentTexts[i].dDecor != tl.dDecor) || (qlCurrentTexts[i].qsText != tl.qsText) || qsForce.contains(tl.iPlayer)) {
- if (tl.qsText.isNull()) {
- te->width = 0;
- } else {
- int width = 0;
- const unsigned char *src = NULL;
-
- if (qhUserTextures.contains(tl.iPlayer)) {
- const UserTexture &ut=qhUserTextures.value(tl.iPlayer);
- width = ut.first;
- src = reinterpret_cast<const unsigned char *>(ut.second.constData());
- } else {
- width = qhWidths[tl.qsText];
- src = qhTextures[tl.qsText];
- }
-
- unsigned char * dst = NULL;
-
- if (tl.dDecor != None) {
- unsigned char * decdst;
- const unsigned char * decsrc = reinterpret_cast<const unsigned char *>((tl.dDecor == Muted) ? qbaMuted.constData() : qbaDeafened.constData());
-
- width = qMin(TEXT_WIDTH - TEXT_HEIGHT, width);
- if (g.s.bOverlayLeft) {
- dst = sm.sm->texts[i].texture + TEXT_HEIGHT * 4;
- decdst = sm.sm->texts[i].texture;
- } else {
- dst = sm.sm->texts[i].texture;
- decdst = sm.sm->texts[i].texture + width * 4;
- }
- for(int j=0;j<TEXT_HEIGHT;j++)
- memcpy(decdst + j * TEXT_WIDTH * 4, decsrc + j * TEXT_HEIGHT * 4, TEXT_HEIGHT * 4);
-
+ if (tl.qsText.isNull()) {
+ te->width = 0;
} else {
- width = qMin(TEXT_WIDTH, width);
- dst = sm.sm->texts[i].texture;
- }
+ int width = 0;
+ const unsigned char *src = NULL;
+
+ if (qhUserTextures.contains(tl.iPlayer)) {
+ const UserTexture &ut=qhUserTextures.value(tl.iPlayer);
+ width = ut.first;
+ src = reinterpret_cast<const unsigned char *>(ut.second.constData());
+ } else {
+ width = qhWidths[tl.qsText];
+ src = qhTextures[tl.qsText];
+ }
- for(int j=0;j<TEXT_HEIGHT;j++)
- memcpy(dst + j * TEXT_WIDTH * 4, src + j * TEXT_WIDTH * 4, width * 4);
+ unsigned char * dst = NULL;
+
+ if (tl.dDecor != None) {
+ unsigned char * decdst;
+ const unsigned char * decsrc = reinterpret_cast<const unsigned char *>((tl.dDecor == Muted) ? qbaMuted.constData() : qbaDeafened.constData());
+
+ width = qMin(TEXT_WIDTH - TEXT_HEIGHT, width);
+ if (g.s.bOverlayLeft) {
+ dst = sm.sm->texts[i].texture + TEXT_HEIGHT * 4;
+ decdst = sm.sm->texts[i].texture;
+ } else {
+ dst = sm.sm->texts[i].texture;
+ decdst = sm.sm->texts[i].texture + width * 4;
+ }
+ for (int j=0;j<TEXT_HEIGHT;j++)
+ memcpy(decdst + j * TEXT_WIDTH * 4, decsrc + j * TEXT_HEIGHT * 4, TEXT_HEIGHT * 4);
+
+ } else {
+ width = qMin(TEXT_WIDTH, width);
+ dst = sm.sm->texts[i].texture;
+ }
+
+ for (int j=0;j<TEXT_HEIGHT;j++)
+ memcpy(dst + j * TEXT_WIDTH * 4, src + j * TEXT_WIDTH * 4, width * 4);
- if (tl.dDecor != None)
- width += TEXT_HEIGHT;
+ if (tl.dDecor != None)
+ width += TEXT_HEIGHT;
- te->width = width;
- te->bUpdated = true;
- }
- qsForce.remove(tl.iPlayer);
+ te->width = width;
+ te->bUpdated = true;
+ }
+ qsForce.remove(tl.iPlayer);
}
}
- for(;i<NUM_TEXTS;i++) {
- sm.sm->texts[i].width = -1;
+ for (;i<NUM_TEXTS;i++) {
+ sm.sm->texts[i].width = -1;
}
qlCurrentTexts = lines;
diff --git a/src/mumble/Overlay.h b/src/mumble/Overlay.h
index db5f6f277..813591b4b 100644
--- a/src/mumble/Overlay.h
+++ b/src/mumble/Overlay.h
@@ -38,19 +38,19 @@ class Player;
class SharedMemoryPrivate;
class SharedMemory {
- protected:
- SharedMemoryPrivate *d;
- public:
- SharedMem *sm;
- SharedMemory();
- ~SharedMemory();
- void resolve(QLibrary *lib);
- bool tryLock();
- void unlock();
+ protected:
+ SharedMemoryPrivate *d;
+ public:
+ SharedMem *sm;
+ SharedMemory();
+ ~SharedMemory();
+ void resolve(QLibrary *lib);
+ bool tryLock();
+ void unlock();
};
class OverlayConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QCheckBox *qcbEnable, *qcbAlwaysSelf;
QComboBox *qcbShow;
@@ -89,19 +89,19 @@ class OverlayConfig : public ConfigWidget {
class OverlayPrivate;
class Overlay : public QObject {
- friend class OverlayConfig;
- Q_OBJECT
+ friend class OverlayConfig;
+ Q_OBJECT
protected:
OverlayPrivate *d;
enum Decoration { None, Muted, Deafened };
struct TextLine {
- QString qsText;
- int iPlayer;
- quint32 uiColor;
- Decoration dDecor;
- TextLine(const QString &t, quint32 c, int p = -1, Decoration d = None) : qsText(t), iPlayer(p), uiColor(c), dDecor(d) { };
+ QString qsText;
+ int iPlayer;
+ quint32 uiColor;
+ Decoration dDecor;
+ TextLine(const QString &t, quint32 c, int p = -1, Decoration d = None) : qsText(t), iPlayer(p), uiColor(c), dDecor(d) { };
};
typedef QPair<short, QByteArray> UserTexture;
diff --git a/src/mumble/Overlay_unix.cpp b/src/mumble/Overlay_unix.cpp
index e7d167c57..e1db99572 100644
--- a/src/mumble/Overlay_unix.cpp
+++ b/src/mumble/Overlay_unix.cpp
@@ -45,27 +45,27 @@
class SharedMemoryPrivate {
- public:
- int fd;
- sem_t *sem;
+ public:
+ int fd;
+ sem_t *sem;
};
SharedMemory::SharedMemory() {
- d = new SharedMemoryPrivate();
- d->fd = -1;
- d->sem = NULL;
- sm = NULL;
+ d = new SharedMemoryPrivate();
+ d->fd = -1;
+ d->sem = NULL;
+ sm = NULL;
}
SharedMemory::~SharedMemory() {
if (sm)
munmap(sm, sizeof(SharedMem));
-
+
if (d->sem != 0) {
sem_close(d->sem);
sem_unlink("/MumbleOverlaySem");
- }
-
+ }
+
if (d->fd >= 0) {
close(d->fd);
shm_unlink("/MumbleOverlayMem");
@@ -118,7 +118,7 @@ class OverlayPrivate {
};
void Overlay::platformInit() {
- d = new OverlayPrivate();
+ d = new OverlayPrivate();
}
void Overlay::setActive(bool) {
diff --git a/src/mumble/Overlay_win.cpp b/src/mumble/Overlay_win.cpp
index c9f762b3b..2871e54f1 100644
--- a/src/mumble/Overlay_win.cpp
+++ b/src/mumble/Overlay_win.cpp
@@ -37,13 +37,13 @@ typedef void (__cdecl *HooksProc)();
class SharedMemoryPrivate {
- public:
- HANDLE hMutex;
+ public:
+ HANDLE hMutex;
};
SharedMemory::SharedMemory() {
- d = new SharedMemoryPrivate();
- sm = NULL;
+ d = new SharedMemoryPrivate();
+ sm = NULL;
}
SharedMemory::~SharedMemory() {
@@ -58,8 +58,8 @@ void SharedMemory::resolve(QLibrary *lib) {
}
bool SharedMemory::tryLock() {
- DWORD dwWaitResult = WaitForSingleObject(d->hMutex, 500L);
- return (dwWaitResult == WAIT_OBJECT_0);
+ DWORD dwWaitResult = WaitForSingleObject(d->hMutex, 500L);
+ return (dwWaitResult == WAIT_OBJECT_0);
}
void SharedMemory::unlock() {
@@ -67,12 +67,12 @@ void SharedMemory::unlock() {
}
class OverlayPrivate {
- public:
- HooksProc hpInstall, hpRemove;
+ public:
+ HooksProc hpInstall, hpRemove;
};
void Overlay::platformInit() {
- d = new OverlayPrivate();
+ d = new OverlayPrivate();
d->hpInstall = (HooksProc)qlOverlay->resolve("InstallHooks");
d->hpRemove = (HooksProc)qlOverlay->resolve("RemoveHooks");
}
diff --git a/src/mumble/PlayerModel.cpp b/src/mumble/PlayerModel.cpp
index f0245ee06..ab8ec7897 100644
--- a/src/mumble/PlayerModel.cpp
+++ b/src/mumble/PlayerModel.cpp
@@ -79,16 +79,16 @@ ModelItem *ModelItem::child(int idx) const {
return NULL;
if (! bPlayersTop) {
- if (idx < qlChannels.count())
- return c_qhChannels.value(channelAt(idx));
- else
- return c_qhPlayers.value(playerAt(idx));
- } else {
- if (idx < qlPlayers.count())
- return c_qhPlayers.value(playerAt(idx));
- else
- return c_qhChannels.value(channelAt(idx));
- }
+ if (idx < qlChannels.count())
+ return c_qhChannels.value(channelAt(idx));
+ else
+ return c_qhPlayers.value(playerAt(idx));
+ } else {
+ if (idx < qlPlayers.count())
+ return c_qhPlayers.value(playerAt(idx));
+ else
+ return c_qhChannels.value(channelAt(idx));
+ }
}
bool ModelItem::validRow(int idx) const {
@@ -96,7 +96,7 @@ bool ModelItem::validRow(int idx) const {
}
Player *ModelItem::playerAt(int idx) const {
- if (! bPlayersTop)
+ if (! bPlayersTop)
idx -= qlChannels.count();
if ((idx>= 0) && (idx < qlPlayers.count()))
return qlPlayers.at(idx);
@@ -104,7 +104,7 @@ Player *ModelItem::playerAt(int idx) const {
}
Channel *ModelItem::channelAt(int idx) const {
- if (bPlayersTop)
+ if (bPlayersTop)
idx -= qlPlayers.count();
if ((idx>= 0) && (idx < qlChannels.count()))
return qlChannels.at(idx);
@@ -112,9 +112,9 @@ Channel *ModelItem::channelAt(int idx) const {
}
int ModelItem::rowOf(Channel *c) const {
- int v = qlChannels.lastIndexOf(c);
- if (v != -1)
- v += (!bPlayersTop) ? 0 : qlPlayers.count();
+ int v = qlChannels.lastIndexOf(c);
+ if (v != -1)
+ v += (!bPlayersTop) ? 0 : qlPlayers.count();
return v;
}
@@ -145,7 +145,7 @@ int ModelItem::insertIndex(Channel *c) const {
Channel *cp;
foreach(cp, qlChannels)
- qls << cp->qsName;
+ qls << cp->qsName;
qls << c->qsName;
qSort(qls);
@@ -157,7 +157,7 @@ int ModelItem::insertIndex(Player *p) const {
Player *pp;
foreach(pp, qlPlayers)
- qls << pp->qsName;
+ qls << pp->qsName;
qls << p->qsName;
qSort(qls);
@@ -199,13 +199,11 @@ PlayerModel::~PlayerModel() {
}
-int PlayerModel::columnCount(const QModelIndex &) const
-{
+int PlayerModel::columnCount(const QModelIndex &) const {
return 2;
}
-QModelIndex PlayerModel::index(int row, int column, const QModelIndex &p) const
-{
+QModelIndex PlayerModel::index(int row, int column, const QModelIndex &p) const {
ModelItem *item;
QModelIndex idx = QModelIndex();
@@ -213,10 +211,10 @@ QModelIndex PlayerModel::index(int row, int column, const QModelIndex &p) const
return QModelIndex();
}
- if ( ! p.isValid()) {
+ if (! p.isValid()) {
item = miRoot;
} else {
- item = static_cast<ModelItem *>(p.internalPointer());
+ item = static_cast<ModelItem *>(p.internalPointer());
}
if (! item->validRow(row))
@@ -224,11 +222,10 @@ QModelIndex PlayerModel::index(int row, int column, const QModelIndex &p) const
idx = createIndex(row, column, item->child(row));
- return idx;
+ return idx;
}
-QModelIndex PlayerModel::index(Player *p, int column) const
-{
+QModelIndex PlayerModel::index(Player *p, int column) const {
ModelItem *item = ModelItem::c_qhPlayers.value(p);
Q_ASSERT(p);
Q_ASSERT(item);
@@ -236,8 +233,7 @@ QModelIndex PlayerModel::index(Player *p, int column) const
return idx;
}
-QModelIndex PlayerModel::index(Channel *c) const
-{
+QModelIndex PlayerModel::index(Channel *c) const {
ModelItem *item = ModelItem::c_qhChannels.value(c);
Q_ASSERT(c);
Q_ASSERT(item);
@@ -247,12 +243,11 @@ QModelIndex PlayerModel::index(Channel *c) const
return idx;
}
-QModelIndex PlayerModel::parent(const QModelIndex &idx) const
-{
+QModelIndex PlayerModel::parent(const QModelIndex &idx) const {
if (! idx.isValid())
- return QModelIndex();
+ return QModelIndex();
- ModelItem *item = static_cast<ModelItem *>(idx.internalPointer());
+ ModelItem *item = static_cast<ModelItem *>(idx.internalPointer());
ModelItem *pitem = item->parent();
ModelItem *gpitem = (pitem) ? pitem->parent() : NULL;
@@ -263,27 +258,25 @@ QModelIndex PlayerModel::parent(const QModelIndex &idx) const
QModelIndex pidx = createIndex(pitem->rowOfSelf(), 0, pitem);
- return pidx;
+ return pidx;
}
-int PlayerModel::rowCount(const QModelIndex &p) const
-{
- ModelItem *item;
+int PlayerModel::rowCount(const QModelIndex &p) const {
+ ModelItem *item;
- int val = 0;
+ int val = 0;
- if (!p.isValid())
- item = miRoot;
- else
- item = static_cast<ModelItem *>(p.internalPointer());
+ if (!p.isValid())
+ item = miRoot;
+ else
+ item = static_cast<ModelItem *>(p.internalPointer());
val = item->rows();
return val;
}
-QString PlayerModel::stringIndex(const QModelIndex &idx) const
-{
+QString PlayerModel::stringIndex(const QModelIndex &idx) const {
ModelItem *item = static_cast<ModelItem *>(idx.internalPointer());
if (!idx.isValid())
return QLatin1String("invIdx");
@@ -295,10 +288,9 @@ QString PlayerModel::stringIndex(const QModelIndex &idx) const
return QString::fromLatin1("C:%1 [%2,%3]").arg(item->cChan->qsName).arg(idx.row()).arg(idx.column());
}
-QVariant PlayerModel::data(const QModelIndex &idx, int role) const
-{
- if (!idx.isValid())
- return QVariant();
+QVariant PlayerModel::data(const QModelIndex &idx, int role) const {
+ if (!idx.isValid())
+ return QVariant();
ModelItem *item = static_cast<ModelItem *>(idx.internalPointer());
@@ -362,22 +354,20 @@ QVariant PlayerModel::data(const QModelIndex &idx, int role) const
return QVariant();
}
-Qt::ItemFlags PlayerModel::flags(const QModelIndex &idx) const
-{
+Qt::ItemFlags PlayerModel::flags(const QModelIndex &idx) const {
if (!idx.isValid())
return Qt::ItemIsDropEnabled;
- if (idx.column() != 0)
- return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled;
+ if (idx.column() != 0)
+ return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled;
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
}
-QVariant PlayerModel::otherRoles(int section, int role, bool isPlayer) const
-{
- switch(role) {
+QVariant PlayerModel::otherRoles(int section, int role, bool isPlayer) const {
+ switch (role) {
case Qt::ToolTipRole:
- switch(section) {
+ switch (section) {
case 0:
return isPlayer ? tr("Name of player") : tr("Name of channel");
case 1:
@@ -385,26 +375,26 @@ QVariant PlayerModel::otherRoles(int section, int role, bool isPlayer) const
}
break;
case Qt::WhatsThisRole:
- switch(section) {
+ switch (section) {
case 0:
if (isPlayer)
- return tr("This is a player connected to the server. The icon to the left of the player indicates "
- "whether or not they are talking:<br />"
- "<img src=\"skin:talking_on.png\" /> Talking<br />"
- "<img src=\"skin:talking_off.png\" /> Not talking"
- );
+ return tr("This is a player connected to the server. The icon to the left of the player indicates "
+ "whether or not they are talking:<br />"
+ "<img src=\"skin:talking_on.png\" /> Talking<br />"
+ "<img src=\"skin:talking_off.png\" /> Not talking"
+ );
else
return tr("This is a channel on the server. Only players in the same channel can hear each other.");
case 1:
return tr("This shows the flags the player has on the server, if any:<br />"
- "<img src=\"skin:authenticated.png\" />Authenticated user<br />"
- "<img src=\"skin:muted_self.png\" />Muted (by self)<br />"
- "<img src=\"skin:muted_server.png\" />Muted (by admin)<br />"
- "<img src=\"skin:deafened_self.png\" />Deafened (by self)<br />"
- "<img src=\"skin:deafened_server.png\" />Deafened (by admin)<br />"
- "A player muted by himself is probably just away, talking on the phone or something like that.<br />"
- "A player muted by an admin is probably also just away, and the noise the player is making was annoying "
- "enough that an admin muted him.");
+ "<img src=\"skin:authenticated.png\" />Authenticated user<br />"
+ "<img src=\"skin:muted_self.png\" />Muted (by self)<br />"
+ "<img src=\"skin:muted_server.png\" />Muted (by admin)<br />"
+ "<img src=\"skin:deafened_self.png\" />Deafened (by self)<br />"
+ "<img src=\"skin:deafened_server.png\" />Deafened (by admin)<br />"
+ "A player muted by himself is probably just away, talking on the phone or something like that.<br />"
+ "A player muted by an admin is probably also just away, and the noise the player is making was annoying "
+ "enough that an admin muted him.");
}
break;
}
@@ -412,14 +402,13 @@ QVariant PlayerModel::otherRoles(int section, int role, bool isPlayer) const
}
QVariant PlayerModel::headerData(int section, Qt::Orientation orientation,
- int role) const
-{
+ int role) const {
if (orientation != Qt::Horizontal)
return QVariant();
- switch(role) {
+ switch (role) {
case Qt::DisplayRole:
- switch(section) {
+ switch (section) {
case 0:
return tr("Name");
case 1:
@@ -427,7 +416,7 @@ QVariant PlayerModel::headerData(int section, Qt::Orientation orientation,
}
}
- return QVariant();
+ return QVariant();
}
void PlayerModel::unbugHide(const QModelIndex &idx) {
@@ -623,10 +612,10 @@ void PlayerModel::removeChannel(Channel *c) {
item=ModelItem::c_qhChannels.value(c);
foreach(subc, item->qlChannels)
- removeChannel(subc);
+ removeChannel(subc);
foreach(pl, item->qlPlayers)
- removePlayer(pl);
+ removePlayer(pl);
hideChannel(c);
Channel::remove(c);
@@ -643,13 +632,13 @@ void PlayerModel::moveChannel(Channel *c, int id) {
void PlayerModel::linkChannels(Channel *c, QList<Channel *> links) {
foreach(Channel *l, links)
- c->link(l);
+ c->link(l);
recheckLinks();
}
void PlayerModel::unlinkChannels(Channel *c, QList<Channel *> links) {
foreach(Channel *l, links)
- c->unlink(l);
+ c->unlink(l);
recheckLinks();
}
@@ -672,33 +661,30 @@ void PlayerModel::removeAll() {
updateOverlay();
}
-Player *PlayerModel::getPlayer(const QModelIndex &idx) const
-{
+Player *PlayerModel::getPlayer(const QModelIndex &idx) const {
if (! idx.isValid())
return NULL;
- ModelItem *item;
- item = static_cast<ModelItem *>(idx.internalPointer());
+ ModelItem *item;
+ item = static_cast<ModelItem *>(idx.internalPointer());
- return item->pPlayer;
+ return item->pPlayer;
}
-Channel *PlayerModel::getChannel(const QModelIndex &idx) const
-{
+Channel *PlayerModel::getChannel(const QModelIndex &idx) const {
if (! idx.isValid())
return NULL;
- ModelItem *item;
- item = static_cast<ModelItem *>(idx.internalPointer());
+ ModelItem *item;
+ item = static_cast<ModelItem *>(idx.internalPointer());
if (item->pPlayer)
return item->pPlayer->cChannel;
else
- return item->cChan;
+ return item->cChan;
}
-Channel *PlayerModel::getSubChannel(Channel *p, int idx) const
-{
+Channel *PlayerModel::getSubChannel(Channel *p, int idx) const {
ModelItem *item=ModelItem::c_qhChannels.value(p);
if (idx < 0 || idx >= item->qlChannels.count())
return NULL;
@@ -706,16 +692,14 @@ Channel *PlayerModel::getSubChannel(Channel *p, int idx) const
}
-void PlayerModel::playerTalkingChanged(bool)
-{
+void PlayerModel::playerTalkingChanged(bool) {
Player *p=static_cast<Player *>(sender());
QModelIndex idx = index(p);
emit dataChanged(idx, idx);
updateOverlay();
}
-void PlayerModel::playerMuteDeafChanged()
-{
+void PlayerModel::playerMuteDeafChanged() {
Player *p=static_cast<Player *>(sender());
QModelIndex idx = index(p, 1);
emit dataChanged(idx, idx);
@@ -754,7 +738,7 @@ QMimeData *PlayerModel::mimeData(const QModelIndexList &idxs) const {
return md;
}
-bool PlayerModel::dropMimeData (const QMimeData *md, Qt::DropAction, int, int, const QModelIndex &p) {
+bool PlayerModel::dropMimeData(const QMimeData *md, Qt::DropAction, int, int, const QModelIndex &p) {
if (! md->hasFormat(mimeTypes().at(0)))
return false;
@@ -772,7 +756,7 @@ bool PlayerModel::dropMimeData (const QMimeData *md, Qt::DropAction, int, int, c
ds >> sId;
Channel *c;
- if ( ! p.isValid()) {
+ if (! p.isValid()) {
c = Channel::get(0);
} else {
c = getChannel(p);
@@ -800,7 +784,7 @@ void PlayerModel::updateOverlay() const {
PlayerDelegate::PlayerDelegate(QObject *p) : QItemDelegate(p) {
}
-QSize PlayerDelegate::sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index) const {
+QSize PlayerDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
if (index.column() == 1) {
const QAbstractItemModel *m = index.model();
QVariant data = m->data(index);
@@ -818,7 +802,7 @@ void PlayerDelegate::paint(QPainter * painter, const QStyleOptionViewItem &optio
QList<QVariant> ql = data.toList();
painter->save();
- for(int i=0;i<ql.size();i++) {
+ for (int i=0;i<ql.size();i++) {
QRect r = option.rect;
r.setSize(QSize(16,16));
r.translate(i*18+1,1);
diff --git a/src/mumble/PlayerModel.h b/src/mumble/PlayerModel.h
index 8068ce843..f2f8a63a8 100644
--- a/src/mumble/PlayerModel.h
+++ b/src/mumble/PlayerModel.h
@@ -35,10 +35,10 @@ class Player;
class Channel;
class PlayerDelegate : public QItemDelegate {
- Q_OBJECT
+ Q_OBJECT
public:
PlayerDelegate(QObject *parent = NULL);
- QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter * painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
@@ -77,74 +77,74 @@ struct ModelItem {
class ChannelItem;
class PlayerModel : public QAbstractItemModel {
- friend class ModelItem;
- Q_OBJECT
-protected:
- QIcon qiTalkingOn, qiTalkingAlt, qiTalkingOff;
- QIcon qiMutedSelf, qiMutedServer, qiMutedLocal;
- QIcon qiDeafenedSelf, qiDeafenedServer;
- QIcon qiAuthenticated, qiChannel, qiLinkedChannel;
- ModelItem *miRoot;
- QSet<Channel *> qsLinked;
-
- QModelIndex index(Player *, int column = 0) const;
- QModelIndex index(Channel *) const;
- QModelIndex index(ChannelItem *) const;
-
- void hidePlayer(Player *p);
- void showPlayer(Player *p, Channel *c);
-
- void hideChannel(Channel *c);
- void showChannel(Channel *c, Channel *p);
-
- QString stringIndex(const QModelIndex &index) const;
-
- void unbugHide(const QModelIndex &index);
-public:
- PlayerModel(QObject *parent = 0);
- ~PlayerModel();
-
- QVariant data(const QModelIndex &index, int role) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- Qt::DropActions supportedDropActions() const;
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &idx) const;
- bool dropMimeData ( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
-
- Player *addPlayer(short id, QString name);
- Player *getPlayer(const QModelIndex &idx) const;
-
- Channel *addChannel(int id, Channel *p, QString name);
- Channel *getChannel(const QModelIndex &idx) const;
-
- Channel *getSubChannel(Channel *p, int idx) const;
-
- void renamePlayer(Player *p, QString name);
-
- void movePlayer(Player *p, int id);
- void moveChannel(Channel *p, int id);
-
- void removePlayer(Player *p);
- void removeChannel(Channel *c);
-
- void linkChannels(Channel *c, QList<Channel *> links);
- void unlinkChannels(Channel *c, QList<Channel *> links);
- void unlinkAll(Channel *c);
-
- void removeAll();
-
- QVariant otherRoles(int column, int role, bool isPlayer) const;
-public slots:
- void playerTalkingChanged(bool talking);
- void playerMuteDeafChanged();
- void ensureSelfVisible();
- void recheckLinks();
- void updateOverlay() const;
+ friend class ModelItem;
+ Q_OBJECT
+ protected:
+ QIcon qiTalkingOn, qiTalkingAlt, qiTalkingOff;
+ QIcon qiMutedSelf, qiMutedServer, qiMutedLocal;
+ QIcon qiDeafenedSelf, qiDeafenedServer;
+ QIcon qiAuthenticated, qiChannel, qiLinkedChannel;
+ ModelItem *miRoot;
+ QSet<Channel *> qsLinked;
+
+ QModelIndex index(Player *, int column = 0) const;
+ QModelIndex index(Channel *) const;
+ QModelIndex index(ChannelItem *) const;
+
+ void hidePlayer(Player *p);
+ void showPlayer(Player *p, Channel *c);
+
+ void hideChannel(Channel *c);
+ void showChannel(Channel *c, Channel *p);
+
+ QString stringIndex(const QModelIndex &index) const;
+
+ void unbugHide(const QModelIndex &index);
+ public:
+ PlayerModel(QObject *parent = 0);
+ ~PlayerModel();
+
+ QVariant data(const QModelIndex &index, int role) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ Qt::DropActions supportedDropActions() const;
+ QStringList mimeTypes() const;
+ QMimeData *mimeData(const QModelIndexList &idx) const;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
+
+ Player *addPlayer(short id, QString name);
+ Player *getPlayer(const QModelIndex &idx) const;
+
+ Channel *addChannel(int id, Channel *p, QString name);
+ Channel *getChannel(const QModelIndex &idx) const;
+
+ Channel *getSubChannel(Channel *p, int idx) const;
+
+ void renamePlayer(Player *p, QString name);
+
+ void movePlayer(Player *p, int id);
+ void moveChannel(Channel *p, int id);
+
+ void removePlayer(Player *p);
+ void removeChannel(Channel *c);
+
+ void linkChannels(Channel *c, QList<Channel *> links);
+ void unlinkChannels(Channel *c, QList<Channel *> links);
+ void unlinkAll(Channel *c);
+
+ void removeAll();
+
+ QVariant otherRoles(int column, int role, bool isPlayer) const;
+ public slots:
+ void playerTalkingChanged(bool talking);
+ void playerMuteDeafChanged();
+ void ensureSelfVisible();
+ void recheckLinks();
+ void updateOverlay() const;
};
#else
diff --git a/src/mumble/Plugins.cpp b/src/mumble/Plugins.cpp
index 6e62c953c..bcc58da19 100644
--- a/src/mumble/Plugins.cpp
+++ b/src/mumble/Plugins.cpp
@@ -67,9 +67,9 @@ PluginConfig::PluginConfig(QWidget *p) : ConfigWidget(p) {
qcbTransmit->setChecked(g.s.bTransmitPosition);
qcbTransmit->setToolTip(tr("Enable plugins and transmit positional information"));
qcbTransmit->setWhatsThis(tr("This enables plugins for supported games to fetch your in-game position "
- "and transmit that with each voice packet. This enables other players to "
- "hear your voice in-game from the direction your character is in relation "
- "to their own."));
+ "and transmit that with each voice packet. This enables other players to "
+ "hear your voice in-game from the direction your character is in relation "
+ "to their own."));
grid->addWidget(qcbTransmit, 0, 0);
qgbOptions->setLayout(grid);
@@ -80,7 +80,7 @@ PluginConfig::PluginConfig(QWidget *p) : ConfigWidget(p) {
reloadButton->setObjectName(QLatin1String("Reload"));
reloadButton->setToolTip(tr("Reloads all plugins"));
reloadButton->setWhatsThis(tr("This rescans and reloads plugins. Use this if you just added or changed "
- "a plugin to the plugins directory."));
+ "a plugin to the plugins directory."));
QPushButton *aboutButton=new QPushButton(tr("&About"));
aboutButton->setObjectName(QLatin1String("About"));
aboutButton->setToolTip(tr("Information about plugin"));
@@ -101,13 +101,13 @@ PluginConfig::PluginConfig(QWidget *p) : ConfigWidget(p) {
v->addLayout(h);
qgbPlugins->setLayout(v);
- v = new QVBoxLayout;
- v->addWidget(qgbOptions);
- v->addWidget(qgbPlugins);
- v->addStretch(1);
- setLayout(v);
+ v = new QVBoxLayout;
+ v->addWidget(qgbOptions);
+ v->addWidget(qgbPlugins);
+ v->addStretch(1);
+ setLayout(v);
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
QString PluginConfig::title() const {
@@ -169,9 +169,9 @@ Plugins::Plugins(QObject *p) : QObject(p) {
timer->start(1000);
locked = prevlocked = NULL;
bValid = false;
- for(int i=0;i<3;i++)
+ for (int i=0;i<3;i++)
fPosition[i]=fFront[i]=fTop[i]= 0.0;
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
}
void Plugins::rescanPlugins() {
@@ -229,7 +229,7 @@ void Plugins::fetch() {
locked->locked = false;
prevlocked = locked;
locked = NULL;
- for(int i=0;i<3;i++)
+ for (int i=0;i<3;i++)
fPosition[i]=fFront[i]=fTop[i]= 0.0;
}
bValid = ok;
@@ -240,8 +240,8 @@ void Plugins::on_Timer_timeout() {
if (prevlocked) {
g.l->log(Log::Information,
- tr("Plugin %1 lost link.").arg(prevlocked->description),
- tr("%1 lost link.").arg(prevlocked->shortname));
+ tr("Plugin %1 lost link.").arg(prevlocked->description),
+ tr("%1 lost link.").arg(prevlocked->shortname));
prevlocked = NULL;
}
@@ -256,34 +256,32 @@ void Plugins::on_Timer_timeout() {
HANDLE hToken = NULL;
- if(!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, FALSE, &hToken))
- {
- if (GetLastError() == ERROR_NO_TOKEN)
- {
- ImpersonateSelf(SecurityImpersonation);
- OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, FALSE, &hToken);
+ if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, FALSE, &hToken)) {
+ if (GetLastError() == ERROR_NO_TOKEN) {
+ ImpersonateSelf(SecurityImpersonation);
+ OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, FALSE, &hToken);
}
- }
+ }
- TOKEN_PRIVILEGES tp;
- LUID luid;
- TOKEN_PRIVILEGES tpPrevious;
- DWORD cbPrevious=sizeof(TOKEN_PRIVILEGES);
+ TOKEN_PRIVILEGES tp;
+ LUID luid;
+ TOKEN_PRIVILEGES tpPrevious;
+ DWORD cbPrevious=sizeof(TOKEN_PRIVILEGES);
- LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &luid);
+ LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid);
- tp.PrivilegeCount = 1;
- tp.Privileges[0].Luid = luid;
- tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ tp.PrivilegeCount = 1;
+ tp.Privileges[0].Luid = luid;
+ tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &tpPrevious, &cbPrevious);
+ AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &tpPrevious, &cbPrevious);
#endif
foreach(PluginInfo *pi, qlPlugins) {
if (pi->p->trylock()) {
g.l->log(Log::Information,
- tr("Plugin %1 linked.").arg(pi->description),
- tr("%1 linked.").arg(pi->shortname));
+ tr("Plugin %1 linked.").arg(pi->description),
+ tr("%1 linked.").arg(pi->shortname));
pi->locked = true;
bUnlink = false;
locked = pi;
@@ -292,7 +290,7 @@ void Plugins::on_Timer_timeout() {
}
#ifdef Q_OS_WIN
- AdjustTokenPrivileges(hToken, FALSE, &tpPrevious, cbPrevious, NULL, NULL);
- CloseHandle(hToken);
+ AdjustTokenPrivileges(hToken, FALSE, &tpPrevious, cbPrevious, NULL, NULL);
+ CloseHandle(hToken);
#endif
}
diff --git a/src/mumble/Plugins.h b/src/mumble/Plugins.h
index 02b5a1148..0cd3ffe1c 100644
--- a/src/mumble/Plugins.h
+++ b/src/mumble/Plugins.h
@@ -36,7 +36,7 @@
struct PluginInfo;
class PluginConfig : public ConfigWidget {
- Q_OBJECT
+ Q_OBJECT
protected:
QCheckBox *qcbTransmit;
QListWidget *qlwPlugins;
@@ -54,8 +54,8 @@ class PluginConfig : public ConfigWidget {
};
class Plugins : public QObject {
- friend class PluginConfig;
- Q_OBJECT
+ friend class PluginConfig;
+ Q_OBJECT
protected:
QMutex qmPlugins;
QList<PluginInfo *> qlPlugins;
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 9be806f42..21fdb1174 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -43,27 +43,25 @@ ServerHandlerMessageEvent::ServerHandlerMessageEvent(QByteArray &msg, bool udp)
bUdp = udp;
}
-ServerHandler::ServerHandler()
-{
+ServerHandler::ServerHandler() {
cConnection = NULL;
qusUdp = NULL;
// For some strange reason, on Win32, we have to call supportsSsl before the cipher list is ready.
qWarning("OpenSSL Support: %d", QSslSocket::supportsSsl());
- QList<QSslCipher> pref;
- foreach(QSslCipher c, QSslSocket::defaultCiphers()) {
- if (c.usedBits() < 128)
- continue;
- pref << c;
- }
- if (pref.isEmpty())
- qFatal("No ciphers of at least 128 bit found");
- QSslSocket::setDefaultCiphers(pref);
+ QList<QSslCipher> pref;
+ foreach(QSslCipher c, QSslSocket::defaultCiphers()) {
+ if (c.usedBits() < 128)
+ continue;
+ pref << c;
+ }
+ if (pref.isEmpty())
+ qFatal("No ciphers of at least 128 bit found");
+ QSslSocket::setDefaultCiphers(pref);
}
-ServerHandler::~ServerHandler()
-{
+ServerHandler::~ServerHandler() {
wait();
}
@@ -121,13 +119,12 @@ void ServerHandler::udpReady() {
delete msg;
continue;
}
- message(qba);
+ message(qba);
delete msg;
}
}
-void ServerHandler::sendMessage(Message *mMsg, bool forceTCP)
-{
+void ServerHandler::sendMessage(Message *mMsg, bool forceTCP) {
QByteArray qbaBuffer;
mMsg->sPlayerId = g.sId;
mMsg->messageToNetwork(qbaBuffer);
@@ -137,8 +134,7 @@ void ServerHandler::sendMessage(Message *mMsg, bool forceTCP)
QApplication::postEvent(this, shme);
}
-void ServerHandler::run()
-{
+void ServerHandler::run() {
QSslSocket *qtsSock = new QSslSocket(this);
cConnection = new Connection(this, qtsSock);
qusUdp = NULL;
@@ -171,11 +167,11 @@ void ServerHandler::run()
}
void ServerHandler::setSslErrors(const QList<QSslError> &errors) {
- qscCert = cConnection->peerCertificate();
- if (QString::fromLatin1(qscCert.digest(QCryptographicHash::Sha1).toHex()) == Database::getDigest(qsHostName, iPort))
- cConnection->proceedAnyway();
- else
- qlErrors = errors;
+ qscCert = cConnection->peerCertificate();
+ if (QString::fromLatin1(qscCert.digest(QCryptographicHash::Sha1).toHex()) == Database::getDigest(qsHostName, iPort))
+ cConnection->proceedAnyway();
+ else
+ qlErrors = errors;
}
void ServerHandler::sendPing() {
@@ -208,7 +204,7 @@ void ServerHandler::message(QByteArray &qbaMsg) {
}
}
} else {
- if(mMsg->messageType() == Message::ServerLeave) {
+ if (mMsg->messageType() == Message::ServerLeave) {
if (ao)
ao->removeBuffer(p);
}
@@ -229,7 +225,7 @@ void ServerHandler::disconnect() {
void ServerHandler::serverConnectionClosed(QString reason) {
AudioOutputPtr ao = g.ao;
if (ao)
- ao->wipe();
+ ao->wipe();
emit disconnected(reason);
exit(0);
}
diff --git a/src/mumble/ServerHandler.h b/src/mumble/ServerHandler.h
index 1c7e8a2a9..a5ea79c04 100644
--- a/src/mumble/ServerHandler.h
+++ b/src/mumble/ServerHandler.h
@@ -36,17 +36,15 @@
class Connection;
class Message;
-class ServerHandlerMessageEvent : public QEvent
-{
+class ServerHandlerMessageEvent : public QEvent {
public:
QByteArray qbaMsg;
bool bUdp;
ServerHandlerMessageEvent(QByteArray &msg, bool udp);
};
-class ServerHandler : public QThread
-{
- Q_OBJECT
+class ServerHandler : public QThread {
+ Q_OBJECT
protected:
QString qsHostName;
QString qsUserName;
diff --git a/src/mumble/TextToSpeech.h b/src/mumble/TextToSpeech.h
index 77ac3060d..00b8ad4eb 100644
--- a/src/mumble/TextToSpeech.h
+++ b/src/mumble/TextToSpeech.h
@@ -34,9 +34,9 @@
class TextToSpeechPrivate;
class TextToSpeech : public QObject {
- friend class TextToSpeechPrivate;
- Q_OBJECT
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
+ friend class TextToSpeechPrivate;
+ Q_OBJECT
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
protected:
bool enabled;
public:
diff --git a/src/mumble/TextToSpeech_win.cpp b/src/mumble/TextToSpeech_win.cpp
index 4e5e32f74..e1b9dd848 100644
--- a/src/mumble/TextToSpeech_win.cpp
+++ b/src/mumble/TextToSpeech_win.cpp
@@ -48,9 +48,9 @@ class TextToSpeechPrivate {
TextToSpeechPrivate::TextToSpeechPrivate() {
pVoice = NULL;
- HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
- if( FAILED(hr))
- qWarning("TextToSpeechPrivate: Failed to allocate TTS Voice");
+ HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
+ if (FAILED(hr))
+ qWarning("TextToSpeechPrivate: Failed to allocate TTS Voice");
}
TextToSpeechPrivate::~TextToSpeechPrivate() {
diff --git a/src/mumble/VersionCheck.cpp b/src/mumble/VersionCheck.cpp
index 95ce1f331..4b6164f3a 100644
--- a/src/mumble/VersionCheck.cpp
+++ b/src/mumble/VersionCheck.cpp
@@ -41,7 +41,7 @@ VersionCheck::VersionCheck(QObject *p) : QObject(p) {
quUrl.addQueryItem(QLatin1String("date"), QLatin1String(QUrl::toPercentEncoding(QLatin1String(__DATE__))));
quUrl.addQueryItem(QLatin1String("time"), QLatin1String(QUrl::toPercentEncoding(QLatin1String(__TIME__))));
- QMetaObject::connectSlotsByName(this);
+ QMetaObject::connectSlotsByName(this);
QFile f(qApp->applicationFilePath());
if (! f.open(QIODevice::ReadOnly)) {
@@ -72,7 +72,7 @@ void VersionCheck::on_Agent_requestFinished(int id, bool error) {
if (a.size() > 0)
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Mumble"), QLatin1String(a), QMessageBox::Ok| QMessageBox::Default| QMessageBox::Escape, QMessageBox::NoButton);
} else {
- QMessageBox::information(static_cast<QWidget *>(parent()), tr("Mumble"), tr("Mumble failed to retrieve version information from the SourceForge server."), QMessageBox::Ok| QMessageBox::Default| QMessageBox::Escape, QMessageBox::NoButton);
+ QMessageBox::information(static_cast<QWidget *>(parent()), tr("Mumble"), tr("Mumble failed to retrieve version information from the SourceForge server."), QMessageBox::Ok| QMessageBox::Default| QMessageBox::Escape, QMessageBox::NoButton);
}
deleteLater();
}
diff --git a/src/mumble/VersionCheck.h b/src/mumble/VersionCheck.h
index aa68537fd..093f35eee 100644
--- a/src/mumble/VersionCheck.h
+++ b/src/mumble/VersionCheck.h
@@ -32,7 +32,7 @@
#define _VERSIONCHECK_H
class VersionCheck : public QObject {
- Q_OBJECT
+ Q_OBJECT
protected:
QUrl quUrl;
QHttp *qhAgent;
diff --git a/src/mumble/iasiothiscallresolver.h b/src/mumble/iasiothiscallresolver.h
index 792404288..c34693382 100644
--- a/src/mumble/iasiothiscallresolver.h
+++ b/src/mumble/iasiothiscallresolver.h
@@ -33,7 +33,7 @@
:"=a"(resultName) /* Output Operands */ \
:"c"(thisPtr) /* Input Operands */ \
); \
-
+
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 ) \
__asm__ __volatile__ ("pushl %0\n\t" \
@@ -43,7 +43,7 @@
:"r"(param1), /* Input Operands */ \
"c"(thisPtr) \
); \
-
+
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 ) \
__asm__ __volatile__ ("pushl %1\n\t" \
@@ -53,7 +53,7 @@
:"r"(param1), /* Input Operands */ \
"c"(thisPtr) \
); \
-
+
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \
__asm__ __volatile__ ("pushl 4(%1)\n\t" \
@@ -66,7 +66,7 @@
/* when using GCC 3.3.3, and maybe later versions*/\
"c"(thisPtr) \
); \
-
+
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \
__asm__ __volatile__ ("pushl %1\n\t" \
@@ -78,7 +78,7 @@
"r"(param1), \
"c"(thisPtr) \
); \
-
+
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\
__asm__ __volatile__ ("pushl %1\n\t" \
@@ -94,126 +94,126 @@
"r"(param1), \
"c"(thisPtr) \
); \
-
+
class IASIOThiscallResolver : public IASIO {
-private:
- IASIO *that_;
-public:
- IASIOThiscallResolver(IASIO *that) {
- that_ = that;
- };
-
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv) {
- return that_->QueryInterface(riid, ppv);
- };
- virtual ULONG STDMETHODCALLTYPE AddRef() {
- return that_->AddRef();
- };
- virtual ULONG STDMETHODCALLTYPE Release() {
- return that_->Release();
- };
-
- virtual ASIOBool init(void *sysHandle) {
- ASIOBool result;
- CALL_THISCALL_1( result, that_, 12, sysHandle );
- return result;
- };
- virtual void getDriverName(char *name) {
- CALL_VOID_THISCALL_1( that_, 16, name );
- };
- virtual long getDriverVersion() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 20 );
- return result;
- };
- virtual void getErrorMessage(char *string) {
- CALL_VOID_THISCALL_1( that_, 24, string );
- };
- virtual ASIOError start() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 28 );
- return result;
- };
- virtual ASIOError stop() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 32 );
- return result;
- };
- virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) {
- ASIOBool result;
- CALL_THISCALL_2( result, that_, 36, numInputChannels, numOutputChannels );
- return result;
- };
- virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) {
- ASIOBool result;
- CALL_THISCALL_2( result, that_, 40, inputLatency, outputLatency );
- return result;
- };
- virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity) {
- ASIOBool result;
- CALL_THISCALL_4( result, that_, 44, minSize, maxSize, preferredSize, granularity );
- return result;
- };
- virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) {
- ASIOBool result;
- CALL_THISCALL_1_DOUBLE( result, that_, 48, sampleRate );
- return result;
- };
- virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) {
- ASIOBool result;
- CALL_THISCALL_1( result, that_, 52, sampleRate );
- return result;
- };
- virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) {
- ASIOBool result;
- CALL_THISCALL_1_DOUBLE( result, that_, 56, sampleRate );
- return result;
- };
- virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) {
- ASIOBool result;
- CALL_THISCALL_2( result, that_, 60, clocks, numSources );
- return result;
- };
- virtual ASIOError setClockSource(long reference) {
- ASIOBool result;
- CALL_THISCALL_1( result, that_, 64, reference );
- return result;
- };
- virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) {
- ASIOBool result;
- CALL_THISCALL_2( result, that_, 68, sPos, tStamp );
- return result;
- };
- virtual ASIOError getChannelInfo(ASIOChannelInfo *info) {
- ASIOBool result;
- CALL_THISCALL_1( result, that_, 72, info );
- return result;
- };
- virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, long bufferSize, ASIOCallbacks *callbacks) {
- ASIOBool result;
- CALL_THISCALL_4( result, that_, 76, bufferInfos, numChannels, bufferSize, callbacks );
- return result;
- };
- virtual ASIOError disposeBuffers() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 80 );
- return result;
- };
- virtual ASIOError controlPanel() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 84 );
- return result;
- };
- virtual ASIOError future(long selector,void *opt) {
- ASIOBool result;
- CALL_THISCALL_2( result, that_, 88, selector, opt );
- return result;
- };
- virtual ASIOError outputReady() {
- ASIOBool result;
- CALL_THISCALL_0( result, that_, 92 );
- return result;
- };
+ private:
+ IASIO *that_;
+ public:
+ IASIOThiscallResolver(IASIO *that) {
+ that_ = that;
+ };
+
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv) {
+ return that_->QueryInterface(riid, ppv);
+ };
+ virtual ULONG STDMETHODCALLTYPE AddRef() {
+ return that_->AddRef();
+ };
+ virtual ULONG STDMETHODCALLTYPE Release() {
+ return that_->Release();
+ };
+
+ virtual ASIOBool init(void *sysHandle) {
+ ASIOBool result;
+ CALL_THISCALL_1(result, that_, 12, sysHandle);
+ return result;
+ };
+ virtual void getDriverName(char *name) {
+ CALL_VOID_THISCALL_1(that_, 16, name);
+ };
+ virtual long getDriverVersion() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 20);
+ return result;
+ };
+ virtual void getErrorMessage(char *string) {
+ CALL_VOID_THISCALL_1(that_, 24, string);
+ };
+ virtual ASIOError start() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 28);
+ return result;
+ };
+ virtual ASIOError stop() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 32);
+ return result;
+ };
+ virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) {
+ ASIOBool result;
+ CALL_THISCALL_2(result, that_, 36, numInputChannels, numOutputChannels);
+ return result;
+ };
+ virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) {
+ ASIOBool result;
+ CALL_THISCALL_2(result, that_, 40, inputLatency, outputLatency);
+ return result;
+ };
+ virtual ASIOError getBufferSize(long *minSize, long *maxSize, long *preferredSize, long *granularity) {
+ ASIOBool result;
+ CALL_THISCALL_4(result, that_, 44, minSize, maxSize, preferredSize, granularity);
+ return result;
+ };
+ virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) {
+ ASIOBool result;
+ CALL_THISCALL_1_DOUBLE(result, that_, 48, sampleRate);
+ return result;
+ };
+ virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) {
+ ASIOBool result;
+ CALL_THISCALL_1(result, that_, 52, sampleRate);
+ return result;
+ };
+ virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) {
+ ASIOBool result;
+ CALL_THISCALL_1_DOUBLE(result, that_, 56, sampleRate);
+ return result;
+ };
+ virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) {
+ ASIOBool result;
+ CALL_THISCALL_2(result, that_, 60, clocks, numSources);
+ return result;
+ };
+ virtual ASIOError setClockSource(long reference) {
+ ASIOBool result;
+ CALL_THISCALL_1(result, that_, 64, reference);
+ return result;
+ };
+ virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) {
+ ASIOBool result;
+ CALL_THISCALL_2(result, that_, 68, sPos, tStamp);
+ return result;
+ };
+ virtual ASIOError getChannelInfo(ASIOChannelInfo *info) {
+ ASIOBool result;
+ CALL_THISCALL_1(result, that_, 72, info);
+ return result;
+ };
+ virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, long bufferSize, ASIOCallbacks *callbacks) {
+ ASIOBool result;
+ CALL_THISCALL_4(result, that_, 76, bufferInfos, numChannels, bufferSize, callbacks);
+ return result;
+ };
+ virtual ASIOError disposeBuffers() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 80);
+ return result;
+ };
+ virtual ASIOError controlPanel() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 84);
+ return result;
+ };
+ virtual ASIOError future(long selector,void *opt) {
+ ASIOBool result;
+ CALL_THISCALL_2(result, that_, 88, selector, opt);
+ return result;
+ };
+ virtual ASIOError outputReady() {
+ ASIOBool result;
+ CALL_THISCALL_0(result, that_, 92);
+ return result;
+ };
};
#endif
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index 41231afdc..578ca2ad9 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -40,16 +40,15 @@
#ifdef BOOST_NO_EXCEPTIONS
namespace boost {
- void throw_exception(std::exception const & e) {
- qFatal("Boost exception caught!");
- }
+void throw_exception(std::exception const & e) {
+ qFatal("Boost exception caught!");
+}
}
#endif
extern void os_init();
-int main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
// Check for SSE and MMX, but only in the windows binaries
int res;
@@ -80,28 +79,28 @@ int main(int argc, char **argv)
QString skin=g.qs->value(QLatin1String("skin")).toString();
if (! skin.isEmpty()) {
- QFile file(skin);
- file.open(QFile::ReadOnly);
- QString styleSheet=QLatin1String(file.readAll());
- if (! styleSheet.isEmpty()) {
- QFileInfo fi(skin);
- QDir::addSearchPath(QLatin1String("skin"), fi.path());
- a.setStyleSheet(styleSheet);
- }
+ QFile file(skin);
+ file.open(QFile::ReadOnly);
+ QString styleSheet=QLatin1String(file.readAll());
+ if (! styleSheet.isEmpty()) {
+ QFileInfo fi(skin);
+ QDir::addSearchPath(QLatin1String("skin"), fi.path());
+ a.setStyleSheet(styleSheet);
+ }
}
QDir::addSearchPath(QLatin1String("skin"),QLatin1String(":/"));
QDir::addSearchPath(QLatin1String("translation"), a.applicationDirPath());
QDir::addSearchPath(QLatin1String("translation"), QLatin1String(":/"));
- QString locale=g.qs->value(QLatin1String("Language"), QLocale::system().name()).toString();
- QTranslator translator;
- translator.load(QLatin1String("translation:mumble_") + locale);
- a.installTranslator(&translator);
+ QString locale=g.qs->value(QLatin1String("Language"), QLocale::system().name()).toString();
+ QTranslator translator;
+ translator.load(QLatin1String("translation:mumble_") + locale);
+ a.installTranslator(&translator);
- QTranslator qttranslator;
- qttranslator.load(QLatin1String("translation:qt_") + locale);
- a.installTranslator(&qttranslator);
+ QTranslator qttranslator;
+ qttranslator.load(QLatin1String("translation:qt_") + locale);
+ a.installTranslator(&qttranslator);
// Set application icon
diff --git a/src/mumble/mumble_pch.h b/src/mumble/mumble_pch.h
index f539e93fe..37ef3fe26 100644
--- a/src/mumble/mumble_pch.h
+++ b/src/mumble/mumble_pch.h
@@ -38,114 +38,114 @@ typedef float spx_float_t;
typedef spx_word32_t spx_mem_t;
/** Speex echo cancellation state. */
struct CloneSpeexEchoState {
- int frame_size; /**< Number of samples processed each time */
- int window_size;
- int M;
- int cancel_count;
- int adapted;
- int saturated;
- int screwed_up;
- spx_int32_t sampling_rate;
- spx_word16_t spec_average;
- spx_word16_t beta0;
- spx_word16_t beta_max;
- spx_word32_t sum_adapt;
- spx_word16_t leak_estimate;
+ int frame_size; /**< Number of samples processed each time */
+ int window_size;
+ int M;
+ int cancel_count;
+ int adapted;
+ int saturated;
+ int screwed_up;
+ spx_int32_t sampling_rate;
+ spx_word16_t spec_average;
+ spx_word16_t beta0;
+ spx_word16_t beta_max;
+ spx_word32_t sum_adapt;
+ spx_word16_t leak_estimate;
- spx_word16_t *e; /* scratch */
- spx_word16_t *x; /* Far-end input buffer (2N) */
- spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */
- spx_word16_t *input; /* scratch */
- spx_word16_t *y; /* scratch */
- spx_word16_t *last_y;
- spx_word16_t *Y; /* scratch */
- spx_word16_t *E;
- spx_word32_t *PHI; /* scratch */
- spx_word32_t *W; /* (Background) filter weights */
- spx_word16_t *foreground; /* Foreground filter weights */
- spx_word32_t Davg1; /* 1st recursive average of the residual power difference */
- spx_word32_t Davg2; /* 2nd recursive average of the residual power difference */
- spx_float_t Dvar1; /* Estimated variance of 1st estimator */
- spx_float_t Dvar2; /* Estimated variance of 2nd estimator */
- spx_word32_t *power; /* Power of the far-end signal */
- spx_float_t *power_1;/* Inverse power of far-end */
- spx_word16_t *wtmp; /* scratch */
- spx_word32_t *Rf; /* scratch */
- spx_word32_t *Yf; /* scratch */
- spx_word32_t *Xf; /* scratch */
- spx_word32_t *Eh;
- spx_word32_t *Yh;
- spx_float_t Pey;
- spx_float_t Pyy;
- spx_word16_t *window;
- spx_word16_t *prop;
- void *fft_table;
- spx_word16_t memX, memD, memE;
- spx_word16_t preemph;
- spx_word16_t notch_radius;
- spx_mem_t notch_mem[2];
+ spx_word16_t *e; /* scratch */
+ spx_word16_t *x; /* Far-end input buffer (2N) */
+ spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */
+ spx_word16_t *input; /* scratch */
+ spx_word16_t *y; /* scratch */
+ spx_word16_t *last_y;
+ spx_word16_t *Y; /* scratch */
+ spx_word16_t *E;
+ spx_word32_t *PHI; /* scratch */
+ spx_word32_t *W; /* (Background) filter weights */
+ spx_word16_t *foreground; /* Foreground filter weights */
+ spx_word32_t Davg1; /* 1st recursive average of the residual power difference */
+ spx_word32_t Davg2; /* 2nd recursive average of the residual power difference */
+ spx_float_t Dvar1; /* Estimated variance of 1st estimator */
+ spx_float_t Dvar2; /* Estimated variance of 2nd estimator */
+ spx_word32_t *power; /* Power of the far-end signal */
+ spx_float_t *power_1;/* Inverse power of far-end */
+ spx_word16_t *wtmp; /* scratch */
+ spx_word32_t *Rf; /* scratch */
+ spx_word32_t *Yf; /* scratch */
+ spx_word32_t *Xf; /* scratch */
+ spx_word32_t *Eh;
+ spx_word32_t *Yh;
+ spx_float_t Pey;
+ spx_float_t Pyy;
+ spx_word16_t *window;
+ spx_word16_t *prop;
+ void *fft_table;
+ spx_word16_t memX, memD, memE;
+ spx_word16_t preemph;
+ spx_word16_t notch_radius;
+ spx_mem_t notch_mem[2];
};
/** Speex pre-processor state. */
struct CloneSpeexPreprocessState {
- /* Basic info */
- int frame_size; /**< Number of samples processed each time */
- int ps_size; /**< Number of points in the power spectrum */
- int sampling_rate; /**< Sampling rate of the input/output */
- int nbands;
- void *bank;
- int denoise_enabled;
- int vad_enabled;
- int dereverb_enabled;
- spx_word16_t reverb_decay;
- spx_word16_t reverb_level;
- spx_word16_t speech_prob_start;
- spx_word16_t speech_prob_continue;
- int noise_suppress;
- int echo_suppress;
- int echo_suppress_active;
- CloneSpeexEchoState *echo_state;
- spx_word16_t *frame; /**< Processing frame (2*ps_size) */
- spx_word16_t *ft; /**< Processing frame in freq domain (2*ps_size) */
- spx_word32_t *ps; /**< Current power spectrum */
- spx_word16_t *gain2; /**< Adjusted gains */
- spx_word16_t *gain_floor; /**< Minimum gain allowed */
- spx_word16_t *window; /**< Analysis/Synthesis window */
- spx_word32_t *noise; /**< Noise estimate */
- spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */
- spx_word32_t *old_ps; /**< Power spectrum for last frame */
- spx_word16_t *gain; /**< Ephraim Malah gain */
- spx_word16_t *prior; /**< A-priori SNR */
- spx_word16_t *post; /**< A-posteriori SNR */
+ /* Basic info */
+ int frame_size; /**< Number of samples processed each time */
+ int ps_size; /**< Number of points in the power spectrum */
+ int sampling_rate; /**< Sampling rate of the input/output */
+ int nbands;
+ void *bank;
+ int denoise_enabled;
+ int vad_enabled;
+ int dereverb_enabled;
+ spx_word16_t reverb_decay;
+ spx_word16_t reverb_level;
+ spx_word16_t speech_prob_start;
+ spx_word16_t speech_prob_continue;
+ int noise_suppress;
+ int echo_suppress;
+ int echo_suppress_active;
+ CloneSpeexEchoState *echo_state;
+ spx_word16_t *frame; /**< Processing frame (2*ps_size) */
+ spx_word16_t *ft; /**< Processing frame in freq domain (2*ps_size) */
+ spx_word32_t *ps; /**< Current power spectrum */
+ spx_word16_t *gain2; /**< Adjusted gains */
+ spx_word16_t *gain_floor; /**< Minimum gain allowed */
+ spx_word16_t *window; /**< Analysis/Synthesis window */
+ spx_word32_t *noise; /**< Noise estimate */
+ spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */
+ spx_word32_t *old_ps; /**< Power spectrum for last frame */
+ spx_word16_t *gain; /**< Ephraim Malah gain */
+ spx_word16_t *prior; /**< A-priori SNR */
+ spx_word16_t *post; /**< A-posteriori SNR */
- spx_word32_t *S; /**< Smoothed power spectrum */
- spx_word32_t *Smin; /**< See Cohen paper */
- spx_word32_t *Stmp; /**< See Cohen paper */
- int *update_prob; /**< Propability of speech presence for noise update */
+ spx_word32_t *S; /**< Smoothed power spectrum */
+ spx_word32_t *Smin; /**< See Cohen paper */
+ spx_word32_t *Stmp; /**< See Cohen paper */
+ int *update_prob; /**< Propability of speech presence for noise update */
- spx_word16_t *zeta; /**< Smoothed a priori SNR */
- spx_word32_t *echo_noise;
- spx_word32_t *residual_echo;
+ spx_word16_t *zeta; /**< Smoothed a priori SNR */
+ spx_word32_t *echo_noise;
+ spx_word32_t *residual_echo;
- spx_word16_t *inbuf; /**< Input buffer (overlapped analysis) */
- spx_word16_t *outbuf; /**< Output buffer (for overlap and add) */
+ spx_word16_t *inbuf; /**< Input buffer (overlapped analysis) */
+ spx_word16_t *outbuf; /**< Output buffer (for overlap and add) */
- int agc_enabled;
- float agc_level;
- float loudness_accum;
- float *loudness_weight; /**< Perceptual loudness curve */
- float loudness; /**< Loudness estimate */
- float agc_gain; /**< Current AGC gain */
- int nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
- float max_gain; /**< Maximum gain allowed */
- float max_increase_step; /**< Maximum increase in gain from one frame to another */
- float max_decrease_step; /**< Maximum decrease in gain from one frame to another */
- float prev_loudness; /**< Loudness of previous frame */
- float init_max; /**< Current gain limit during initialisation */
- int nb_adapt; /**< Number of frames used for adaptation so far */
- int was_speech;
- int min_count; /**< Number of frames processed so far */
- void *fft_lookup; /**< Lookup table for the FFT */
+ int agc_enabled;
+ float agc_level;
+ float loudness_accum;
+ float *loudness_weight; /**< Perceptual loudness curve */
+ float loudness; /**< Loudness estimate */
+ float agc_gain; /**< Current AGC gain */
+ int nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
+ float max_gain; /**< Maximum gain allowed */
+ float max_increase_step; /**< Maximum increase in gain from one frame to another */
+ float max_decrease_step; /**< Maximum decrease in gain from one frame to another */
+ float prev_loudness; /**< Loudness of previous frame */
+ float init_max; /**< Current gain limit during initialisation */
+ int nb_adapt; /**< Number of frames used for adaptation so far */
+ int was_speech;
+ int min_count; /**< Number of frames processed so far */
+ void *fft_lookup; /**< Lookup table for the FFT */
};
diff --git a/src/mumble/os_win.cpp b/src/mumble/os_win.cpp
index fd5167624..6e80f0641 100644
--- a/src/mumble/os_win.cpp
+++ b/src/mumble/os_win.cpp
@@ -32,8 +32,7 @@
#include <tlhelp32.h>
static FILE *fConsole;
-static void mumbleMessageOutput(QtMsgType type, const char *msg)
-{
+static void mumbleMessageOutput(QtMsgType type, const char *msg) {
char c;
switch (type) {
case QtDebugMsg:
@@ -83,7 +82,7 @@ static LONG WINAPI MumbleUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* Ex
CloseHandle(hSnap);
}
- for(unsigned int i=0;i<er->NumberParameters;i++) {
+ for (unsigned int i=0;i<er->NumberParameters;i++) {
qWarning("Parameter %4d: %08lx", i, er->ExceptionInformation[i]);
}
if (er->ExceptionRecord)
@@ -102,7 +101,7 @@ static LONG WINAPI MumbleUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* Ex
stop = Bp + 0x40;
if ((stop < start) || (stop-start >512))
stop = start + 512;
- for(Sp=stop;Sp>=start;Sp-=sizeof(DWORD)) {
+ for (Sp=stop;Sp>=start;Sp-=sizeof(DWORD)) {
DWORD val[4] = {0,0,0,0};
DWORD nbytes = sizeof(DWORD)*4;
if (ReadProcessMemory(GetCurrentProcess(), reinterpret_cast<const void *>(Sp), &val[0],sizeof(DWORD)*4, &nbytes))
diff --git a/src/murmur/Cert.cpp b/src/murmur/Cert.cpp
index b931b251c..c7d5855cf 100644
--- a/src/murmur/Cert.cpp
+++ b/src/murmur/Cert.cpp
@@ -38,20 +38,19 @@
#include <openssl/engine.h>
#endif
-int add_ext(X509 * crt, int nid, char *value)
-{
- X509_EXTENSION *ex;
- X509V3_CTX ctx;
- X509V3_set_ctx_nodb(&ctx);
- X509V3_set_ctx(&ctx, crt, crt, NULL, NULL, 0);
- ex = X509V3_EXT_conf_nid(NULL, &ctx, nid, value);
- if (!ex)
- return 0;
-
- X509_add_ext(crt, ex, -1);
- X509_EXTENSION_free(ex);
- return 1;
-}
+int add_ext(X509 * crt, int nid, char *value) {
+ X509_EXTENSION *ex;
+ X509V3_CTX ctx;
+ X509V3_set_ctx_nodb(&ctx);
+ X509V3_set_ctx(&ctx, crt, crt, NULL, NULL, 0);
+ ex = X509V3_EXT_conf_nid(NULL, &ctx, nid, value);
+ if (!ex)
+ return 0;
+
+ X509_add_ext(crt, ex, -1);
+ X509_EXTENSION_free(ex);
+ return 1;
+}
Cert cert;
@@ -59,150 +58,150 @@ Cert::Cert() : QObject() {
}
void Cert::initialize() {
- QByteArray crt, key, store;
-
-
-
- if (! g_sp.qsSSLCert.isEmpty()) {
- QFile pem(g_sp.qsSSLCert);
- if (pem.open(QIODevice::ReadOnly)) {
- crt = pem.readAll();
- pem.close();
- } else {
- qWarning("Failed to read %s", qPrintable(g_sp.qsSSLCert));
- }
- }
- if (! g_sp.qsSSLKey.isEmpty()) {
- QFile pem(g_sp.qsSSLKey);
- if (pem.open(QIODevice::ReadOnly)) {
- key = pem.readAll();
- pem.close();
- } else {
- qWarning("Failed to read %s", qPrintable(g_sp.qsSSLKey));
- }
- }
- QFile pem(g_sp.qsSSLStore);
- if (pem.open(QIODevice::ReadOnly)) {
- store = pem.readAll();
- pem.close();
- }
- if (! crt.isEmpty()) {
- qscCert = QSslCertificate(crt);
- if (qscCert.isNull()) {
- qWarning("Failed to parse certificate.");
- }
- }
-
- if (! key.isEmpty() && qscCert.isNull()) {
- qscCert = QSslCertificate(key);
- if (! qscCert.isNull()) {
- qDebug("Using certificate from key file.");
- }
- }
-
-
- if (! qscCert.isNull()) {
- QSsl::KeyAlgorithm alg = qscCert.publicKey().algorithm();
-
- if (! key.isEmpty()) {
- qskKey = QSslKey(key, alg);
- if (qskKey.isNull()) {
- qWarning("Failed to parse key file.");
- }
- }
-
- if (! crt.isEmpty() && qskKey.isNull()) {
- qskKey = QSslKey(crt, alg);
- if (! qskKey.isNull()) {
- qDebug("Using key from certificate file.");
- }
- }
-
- }
-
- if (qscCert.isNull() || qskKey.isNull()) {
- if (! key.isEmpty() || ! crt.isEmpty()) {
- qFatal("Certificate specified, but failed to load.");
- }
- qskKey = QSslKey(store, QSsl::Rsa);
- qscCert = QSslCertificate(store);
- if (qscCert.isNull() || qskKey.isNull()) {
- qWarning("Generating new server certificate.");
-
- BIO *bio_err;
-
- CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
- bio_err=BIO_new_fp(stderr, BIO_NOCLOSE);
-
- X509 *x509 = X509_new();
- EVP_PKEY *pkey = EVP_PKEY_new();
- RSA *rsa = RSA_generate_key(1024,RSA_F4,NULL,NULL);
- EVP_PKEY_assign_RSA(pkey, rsa);
-
- X509_set_version(x509, 2);
- ASN1_INTEGER_set(X509_get_serialNumber(x509),1);
- X509_gmtime_adj(X509_get_notBefore(x509),0);
- X509_gmtime_adj(X509_get_notAfter(x509),60*60*24*365);
- X509_set_pubkey(x509, pkey);
-
- X509_NAME *name=X509_get_subject_name(x509);
-
- X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, reinterpret_cast<const unsigned char *>("Murmur Autogenerated Certificate"), -1, -1, 0);
- X509_set_issuer_name(x509, name);
- add_ext(x509, NID_basic_constraints, "critical,CA:FALSE");
- add_ext(x509, NID_ext_key_usage, "serverAuth,clientAuth");
- add_ext(x509, NID_subject_key_identifier, "hash");
- add_ext(x509, NID_netscape_cert_type, "server");
- add_ext(x509, NID_netscape_comment, "Generated from murmur");
-
- X509_sign(x509, pkey, EVP_md5());
-
- crt.resize(i2d_X509(x509, NULL));
- unsigned char *dptr=reinterpret_cast<unsigned char *>(crt.data());
- i2d_X509(x509, &dptr);
-
- qscCert = QSslCertificate(crt, QSsl::Der);
- if (qscCert.isNull())
- qFatal("Certificate generation failed");
-
- key.resize(i2d_PrivateKey(pkey, NULL));
- dptr=reinterpret_cast<unsigned char *>(key.data());
- i2d_PrivateKey(pkey, &dptr);
-
- qskKey = QSslKey(key, QSsl::Rsa, QSsl::Der);
- if (qskKey.isNull())
- qFatal("Key generation failed");
-
- QFile pemout(g_sp.qsSSLStore);
- if (! pemout.open(QIODevice::WriteOnly)) {
- qFatal("Failed to open keystore %s for writing.", qPrintable(g_sp.qsSSLStore));
- }
- pemout.write(qscCert.toPem());
- pemout.write(qskKey.toPem());
- pemout.close();
- }
- }
-
- QList<QSslCipher> pref;
- foreach(QSslCipher c, QSslSocket::defaultCiphers()) {
- if (c.usedBits() < 128)
- continue;
- pref << c;
- }
- if (pref.isEmpty())
- qFatal("No ciphers of at least 128 bit found");
- QSslSocket::setDefaultCiphers(pref);
+ QByteArray crt, key, store;
+
+
+
+ if (! g_sp.qsSSLCert.isEmpty()) {
+ QFile pem(g_sp.qsSSLCert);
+ if (pem.open(QIODevice::ReadOnly)) {
+ crt = pem.readAll();
+ pem.close();
+ } else {
+ qWarning("Failed to read %s", qPrintable(g_sp.qsSSLCert));
+ }
+ }
+ if (! g_sp.qsSSLKey.isEmpty()) {
+ QFile pem(g_sp.qsSSLKey);
+ if (pem.open(QIODevice::ReadOnly)) {
+ key = pem.readAll();
+ pem.close();
+ } else {
+ qWarning("Failed to read %s", qPrintable(g_sp.qsSSLKey));
+ }
+ }
+ QFile pem(g_sp.qsSSLStore);
+ if (pem.open(QIODevice::ReadOnly)) {
+ store = pem.readAll();
+ pem.close();
+ }
+ if (! crt.isEmpty()) {
+ qscCert = QSslCertificate(crt);
+ if (qscCert.isNull()) {
+ qWarning("Failed to parse certificate.");
+ }
+ }
+
+ if (! key.isEmpty() && qscCert.isNull()) {
+ qscCert = QSslCertificate(key);
+ if (! qscCert.isNull()) {
+ qDebug("Using certificate from key file.");
+ }
+ }
+
+
+ if (! qscCert.isNull()) {
+ QSsl::KeyAlgorithm alg = qscCert.publicKey().algorithm();
+
+ if (! key.isEmpty()) {
+ qskKey = QSslKey(key, alg);
+ if (qskKey.isNull()) {
+ qWarning("Failed to parse key file.");
+ }
+ }
+
+ if (! crt.isEmpty() && qskKey.isNull()) {
+ qskKey = QSslKey(crt, alg);
+ if (! qskKey.isNull()) {
+ qDebug("Using key from certificate file.");
+ }
+ }
+
+ }
+
+ if (qscCert.isNull() || qskKey.isNull()) {
+ if (! key.isEmpty() || ! crt.isEmpty()) {
+ qFatal("Certificate specified, but failed to load.");
+ }
+ qskKey = QSslKey(store, QSsl::Rsa);
+ qscCert = QSslCertificate(store);
+ if (qscCert.isNull() || qskKey.isNull()) {
+ qWarning("Generating new server certificate.");
+
+ BIO *bio_err;
+
+ CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+ bio_err=BIO_new_fp(stderr, BIO_NOCLOSE);
+
+ X509 *x509 = X509_new();
+ EVP_PKEY *pkey = EVP_PKEY_new();
+ RSA *rsa = RSA_generate_key(1024,RSA_F4,NULL,NULL);
+ EVP_PKEY_assign_RSA(pkey, rsa);
+
+ X509_set_version(x509, 2);
+ ASN1_INTEGER_set(X509_get_serialNumber(x509),1);
+ X509_gmtime_adj(X509_get_notBefore(x509),0);
+ X509_gmtime_adj(X509_get_notAfter(x509),60*60*24*365);
+ X509_set_pubkey(x509, pkey);
+
+ X509_NAME *name=X509_get_subject_name(x509);
+
+ X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, reinterpret_cast<const unsigned char *>("Murmur Autogenerated Certificate"), -1, -1, 0);
+ X509_set_issuer_name(x509, name);
+ add_ext(x509, NID_basic_constraints, "critical,CA:FALSE");
+ add_ext(x509, NID_ext_key_usage, "serverAuth,clientAuth");
+ add_ext(x509, NID_subject_key_identifier, "hash");
+ add_ext(x509, NID_netscape_cert_type, "server");
+ add_ext(x509, NID_netscape_comment, "Generated from murmur");
+
+ X509_sign(x509, pkey, EVP_md5());
+
+ crt.resize(i2d_X509(x509, NULL));
+ unsigned char *dptr=reinterpret_cast<unsigned char *>(crt.data());
+ i2d_X509(x509, &dptr);
+
+ qscCert = QSslCertificate(crt, QSsl::Der);
+ if (qscCert.isNull())
+ qFatal("Certificate generation failed");
+
+ key.resize(i2d_PrivateKey(pkey, NULL));
+ dptr=reinterpret_cast<unsigned char *>(key.data());
+ i2d_PrivateKey(pkey, &dptr);
+
+ qskKey = QSslKey(key, QSsl::Rsa, QSsl::Der);
+ if (qskKey.isNull())
+ qFatal("Key generation failed");
+
+ QFile pemout(g_sp.qsSSLStore);
+ if (! pemout.open(QIODevice::WriteOnly)) {
+ qFatal("Failed to open keystore %s for writing.", qPrintable(g_sp.qsSSLStore));
+ }
+ pemout.write(qscCert.toPem());
+ pemout.write(qskKey.toPem());
+ pemout.close();
+ }
+ }
+
+ QList<QSslCipher> pref;
+ foreach(QSslCipher c, QSslSocket::defaultCiphers()) {
+ if (c.usedBits() < 128)
+ continue;
+ pref << c;
+ }
+ if (pref.isEmpty())
+ qFatal("No ciphers of at least 128 bit found");
+ QSslSocket::setDefaultCiphers(pref);
}
const QSslCertificate &Cert::getCert() const {
- return qscCert;
+ return qscCert;
}
const QSslKey &Cert::getKey() const {
- return qskKey;
+ return qskKey;
}
const QString Cert::getDigest() const {
- return QString::fromLatin1(qscCert.digest().toHex());
+ return QString::fromLatin1(qscCert.digest().toHex());
}
diff --git a/src/murmur/Cert.h b/src/murmur/Cert.h
index 01eab3920..4e88c4113 100644
--- a/src/murmur/Cert.h
+++ b/src/murmur/Cert.h
@@ -35,16 +35,16 @@
#include "Server.h"
class Cert : public QObject {
- Q_OBJECT
- protected:
- QSslCertificate qscCert;
- QSslKey qskKey;
- public:
- Cert();
- void initialize();
- const QSslCertificate &getCert() const;
- const QSslKey &getKey() const;
- const QString getDigest() const;
+ Q_OBJECT
+ protected:
+ QSslCertificate qscCert;
+ QSslKey qskKey;
+ public:
+ Cert();
+ void initialize();
+ const QSslCertificate &getCert() const;
+ const QSslKey &getKey() const;
+ const QString getDigest() const;
};
extern Cert cert;
diff --git a/src/murmur/DBus.cpp b/src/murmur/DBus.cpp
index c8416174d..bf6c84fa5 100644
--- a/src/murmur/DBus.cpp
+++ b/src/murmur/DBus.cpp
@@ -35,173 +35,173 @@
#include "DBus.h"
QDBusArgument &operator<<(QDBusArgument &a, const PlayerInfo &s) {
- a.beginStructure();
- a << s.session << s.mute << s.deaf << s.suppressed << s.selfMute << s.selfDeaf << s.channel;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.session << s.mute << s.deaf << s.suppressed << s.selfMute << s.selfDeaf << s.channel;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, PlayerInfo &s) {
- a.beginStructure();
- a >> s.session >> s.mute >> s.deaf >> s.suppressed >> s.selfMute >> s.selfDeaf >> s.channel;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.session >> s.mute >> s.deaf >> s.suppressed >> s.selfMute >> s.selfDeaf >> s.channel;
+ a.endStructure();
+ return a;
}
QDBusArgument &operator<<(QDBusArgument &a, const PlayerInfoExtended &s) {
- a.beginStructure();
- a << s.session << s.mute << s.deaf << s.suppressed << s.selfMute << s.selfDeaf << s.channel << s.id << s.name << s.onlinesecs << s.bytespersec;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.session << s.mute << s.deaf << s.suppressed << s.selfMute << s.selfDeaf << s.channel << s.id << s.name << s.onlinesecs << s.bytespersec;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, PlayerInfoExtended &s) {
- a.beginStructure();
- a >> s.session >> s.mute >> s.deaf >> s.suppressed >> s.selfMute >> s.selfDeaf >> s.channel >> s.id >> s.name >> s.onlinesecs >> s.bytespersec;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.session >> s.mute >> s.deaf >> s.suppressed >> s.selfMute >> s.selfDeaf >> s.channel >> s.id >> s.name >> s.onlinesecs >> s.bytespersec;
+ a.endStructure();
+ return a;
}
QDBusArgument &operator<<(QDBusArgument &a, const ChannelInfo &s) {
- a.beginStructure();
- a << s.id << s.name << s.parent << s.links;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.id << s.name << s.parent << s.links;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, ChannelInfo &s) {
- a.beginStructure();
- a >> s.id >> s.name >> s.parent >> s.links;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.id >> s.name >> s.parent >> s.links;
+ a.endStructure();
+ return a;
}
QDBusArgument &operator<<(QDBusArgument &a, const GroupInfo &s) {
- a.beginStructure();
- a << s.name << s.inherited << s.inherit << s.inheritable;
- a << s.add << s.remove << s.members;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.name << s.inherited << s.inherit << s.inheritable;
+ a << s.add << s.remove << s.members;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, GroupInfo &s) {
- a.beginStructure();
- a >> s.name >> s.inherited >> s.inherit >> s.inheritable;
- a >> s.add >> s.remove >> s.members;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.name >> s.inherited >> s.inherit >> s.inheritable;
+ a >> s.add >> s.remove >> s.members;
+ a.endStructure();
+ return a;
}
QDBusArgument &operator<<(QDBusArgument &a, const ACLInfo &s) {
- a.beginStructure();
- a << s.applyHere << s.applySubs << s.inherited;
- a << s.playerid << s.group;
- a << s.allow << s.deny;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.applyHere << s.applySubs << s.inherited;
+ a << s.playerid << s.group;
+ a << s.allow << s.deny;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, ACLInfo &s) {
- a.beginStructure();
- a >> s.applyHere >> s.applySubs >> s.inherited;
- a >> s.playerid >> s.group;
- a >> s.allow >> s.deny;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.applyHere >> s.applySubs >> s.inherited;
+ a >> s.playerid >> s.group;
+ a >> s.allow >> s.deny;
+ a.endStructure();
+ return a;
}
QDBusArgument &operator<<(QDBusArgument &a, const BanInfo &s) {
- a.beginStructure();
- a << s.address << s.bits;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a << s.address << s.bits;
+ a.endStructure();
+ return a;
}
const QDBusArgument & operator >>(const QDBusArgument &a, BanInfo &s) {
- a.beginStructure();
- a >> s.address >> s.bits;
- a.endStructure();
- return a;
+ a.beginStructure();
+ a >> s.address >> s.bits;
+ a.endStructure();
+ return a;
}
void MurmurDBus::registerTypes() {
- qDBusRegisterMetaType<PlayerInfo>();
- qDBusRegisterMetaType<PlayerInfoExtended>();
- qDBusRegisterMetaType<QList<PlayerInfoExtended> >();
- qDBusRegisterMetaType<ChannelInfo>();
- qDBusRegisterMetaType<QList<ChannelInfo> >();
- qDBusRegisterMetaType<GroupInfo>();
- qDBusRegisterMetaType<QList<GroupInfo> >();
- qDBusRegisterMetaType<ACLInfo>();
- qDBusRegisterMetaType<QList<ACLInfo> >();
- qDBusRegisterMetaType<BanInfo>();
- qDBusRegisterMetaType<QList<BanInfo> >();
+ qDBusRegisterMetaType<PlayerInfo>();
+ qDBusRegisterMetaType<PlayerInfoExtended>();
+ qDBusRegisterMetaType<QList<PlayerInfoExtended> >();
+ qDBusRegisterMetaType<ChannelInfo>();
+ qDBusRegisterMetaType<QList<ChannelInfo> >();
+ qDBusRegisterMetaType<GroupInfo>();
+ qDBusRegisterMetaType<QList<GroupInfo> >();
+ qDBusRegisterMetaType<ACLInfo>();
+ qDBusRegisterMetaType<QList<ACLInfo> >();
+ qDBusRegisterMetaType<BanInfo>();
+ qDBusRegisterMetaType<QList<BanInfo> >();
}
MurmurDBus::MurmurDBus(QCoreApplication &app) : QDBusAbstractAdaptor(&app), qdbc(QLatin1String("mainbus")) {
}
QString MurmurDBus::mapIdToName(int id) {
- if (qsAuthPath.isEmpty())
- return QString();
-
- QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
- QDBusReply<QString> reply = remoteApp.call("getUserName",id);
- if (reply.isValid())
- return reply.value();
- else {
- qWarning("Authenticator failed getUserName for %d: %s", id, qPrintable(reply.error().message()));
- qsAuthPath = QString();
- qsAuthService = QString();
- return QString();
- }
+ if (qsAuthPath.isEmpty())
+ return QString();
+
+ QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
+ QDBusReply<QString> reply = remoteApp.call("getUserName",id);
+ if (reply.isValid())
+ return reply.value();
+ else {
+ qWarning("Authenticator failed getUserName for %d: %s", id, qPrintable(reply.error().message()));
+ qsAuthPath = QString();
+ qsAuthService = QString();
+ return QString();
+ }
}
QByteArray MurmurDBus::mapIdToTexture(int id) {
- if (qsAuthPath.isEmpty())
- return QByteArray();
-
- QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
- QDBusReply<QByteArray> reply = remoteApp.call("getUserTexture",id);
- if (reply.isValid()) {
- return reply.value();
- } else {
- // This is NOT a critical failure, it's an OPTIONAL implementation.
- return QByteArray();
- }
+ if (qsAuthPath.isEmpty())
+ return QByteArray();
+
+ QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
+ QDBusReply<QByteArray> reply = remoteApp.call("getUserTexture",id);
+ if (reply.isValid()) {
+ return reply.value();
+ } else {
+ // This is NOT a critical failure, it's an OPTIONAL implementation.
+ return QByteArray();
+ }
}
int MurmurDBus::mapNameToId(const QString &name) {
- if (qsAuthPath.isEmpty())
- return -2;
-
- QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
- QDBusReply<int> reply = remoteApp.call("getUserId",name);
- if (reply.isValid())
- return reply.value();
- else {
- qWarning("Authenticator failed getUserId for %s: %s", qPrintable(name), qPrintable(reply.error().message()));
- qsAuthPath = QString();
- qsAuthService = QString();
- return -2;
- }
+ if (qsAuthPath.isEmpty())
+ return -2;
+
+ QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
+ QDBusReply<int> reply = remoteApp.call("getUserId",name);
+ if (reply.isValid())
+ return reply.value();
+ else {
+ qWarning("Authenticator failed getUserId for %s: %s", qPrintable(name), qPrintable(reply.error().message()));
+ qsAuthPath = QString();
+ qsAuthService = QString();
+ return -2;
+ }
}
int MurmurDBus::authenticate(const QString &uname, const QString &pw) {
- if (qsAuthPath.isEmpty())
- return -2;
-
- QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
- QDBusReply<int> reply = remoteApp.call(QDBus::BlockWithGui, "authenticate",uname,pw);
- if (reply.isValid()) {
- qWarning("Authenticate success for %s: %d", qPrintable(uname),reply.value());
- return reply.value();
- } else {
- qWarning("Authenticator failed authenticate for %s: %s", qPrintable(uname), qPrintable(reply.error().message()));
- qsAuthPath = QString();
- qsAuthService = QString();
- return -2;
- }
+ if (qsAuthPath.isEmpty())
+ return -2;
+
+ QDBusInterface remoteApp(qsAuthService,qsAuthPath,QString(),qdbc);
+ QDBusReply<int> reply = remoteApp.call(QDBus::BlockWithGui, "authenticate",uname,pw);
+ if (reply.isValid()) {
+ qWarning("Authenticate success for %s: %d", qPrintable(uname),reply.value());
+ return reply.value();
+ } else {
+ qWarning("Authenticator failed authenticate for %s: %s", qPrintable(uname), qPrintable(reply.error().message()));
+ qsAuthPath = QString();
+ qsAuthService = QString();
+ return -2;
+ }
}
#define PLAYER_SETUP_VAR(var) \
@@ -210,7 +210,7 @@ int MurmurDBus::authenticate(const QString &uname, const QString &pw) {
QDBusConnection::sessionBus().send(msg.createErrorReply("net.sourceforge.mumble.Error.session", "Invalid session id")); \
return; \
}
-
+
#define PLAYER_SETUP PLAYER_SETUP_VAR(session)
#define CHANNEL_SETUP_VAR2(dst,var) \
@@ -223,431 +223,431 @@ int MurmurDBus::authenticate(const QString &uname, const QString &pw) {
#define CHANNEL_SETUP_VAR(var) CHANNEL_SETUP_VAR2(cChannel,var)
void MurmurDBus::getPlayers(QList<PlayerInfoExtended> &a) {
- a.clear();
- foreach(Player *p, g_sServer->qmPlayers) {
- a << PlayerInfoExtended(p);
- }
+ a.clear();
+ foreach(Player *p, g_sServer->qmPlayers) {
+ a << PlayerInfoExtended(p);
+ }
}
void MurmurDBus::getChannels(QList<ChannelInfo> &a) {
- a.clear();
- QQueue<Channel *> q;
- q << Channel::get(0);
- while (! q.isEmpty()) {
- Channel *c = q.dequeue();
- a << ChannelInfo(c);
- foreach(c, c->qlChannels)
- q.enqueue(c);
- }
+ a.clear();
+ QQueue<Channel *> q;
+ q << Channel::get(0);
+ while (! q.isEmpty()) {
+ Channel *c = q.dequeue();
+ a << ChannelInfo(c);
+ foreach(c, c->qlChannels)
+ q.enqueue(c);
+ }
}
void MurmurDBus::kickPlayer(short session, const QString &reason, const QDBusMessage &msg) {
- PLAYER_SETUP;
- Connection *c = g_sServer->qmConnections.value(session);
- if (!c)
- return;
+ PLAYER_SETUP;
+ Connection *c = g_sServer->qmConnections.value(session);
+ if (!c)
+ return;
- MessagePlayerKick mpk;
- mpk.sPlayerId = 0;
- mpk.sVictim = session;
- mpk.qsReason=reason;
- g_sServer->sendAll(&mpk);
- c->disconnect();
+ MessagePlayerKick mpk;
+ mpk.sPlayerId = 0;
+ mpk.sVictim = session;
+ mpk.qsReason=reason;
+ g_sServer->sendAll(&mpk);
+ c->disconnect();
}
void MurmurDBus::getPlayerState(short session, const QDBusMessage &msg, PlayerInfo &pi) {
- PLAYER_SETUP;
- pi = PlayerInfo(pPlayer);
+ PLAYER_SETUP;
+ pi = PlayerInfo(pPlayer);
}
void MurmurDBus::setPlayerState(const PlayerInfo &npi, const QDBusMessage &msg) {
- PLAYER_SETUP_VAR(npi.session);
- CHANNEL_SETUP_VAR(npi.channel);
- PlayerInfo pi(pPlayer);
-
- bool changed = false;
-
- bool deaf = npi.deaf;
- bool mute = npi.mute;
- if (deaf)
- mute = true;
- if (! mute)
- deaf = false;
-
- if ((pi.deaf != deaf) && (deaf || (!deaf && mute))) {
- pPlayer->bDeaf = deaf;
- pPlayer->bMute = mute;
- MessagePlayerDeaf mpd;
- mpd.sPlayerId = 0;
- mpd.sVictim=pPlayer->sId;
- mpd.bDeaf = deaf;
- g_sServer->sendAll(&mpd);
- changed = true;
- } else if ((pi.deaf != deaf) || (pi.mute != mute)) {
- pPlayer->bDeaf = deaf;
- pPlayer->bMute = mute;
-
- MessagePlayerMute mpm;
- mpm.sPlayerId = 0;
- mpm.sVictim=pPlayer->sId;
- mpm.bMute=mute;
- g_sServer->sendAll(&mpm);
- changed = true;
- }
-
- if (cChannel->iId != pi.channel) {
- g_sServer->playerEnterChannel(pPlayer, cChannel);
- MessagePlayerMove mpm;
- mpm.sPlayerId = 0;
- mpm.sVictim = pPlayer->sId;
- mpm.iChannelId = cChannel->iId;
- g_sServer->sendAll(&mpm);
- changed = true;
- }
-
- if (changed)
- emit playerStateChanged(PlayerInfo(pPlayer));
+ PLAYER_SETUP_VAR(npi.session);
+ CHANNEL_SETUP_VAR(npi.channel);
+ PlayerInfo pi(pPlayer);
+
+ bool changed = false;
+
+ bool deaf = npi.deaf;
+ bool mute = npi.mute;
+ if (deaf)
+ mute = true;
+ if (! mute)
+ deaf = false;
+
+ if ((pi.deaf != deaf) && (deaf || (!deaf && mute))) {
+ pPlayer->bDeaf = deaf;
+ pPlayer->bMute = mute;
+ MessagePlayerDeaf mpd;
+ mpd.sPlayerId = 0;
+ mpd.sVictim=pPlayer->sId;
+ mpd.bDeaf = deaf;
+ g_sServer->sendAll(&mpd);
+ changed = true;
+ } else if ((pi.deaf != deaf) || (pi.mute != mute)) {
+ pPlayer->bDeaf = deaf;
+ pPlayer->bMute = mute;
+
+ MessagePlayerMute mpm;
+ mpm.sPlayerId = 0;
+ mpm.sVictim=pPlayer->sId;
+ mpm.bMute=mute;
+ g_sServer->sendAll(&mpm);
+ changed = true;
+ }
+
+ if (cChannel->iId != pi.channel) {
+ g_sServer->playerEnterChannel(pPlayer, cChannel);
+ MessagePlayerMove mpm;
+ mpm.sPlayerId = 0;
+ mpm.sVictim = pPlayer->sId;
+ mpm.iChannelId = cChannel->iId;
+ g_sServer->sendAll(&mpm);
+ changed = true;
+ }
+
+ if (changed)
+ emit playerStateChanged(PlayerInfo(pPlayer));
}
void MurmurDBus::addChannel(const QString &name, int chanparent, const QDBusMessage &msg, int &newid) {
- CHANNEL_SETUP_VAR(chanparent);
-
- Channel *nc = ServerDB::addChannel(cChannel, name);
- ServerDB::updateChannel(nc);
- newid = nc->iId;
-
- MessageChannelAdd mca;
- mca.sPlayerId = 0;
- mca.qsName = name;
- mca.iParent = chanparent;
- mca.iId = nc->iId;
- g_sServer->sendAll(&mca);
+ CHANNEL_SETUP_VAR(chanparent);
+
+ Channel *nc = ServerDB::addChannel(cChannel, name);
+ ServerDB::updateChannel(nc);
+ newid = nc->iId;
+
+ MessageChannelAdd mca;
+ mca.sPlayerId = 0;
+ mca.qsName = name;
+ mca.iParent = chanparent;
+ mca.iId = nc->iId;
+ g_sServer->sendAll(&mca);
}
void MurmurDBus::removeChannel(int id, const QDBusMessage &msg) {
- CHANNEL_SETUP_VAR(id);
- if (!cChannel->cParent) {
- QDBusConnection::sessionBus().send(msg.createErrorReply("net.sourceforge.mumble.Error.channel", "Invalid channel id"));
- return;
- }
- g_sServer->removeChannel(cChannel, NULL);
+ CHANNEL_SETUP_VAR(id);
+ if (!cChannel->cParent) {
+ QDBusConnection::sessionBus().send(msg.createErrorReply("net.sourceforge.mumble.Error.channel", "Invalid channel id"));
+ return;
+ }
+ g_sServer->removeChannel(cChannel, NULL);
}
void MurmurDBus::setChannelState(const ChannelInfo &nci, const QDBusMessage &msg) {
- CHANNEL_SETUP_VAR(nci.id);
- ChannelInfo ci(cChannel);
-
- CHANNEL_SETUP_VAR2(cParent, nci.parent);
-
- bool changed = false;
-
- QSet<Channel *> newset;
- foreach(int id, nci.links) {
- CHANNEL_SETUP_VAR2(cLink, id);
- newset << cLink;
- }
-
- if (cParent != cChannel->cParent) {
-
- Channel *p = cParent;
- while (p) {
- if (p == cChannel) {
- QDBusConnection::sessionBus().send(msg.createErrorReply("net.sourceforge.mumble.Error.channel", "Moving channel to subchannel"));
- return;
- }
- p = p->cParent;
- }
-
- cChannel->cParent->removeChannel(cChannel);
- cParent->addChannel(cChannel);
- ServerDB::updateChannel(cChannel);
-
- MessageChannelMove mcm;
- mcm.sPlayerId = 0;
- mcm.iId = nci.id;
- mcm.iParent = nci.parent;
- g_sServer->sendAll(&mcm);
-
- changed = true;
- }
-
- QSet<Channel *> oldset = cChannel->qsPermLinks;
-
- if (newset != oldset) {
- // Remove
-
- foreach(Channel *l, oldset) {
- if (! newset.contains(l)) {
- ServerDB::removeLink(cChannel, l);
-
- MessageChannelLink mcl;
- mcl.sPlayerId = 0;
- mcl.iId = nci.id;
- mcl.qlTargets << l->iId;
- mcl.ltType = MessageChannelLink::Unlink;
- g_sServer->sendAll(&mcl);
- }
- }
-
- // Add
- foreach(Channel *l, newset) {
- if (! oldset.contains(l)) {
- ServerDB::addLink(cChannel, l);
-
- MessageChannelLink mcl;
- mcl.sPlayerId = 0;
- mcl.iId = nci.id;
- mcl.qlTargets << l->iId;
- mcl.ltType = MessageChannelLink::Link;
- g_sServer->sendAll(&mcl);
- }
- }
-
- changed = true;
- }
-
- if (changed)
- emit channelStateChanged(ChannelInfo(cChannel));
+ CHANNEL_SETUP_VAR(nci.id);
+ ChannelInfo ci(cChannel);
+
+ CHANNEL_SETUP_VAR2(cParent, nci.parent);
+
+ bool changed = false;
+
+ QSet<Channel *> newset;
+ foreach(int id, nci.links) {
+ CHANNEL_SETUP_VAR2(cLink, id);
+ newset << cLink;
+ }
+
+ if (cParent != cChannel->cParent) {
+
+ Channel *p = cParent;
+ while (p) {
+ if (p == cChannel) {
+ QDBusConnection::sessionBus().send(msg.createErrorReply("net.sourceforge.mumble.Error.channel", "Moving channel to subchannel"));
+ return;
+ }
+ p = p->cParent;
+ }
+
+ cChannel->cParent->removeChannel(cChannel);
+ cParent->addChannel(cChannel);
+ ServerDB::updateChannel(cChannel);
+
+ MessageChannelMove mcm;
+ mcm.sPlayerId = 0;
+ mcm.iId = nci.id;
+ mcm.iParent = nci.parent;
+ g_sServer->sendAll(&mcm);
+
+ changed = true;
+ }
+
+ QSet<Channel *> oldset = cChannel->qsPermLinks;
+
+ if (newset != oldset) {
+ // Remove
+
+ foreach(Channel *l, oldset) {
+ if (! newset.contains(l)) {
+ ServerDB::removeLink(cChannel, l);
+
+ MessageChannelLink mcl;
+ mcl.sPlayerId = 0;
+ mcl.iId = nci.id;
+ mcl.qlTargets << l->iId;
+ mcl.ltType = MessageChannelLink::Unlink;
+ g_sServer->sendAll(&mcl);
+ }
+ }
+
+ // Add
+ foreach(Channel *l, newset) {
+ if (! oldset.contains(l)) {
+ ServerDB::addLink(cChannel, l);
+
+ MessageChannelLink mcl;
+ mcl.sPlayerId = 0;
+ mcl.iId = nci.id;
+ mcl.qlTargets << l->iId;
+ mcl.ltType = MessageChannelLink::Link;
+ g_sServer->sendAll(&mcl);
+ }
+ }
+
+ changed = true;
+ }
+
+ if (changed)
+ emit channelStateChanged(ChannelInfo(cChannel));
}
void MurmurDBus::getACL(int id, const QDBusMessage &msg, QList<ACLInfo> &acls, QList<GroupInfo> &groups, bool &inherit) {
- CHANNEL_SETUP_VAR(id);
-
- QStack<Channel *> chans;
- Channel *p;
- ChanACL *acl;
-
- p = cChannel;
- while (p) {
- chans.push(p);
- if ((p == cChannel) || (p->bInheritACL))
- p = p->cParent;
- else
- p =NULL;
- }
-
- inherit = cChannel->bInheritACL;
-
- while (! chans.isEmpty()) {
- p = chans.pop();
- foreach(acl, p->qlACL) {
- if ((p==cChannel) || (acl->bApplySubs)) {
- ACLInfo ai(acl);
- if (p != cChannel)
- ai.inherited = true;
- acls << ai;
- }
- }
- }
-
- p = cChannel->cParent;
- QSet<QString> allnames = Group::groupNames(cChannel);
- QString name;
- foreach(name, allnames) {
- Group *g = cChannel->qhGroups.value(name);
- Group *pg = p ? Group::getGroup(p, name) : NULL;
- GroupInfo gi(g);
- QSet<int> members;
- if (pg) {
- members = pg->members();
- gi.inherited = pg->bInheritable;
- }
- members+=g->qsAdd;
- members-=g->qsRemove;
- gi.members = members.toList();
- groups << gi;
- }
+ CHANNEL_SETUP_VAR(id);
+
+ QStack<Channel *> chans;
+ Channel *p;
+ ChanACL *acl;
+
+ p = cChannel;
+ while (p) {
+ chans.push(p);
+ if ((p == cChannel) || (p->bInheritACL))
+ p = p->cParent;
+ else
+ p =NULL;
+ }
+
+ inherit = cChannel->bInheritACL;
+
+ while (! chans.isEmpty()) {
+ p = chans.pop();
+ foreach(acl, p->qlACL) {
+ if ((p==cChannel) || (acl->bApplySubs)) {
+ ACLInfo ai(acl);
+ if (p != cChannel)
+ ai.inherited = true;
+ acls << ai;
+ }
+ }
+ }
+
+ p = cChannel->cParent;
+ QSet<QString> allnames = Group::groupNames(cChannel);
+ QString name;
+ foreach(name, allnames) {
+ Group *g = cChannel->qhGroups.value(name);
+ Group *pg = p ? Group::getGroup(p, name) : NULL;
+ GroupInfo gi(g);
+ QSet<int> members;
+ if (pg) {
+ members = pg->members();
+ gi.inherited = pg->bInheritable;
+ }
+ members+=g->qsAdd;
+ members-=g->qsRemove;
+ gi.members = members.toList();
+ groups << gi;
+ }
}
void MurmurDBus::setACL(int id, const QList<ACLInfo> &acls, const QList<GroupInfo> &groups, bool inherit, const QDBusMessage &msg) {
- CHANNEL_SETUP_VAR(id);
-
- Group *g;
- ChanACL *a;
- ACLInfo ai;
- GroupInfo gi;
-
- QHash<QString, QSet<int> > hOldTemp;
-
- foreach(g, cChannel->qhGroups) {
- hOldTemp.insert(g->qsName, g->qsTemporary);
- delete g;
- }
- foreach(a, cChannel->qlACL)
- delete a;
- cChannel->qhGroups.clear();
- cChannel->qlACL.clear();
-
- cChannel->bInheritACL = inherit;
-
- foreach(gi, groups) {
- g = new Group(cChannel, gi.name);
- g->bInherit=gi.inherit;
- g->bInheritable=gi.inheritable;
- g->qsAdd = gi.add.toSet();
- g->qsRemove = gi.remove.toSet();
- g->qsTemporary = hOldTemp.value(gi.name);
- }
-
- foreach(ai, acls) {
- a = new ChanACL(cChannel);
- a->bApplyHere = ai.applyHere;
- a->bApplySubs = ai.applySubs;
- a->iPlayerId = ai.playerid;
- a->qsGroup = ai.group;
- a->pDeny = static_cast<ChanACL::Permissions>(ai.deny);
- a->pAllow = static_cast<ChanACL::Permissions>(ai.allow);
- }
-
- ChanACL::clearCache();
- ServerDB::updateChannel(cChannel);
+ CHANNEL_SETUP_VAR(id);
+
+ Group *g;
+ ChanACL *a;
+ ACLInfo ai;
+ GroupInfo gi;
+
+ QHash<QString, QSet<int> > hOldTemp;
+
+ foreach(g, cChannel->qhGroups) {
+ hOldTemp.insert(g->qsName, g->qsTemporary);
+ delete g;
+ }
+ foreach(a, cChannel->qlACL)
+ delete a;
+ cChannel->qhGroups.clear();
+ cChannel->qlACL.clear();
+
+ cChannel->bInheritACL = inherit;
+
+ foreach(gi, groups) {
+ g = new Group(cChannel, gi.name);
+ g->bInherit=gi.inherit;
+ g->bInheritable=gi.inheritable;
+ g->qsAdd = gi.add.toSet();
+ g->qsRemove = gi.remove.toSet();
+ g->qsTemporary = hOldTemp.value(gi.name);
+ }
+
+ foreach(ai, acls) {
+ a = new ChanACL(cChannel);
+ a->bApplyHere = ai.applyHere;
+ a->bApplySubs = ai.applySubs;
+ a->iPlayerId = ai.playerid;
+ a->qsGroup = ai.group;
+ a->pDeny = static_cast<ChanACL::Permissions>(ai.deny);
+ a->pAllow = static_cast<ChanACL::Permissions>(ai.allow);
+ }
+
+ ChanACL::clearCache();
+ ServerDB::updateChannel(cChannel);
}
void MurmurDBus::getBans(QList<BanInfo> &bi) {
- bi.clear();
- QPair<quint32,int> ban;
- foreach(ban, g_sServer->qlBans) {
- bi << BanInfo(ban);
- }
+ bi.clear();
+ QPair<quint32,int> ban;
+ foreach(ban, g_sServer->qlBans) {
+ bi << BanInfo(ban);
+ }
}
void MurmurDBus::setBans(const QList<BanInfo> &bans, const QDBusMessage &) {
- g_sServer->qlBans.clear();
- foreach(BanInfo bi, bans)
- g_sServer->qlBans << QPair<quint32,int>(bi.address,bi.bits);
- ServerDB::setBans(g_sServer->qlBans);
+ g_sServer->qlBans.clear();
+ foreach(BanInfo bi, bans)
+ g_sServer->qlBans << QPair<quint32,int>(bi.address,bi.bits);
+ ServerDB::setBans(g_sServer->qlBans);
}
void MurmurDBus::getPlayerNames(const QList<int> &ids, const QDBusMessage &, QList<QString> &names) {
- names.clear();
- foreach(int id, ids) {
- if (! g_sServer->qhUserNameCache.contains(id)) {
- QString name=ServerDB::getUserName(id);
- if (! name.isEmpty()) {
- g_sServer->qhUserNameCache[id]=name;
- }
- }
- names << g_sServer->qhUserNameCache.value(id);
- }
+ names.clear();
+ foreach(int id, ids) {
+ if (! g_sServer->qhUserNameCache.contains(id)) {
+ QString name=ServerDB::getUserName(id);
+ if (! name.isEmpty()) {
+ g_sServer->qhUserNameCache[id]=name;
+ }
+ }
+ names << g_sServer->qhUserNameCache.value(id);
+ }
}
void MurmurDBus::getPlayerIds(const QList<QString> &names, const QDBusMessage &, QList<int> &ids) {
- ids.clear();
- foreach(QString name, names) {
- if (! g_sServer->qhUserIDCache.contains(name)) {
- int id=ServerDB::getUserID(name);
- if (id != -1) {
- g_sServer->qhUserIDCache[name]=id;
- }
- }
- ids << g_sServer->qhUserIDCache.value(name);
- }
+ ids.clear();
+ foreach(QString name, names) {
+ if (! g_sServer->qhUserIDCache.contains(name)) {
+ int id=ServerDB::getUserID(name);
+ if (id != -1) {
+ g_sServer->qhUserIDCache[name]=id;
+ }
+ }
+ ids << g_sServer->qhUserIDCache.value(name);
+ }
}
void MurmurDBus::setAuthenticator(const QDBusObjectPath &path, const QDBusMessage &msg) {
- qsAuthPath = path.path();
- qsAuthService = msg.service();
- qWarning("Authenticator set to %s %s",qPrintable(qsAuthService),qPrintable(qsAuthPath));
+ qsAuthPath = path.path();
+ qsAuthService = msg.service();
+ qWarning("Authenticator set to %s %s",qPrintable(qsAuthService),qPrintable(qsAuthPath));
}
void MurmurDBus::setTemporaryGroups(int channel, int playerid, const QStringList &groups, const QDBusMessage &msg) {
- CHANNEL_SETUP_VAR(channel);
-
- Group *g;
- foreach(g, cChannel->qhGroups)
- g->qsTemporary.remove(playerid);
-
- QString gname;
- foreach(gname, groups) {
- g = cChannel->qhGroups.value(gname);
- if (! g) {
- g = new Group(cChannel, gname);
- }
- g->qsTemporary.insert(playerid);
- }
+ CHANNEL_SETUP_VAR(channel);
+
+ Group *g;
+ foreach(g, cChannel->qhGroups)
+ g->qsTemporary.remove(playerid);
- ChanACL::clearCache();
+ QString gname;
+ foreach(gname, groups) {
+ g = cChannel->qhGroups.value(gname);
+ if (! g) {
+ g = new Group(cChannel, gname);
+ }
+ g->qsTemporary.insert(playerid);
+ }
+
+ ChanACL::clearCache();
}
PlayerInfo::PlayerInfo(Player *p) {
- session = p->sId;
- mute = p->bMute;
- deaf = p->bDeaf;
- suppressed = p->bSuppressed;
- selfMute = p->bSelfMute;
- selfDeaf = p->bSelfDeaf;
- channel = p->cChannel->iId;
+ session = p->sId;
+ mute = p->bMute;
+ deaf = p->bDeaf;
+ suppressed = p->bSuppressed;
+ selfMute = p->bSelfMute;
+ selfDeaf = p->bSelfDeaf;
+ channel = p->cChannel->iId;
}
PlayerInfoExtended::PlayerInfoExtended(Player *p) : PlayerInfo(p) {
- id = p->iId;
- name = p->qsName;
-
- Connection *c = g_sServer->qmConnections[p->sId];
- BandwidthRecord *bw= g_sServer->qmBandwidth[c];
- onlinesecs = bw->qtFirst.elapsed() / 1000;
-
- int sincelast = bw->a_qtWhen[bw->iRecNum].elapsed() / 20;
- int todo = N_BANDWIDTH_SLOTS - sincelast;
- int sum = 0;
- for(int i=0;i<todo;i++) {
- sum += bw->a_iBW[(bw->iRecNum + N_BANDWIDTH_SLOTS - i) % N_BANDWIDTH_SLOTS];
- }
- bytespersec= (sum * 50) / N_BANDWIDTH_SLOTS;
+ id = p->iId;
+ name = p->qsName;
+
+ Connection *c = g_sServer->qmConnections[p->sId];
+ BandwidthRecord *bw= g_sServer->qmBandwidth[c];
+ onlinesecs = bw->qtFirst.elapsed() / 1000;
+
+ int sincelast = bw->a_qtWhen[bw->iRecNum].elapsed() / 20;
+ int todo = N_BANDWIDTH_SLOTS - sincelast;
+ int sum = 0;
+ for (int i=0;i<todo;i++) {
+ sum += bw->a_iBW[(bw->iRecNum + N_BANDWIDTH_SLOTS - i) % N_BANDWIDTH_SLOTS];
+ }
+ bytespersec= (sum * 50) / N_BANDWIDTH_SLOTS;
}
ChannelInfo::ChannelInfo(Channel *c) {
- id = c->iId;
- name = c->qsName;
- parent = c->cParent ? c->cParent->iId : -1;
- foreach(Channel *chn, c->qsPermLinks)
- links << chn->iId;
+ id = c->iId;
+ name = c->qsName;
+ parent = c->cParent ? c->cParent->iId : -1;
+ foreach(Channel *chn, c->qsPermLinks)
+ links << chn->iId;
}
ACLInfo::ACLInfo(ChanACL *acl) {
- applyHere = acl->bApplyHere;
- applySubs = acl->bApplySubs;
- inherited = false;
- playerid = acl->iPlayerId;
- group = acl->qsGroup;
- allow = acl->pDeny;
- deny = acl->pAllow;
+ applyHere = acl->bApplyHere;
+ applySubs = acl->bApplySubs;
+ inherited = false;
+ playerid = acl->iPlayerId;
+ group = acl->qsGroup;
+ allow = acl->pDeny;
+ deny = acl->pAllow;
}
GroupInfo::GroupInfo(Group *g) {
- name = g->qsName;
- inherit = g->bInherit;
- inheritable = g->bInheritable;
- add = g->qsAdd.toList();
- remove = g->qsRemove.toList();
- members.clear();
+ name = g->qsName;
+ inherit = g->bInherit;
+ inheritable = g->bInheritable;
+ add = g->qsAdd.toList();
+ remove = g->qsRemove.toList();
+ members.clear();
}
BanInfo::BanInfo(QPair<quint32,int> b) {
- address = b.first;
- bits = b.second;
+ address = b.first;
+ bits = b.second;
}
void MurmurDBus::playerStateChanged(Player *p) {
- emit playerStateChanged(PlayerInfo(p));
+ emit playerStateChanged(PlayerInfo(p));
}
void MurmurDBus::playerConnected(Player *p) {
- emit playerConnected(PlayerInfo(p));
+ emit playerConnected(PlayerInfo(p));
}
void MurmurDBus::playerDisconnected(Player *p) {
- emit playerDisconnected(PlayerInfo(p));
+ emit playerDisconnected(PlayerInfo(p));
}
void MurmurDBus::channelStateChanged(Channel *c) {
- emit channelStateChanged(ChannelInfo(c));
+ emit channelStateChanged(ChannelInfo(c));
}
void MurmurDBus::channelCreated(Channel *c) {
- emit channelCreated(ChannelInfo(c));
+ emit channelCreated(ChannelInfo(c));
}
void MurmurDBus::channelRemoved(Channel *c) {
- emit channelRemoved(ChannelInfo(c));
+ emit channelRemoved(ChannelInfo(c));
}
diff --git a/src/murmur/DBus_fake.h b/src/murmur/DBus_fake.h
index 8283fcc32..c24ba0eb1 100644
--- a/src/murmur/DBus_fake.h
+++ b/src/murmur/DBus_fake.h
@@ -39,22 +39,30 @@
#include "ACL.h"
class MurmurDBus : public QObject {
- Q_OBJECT
- public:
- MurmurDBus(QCoreApplication &) {};
+ Q_OBJECT
+ public:
+ MurmurDBus(QCoreApplication &) {};
- void playerStateChanged(Player *) {};
- void playerConnected(Player *) {};
- void playerDisconnected(Player *) {};
+ void playerStateChanged(Player *) {};
+ void playerConnected(Player *) {};
+ void playerDisconnected(Player *) {};
- void channelStateChanged(Channel *) {};
- void channelCreated(Channel *) {};
- void channelRemoved(Channel *) {};
+ void channelStateChanged(Channel *) {};
+ void channelCreated(Channel *) {};
+ void channelRemoved(Channel *) {};
- int mapNameToId(const QString &) { return -2; };
- QString mapIdToName(int) { return QString(); };
- QByteArray mapIdToTexture(int) { return QByteArray(); };
- int authenticate(const QString &uname, const QString &pw) { return -2; };
+ int mapNameToId(const QString &) {
+ return -2;
+ };
+ QString mapIdToName(int) {
+ return QString();
+ };
+ QByteArray mapIdToTexture(int) {
+ return QByteArray();
+ };
+ int authenticate(const QString &uname, const QString &pw) {
+ return -2;
+ };
};
extern MurmurDBus *dbus;
diff --git a/src/murmur/DBus_real.h b/src/murmur/DBus_real.h
index 1886c5b46..a8a873bcd 100644
--- a/src/murmur/DBus_real.h
+++ b/src/murmur/DBus_real.h
@@ -38,137 +38,131 @@
#include "Group.h"
#include "ACL.h"
-struct PlayerInfo
-{
- short session;
- bool mute, deaf, suppressed;
- bool selfMute, selfDeaf;
- int channel;
- PlayerInfo() { };
- PlayerInfo(Player *);
+struct PlayerInfo {
+ short session;
+ bool mute, deaf, suppressed;
+ bool selfMute, selfDeaf;
+ int channel;
+ PlayerInfo() { };
+ PlayerInfo(Player *);
};
Q_DECLARE_METATYPE(PlayerInfo);
-struct PlayerInfoExtended : public PlayerInfo
-{
- int id;
- QString name;
- int onlinesecs;
- int bytespersec;
- PlayerInfoExtended() {};
- PlayerInfoExtended(Player *);
+struct PlayerInfoExtended : public PlayerInfo {
+ int id;
+ QString name;
+ int onlinesecs;
+ int bytespersec;
+ PlayerInfoExtended() {};
+ PlayerInfoExtended(Player *);
};
Q_DECLARE_METATYPE(PlayerInfoExtended);
Q_DECLARE_METATYPE(QList<PlayerInfoExtended>);
-struct ChannelInfo
-{
- int id;
- QString name;
- int parent;
- QList<int> links;
- ChannelInfo() { };
- ChannelInfo(Channel *c);
+struct ChannelInfo {
+ int id;
+ QString name;
+ int parent;
+ QList<int> links;
+ ChannelInfo() { };
+ ChannelInfo(Channel *c);
};
Q_DECLARE_METATYPE(ChannelInfo);
Q_DECLARE_METATYPE(QList<ChannelInfo>);
-struct GroupInfo
-{
- QString name;
- bool inherited, inherit, inheritable;
- QList<int> add, remove, members;
- GroupInfo() { };
- GroupInfo(Group *g);
+struct GroupInfo {
+ QString name;
+ bool inherited, inherit, inheritable;
+ QList<int> add, remove, members;
+ GroupInfo() { };
+ GroupInfo(Group *g);
};
Q_DECLARE_METATYPE(GroupInfo);
Q_DECLARE_METATYPE(QList<GroupInfo>);
-struct ACLInfo
-{
- bool applyHere, applySubs, inherited;
- int playerid;
- QString group;
- unsigned int allow, deny;
- ACLInfo() { };
- ACLInfo(ChanACL *acl);
+struct ACLInfo {
+ bool applyHere, applySubs, inherited;
+ int playerid;
+ QString group;
+ unsigned int allow, deny;
+ ACLInfo() { };
+ ACLInfo(ChanACL *acl);
};
Q_DECLARE_METATYPE(ACLInfo);
Q_DECLARE_METATYPE(QList<ACLInfo>);
-struct BanInfo
-{
- unsigned int address;
- int bits;
- BanInfo() { };
- BanInfo(QPair<quint32,int>);
+struct BanInfo {
+ unsigned int address;
+ int bits;
+ BanInfo() { };
+ BanInfo(QPair<quint32,int>);
};
Q_DECLARE_METATYPE(BanInfo);
Q_DECLARE_METATYPE(QList<BanInfo>);
class MurmurDBus : public QDBusAbstractAdaptor {
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "net.sourceforge.mumble.Murmur");
- protected:
- QString qsAuthService;
- QString qsAuthPath;
- public:
- QDBusConnection qdbc;
-
- MurmurDBus(QCoreApplication &application);
-
- void playerStateChanged(Player *p);
- void playerConnected(Player *p);
- void playerDisconnected(Player *p);
-
- void channelStateChanged(Channel *c);
- void channelCreated(Channel *c);
- void channelRemoved(Channel *c);
- static void registerTypes();
-
- int mapNameToId(const QString &name);
- QString mapIdToName(int id);
- QByteArray mapIdToTexture(int id);
- int authenticate(const QString &uname, const QString &pw);
- public slots:
- // Order of paremeters is IMPORTANT, or Qt will barf.
- // Needs to be:
- // First all input parameters (non-ref or const-ref)
- // Then const QDbusMessage ref
- // Then output paremeters (ref)
- // Unfortunately, this makes things look chaotic, but luckily it looks sane again when introspected.
- // make SURE arguments have sane names, the argument-name will be exported in introspection xml.
-
- void getPlayers(QList<PlayerInfoExtended> &player_list);
- void getChannels(QList<ChannelInfo> &channel_list);
-
- void getACL(int channel, const QDBusMessage &, QList<ACLInfo> &acls,QList<GroupInfo> &groups, bool &inherit);
- void setACL(int channel, const QList<ACLInfo> &acls, const QList<GroupInfo> &groups, bool inherit, const QDBusMessage &);
-
- void getBans(QList<BanInfo> &bans);
- void setBans(const QList<BanInfo> &bans, const QDBusMessage &);
-
- void kickPlayer(short session, const QString &reason, const QDBusMessage &);
- void getPlayerState(short session, const QDBusMessage &, PlayerInfo &state);
- void setPlayerState(const PlayerInfo &state, const QDBusMessage &);
- void setChannelState(const ChannelInfo &state, const QDBusMessage &);
-
- void removeChannel(int id, const QDBusMessage &);
- void addChannel(const QString &name, int parent, const QDBusMessage &, int &newid);
-
- void getPlayerNames(const QList<int> &ids, const QDBusMessage &, QList<QString> &names);
- void getPlayerIds(const QList<QString> &names, const QDBusMessage &, QList<int> &ids);
-
- void setAuthenticator(const QDBusObjectPath &path, const QDBusMessage &);
- void setTemporaryGroups(int channel, int playerid, const QStringList &groups, const QDBusMessage &);
- signals:
- void playerStateChanged(const PlayerInfo &state);
- void playerConnected(const PlayerInfo &state);
- void playerDisconnected(const PlayerInfo &state);
-
- void channelStateChanged(const ChannelInfo &state);
- void channelCreated(const ChannelInfo &state);
- void channelRemoved(const ChannelInfo &state);
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "net.sourceforge.mumble.Murmur");
+ protected:
+ QString qsAuthService;
+ QString qsAuthPath;
+ public:
+ QDBusConnection qdbc;
+
+ MurmurDBus(QCoreApplication &application);
+
+ void playerStateChanged(Player *p);
+ void playerConnected(Player *p);
+ void playerDisconnected(Player *p);
+
+ void channelStateChanged(Channel *c);
+ void channelCreated(Channel *c);
+ void channelRemoved(Channel *c);
+ static void registerTypes();
+
+ int mapNameToId(const QString &name);
+ QString mapIdToName(int id);
+ QByteArray mapIdToTexture(int id);
+ int authenticate(const QString &uname, const QString &pw);
+ public slots:
+ // Order of paremeters is IMPORTANT, or Qt will barf.
+ // Needs to be:
+ // First all input parameters (non-ref or const-ref)
+ // Then const QDbusMessage ref
+ // Then output paremeters (ref)
+ // Unfortunately, this makes things look chaotic, but luckily it looks sane again when introspected.
+ // make SURE arguments have sane names, the argument-name will be exported in introspection xml.
+
+ void getPlayers(QList<PlayerInfoExtended> &player_list);
+ void getChannels(QList<ChannelInfo> &channel_list);
+
+ void getACL(int channel, const QDBusMessage &, QList<ACLInfo> &acls,QList<GroupInfo> &groups, bool &inherit);
+ void setACL(int channel, const QList<ACLInfo> &acls, const QList<GroupInfo> &groups, bool inherit, const QDBusMessage &);
+
+ void getBans(QList<BanInfo> &bans);
+ void setBans(const QList<BanInfo> &bans, const QDBusMessage &);
+
+ void kickPlayer(short session, const QString &reason, const QDBusMessage &);
+ void getPlayerState(short session, const QDBusMessage &, PlayerInfo &state);
+ void setPlayerState(const PlayerInfo &state, const QDBusMessage &);
+ void setChannelState(const ChannelInfo &state, const QDBusMessage &);
+
+ void removeChannel(int id, const QDBusMessage &);
+ void addChannel(const QString &name, int parent, const QDBusMessage &, int &newid);
+
+ void getPlayerNames(const QList<int> &ids, const QDBusMessage &, QList<QString> &names);
+ void getPlayerIds(const QList<QString> &names, const QDBusMessage &, QList<int> &ids);
+
+ void setAuthenticator(const QDBusObjectPath &path, const QDBusMessage &);
+ void setTemporaryGroups(int channel, int playerid, const QStringList &groups, const QDBusMessage &);
+ signals:
+ void playerStateChanged(const PlayerInfo &state);
+ void playerConnected(const PlayerInfo &state);
+ void playerDisconnected(const PlayerInfo &state);
+
+ void channelStateChanged(const ChannelInfo &state);
+ void channelCreated(const ChannelInfo &state);
+ void channelRemoved(const ChannelInfo &state);
};
extern MurmurDBus *dbus;
diff --git a/src/murmur/Register.cpp b/src/murmur/Register.cpp
index d4510776e..ebf100762 100644
--- a/src/murmur/Register.cpp
+++ b/src/murmur/Register.cpp
@@ -35,90 +35,90 @@
#include "Register.h"
Register::Register() {
- http = NULL;
- connect(&qtTick, SIGNAL(timeout()), this, SLOT(update()));
-
- if (! g_sp.qsRegName.isEmpty()) {
- if ((! g_sp.qsRegName.isEmpty()) && (! g_sp.qsRegPassword.isEmpty()) && (g_sp.qurlRegWeb.isValid()) && (g_sp.qsPassword.isEmpty()))
- qtTick.start(60000);
- else
- qWarning("Registration needs nonempty name, password and url, and the server must not be password protected.");
- } else {
- qWarning("Not registering server as public");
- }
+ http = NULL;
+ connect(&qtTick, SIGNAL(timeout()), this, SLOT(update()));
+
+ if (! g_sp.qsRegName.isEmpty()) {
+ if ((! g_sp.qsRegName.isEmpty()) && (! g_sp.qsRegPassword.isEmpty()) && (g_sp.qurlRegWeb.isValid()) && (g_sp.qsPassword.isEmpty()))
+ qtTick.start(60000);
+ else
+ qWarning("Registration needs nonempty name, password and url, and the server must not be password protected.");
+ } else {
+ qWarning("Not registering server as public");
+ }
}
void Register::abort() {
- if (http) {
- http->deleteLater();
- http = NULL;
- }
+ if (http) {
+ http->deleteLater();
+ http = NULL;
+ }
}
void Register::update() {
- abort();
- qtTick.start(1000 * 60 * 60);
-
- QDomDocument doc;
- QDomElement root=doc.createElement(QLatin1String("server"));
- doc.appendChild(root);
-
- QDomElement tag;
- QDomText t;
-
- tag=doc.createElement(QLatin1String("name"));
- root.appendChild(tag);
-
- t=doc.createTextNode(g_sp.qsRegName);
- tag.appendChild(t);
-
- tag=doc.createElement(QLatin1String("host"));
- root.appendChild(tag);
-
- t=doc.createTextNode(g_sp.qsRegHost);
- tag.appendChild(t);
-
- tag=doc.createElement(QLatin1String("password"));
- root.appendChild(tag);
-
- t=doc.createTextNode(g_sp.qsRegPassword);
- tag.appendChild(t);
-
- tag=doc.createElement(QLatin1String("port"));
- root.appendChild(tag);
-
- t=doc.createTextNode(QString::number(g_sp.iPort));
- tag.appendChild(t);
-
- tag=doc.createElement(QLatin1String("url"));
- root.appendChild(tag);
-
- t=doc.createTextNode(g_sp.qurlRegWeb.toString());
- tag.appendChild(t);
-
- tag=doc.createElement(QLatin1String("digest"));
- root.appendChild(tag);
-
- t=doc.createTextNode(cert.getDigest());
- tag.appendChild(t);
-
- http = new QHttp(this);
- connect(http, SIGNAL(done(bool)), this, SLOT(done(bool)));
- http->setHost(QLatin1String("mumble.hive.no"), 80);
-
- QHttpRequestHeader h(QLatin1String("POST"), QLatin1String("/register.cgi"));
- h.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
- h.setValue(QLatin1String("Host"), QLatin1String("mumble.hive.no"));
- h.setContentType(QLatin1String("text/xml"));
- http->request(h, doc.toString().toUtf8());
+ abort();
+ qtTick.start(1000 * 60 * 60);
+
+ QDomDocument doc;
+ QDomElement root=doc.createElement(QLatin1String("server"));
+ doc.appendChild(root);
+
+ QDomElement tag;
+ QDomText t;
+
+ tag=doc.createElement(QLatin1String("name"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(g_sp.qsRegName);
+ tag.appendChild(t);
+
+ tag=doc.createElement(QLatin1String("host"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(g_sp.qsRegHost);
+ tag.appendChild(t);
+
+ tag=doc.createElement(QLatin1String("password"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(g_sp.qsRegPassword);
+ tag.appendChild(t);
+
+ tag=doc.createElement(QLatin1String("port"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(QString::number(g_sp.iPort));
+ tag.appendChild(t);
+
+ tag=doc.createElement(QLatin1String("url"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(g_sp.qurlRegWeb.toString());
+ tag.appendChild(t);
+
+ tag=doc.createElement(QLatin1String("digest"));
+ root.appendChild(tag);
+
+ t=doc.createTextNode(cert.getDigest());
+ tag.appendChild(t);
+
+ http = new QHttp(this);
+ connect(http, SIGNAL(done(bool)), this, SLOT(done(bool)));
+ http->setHost(QLatin1String("mumble.hive.no"), 80);
+
+ QHttpRequestHeader h(QLatin1String("POST"), QLatin1String("/register.cgi"));
+ h.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive"));
+ h.setValue(QLatin1String("Host"), QLatin1String("mumble.hive.no"));
+ h.setContentType(QLatin1String("text/xml"));
+ http->request(h, doc.toString().toUtf8());
}
void Register::done(bool err) {
- if (err) {
- qWarning("Regstration failed: %s", qPrintable(http->errorString()));
- } else {
- QByteArray qba = http->readAll();
- qWarning("Registration: %s", qPrintable(QString(QLatin1String(qba))));
- }
- abort();
+ if (err) {
+ qWarning("Regstration failed: %s", qPrintable(http->errorString()));
+ } else {
+ QByteArray qba = http->readAll();
+ qWarning("Registration: %s", qPrintable(QString(QLatin1String(qba))));
+ }
+ abort();
}
diff --git a/src/murmur/Register.h b/src/murmur/Register.h
index 56dd626ef..9c862a5e4 100644
--- a/src/murmur/Register.h
+++ b/src/murmur/Register.h
@@ -32,16 +32,16 @@
#define _REGISTER_H
class Register : public QObject {
- Q_OBJECT
- protected:
- QTimer qtTick;
- QHttp *http;
- public slots:
- void done(bool);
- void update();
- void abort();
- public:
- Register();
+ Q_OBJECT
+ protected:
+ QTimer qtTick;
+ QHttp *http;
+ public slots:
+ void done(bool);
+ void update();
+ void abort();
+ public:
+ Register();
};
#else
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp
index ae5fc1a23..66f4ddf75 100644
--- a/src/murmur/Server.cpp
+++ b/src/murmur/Server.cpp
@@ -59,16 +59,16 @@ LogEmitter::LogEmitter(QObject *p) : QObject(p) {
};
void LogEmitter::addLogEntry(const QString &msg) {
- emit newLogEntry(msg);
+ emit newLogEntry(msg);
};
SslServer::SslServer(QObject *p) : QTcpServer(p) {
}
void SslServer::incomingConnection(int v) {
- QSslSocket *s = new QSslSocket(this);
- s->setSocketDescriptor(v);
- qlSockets.append(s);
+ QSslSocket *s = new QSslSocket(this);
+ s->setSocketDescriptor(v);
+ qlSockets.append(s);
}
QSslSocket *SslServer::nextPendingSSLConnection() {
@@ -96,8 +96,8 @@ void ServerParams::read(QString fname) {
if (fname.isEmpty())
fname = "murmur.ini";
else {
- if (! QFile(fname).exists())
- qFatal("Specified ini file %s could not be opened", qPrintable(fname));
+ if (! QFile(fname).exists())
+ qFatal("Specified ini file %s could not be opened", qPrintable(fname));
}
QSettings qs(fname, QSettings::IniFormat);
@@ -126,7 +126,7 @@ void ServerParams::read(QString fname) {
qsRegPassword = qs.value("registerPassword", qsRegPassword).toString();
qsRegHost = qs.value("registerHostname", qsRegHost).toString();
qurlRegWeb = QUrl(qs.value("registerUrl", qurlRegWeb.toString()).toString());
-
+
qsSSLCert = qs.value("sslCert", qsSSLCert).toString();
qsSSLKey = qs.value("sslKey", qsSSLKey).toString();
qsSSLStore = qs.value("sslStore", qsSSLStore).toString();
@@ -136,7 +136,7 @@ BandwidthRecord::BandwidthRecord() {
iRecNum = 0;
iSum = 0;
qtFirst.start();
- for(int i=0;i<N_BANDWIDTH_SLOTS;i++)
+ for (int i=0;i<N_BANDWIDTH_SLOTS;i++)
a_iBW[i] = 0;
}
@@ -199,7 +199,7 @@ void UDPThread::run() {
if (p != qhPeers.value(sPlayerId)) {
Connection *source = g_sServer->qmConnections.value(sPlayerId);
- if (! source || ! (source->peerAddress() == senderAddr)) {
+ if (! source || !(source->peerAddress() == senderAddr)) {
continue;
}
// At any point after this, the connection might go away WHILE we're processing. That is "bad".
@@ -209,11 +209,11 @@ void UDPThread::run() {
if (g_sServer->qmConnections.contains(sPlayerId)) {
qhHosts[sPlayerId] = senderAddr;
qhPeers[sPlayerId] = p;
- }
+ }
}
rl.relock();
if (! g_sServer->qmConnections.contains(sPlayerId)) {
- continue;
+ continue;
}
}
@@ -267,9 +267,9 @@ void UDPThread::processMsg(PacketDataStream &pds, Connection *cCon) {
pds >> seq;
pds >> flags;
- int nframes = ((flags >> 4) & 0x03) + 1;
+ int nframes = ((flags >> 4) & 0x03) + 1;
int packetsize = (20 + 8 + 3 + pds.left() + nframes - 1) / nframes;
- for(int i = 0; i < nframes; i++)
+ for (int i = 0; i < nframes; i++)
bw->addFrame(packetsize);
if (bw->bytesPerSec() > g_sp.iMaxBandwidth) {
@@ -324,7 +324,7 @@ Server::Server(QObject *p) : QObject(p) {
log(QString("Server listening on port %1").arg(g_sp.iPort));
- for(int i=1;i<2000;i++)
+ for (int i=1;i<2000;i++)
qqIds.enqueue(i);
qtTimer = new QTimer(this);
@@ -402,7 +402,7 @@ void Server::newClient() {
connect(cCon, SIGNAL(handleSslErrors(const QList<QSslError> &)), this, SLOT(sslError(const QList<QSslError> &)));
log(QString("New connection: %1:%2").arg(sock->peerAddress().toString()).arg(sock->peerPort()), cCon);
-
+
sock->startServerEncryption();
}
@@ -419,7 +419,7 @@ void Server::sslError(const QList<QSslError> &errors) {
if (ok) {
Connection *c = static_cast<Connection *>(sender());
c->proceedAnyway();
- }
+ }
}
void Server::connectionClosed(QString reason) {
@@ -459,37 +459,37 @@ void Server::connectionClosed(QString reason) {
}
void Server::message(QByteArray &qbaMsg, Connection *cCon) {
- if (cCon == NULL)
+ if (cCon == NULL)
cCon = static_cast<Connection *>(sender());
Message *mMsg = Message::networkToMessage(qbaMsg);
- // Just leftovers from the buffer and we just kicked
- // the user off.
- if (! qmPlayers.contains(cCon))
- return;
+ // Just leftovers from the buffer and we just kicked
+ // the user off.
+ if (! qmPlayers.contains(cCon))
+ return;
- if (mMsg) {
+ if (mMsg) {
mMsg->process(cCon);
delete mMsg;
- } else {
+ } else {
cCon->disconnect();
- }
+ }
}
void Server::checkTimeout() {
- QList<Connection *> qlClose;
+ QList<Connection *> qlClose;
qrwlConnections.lockForRead();
foreach(Connection *c, qmConnections) {
- if (c->activityTime() > (g_sp.iTimeout * 1000)) {
- log(QLatin1String("Timeout"), c);
- qlClose.append(c);
- }
+ if (c->activityTime() > (g_sp.iTimeout * 1000)) {
+ log(QLatin1String("Timeout"), c);
+ qlClose.append(c);
+ }
}
qrwlConnections.unlock();
foreach(Connection *c, qlClose)
- c->disconnect();
+ c->disconnect();
}
void Server::tcpTransmit(QByteArray a, short id) {
@@ -515,7 +515,7 @@ void Server::sendAll(Message *mMsg) {
void Server::sendExcept(Message *mMsg, Connection *cCon) {
QHash<Connection *, Player *>::const_iterator i;
- for(i=qmPlayers.constBegin(); i != qmPlayers.constEnd(); ++i) {
+ for (i=qmPlayers.constBegin(); i != qmPlayers.constEnd(); ++i) {
if ((i.key() != cCon) && (i.value()->sState == Player::Authenticated))
sendMessage(i.key(), mMsg);
}
@@ -596,14 +596,14 @@ void Server::playerEnterChannel(Player *p, Channel *c, bool quiet) {
}
void Server::checkCommands() {
- static bool warned = false;
+ static bool warned = false;
QList<ServerDB::qpCommand> cmdlist=ServerDB::getCommands();
if (cmdlist.count() == 0)
return;
foreach(ServerDB::qpCommand cmd, cmdlist) {
- if (! warned) {
- log(QLatin1String("The commands table is deprecated and will be removed in a later release. Please migrate to DBus."), NULL);
- warned = true;
+ if (! warned) {
+ log(QLatin1String("The commands table is deprecated and will be removed in a later release. Please migrate to DBus."), NULL);
+ warned = true;
}
QString cmdname = cmd.first;
QList<QVariant> argv = cmd.second;
@@ -710,19 +710,19 @@ void MessageServerAuthenticate::process(Connection *cCon) {
pSrcPlayer->qsName = qsUsername;
if (iVersion != MESSAGE_STREAM_VERSION) {
- msr.qsReason = "Wrong version of mumble protocol";
- msr.rtType = MessageServerReject::WrongVersion;
+ msr.qsReason = "Wrong version of mumble protocol";
+ msr.rtType = MessageServerReject::WrongVersion;
} else if (! nameok) {
- msr.qsReason = "Invalid Username";
- msr.rtType = MessageServerReject::InvalidUsername;
+ msr.qsReason = "Invalid Username";
+ msr.rtType = MessageServerReject::InvalidUsername;
} else if (id==-1) {
- msr.qsReason = "Wrong password for user";
- msr.rtType = MessageServerReject::WrongUserPW;
+ msr.qsReason = "Wrong password for user";
+ msr.rtType = MessageServerReject::WrongUserPW;
} else if (id==-2 && ! g_sp.qsPassword.isEmpty() && g_sp.qsPassword != qsPassword) {
- msr.qsReason = "Invalid server password";
- msr.rtType = MessageServerReject::WrongServerPW;
+ msr.qsReason = "Invalid server password";
+ msr.rtType = MessageServerReject::WrongServerPW;
} else {
- ok = true;
+ ok = true;
}
Player *ppOld = Player::match(pSrcPlayer, true);
@@ -730,11 +730,11 @@ void MessageServerAuthenticate::process(Connection *cCon) {
// Allow reuse of name from same IP
if (ok && ppOld && (pSrcPlayer->iId == -1)) {
- if (cOld->peerAddress() != cCon->peerAddress()) {
+ if (cOld->peerAddress() != cCon->peerAddress()) {
msr.qsReason = "Playername already in use";
msr.rtType = MessageServerReject::UsernameInUse;
ok = false;
- }
+ }
}
if (iMaxBandwidth > g_sp.iMaxBandwidth) {
@@ -750,10 +750,10 @@ void MessageServerAuthenticate::process(Connection *cCon) {
}
if (! ok) {
- g_sServer->log(QString::fromLatin1("Rejected connection: %1").arg(msr.qsReason), cCon);
- g_sServer->sendMessage(cCon, &msr);
- cCon->disconnect();
- return;
+ g_sServer->log(QString::fromLatin1("Rejected connection: %1").arg(msr.qsReason), cCon);
+ g_sServer->sendMessage(cCon, &msr);
+ cCon->disconnect();
+ return;
}
// Kick ghost
@@ -789,7 +789,7 @@ void MessageServerAuthenticate::process(Connection *cCon) {
g_sServer->sendMessage(cCon, &mca);
foreach(c, c->qlChannels)
- q.enqueue(c);
+ q.enqueue(c);
}
foreach(c, chans) {
@@ -798,7 +798,7 @@ void MessageServerAuthenticate::process(Connection *cCon) {
mcl.iId = c->iId;
mcl.ltType = MessageChannelLink::Link;
foreach(Channel *l, c->qhLinks.keys())
- mcl.qlTargets << l->iId;
+ mcl.qlTargets << l->iId;
g_sServer->sendMessage(cCon, &mcl);
}
}
@@ -886,27 +886,27 @@ void MessageServerBanList::process(Connection *cCon) {
}
void MessageServerLeave::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessageServerJoin::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessageServerReject::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessageServerSync::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessagePermissionDenied::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessagePlayerRename::process(Connection *cCon) {
- cCon->disconnect();
+ cCon->disconnect();
}
void MessageSpeex::process(Connection *cCon) {
@@ -1155,7 +1155,7 @@ void MessageChannelLink::process(Connection *cCon) {
return;
}
- Channel *l = (qlTargets.count() == 1 ) ? Channel::get(qlTargets[0]) : NULL;
+ Channel *l = (qlTargets.count() == 1) ? Channel::get(qlTargets[0]) : NULL;
switch (ltType) {
case Link:
@@ -1181,7 +1181,7 @@ void MessageChannelLink::process(Connection *cCon) {
QSet<Channel *> oldset = c->qhLinks.keys().toSet();
- switch(ltType) {
+ switch (ltType) {
case UnlinkAll:
c->unlink(NULL);
ServerDB::removeLink(c, NULL);
@@ -1235,7 +1235,7 @@ void MessageChannelLink::process(Connection *cCon) {
changed = oldset - newset;
}
foreach(l, changed)
- mcl.qlTargets << l->iId;
+ mcl.qlTargets << l->iId;
g_sServer->sendAll(&mcl);
}
@@ -1277,7 +1277,7 @@ void MessageEditACL::process(Connection *cCon) {
mea.bQuery = false;
mea.bInheritACL = c->bInheritACL;
- while(! chans.isEmpty()) {
+ while (! chans.isEmpty()) {
p = chans.pop();
foreach(acl, p->qlACL) {
if ((p == c) || (acl->bApplySubs)) {
@@ -1328,7 +1328,7 @@ void MessageEditACL::process(Connection *cCon) {
}
foreach(a, c->qlACL)
- delete a;
+ delete a;
c->qhGroups.clear();
c->qlACL.clear();
@@ -1376,7 +1376,7 @@ void MessageQueryUsers::process(Connection *cCon) {
MSG_SETUP(Player::Authenticated);
int i;
- for(i=0;i<qlIds.count();i++) {
+ for (i=0;i<qlIds.count();i++) {
QString name = qlNames[i];
int id = qlIds[i];
if (id == -1) {
diff --git a/src/murmur/Server.h b/src/murmur/Server.h
index 25641baab..0c82ff734 100644
--- a/src/murmur/Server.h
+++ b/src/murmur/Server.h
@@ -60,17 +60,17 @@ struct BandwidthRecord {
};
class LogEmitter : public QObject {
- Q_OBJECT
- signals:
- void newLogEntry(const QString &msg);
- public:
- LogEmitter(QObject *parent = NULL);
- void addLogEntry(const QString &msg);
+ Q_OBJECT
+ signals:
+ void newLogEntry(const QString &msg);
+ public:
+ LogEmitter(QObject *parent = NULL);
+ void addLogEntry(const QString &msg);
};
class UDPThread : public QThread {
- friend class Server;
- Q_OBJECT;
+ friend class Server;
+ Q_OBJECT;
protected:
QUdpSocket *qusUdp;
QHash<short, Peer> qhPeers;
@@ -85,7 +85,7 @@ class UDPThread : public QThread {
};
class SslServer : public QTcpServer {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QList<QSslSocket *> qlSockets;
void incomingConnection(int);
@@ -95,7 +95,7 @@ class SslServer : public QTcpServer {
};
class Server : public QObject {
- Q_OBJECT;
+ Q_OBJECT;
protected:
QQueue<int> qqIds;
SslServer *qtsServer;
@@ -163,7 +163,7 @@ struct ServerParams {
QString qsRegPassword;
QString qsRegHost;
QUrl qurlRegWeb;
-
+
QString qsSSLCert;
QString qsSSLKey;
QString qsSSLStore;
diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp
index a953f8a13..1975b3051 100644
--- a/src/murmur/ServerDB.cpp
+++ b/src/murmur/ServerDB.cpp
@@ -80,7 +80,7 @@ ServerDB::ServerDB() {
datapaths << QDir::currentPath();
datapaths << QDir::homePath();
- for(i = 0; (i < datapaths.size()) && ! found; i++) {
+ for (i = 0; (i < datapaths.size()) && ! found; i++) {
if (!datapaths[i].isEmpty()) {
QFile f(datapaths[i] + "/murmur.sqlite");
if (f.exists()) {
@@ -91,7 +91,7 @@ ServerDB::ServerDB() {
}
if (! found) {
- for(i = 0; (i < datapaths.size()) && ! found; i++) {
+ for (i = 0; (i < datapaths.size()) && ! found; i++) {
if (!datapaths[i].isEmpty()) {
QFile f(datapaths[i] + "/murmur.sqlite");
db.setDatabaseName(f.fileName());
@@ -159,20 +159,20 @@ ServerDB::ServerDB() {
query.exec("DROP TABLE aclold");
}
-/* Deprecated. Support if exists, but don't create in new installations.
- *
- query.exec("CREATE TABLE connections (con_id INTEGER PRIMARY KEY, player_id INTEGER, channel_id INTEGER, player_name TEXT, ip TEXT, port INTEGER)");
- query.exec("CREATE UNIQUE INDEX connections_player_name ON connections(player_name)");
-*/
+ /* Deprecated. Support if exists, but don't create in new installations.
+ *
+ query.exec("CREATE TABLE connections (con_id INTEGER PRIMARY KEY, player_id INTEGER, channel_id INTEGER, player_name TEXT, ip TEXT, port INTEGER)");
+ query.exec("CREATE UNIQUE INDEX connections_player_name ON connections(player_name)");
+ */
query.exec("DELETE FROM connections");
query.exec("CREATE TABLE channel_links (channel_links_id INTEGER PRIMARY KEY AUTOINCREMENT, channel_id INTEGER, link_id INTEGER)");
query.exec("CREATE TRIGGER channel_links_del_channel AFTER DELETE ON channels FOR EACH ROW BEGIN DELETE FROM channel_links WHERE channel_id = old.channel_id OR link_id = old.channel_id; END;");
query.exec("DELETE FROM channel_links");
-/* Deprecated
- query.exec("CREATE TABLE commands (command_id INTEGER PRIMARY KEY AUTOINCREMENT, command TEXT, arg1 TEXT, arg2 TEXT, arg3 TEXT, arg4 TEXT, arg5 TEXT, arg6 TEXT, arg7 TEXT, arg8 TEXT, arg9 TEXT)");
-*/
+ /* Deprecated
+ query.exec("CREATE TABLE commands (command_id INTEGER PRIMARY KEY AUTOINCREMENT, command TEXT, arg1 TEXT, arg2 TEXT, arg3 TEXT, arg4 TEXT, arg5 TEXT, arg6 TEXT, arg7 TEXT, arg8 TEXT, arg9 TEXT)");
+ */
query.exec("DELETE FROM commands");
query.exec("CREATE TABLE bans (ban_id INTEGER PRIMARY KEY AUTOINCREMENT, base INTEGER, mask INTEGER)");
@@ -232,7 +232,7 @@ int ServerDB::authenticate(QString &name, const QString &pw) {
if (res != -1) {
TransactionHolder th;
QSqlQuery query;
-
+
query.prepare("INSERT INTO players (player_id, name) VALUES (?,?)");
query.addBindValue(res);
query.addBindValue(name);
@@ -286,7 +286,7 @@ QString ServerDB::getUserName(int id) {
int ServerDB::getUserID(const QString &name) {
int id = dbus->mapNameToId(name);
-
+
if (id != -2)
return id;
TransactionHolder th;
@@ -513,7 +513,7 @@ void ServerDB::readChannels(Channel *p) {
}
foreach(c, kids)
- readChannels(c);
+ readChannels(c);
}
void ServerDB::setLastChannel(const Player *p) {
@@ -619,9 +619,9 @@ void ServerDB::dumpChannel(const Channel *c) {
foreach(g, c->qhGroups) {
qWarning("Group %s (Inh %d Able %d)", qPrintable(g->qsName), g->bInherit, g->bInheritable);
foreach(pid, g->qsAdd)
- qWarning("Add %d", pid);
+ qWarning("Add %d", pid);
foreach(pid, g->qsRemove)
- qWarning("Remove %d", pid);
+ qWarning("Remove %d", pid);
}
foreach(acl, c->qlACL) {
int allow = static_cast<int>(acl->pAllow);
@@ -645,7 +645,7 @@ QList<ServerDB::qpCommand> ServerDB::getCommands() {
while (query.next()) {
qpCommand cmd;
cmd.first = query.value(0).toString();
- for(int i=1;i<10;i++)
+ for (int i=1;i<10;i++)
cmd.second.append(query.value(i));
commands << cmd;
}
diff --git a/src/murmur/ServerDB.h b/src/murmur/ServerDB.h
index 248d3da99..03e60c5e3 100644
--- a/src/murmur/ServerDB.h
+++ b/src/murmur/ServerDB.h
@@ -38,7 +38,7 @@ class Player;
class Connection;
class ServerDB : public QObject {
- Q_OBJECT
+ Q_OBJECT
public:
typedef QPair<QString, QList<QVariant> > qpCommand;
typedef QPair<quint32, int> qpBan;
diff --git a/src/murmur/Tray.cpp b/src/murmur/Tray.cpp
index 5ec15b03b..6f0db9ace 100644
--- a/src/murmur/Tray.cpp
+++ b/src/murmur/Tray.cpp
@@ -32,26 +32,26 @@
#include "Server.h"
Tray::Tray(QObject *p, LogEmitter *logger) : QObject(p) {
- le = logger;
+ le = logger;
qsti = new QSystemTrayIcon(qApp->windowIcon(), this);
qsti->setObjectName(QLatin1String("Tray"));
qsti->setToolTip(tr("Murmur"));
qaQuit = new QAction(tr("&Quit Murmur"), this);
- qaQuit->setShortcut(tr("Ctrl+Q", "Quit"));
- qaQuit->setObjectName(QLatin1String("Quit"));
+ qaQuit->setShortcut(tr("Ctrl+Q", "Quit"));
+ qaQuit->setObjectName(QLatin1String("Quit"));
qaShowLog = new QAction(tr("&Show Log"), this);
- qaShowLog->setShortcut(tr("Ctrl+L", "Quit"));
- qaShowLog->setObjectName(QLatin1String("ShowLog"));
+ qaShowLog->setShortcut(tr("Ctrl+L", "Quit"));
+ qaShowLog->setObjectName(QLatin1String("ShowLog"));
// Can't construct a QMenu which decends from QObject, and qsti is a QObject.
// Qt bug?
- qm = new QMenu(tr("Murmur"), NULL);
- qm->addAction(qaQuit);
- qm->addSeparator();
- qm->addAction(qaShowLog);
+ qm = new QMenu(tr("Murmur"), NULL);
+ qm->addAction(qaQuit);
+ qm->addSeparator();
+ qm->addAction(qaShowLog);
qsti->setContextMenu(qm);
qsti->show();
@@ -62,36 +62,36 @@ Tray::Tray(QObject *p, LogEmitter *logger) : QObject(p) {
}
void Tray::on_Tray_activated(QSystemTrayIcon::ActivationReason r) {
- if (r == QSystemTrayIcon::Trigger) {
- int numclients = g_sServer->qmConnections.count();
- int port = g_sp.iPort;
- qsti->showMessage(tr("Murmur"), tr("Server running on port %1 with %2 conencted clients.").arg(port).arg(numclients), QSystemTrayIcon::Information, 5000);
- }
+ if (r == QSystemTrayIcon::Trigger) {
+ int numclients = g_sServer->qmConnections.count();
+ int port = g_sp.iPort;
+ qsti->showMessage(tr("Murmur"), tr("Server running on port %1 with %2 conencted clients.").arg(port).arg(numclients), QSystemTrayIcon::Information, 5000);
+ }
}
void Tray::on_Quit_triggered() {
if (QMessageBox::question(NULL, tr("Murmur"), tr("Are you sure you wish to quit murmur?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
- qApp->quit();
+ qApp->quit();
}
}
void Tray::on_ShowLog_triggered() {
- QMainWindow *mw = new QMainWindow();
- mw->setAttribute(Qt::WA_DeleteOnClose);
- QTextBrowser *tb = new QTextBrowser();
- mw->setCentralWidget(tb);
+ QMainWindow *mw = new QMainWindow();
+ mw->setAttribute(Qt::WA_DeleteOnClose);
+ QTextBrowser *tb = new QTextBrowser();
+ mw->setCentralWidget(tb);
- connect(le, SIGNAL(newLogEntry(const QString &)), tb, SLOT(append(const QString &)));
+ connect(le, SIGNAL(newLogEntry(const QString &)), tb, SLOT(append(const QString &)));
- foreach(const QString &m, qlLog)
- tb->append(m);
+ foreach(const QString &m, qlLog)
+ tb->append(m);
- mw->show();
+ mw->show();
}
void Tray::addLogMessage(const QString &msg) {
- if (qlLog.count() >= 100)
- qlLog.removeFirst();
+ if (qlLog.count() >= 100)
+ qlLog.removeFirst();
- qlLog.append(msg);
+ qlLog.append(msg);
}
diff --git a/src/murmur/Tray.h b/src/murmur/Tray.h
index 7b3b1e507..1cbe10e48 100644
--- a/src/murmur/Tray.h
+++ b/src/murmur/Tray.h
@@ -35,21 +35,21 @@
#include "Server.h"
class Tray : public QObject {
- Q_OBJECT
- protected:
- QSystemTrayIcon *qsti;
- QMenu *qm;
- QAction *qaQuit;
- QAction *qaShowLog;
- QList<QString> qlLog;
- LogEmitter *le;
- public slots:
- void on_Tray_activated(QSystemTrayIcon::ActivationReason);
- void on_Quit_triggered();
- void on_ShowLog_triggered();
- void addLogMessage(const QString &);
- public:
- Tray(QObject *parent, LogEmitter *le);
+ Q_OBJECT
+ protected:
+ QSystemTrayIcon *qsti;
+ QMenu *qm;
+ QAction *qaQuit;
+ QAction *qaShowLog;
+ QList<QString> qlLog;
+ LogEmitter *le;
+ public slots:
+ void on_Tray_activated(QSystemTrayIcon::ActivationReason);
+ void on_Quit_triggered();
+ void on_ShowLog_triggered();
+ void addLogMessage(const QString &);
+ public:
+ Tray(QObject *parent, LogEmitter *le);
};
#endif
diff --git a/src/murmur/murmur.cpp b/src/murmur/murmur.cpp
index de0012c07..d051ad611 100644
--- a/src/murmur/murmur.cpp
+++ b/src/murmur/murmur.cpp
@@ -61,8 +61,7 @@ bool detach = false;
LogEmitter le;
-static void murmurMessageOutput(QtMsgType type, const char *msg)
-{
+static void murmurMessageOutput(QtMsgType type, const char *msg) {
char c;
switch (type) {
case QtDebugMsg:
@@ -92,17 +91,16 @@ static void murmurMessageOutput(QtMsgType type, const char *msg)
#endif
#endif
} else {
- logfile->write(m.toUtf8());
- logfile->write("\n");
- logfile->flush();
- }
- le.addLogEntry(m);
- if (type == QtFatalMsg)
- exit(0);
+ logfile->write(m.toUtf8());
+ logfile->write("\n");
+ logfile->flush();
+ }
+ le.addLogEntry(m);
+ if (type == QtFatalMsg)
+ exit(0);
}
-int main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
// Check for SSE and MMX, but only in the windows binaries
#ifdef Q_OS_WIN
#define cpuid(func,ax,bx,cx,dx) __asm__ __volatile__ ("cpuid": "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
@@ -138,33 +136,33 @@ int main(int argc, char **argv)
QString inifile;
QString supw;
- qInstallMsgHandler(murmurMessageOutput);
+ qInstallMsgHandler(murmurMessageOutput);
#ifdef Q_OS_WIN
Tray tray(NULL, &le);
#endif
- for(int i=1;i<argc;i++) {
+ for (int i=1;i<argc;i++) {
QString arg = QString(argv[i]).toLower();
- if ((arg == "-supw") && ( i+1 < argc )) {
+ if ((arg == "-supw") && (i+1 < argc)) {
i++;
supw = argv[i];
- } else if ((arg == "-ini") && ( i+1 < argc )) {
+ } else if ((arg == "-ini") && (i+1 < argc)) {
i++;
inifile=argv[i];
} else if ((arg == "-fg")) {
- detach = false;
+ detach = false;
} else if ((arg == "-v")) {
- bVerbose = true;
+ bVerbose = true;
} else if ((arg == "-h") || (arg == "--help")) {
i++;
qFatal("Usage: %s [-ini <inifile>] [-supw <password>]\n"
- " -ini <inifile> Specify ini file to use.\n"
- " -supw <pw> Set password for 'SuperUser' account.\n"
- " -v Add verbose output.\n"
- " -fg Don't detach from console [Linux only].\n"
- "If no inifile is provided, murmur will search for one in \n"
- "default locations.",argv[0]);
+ " -ini <inifile> Specify ini file to use.\n"
+ " -supw <pw> Set password for 'SuperUser' account.\n"
+ " -v Add verbose output.\n"
+ " -fg Don't detach from console [Linux only].\n"
+ "If no inifile is provided, murmur will search for one in \n"
+ "default locations.",argv[0]);
} else {
qFatal("Unknown argument %s", argv[i]);
}
@@ -181,40 +179,40 @@ int main(int argc, char **argv)
if (detach && ! g_sp.qsLogfile.isEmpty()) {
logfile = new QFile(g_sp.qsLogfile);
- if (! logfile->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
- delete logfile;
- logfile = NULL;
- qWarning("Failed to open logfile %s. Will not detach.",qPrintable(g_sp.qsLogfile));
- detach = false;
- } else {
- logfile->setTextModeEnabled(true);
- }
+ if (! logfile->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
+ delete logfile;
+ logfile = NULL;
+ qWarning("Failed to open logfile %s. Will not detach.",qPrintable(g_sp.qsLogfile));
+ detach = false;
+ } else {
+ logfile->setTextModeEnabled(true);
+ }
} else {
- detach = false;
- }
+ detach = false;
+ }
#ifdef Q_OS_UNIX
if (detach) {
- if (fork() != 0) {
- _exit(0);
- }
- setsid();
- if (fork() != 0) {
- _exit(0);
- }
- chdir("/");
- int fd;
-
- fd = open("/dev/null", O_RDONLY);
- dup2(fd, 0);
- close(fd);
-
- fd = open("/dev/null", O_WRONLY);
- dup2(fd, 1);
- close(fd);
-
- fd = open("/dev/null", O_WRONLY);
- dup2(fd, 2);
- close(fd);
+ if (fork() != 0) {
+ _exit(0);
+ }
+ setsid();
+ if (fork() != 0) {
+ _exit(0);
+ }
+ chdir("/");
+ int fd;
+
+ fd = open("/dev/null", O_RDONLY);
+ dup2(fd, 0);
+ close(fd);
+
+ fd = open("/dev/null", O_WRONLY);
+ dup2(fd, 1);
+ close(fd);
+
+ fd = open("/dev/null", O_WRONLY);
+ dup2(fd, 2);
+ close(fd);
}
MurmurDBus::registerTypes();