From 8e9d663a146a6244360d80b3b242093a3bbf1d92 Mon Sep 17 00:00:00 2001 From: Dan Pascu <dan@ag-projects.com> Date: Wed, 7 Aug 2013 12:01:16 +0000 Subject: [PATCH] Added control to adjust tail_length in preferences, but keep it hidden --- blink/preferences.py | 12 +++++ resources/preferences.ui | 98 ++++++++++++++++++++++++++++++---------- 2 files changed, 86 insertions(+), 24 deletions(-) diff --git a/blink/preferences.py b/blink/preferences.py index f787e54..da1f065 100644 --- a/blink/preferences.py +++ b/blink/preferences.py @@ -234,6 +234,7 @@ class PreferencesWindow(base_class, ui_class): self.audio_output_device_button.activated[int].connect(self._SH_AudioOutputDeviceButtonActivated) self.audio_sample_rate_button.activated[str].connect(self._SH_AudioSampleRateButtonActivated) self.enable_echo_cancelling_button.clicked.connect(self._SH_EnableEchoCancellingButtonClicked) + self.tail_length_slider.valueChanged.connect(self._SH_TailLengthSliderValueChanged) # Audio codecs self.audio_codecs_list.itemChanged.connect(self._SH_AudioCodecsListItemChanged) @@ -294,6 +295,11 @@ class PreferencesWindow(base_class, ui_class): def setupUi(self): super(PreferencesWindow, self).setupUi(self) + # Hide the tail_length slider as it is only useful for debugging -Dan + self.tail_length_label.hide() + self.tail_length_slider.hide() + self.tail_length_value_label.hide() + #self.rename_account_button.hide() # do not use this for the time being -Dan self.section_group = QActionGroup(self) @@ -489,6 +495,7 @@ class PreferencesWindow(base_class, ui_class): # Audio devices self.load_audio_devices() self.enable_echo_cancelling_button.setChecked(settings.audio.echo_canceller.enabled) + self.tail_length_slider.setValue(settings.audio.echo_canceller.tail_length) self.audio_sample_rate_button.clear() for rate in SIPSimpleSettings.audio.sample_rate.type.valid_values: self.audio_sample_rate_button.addItem(str(rate), rate) @@ -1052,6 +1059,11 @@ class PreferencesWindow(base_class, ui_class): settings.audio.echo_canceller.enabled = checked settings.save() + def _SH_TailLengthSliderValueChanged(self, value): + settings = SIPSimpleSettings() + settings.audio.echo_canceller.tail_length = value + settings.save() + # Audio codecs signal handlers def _SH_AudioCodecsListItemChanged(self, item): if not self.load_in_progress: diff --git a/resources/preferences.ui b/resources/preferences.ui index c95f745..3f362c2 100644 --- a/resources/preferences.ui +++ b/resources/preferences.ui @@ -1458,6 +1458,22 @@ <item row="0" column="1"> <widget class="QComboBox" name="audio_input_device_button"/> </item> + <item row="6" column="0" colspan="4"> + <spacer name="audio_spacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> <item row="1" column="0"> <widget class="QLabel" name="audio_output_device_label"> <property name="text"> @@ -1518,29 +1534,6 @@ </item> </widget> </item> - <item row="4" column="1" colspan="2"> - <widget class="QCheckBox" name="enable_echo_cancelling_button"> - <property name="text"> - <string>Enable Echo Cancelling</string> - </property> - </widget> - </item> - <item row="5" column="0" colspan="4"> - <spacer name="audio_spacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> <item row="0" column="2"> <spacer name="audio_spacer_1"> <property name="orientation"> @@ -1554,6 +1547,46 @@ </property> </spacer> </item> + <item row="5" column="0"> + <widget class="QLabel" name="tail_length_label"> + <property name="text"> + <string>Tail Length:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QSlider" name="tail_length_slider"> + <property name="maximum"> + <number>30</number> + </property> + <property name="pageStep"> + <number>5</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QLabel" name="tail_length_value_label"> + <property name="text"> + <string>1</string> + </property> + </widget> + </item> + <item row="4" column="1" colspan="2"> + <widget class="QCheckBox" name="enable_echo_cancelling_button"> + <property name="text"> + <string>Enable Echo Cancelling</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -2720,5 +2753,22 @@ </customwidget> </customwidgets> <resources/> - <connections/> + <connections> + <connection> + <sender>tail_length_slider</sender> + <signal>valueChanged(int)</signal> + <receiver>tail_length_value_label</receiver> + <slot>setNum(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>228</x> + <y>229</y> + </hint> + <hint type="destinationlabel"> + <x>364</x> + <y>238</y> + </hint> + </hints> + </connection> + </connections> </ui> -- 2.21.0