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

ListenerLocalVolumeSlider.cpp « mumble « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f3ccc0897792b8c4e406743b99834a9891db09b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2022 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "ListenerLocalVolumeSlider.h"
#include "Channel.h"
#include "ChannelListenerManager.h"
#include "VolumeAdjustment.h"
#include "Global.h"

ListenerLocalVolumeSlider::ListenerLocalVolumeSlider(QWidget *parent) : VolumeSliderWidgetAction(parent) {
}

void ListenerLocalVolumeSlider::setListenedChannel(const Channel &channel) {
	m_channel = &channel;

	float initialAdjustment = Global::get().channelListenerManager->getListenerLocalVolumeAdjustment(m_channel->iId);
	updateSliderValue(initialAdjustment);
}

void ListenerLocalVolumeSlider::on_VolumeSlider_valueChanged(int value) {
	updateTooltip(value);
	displayTooltip(value);

	if (m_channel) {
		float factor = VolumeAdjustment::toFactor(value);
		Global::get().channelListenerManager->setListenerLocalVolumeAdjustment(m_channel->iId, factor);
	}
}