mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #3808
Alice Weigt (1): fix(settings): Change test sound button to checkbox
This commit is contained in:
commit
14d3f13722
|
@ -839,6 +839,22 @@ void Settings::setDhtServerList(const QList<DhtServer>& newDhtServerList)
|
||||||
emit dhtServerListChanged(dhtServerList);
|
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
|
bool Settings::getEnableIPv6() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,6 +244,7 @@ signals:
|
||||||
void outDevChanged(const QString& name);
|
void outDevChanged(const QString& name);
|
||||||
void audioOutDevEnabledChanged(bool enabled);
|
void audioOutDevEnabledChanged(bool enabled);
|
||||||
void outVolumeChanged(int volume);
|
void outVolumeChanged(int volume);
|
||||||
|
void enableTestSoundChanged(bool enabled);
|
||||||
|
|
||||||
// Video
|
// Video
|
||||||
void videoDevChanged(const QString& name);
|
void videoDevChanged(const QString& name);
|
||||||
|
@ -370,6 +371,9 @@ public:
|
||||||
int getOutVolume() const;
|
int getOutVolume() const;
|
||||||
void setOutVolume(int volume);
|
void setOutVolume(int volume);
|
||||||
|
|
||||||
|
bool getEnableTestSound() const;
|
||||||
|
void setEnableTestSound(bool newValue);
|
||||||
|
|
||||||
QString getVideoDev() const;
|
QString getVideoDev() const;
|
||||||
void setVideoDev(const QString& deviceSpecifier);
|
void setVideoDev(const QString& deviceSpecifier);
|
||||||
|
|
||||||
|
@ -619,6 +623,7 @@ private:
|
||||||
QString outDev;
|
QString outDev;
|
||||||
bool audioOutDevEnabled;
|
bool audioOutDevEnabled;
|
||||||
int outVolume;
|
int outVolume;
|
||||||
|
bool enableTestSound;
|
||||||
|
|
||||||
// Video
|
// Video
|
||||||
QString videoDev;
|
QString videoDev;
|
||||||
|
|
|
@ -56,7 +56,9 @@ AVForm::AVForm()
|
||||||
const Audio& audio = Audio::getInstance();
|
const Audio& audio = Audio::getInstance();
|
||||||
const Settings& s = Settings::getInstance();
|
const Settings& s = Settings::getInstance();
|
||||||
|
|
||||||
btnPlayTestSound->setToolTip(
|
cbEnableTestSound->setChecked(s.getEnableTestSound());
|
||||||
|
|
||||||
|
cbEnableTestSound->setToolTip(
|
||||||
tr("Play a test sound while changing the output volume."));
|
tr("Play a test sound while changing the output volume."));
|
||||||
|
|
||||||
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices);
|
connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices);
|
||||||
|
@ -527,17 +529,17 @@ void AVForm::on_playbackSlider_valueChanged(int value)
|
||||||
const qreal percentage = value / 100.0;
|
const qreal percentage = value / 100.0;
|
||||||
audio.setOutputVolume(percentage);
|
audio.setOutputVolume(percentage);
|
||||||
|
|
||||||
if (mPlayTestSound)
|
if (cbEnableTestSound->isChecked())
|
||||||
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test));
|
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();
|
Audio& audio = Audio::getInstance();
|
||||||
if (mPlayTestSound && audio.isOutputReady())
|
if (cbEnableTestSound->isChecked() && audio.isOutputReady())
|
||||||
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test));
|
audio.playMono16Sound(Audio::getSound(Audio::Sound::Test));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ private slots:
|
||||||
void on_inDevCombobox_currentIndexChanged(int deviceIndex);
|
void on_inDevCombobox_currentIndexChanged(int deviceIndex);
|
||||||
void on_outDevCombobox_currentIndexChanged(int deviceIndex);
|
void on_outDevCombobox_currentIndexChanged(int deviceIndex);
|
||||||
void on_playbackSlider_valueChanged(int value);
|
void on_playbackSlider_valueChanged(int value);
|
||||||
void on_btnPlayTestSound_clicked(bool checked);
|
void on_cbEnableTestSound_stateChanged();
|
||||||
void on_microphoneSlider_valueChanged(int value);
|
void on_microphoneSlider_valueChanged(int value);
|
||||||
|
|
||||||
// camera
|
// camera
|
||||||
|
@ -80,7 +80,6 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool subscribedToAudioIn;
|
bool subscribedToAudioIn;
|
||||||
bool mPlayTestSound;
|
|
||||||
VideoSurface *camVideoSurface;
|
VideoSurface *camVideoSurface;
|
||||||
CameraSource &camera;
|
CameraSource &camera;
|
||||||
QVector<QPair<QString, QString>> videoDeviceList;
|
QVector<QPair<QString, QString>> videoDeviceList;
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>830</width>
|
<width>824</width>
|
||||||
<height>495</height>
|
<height>489</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
@ -71,20 +71,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="1" column="1">
|
||||||
<widget class="QSlider" name="playbackSlider">
|
<widget class="QSlider" name="playbackSlider">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -112,6 +98,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -207,8 +203,6 @@ 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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user