Browse Source

fix(settings): Change test sound button to checkbox

Fixes #3800 & #3809
reviewable/pr3808/r1
Alice Weigt 9 years ago
parent
commit
22b89beaf1
  1. 16
      src/persistence/settings.cpp
  2. 11
      src/persistence/settings.h
  3. 12
      src/widget/form/settings/avform.cpp
  4. 3
      src/widget/form/settings/avform.h
  5. 32
      src/widget/form/settings/avform.ui

16
src/persistence/settings.cpp

@ -839,6 +839,22 @@ void Settings::setDhtServerList(const QList<DhtServer>& newDhtServerList) @@ -839,6 +839,22 @@ void Settings::setDhtServerList(const QList<DhtServer>& newDhtServerList)
emit dhtServerListChanged(dhtServerList);
}
}
bool Settings::getEnableTestSound() const
{
QMutexLocker locker{&bigLock};
return enableTestSound;
}
void Settings::setEnableTestSound(bool newValue)
{
QMutexLocker locker{&bigLock};
if (newValue != enableTestSound)
{
enableTestSound = newValue;
emit enableTestSoundChanged(enableTestSound);
}
}
bool Settings::getEnableIPv6() const
{

11
src/persistence/settings.h

@ -244,6 +244,7 @@ signals: @@ -244,6 +244,7 @@ signals:
void outDevChanged(const QString& name);
void audioOutDevEnabledChanged(bool enabled);
void outVolumeChanged(int volume);
void enableTestSoundChanged(bool enabled);
// Video
void videoDevChanged(const QString& name);
@ -301,13 +302,13 @@ public: @@ -301,13 +302,13 @@ public:
QString getToxmeBio() const;
void setToxmeBio(const QString& bio);
bool getToxmePriv() const;
void setToxmePriv(bool priv);
QString getToxmePass() const;
void setToxmePass(const QString& pass);
void setAutoSaveEnabled(bool newValue);
bool getAutoSaveEnabled() const;
@ -370,6 +371,9 @@ public: @@ -370,6 +371,9 @@ public:
int getOutVolume() const;
void setOutVolume(int volume);
bool getEnableTestSound() const;
void setEnableTestSound(bool newValue);
QString getVideoDev() const;
void setVideoDev(const QString& deviceSpecifier);
@ -619,6 +623,7 @@ private: @@ -619,6 +623,7 @@ private:
QString outDev;
bool audioOutDevEnabled;
int outVolume;
bool enableTestSound;
// Video
QString videoDev;

12
src/widget/form/settings/avform.cpp

@ -56,7 +56,9 @@ AVForm::AVForm() @@ -56,7 +56,9 @@ AVForm::AVForm()
const Audio& audio = Audio::getInstance();
const Settings& s = Settings::getInstance();
btnPlayTestSound->setToolTip(
cbEnableTestSound->setChecked(s.getEnableTestSound());
cbEnableTestSound->setToolTip(
tr("Play a test sound while changing the output volume."));
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices);
@ -527,17 +529,17 @@ void AVForm::on_playbackSlider_valueChanged(int value) @@ -527,17 +529,17 @@ void AVForm::on_playbackSlider_valueChanged(int value)
const qreal percentage = value / 100.0;
audio.setOutputVolume(percentage);
if (mPlayTestSound)
if (cbEnableTestSound->isChecked())
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test));
}
}
void AVForm::on_btnPlayTestSound_clicked(bool checked)
void AVForm::on_cbEnableTestSound_stateChanged()
{
mPlayTestSound = checked;
Settings::getInstance().setEnableTestSound(cbEnableTestSound->isChecked());
Audio& audio = Audio::getInstance();
if (mPlayTestSound && audio.isOutputReady())
if (cbEnableTestSound->isChecked() && audio.isOutputReady())
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test));
}

3
src/widget/form/settings/avform.h

@ -61,7 +61,7 @@ private slots: @@ -61,7 +61,7 @@ private slots:
void on_inDevCombobox_currentIndexChanged(int deviceIndex);
void on_outDevCombobox_currentIndexChanged(int deviceIndex);
void on_playbackSlider_valueChanged(int value);
void on_btnPlayTestSound_clicked(bool checked);
void on_cbEnableTestSound_stateChanged();
void on_microphoneSlider_valueChanged(int value);
// camera
@ -80,7 +80,6 @@ private: @@ -80,7 +80,6 @@ private:
private:
bool subscribedToAudioIn;
bool mPlayTestSound;
VideoSurface *camVideoSurface;
CameraSource &camera;
QVector<QPair<QString, QString>> videoDeviceList;

32
src/widget/form/settings/avform.ui

@ -30,8 +30,8 @@ @@ -30,8 +30,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>830</width>
<height>495</height>
<width>824</width>
<height>489</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -71,20 +71,6 @@ @@ -71,20 +71,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="btnPlayTestSound">
<property name="text">
<string notr="true">...</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="1" column="1">
<widget class="QSlider" name="playbackSlider">
<property name="toolTip">
@ -112,6 +98,16 @@ @@ -112,6 +98,16 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="cbEnableTestSound">
<property name="text">
<string>Test Sound</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -207,8 +203,6 @@ which may lead to problems with video calls.</string> @@ -207,8 +203,6 @@ which may lead to problems with video calls.</string>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../../res.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

Loading…
Cancel
Save