mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Cleaned up overlay interface and made it show mute/deafen status.
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@373 05730e5d-ab1b-0410-a4ac-84af385074fa
This commit is contained in:
parent
2a1bfcba31
commit
d107d801ef
@ -88,7 +88,7 @@ class Overlay : public QObject {
|
||||
bool isActive() const;
|
||||
public slots:
|
||||
void on_Timer_timeout();
|
||||
void setPlayers(QList<Player *> players);
|
||||
void updateOverlay();
|
||||
void setActive(bool act);
|
||||
void toggleShow();
|
||||
void forceSettings();
|
||||
|
||||
@ -396,6 +396,7 @@ void Overlay::toggleShow() {
|
||||
}
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
void Overlay::forceSettings() {
|
||||
@ -423,13 +424,14 @@ void Overlay::forceSettings() {
|
||||
sm->bReset = true;
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
#define SAFE_INC_IDX(x) x=(x < NUM_TEXTS) ? (x+1) : (NUM_TEXTS-1)
|
||||
|
||||
typedef QPair<QString, DWORD> qpChanCol;
|
||||
|
||||
void Overlay::setPlayers(QList<Player *> players) {
|
||||
void Overlay::updateOverlay() {
|
||||
DWORD colPlayer = g.s.qcOverlayPlayer.rgba();
|
||||
DWORD colTalking = g.s.qcOverlayTalking.rgba();
|
||||
DWORD colAltTalking = g.s.qcOverlayAltTalking.rgba();
|
||||
@ -442,7 +444,7 @@ void Overlay::setPlayers(QList<Player *> players) {
|
||||
if (! sm)
|
||||
return;
|
||||
|
||||
if (players.count() > 0) {
|
||||
if (g.sId) {
|
||||
Channel *home = Player::get(g.sId)->cChannel;
|
||||
foreach(Channel *c, home->allLinks()) {
|
||||
if (home == c)
|
||||
@ -481,10 +483,15 @@ void Overlay::setPlayers(QList<Player *> players) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Player *p, players) {
|
||||
foreach(Player *p, Player::get(g.sId)->cChannel->qlPlayers) {
|
||||
if (bShowAll || p->bTalking) {
|
||||
QString name = p->qsName;
|
||||
if (p->bDeaf || p->bSelfDeaf)
|
||||
name = name + QString("(D)");
|
||||
else if (p->bMute || p->bSelfMute || p->bLocalMute)
|
||||
name = name + QString("(M)");
|
||||
sm->texts[idx].color = p->bTalking ? (p->bAltSpeak ? colAltTalking : colTalking) : colPlayer;
|
||||
str = p->qsName.left(127);
|
||||
str = name.left(127);
|
||||
wstr = reinterpret_cast<const wchar_t *>(str.utf16());
|
||||
wcscpy(sm->texts[idx].text, wstr);
|
||||
SAFE_INC_IDX(idx);
|
||||
|
||||
@ -694,8 +694,6 @@ void PlayerModel::playerTalkingChanged(bool bTalking)
|
||||
Player *p=static_cast<Player *>(sender());
|
||||
QModelIndex idx = index(p);
|
||||
emit dataChanged(idx, idx);
|
||||
// if (g.sId && (p->cChannel == Player::get(g.sId)->cChannel))
|
||||
// If we can hear them, we need to update them
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
@ -704,6 +702,8 @@ void PlayerModel::playerMuteDeafChanged()
|
||||
Player *p=static_cast<Player *>(sender());
|
||||
QModelIndex idx = index(p, 1);
|
||||
emit dataChanged(idx, idx);
|
||||
if (g.sId && (p->cChannel == Player::get(g.sId)->cChannel))
|
||||
updateOverlay();
|
||||
}
|
||||
|
||||
Qt::DropActions PlayerModel::supportedDropActions() const {
|
||||
@ -778,16 +778,7 @@ bool PlayerModel::dropMimeData (const QMimeData *md, Qt::DropAction action, int
|
||||
|
||||
void PlayerModel::updateOverlay() const {
|
||||
#ifdef Q_OS_WIN
|
||||
if (g.sId) {
|
||||
Channel *c = Player::get(g.sId)->cChannel;
|
||||
ModelItem *item = ModelItem::c_qhChannels.value(c);
|
||||
if (item) {
|
||||
g.o->setPlayers(item->qlPlayers);
|
||||
return;
|
||||
}
|
||||
}
|
||||
QList<Player *> empty;
|
||||
g.o->setPlayers(empty);
|
||||
g.o->updateOverlay();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user