fix: 修复音量调节控件幅度不正确的问题

音量调节幅度为2%,这里的控件上次修改时漏掉了
亮度调节也有类似的问题,一并修复

Log: 修复音量调节控件幅度不正确的问题
Influence: 音量控件调节幅度
Bug: https://pms.uniontech.com/bug-view-172417.html
Change-Id: I945698a16b8ad19dee8d22e71cc639ca68204946
This commit is contained in:
范朋程 2022-12-01 17:12:28 +08:00 committed by fanpengcheng
parent b698b07dde
commit c35bee0c65
2 changed files with 8 additions and 2 deletions

View File

@ -52,7 +52,9 @@ void BrightnessAdjWidget::loadBrightnessItem()
QPixmap rightPixmap = ImageUtil::loadSvg(":/icons/resources/brightnesshigh", QSize(20, 20));
sliderContainer->setIcon(SliderContainer::IconPosition::LeftIcon,leftPixmap, QSize(), 12);
sliderContainer->setIcon(SliderContainer::IconPosition::RightIcon, rightPixmap, QSize(), 12);
// 需求要求调节范围是10%-100%,且调节幅度为1%
sliderContainer->setRange(10, 100);
sliderContainer->setPageStep(1);
sliderContainer->setFixedWidth(310);
sliderContainer->setFixedHeight(itemHeight);
sliderContainer->updateSliderValue(monitor->brightness());

View File

@ -112,6 +112,8 @@ void SoundDevicesWidget::initUi()
SliderProxyStyle *proxy = new SliderProxyStyle(SliderProxyStyle::Normal);
m_sliderContainer->setSliderProxyStyle(proxy);
m_sliderContainer->setRange(0, std::round(m_soundInter->maxUIVolume() * 100.00));
m_sliderContainer->setPageStep(2);
sliderLayout->addWidget(m_sliderContainer);
QHBoxLayout *topLayout = new QHBoxLayout(this);
@ -212,7 +214,9 @@ void SoundDevicesWidget::initConnection()
connect(m_delegate, &SettingDelegate::selectIndexChanged, this, &SoundDevicesWidget::onSelectIndexChanged);
connect(m_soundInter, &DBusAudio::PortEnabledChanged, this, &SoundDevicesWidget::onAudioDevicesChanged);
connect(m_soundInter, &DBusAudio::CardsWithoutUnavailableChanged, this, &SoundDevicesWidget::onAudioDevicesChanged);
connect(m_soundInter, &DBusAudio::MaxUIVolumeChanged, this, [ = ] (double maxValue) {
m_sliderContainer->setRange(0, std::round(maxValue * 100.00));
});
connect(m_sliderContainer, &SliderContainer::sliderValueChanged, this, [ this ](int value) {
m_sinkInter->SetVolume(value * 0.01, true);
});