Browse Source

Merge branch 'pr1621'

closes tux3/qtox#768

added values to slides in av settings, converted slot to qt5 style
audio sliders are disabled, they don't change anything anyway
pull/1623/head
tux3 10 years ago
parent
commit
a8b89e7d7d
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 1
      src/audio.cpp
  2. 25
      src/widget/form/settings/avform.cpp
  3. 1
      src/widget/form/settings/avform.h
  4. 201
      src/widget/form/settings/avsettings.ui

1
src/audio.cpp

@ -232,6 +232,7 @@ void Audio::playMono16Sound(const QByteArray& data) @@ -232,6 +232,7 @@ void Audio::playMono16Sound(const QByteArray& data)
ALuint buffer;
alGenBuffers(1, &buffer);
alBufferData(buffer, AL_FORMAT_MONO16, data.data(), data.size(), 44100);
alSourcef(alMainSource, AL_GAIN, outputVolume);
alSourcei(alMainSource, AL_BUFFER, buffer);
alSourcePlay(alMainSource);
alDeleteBuffers(1, &buffer);

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

@ -50,14 +50,17 @@ AVForm::AVForm() : @@ -50,14 +50,17 @@ AVForm::AVForm() :
auto qcomboboxIndexChanged = (void(QComboBox::*)(const QString&)) &QComboBox::currentIndexChanged;
connect(bodyUI->inDevCombobox, qcomboboxIndexChanged, this, &AVForm::onInDevChanged);
connect(bodyUI->outDevCombobox, qcomboboxIndexChanged, this, &AVForm::onOutDevChanged);
connect(bodyUI->filterAudio, SIGNAL(toggled(bool)), this, SLOT(onFilterAudioToggled(bool)));
connect(bodyUI->filterAudio, &QCheckBox::toggled, this, &AVForm::onFilterAudioToggled);
connect(bodyUI->rescanButton, &QPushButton::clicked, this, [=](){getAudioInDevices(); getAudioOutDevices();});
bodyUI->playbackSlider->setValue(100);
bodyUI->microphoneSlider->setValue(100);
bodyUI->playbackSlider->setEnabled(false);
bodyUI->microphoneSlider->setEnabled(false);
for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
}
@ -78,7 +81,6 @@ void AVForm::present() @@ -78,7 +81,6 @@ void AVForm::present()
Camera::getInstance()->probeProp(Camera::CONTRAST);
Camera::getInstance()->probeProp(Camera::BRIGHTNESS);
Camera::getInstance()->probeProp(Camera::HUE);
Camera::getInstance()->probeResolutions();
bodyUI->videoModescomboBox->blockSignals(true);
@ -260,26 +262,37 @@ void AVForm::onFilterAudioToggled(bool filterAudio) @@ -260,26 +262,37 @@ void AVForm::onFilterAudioToggled(bool filterAudio)
void AVForm::on_HueSlider_valueChanged(int value)
{
Camera::getInstance()->setProp(Camera::HUE, value / 100.0);
bodyUI->hueMax->setText(QString::number(value));
}
void AVForm::on_BrightnessSlider_valueChanged(int value)
{
Camera::getInstance()->setProp(Camera::BRIGHTNESS, value / 100.0);
bodyUI->brightnessMax->setText(QString::number(value));
}
void AVForm::on_SaturationSlider_valueChanged(int value)
{
Camera::getInstance()->setProp(Camera::SATURATION, value / 100.0);
bodyUI->saturationMax->setText(QString::number(value));
}
void AVForm::on_ContrastSlider_valueChanged(int value)
{
Camera::getInstance()->setProp(Camera::CONTRAST, value / 100.0);
bodyUI->contrastMax->setText(QString::number(value));
}
void AVForm::on_playbackSlider_valueChanged(int value)
{
Audio::getInstance().outputVolume = value / 100.0;
bodyUI->playbackMax->setText(QString::number(value));
}
void AVForm::on_microphoneSlider_valueChanged(int value)
{
Audio::getInstance().outputVolume = value / 100.0;
bodyUI->microphoneMax->setText(QString::number(value));
}
bool AVForm::eventFilter(QObject *o, QEvent *e)
@ -308,9 +321,9 @@ void AVForm::killVideoSurface() @@ -308,9 +321,9 @@ void AVForm::killVideoSurface()
if (!CamVideoSurface)
return;
QLayoutItem *child;
while ((child = bodyUI->gridLayout->takeAt(0)) != 0) {
while ((child = bodyUI->gridLayout->takeAt(0)) != 0)
delete child;
}
delete CamVideoSurface;
CamVideoSurface = nullptr;
}

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

