1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
added values to slides in av settings, converted slot to qt5 style
audio sliders are disabled
This commit is contained in:
agilob 2015-05-11 20:15:32 +01:00
parent ef688f6097
commit 3f11eab454
3 changed files with 194 additions and 99 deletions

View File

@ -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()
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)
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()
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;
}

View File

@ -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);

View File

@ -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 @@
<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,17 +62,14 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSlider" name="playbackSlider">
<property name="toolTip">
<string>Use slider to set volume of your speakers.</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="0">
<widget class="QLabel" name="inDevLabel">
<property name="text">
<string>Capture device</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="4" column="2">
<widget class="QSlider" name="microphoneSlider">
<property name="toolTip">
<string>Use slider to set volume of your microphone.
@ -76,34 +80,17 @@ WARNING: slider is not supposed to work yet.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="outDevLabel">
<property name="text">
<string>Playback device</string>
<item row="2" column="2">
<widget class="QSlider" name="playbackSlider">
<property name="toolTip">
<string>Use slider to set volume of your speakers.</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="inDevLabel">
<property name="text">
<string>Capture device</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">
<widget class="QPushButton" name="rescanButton">
<property name="text">
<string>Rescan audio devices</string>
</property>
</widget>
</item>
<item row="8" column="0">
<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>
@ -113,6 +100,47 @@ WARNING: slider is not supposed to work yet.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="outDevLabel">
<property name="text">
<string>Playback device</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="playbackMin">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="rescanButton">
<property name="text">
<string>Rescan audio devices</string>
</property>
</widget>
</item>
<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>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>
</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>
</property>
<property name="text">
<string>Resolution</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>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="2">
<widget class="QSlider" name="HueSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="videoModescomboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -158,45 +183,10 @@ 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>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="HueSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="brightnessLabel">
<property name="text">
<string>Brightness</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSlider" name="BrightnessSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="saturationLabel">
<property name="text">
<string>Saturation</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSlider" name="SaturationSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>0</string>
</property>
</widget>
</item>
@ -207,13 +197,104 @@ which may lead to problems with video calls.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="ContrastSlider">
<item row="1" column="1">
<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="1" column="0">
<widget class="QLabel" name="hueLabel">
<property name="text">
<string>Hue</string>
</property>
</widget>
</item>
<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">
<string>Saturation</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="brightnessLabel">
<property name="text">
<string>Brightness</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="hueMax">
<property name="text">
<string>100</string>
</property>
</widget>
</item>
<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>
</layout>
</item>
<item>