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->setupUi(this);
bodyUI->btnPlayTestSound->setToolTip(
tr("Play a test sound while changing the output volume."));
#ifdef QTOX_FILTER_AUDIO
bodyUI->filterAudio->setChecked(Settings::getInstance().getFilterAudio());
#else
@ -361,6 +364,9 @@ void AVForm::onPlaybackSliderMoved(int value)
if (audio.isOutputReady()) {
const qreal percentage = value / 100.0;
audio.setOutputVolume(percentage);
if (mPlayTestSound)
audio.playMono16Sound(QStringLiteral(":/audio/notification.pcm"));
}
}
@ -419,3 +425,8 @@ void AVForm::retranslateUi()
{
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 onVideoModesIndexChanged(int index);
void on_btnPlayTestSound_clicked(bool checked);
protected:
void updateVideoModes(int curIndex);
@ -78,6 +80,7 @@ private:
private:
Ui::AVSettings *bodyUI;
bool subscribedToAudioIn;
bool mPlayTestSound;
VideoSurface *camVideoSurface;
CameraSource &camera;
QVector<QPair<QString, QString>> videoDeviceList;

View File

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