@ -57,6 +57,7 @@ private slots: @@ -57,6 +57,7 @@ private slots:
void onOutDevChanged(const QString& deviceDescriptor);
void onFilterAudioToggled(bool filterAudio);
void on_playbackSlider_valueChanged(int value);
void on_microphoneSlider_valueChanged(int value);
// camera
void onPropProbingFinished(Camera::Prop prop, double val);

201
src/widget/form/settings/avsettings.ui

@ -30,8 +30,8 @@ @@ -30,8 +30,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>818</width>
<height>510</height>
<width>824</width>
<height>489</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -40,8 +40,15 @@ @@ -40,8 +40,15 @@
<property name="title">
<string>Audio Settings</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="7" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="3">
<widget class="QLabel" name="playbackMax">
<property name="text">
<string>100</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="microphoneLabel">
<property name="text">
<string>Microphone</string>
@ -55,27 +62,44 @@ @@ -55,27 +62,44 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSlider" name="playbackSlider">
<item row="3" column="0">
<widget class="QLabel" name="inDevLabel">
<property name="text">
<string>Capture device</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSlider" name="microphoneSlider">
<property name="toolTip">
<string>Use slider to set volume of your speakers.</string>
<string>Use slider to set volume of your microphone.
WARNING: slider is not supposed to work yet.</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSlider" name="microphoneSlider">
<item row="2" column="2">
<widget class="QSlider" name="playbackSlider">
<property name="toolTip">
<string>Use slider to set volume of your microphone.
WARNING: slider is not supposed to work yet.</string>
<string>Use slider to set volume of your speakers.</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<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>
<property name="text">
<string>Filter audio</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="outDevLabel">
<property name="text">
@ -83,36 +107,40 @@ WARNING: slider is not supposed to work yet.</string> @@ -83,36 +107,40 @@ WARNING: slider is not supposed to work yet.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="inDevLabel">
<item row="2" column="1">
<widget class="QLabel" name="playbackMin">
<property name="text">
<string>Capture device</string>
<string>0</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="inDevCombobox"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="outDevCombobox"/>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QPushButton" name="rescanButton">
<property name="text">
<string>Rescan audio devices</string>
</property>
</widget>
</item>
<item row="8" 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>
<item row="4" column="1">
<widget class="QLabel" name="microphoneMin">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="microphoneMax">
<property name="text">
<string>Filter audio</string>
<string>100</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="inDevCombobox"/>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="outDevCombobox"/>
</item>
</layout>
</widget>
</item>
@ -123,25 +151,22 @@ WARNING: slider is not supposed to work yet.</string> @@ -123,25 +151,22 @@ WARNING: slider is not supposed to work yet.</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="toolTip">
<string>Set resolution of your camera.
The higher values, the better video quality your friends may get.
Note though that with better video quality there is needed better internet connection.
Sometimes your connection may not be good enough to handle higher video quality,
which may lead to problems with video calls.</string>
<layout class="QGridLayout" name="gridLayout_2">
<item row="4" column="2">
<widget class="QSlider" name="ContrastSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>Resolution</string>
</widget>
</item>
<item row="1" column="2">
<widget class="QSlider" name="HueSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="2">
<widget class="QComboBox" name="videoModescomboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -158,34 +183,76 @@ which may lead to problems with video calls.</string> @@ -158,34 +183,76 @@ which may lead to problems with video calls.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="hueLabel">
<item row="4" column="1">
<widget class="QLabel" name="contrastMin">
<property name="text">
<string>Hue</string>
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="contrastLabel">
<property name="text">
<string>Contrast</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="HueSlider">
<widget class="QLabel" name="hueMin">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSlider" name="SaturationSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="brightnessLabel">
<item row="1" column="0">
<widget class="QLabel" name="hueLabel">
<property name="text">
<string>Brightness</string>
<string>Hue</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="0" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="toolTip">
<string>Set resolution of your camera.
The higher values, the better video quality your friends may get.
Note though that with better video quality there is needed better internet connection.
Sometimes your connection may not be good enough to handle higher video quality,
which may lead to problems with video calls.</string>
</property>
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="saturationMin">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSlider" name="BrightnessSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="brightnessMin">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="saturationLabel">
<property name="text">
@ -193,24 +260,38 @@ which may lead to problems with video calls.</string> @@ -193,24 +260,38 @@ which may lead to problems with video calls.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSlider" name="SaturationSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="2" column="0">
<widget class="QLabel" name="brightnessLabel">
<property name="text">
<string>Brightness</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="contrastLabel">
<item row="1" column="3">
<widget class="QLabel" name="hueMax">
<property name="text">
<string>Contrast</string>
<string>100</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="ContrastSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="2" column="3">
<widget class="QLabel" name="brightnessMax">
<property name="text">
<string>100</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="saturationMax">
<property name="text">
<string>100</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="contrastMax">
<property name="text">
<string>100</string>
</property>
</widget>
</item>

Loading…
Cancel
Save