1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

add "play test sound" button, while changing volume

This commit is contained in:
Nils Fenner 2016-01-17 11:34:50 +01:00 committed by tux3
parent 6f7df25f4a
commit f4f77af071
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 55 additions and 25 deletions

View File

@ -44,6 +44,9 @@ AVForm::AVForm() :
bodyUI = new Ui::AVSettings; bodyUI = new Ui::AVSettings;
bodyUI->setupUi(this); bodyUI->setupUi(this);
bodyUI->btnPlayTestSound->setToolTip(
tr("Play a test sound while changing the output volume."));
#ifdef QTOX_FILTER_AUDIO #ifdef QTOX_FILTER_AUDIO
bodyUI->filterAudio->setChecked(Settings::getInstance().getFilterAudio()); bodyUI->filterAudio->setChecked(Settings::getInstance().getFilterAudio());
#else #else
@ -361,6 +364,9 @@ void AVForm::onPlaybackSliderMoved(int value)
if (audio.isOutputReady()) { if (audio.isOutputReady()) {
const qreal percentage = value / 100.0; const qreal percentage = value / 100.0;
audio.setOutputVolume(percentage); audio.setOutputVolume(percentage);
if (mPlayTestSound)
audio.playMono16Sound(QStringLiteral(":/audio/notification.pcm"));
} }
} }
@ -419,3 +425,8 @@ void AVForm::retranslateUi()
{ {
bodyUI->retranslateUi(this); bodyUI->retranslateUi(this);
} }
void AVForm::on_btnPlayTestSound_clicked(bool checked)
{
mPlayTestSound = checked;
}

View File

@ -66,6 +66,8 @@ private slots:
void onVideoDevChanged(int index); void onVideoDevChanged(int index);
void onVideoModesIndexChanged(int index); void onVideoModesIndexChanged(int index);
void on_btnPlayTestSound_clicked(bool checked);
protected: protected:
void updateVideoModes(int curIndex); void updateVideoModes(int curIndex);
@ -78,6 +80,7 @@ private:
private: private:
Ui::AVSettings *bodyUI; Ui::AVSettings *bodyUI;
bool subscribedToAudioIn; bool subscribedToAudioIn;
bool mPlayTestSound;
VideoSurface *camVideoSurface; VideoSurface *camVideoSurface;
CameraSource &camera; CameraSource &camera;
QVector<QPair<QString, QString>> videoDeviceList; QVector<QPair<QString, QString>> videoDeviceList;

View File

@ -41,20 +41,24 @@
<string>Audio Settings</string> <string>Audio Settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="6" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="filterAudio"> <widget class="QLabel" name="outDevLabel">
<property name="toolTip">
<string>Filter sound from your microphone, so that people hearing you would get better sound.</string>
</property>
<property name="text"> <property name="text">
<string>Filter audio</string> <string>Playback device</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="outDevCombobox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="playbackLabel">
<property name="text">
<string>Volume</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="outDevCombobox"/>
</item>
<item row="2" column="1">
<widget class="QSlider" name="playbackSlider"> <widget class="QSlider" name="playbackSlider">
<property name="toolTip"> <property name="toolTip">
<string>Use slider to set volume of your speakers.</string> <string>Use slider to set volume of your speakers.</string>
@ -67,24 +71,38 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="1" column="2">
<widget class="QLabel" name="microphoneLabel"> <widget class="QToolButton" name="btnPlayTestSound">
<property name="text"> <property name="text">
<string>Gain</string> <string>...</string>
</property>
<property name="icon">
<iconset resource="../../../../res.qrc">
<normaloff>:/ui/volButton/volButton.png</normaloff>:/ui/volButton/volButton.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QLabel" name="inDevLabel"> <widget class="QLabel" name="inDevLabel">
<property name="text"> <property name="text">
<string>Capture device</string> <string>Capture device</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="2" column="1" colspan="2">
<widget class="QComboBox" name="inDevCombobox"/> <widget class="QComboBox" name="inDevCombobox"/>
</item> </item>
<item row="5" column="2"> <item row="3" column="0">
<widget class="QLabel" name="microphoneLabel">
<property name="text">
<string>Gain</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QSlider" name="microphoneSlider"> <widget class="QSlider" name="microphoneSlider">
<property name="toolTip"> <property name="toolTip">
<string>Use slider to set volume of your microphone.</string> <string>Use slider to set volume of your microphone.</string>
@ -97,17 +115,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="5" column="0">
<widget class="QLabel" name="playbackLabel"> <widget class="QCheckBox" name="filterAudio">
<property name="text"> <property name="toolTip">
<string>Volume</string> <string>Filter sound from your microphone, so that people hearing you would get better sound.</string>
</property> </property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="outDevLabel">
<property name="text"> <property name="text">
<string>Playback device</string> <string>Filter audio</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -206,6 +220,8 @@ which may lead to problems with video calls.</string>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources>
<include location="../../../../res.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>