From cee36cfdcea26d4eced49bfab0af311687393720 Mon Sep 17 00:00:00 2001 From: tanyulong Date: Mon, 12 Jul 2021 14:59:03 +0800 Subject: [PATCH] Solve the problem of adjusting animation freeze --- .../ukmedia_device_switch_widget.cpp | 11 +++++++++-- .../ukmedia_device_switch_widget.h | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.cpp b/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.cpp index cb10ae2..3a262a3 100755 --- a/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.cpp +++ b/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.cpp @@ -411,13 +411,13 @@ DeviceSwitchWidget::DeviceSwitchWidget(QWidget *parent) : QWidget (parent) * \details * 完整模式下,应用音量节面,当滑动条值改变时更改系统音量 */ - connect(appWidget->systemVolumeSlider,SIGNAL(valueChanged(int)),this,SLOT(advancedSystemSliderChangedSlot(int))); + // connect(appWidget->systemVolumeSlider,SIGNAL(valueChanged(int)),this,SLOT( advancedSystemSliderChangedSlot(int))); /*! * \brief * \details * 完整模式下,系统音量界面,当滑动条值改变时更改系统音量 */ - connect(devWidget->outputDeviceSlider,SIGNAL(valueChanged(int)),this,SLOT(outputDeviceSliderChangedSlot(int))); + // connect(devWidget->outputDeviceSlider,SIGNAL(valueChanged(int)),this,SLOT(outputDeviceSliderChangedSlot(int))); /*! * \brief * \details @@ -2507,6 +2507,7 @@ void DeviceSwitchWidget::update_icon_output (DeviceSwitchWidget *w,MateMixerCont QSlider *slider1 = w->miniWidget->findChild(w->outputControlName); if (slider1 == nullptr) return; + w->setVolume = true; w->devWidget->outputDeviceSlider->setValue(value); // w->miniWidget->masterVolumeSlider->setValue(value); w->appWidget->systemVolumeSlider->setValue(value); @@ -2734,6 +2735,11 @@ void DeviceSwitchWidget::on_control_mute_notify (MateMixerStreamControl *control void DeviceSwitchWidget::on_stream_control_volume_notify (MateMixerStreamControl *control,GParamSpec *pspec,DeviceSwitchWidget *w) { Q_UNUSED(pspec); + if (w->setVolume == true) { + w->setVolume = false; + qDebug() << "123123123123123"; + return; + } MateMixerStreamControlFlags flags; gboolean muted = FALSE; gdouble decibel = 0.0; @@ -2782,6 +2788,7 @@ void DeviceSwitchWidget::on_stream_control_volume_notify (MateMixerStreamControl ca_context_create(&context); int value = int(volume*100/65536.0 + 0.5); if (direction == MATE_MIXER_DIRECTION_OUTPUT) { + w->setVolume = true; w->devWidget->outputDeviceSlider->setValue(value); w->appWidget->systemVolumeSlider->setValue(value); w->miniWidget->masterVolumeSlider->setValue(value); diff --git a/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.h b/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.h index 5881b47..2c9b778 100755 --- a/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.h +++ b/ukui-volume-control-applet-qt/ukmedia_device_switch_widget.h @@ -268,7 +268,8 @@ private: QString mThemeName; bool firstEnterSystem = true; ca_context *caContext; - + + bool setVolume = false; bool setOutputVolume = false; bool setInputVolume = false; -- 2.23.0