From c9f686267d3bbf52df782643b37c828e9d7892fd Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 15 Sep 2020 16:50:29 +0200 Subject: [PATCH 1/2] FIX(client,ui): ChannelListener vol.-adj. display The local volume adjustment a user has set for their own ChannelListeners would be displayed for all listeners in that channel (even for the listeners of other clients). This has been fixed by making sure these adjustments are only displayed for local listeners. --- src/mumble/UserModel.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp index 33d946f67..fce297920 100644 --- a/src/mumble/UserModel.cpp +++ b/src/mumble/UserModel.cpp @@ -1929,9 +1929,15 @@ QString UserModel::createDisplayString(const ClientUser &user, bool isChannelLis // Get the configured volume adjustment. Depending on whether // this display string is for a ChannelListener or a regular user, we have to fetch // the volume adjustment differently. - float volumeAdjustment = isChannelListener && parentChannel - ? ChannelListener::getListenerLocalVolumeAdjustment(parentChannel->iId) - : user.getLocalVolumeAdjustments(); + float volumeAdjustment = 1.0f; + if (isChannelListener) { + if (parentChannel && user.uiSession == g.uiSession) { + // Only the listener of the local user can have a volume adjustment + volumeAdjustment = ChannelListener::getListenerLocalVolumeAdjustment(parentChannel->iId); + } + } else { + volumeAdjustment = user.getLocalVolumeAdjustments(); + } // Transform the adjustment into dB // *2 == 6 dB From 7c0f319529be52370d6990fd06ca0c6ede9b603d Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 15 Sep 2020 17:23:29 +0200 Subject: [PATCH 2/2] FIX(client,ui): MainWindow not updating on vol. adj. If the local volume adjustment of a client or a ChannelListener was changed, the MainWindow would not reflect this change until some event triggered it to refresh (e.g. MouseOver). With this fix, the MainWindow gets updated immediately when the volume adjustment is changed (of a client or a ChannelListener). --- src/mumble/MainWindow.cpp | 2 ++ src/mumble/UserModel.cpp | 10 ++++++++++ src/mumble/UserModel.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 6491dcac3..4183b123a 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -313,6 +313,8 @@ void MainWindow::setupGui() { QObject::connect( this, &MainWindow::userRemovedChannelListener, pmModel, static_cast< void (UserModel::*)(const ClientUser *, const Channel *) >(&UserModel::removeChannelListener)); + QObject::connect(&ChannelListener::get(), &ChannelListener::localVolumeAdjustmentsChanged, pmModel, + &UserModel::on_channelListenerLocalVolumeAdjustmentChanged); qaAudioMute->setChecked(g.s.bMute); qaAudioDeaf->setChecked(g.s.bDeaf); diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp index fce297920..764eaa447 100644 --- a/src/mumble/UserModel.cpp +++ b/src/mumble/UserModel.cpp @@ -1018,6 +1018,7 @@ ClientUser *UserModel::addUser(unsigned int id, const QString &name) { connect(p, SIGNAL(muteDeafStateChanged()), this, SLOT(userStateChanged())); connect(p, SIGNAL(prioritySpeakerStateChanged()), this, SLOT(userStateChanged())); connect(p, SIGNAL(recordingStateChanged()), this, SLOT(userStateChanged())); + connect(p, &ClientUser::localVolumeAdjustmentsChanged, this, &UserModel::userStateChanged); Channel *c = Channel::get(0); ModelItem *citem = ModelItem::c_qhChannels.value(c); @@ -1659,6 +1660,7 @@ Channel *UserModel::getSubChannel(Channel *p, int idx) const { void UserModel::userStateChanged() { ClientUser *user = qobject_cast< ClientUser * >(sender()); + if (!user) return; @@ -1668,6 +1670,14 @@ void UserModel::userStateChanged() { updateOverlay(); } +void UserModel::on_channelListenerLocalVolumeAdjustmentChanged(int channelID, float oldValue, float newValue) { + Q_UNUSED(oldValue); + Q_UNUSED(newValue); + + const QModelIndex idx = channelListenerIndex(ClientUser::get(g.uiSession), Channel::get(channelID)); + emit dataChanged(idx, idx); +} + void UserModel::toggleChannelFiltered(Channel *c) { QModelIndex idx; if (c) { diff --git a/src/mumble/UserModel.h b/src/mumble/UserModel.h index 07de425b7..449df09dd 100644 --- a/src/mumble/UserModel.h +++ b/src/mumble/UserModel.h @@ -208,6 +208,7 @@ public: public slots: /// Invalidates the model data of the ClientUser triggering this slot. void userStateChanged(); + void on_channelListenerLocalVolumeAdjustmentChanged(int channelID, float oldValue, float newValue); void ensureSelfVisible(); void recheckLinks(); void updateOverlay() const;