Commit da4d2505 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings/SettingsVideo): supports video parameters

parent 7ea31e5b
......@@ -899,6 +899,45 @@ Server url not configured.</translation>
<translation>System locale</translation>
</message>
</context>
<context>
<name>SettingsVideo</name>
<message>
<source>videoInputDeviceLabel</source>
<translation>Video input device</translation>
</message>
<message>
<source>useCustomVideoFramerateLabel</source>
<translation type="vanished">Use custom framerate</translation>
</message>
<message>
<source>videoFramerateLabel</source>
<translation>Framerate</translation>
</message>
<message>
<source>videoCaptureTitle</source>
<translation>Video capture parameters</translation>
</message>
<message>
<source>videoPresetLabel</source>
<translation>Video preset</translation>
</message>
<message>
<source>presetDefault</source>
<translation>Default</translation>
</message>
<message>
<source>presetHighFps</source>
<translation>High FPS</translation>
</message>
<message>
<source>presetCustom</source>
<translation>Custom</translation>
</message>
<message>
<source>videoSizeLabel</source>
<translation>Video resolution</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
......
......@@ -909,6 +909,45 @@ Url du serveur non configurée.</translation>
<translation>Locale du système</translation>
</message>
</context>
<context>
<name>SettingsVideo</name>
<message>
<source>videoInputDeviceLabel</source>
<translation>Périphérique de capture vidéo</translation>
</message>
<message>
<source>useCustomVideoFramerateLabel</source>
<translation type="vanished">Forcer n.b. images/s</translation>
</message>
<message>
<source>videoFramerateLabel</source>
<translation>Images/s</translation>
</message>
<message>
<source>videoCaptureTitle</source>
<translation>Paramètres de capture vidéo</translation>
</message>
<message>
<source>videoPresetLabel</source>
<translation>Profil vidéo</translation>
</message>
<message>
<source>presetDefault</source>
<translation>Défaut</translation>
</message>
<message>
<source>presetHighFps</source>
<translation>Fluide</translation>
</message>
<message>
<source>presetCustom</source>
<translation>Personnalisé</translation>
</message>
<message>
<source>videoSizeLabel</source>
<translation>Définition</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
......
......@@ -148,6 +148,60 @@ void SettingsModel::setEchoCancellationEnabled (bool status) {
emit echoCancellationEnabledChanged(status);
}
// =============================================================================
// Video.
// =============================================================================
QStringList SettingsModel::getVideoDevices () const {
QStringList list;
for (const auto &device : CoreManager::getInstance()->getCore()->getVideoDevices())
list << ::Utils::linphoneStringToQString(device);
return list;
}
// -----------------------------------------------------------------------------
QString SettingsModel::getVideoDevice () const {
return ::Utils::linphoneStringToQString(
CoreManager::getInstance()->getCore()->getVideoDevice()
);
}
void SettingsModel::setVideoDevice (const QString &device) {
CoreManager::getInstance()->getCore()->setVideoDevice(
::Utils::qStringToLinphoneString(device)
);
emit videoDeviceChanged(device);
}
// -----------------------------------------------------------------------------
QString SettingsModel::getVideoPreset () const {
return ::Utils::linphoneStringToQString(
CoreManager::getInstance()->getCore()->getVideoPreset()
);
}
void SettingsModel::setVideoPreset (const QString &preset) {
CoreManager::getInstance()->getCore()->setVideoPreset(
::Utils::qStringToLinphoneString(preset)
);
emit videoPresetChanged(preset);
}
// -----------------------------------------------------------------------------
int SettingsModel::getVideoFramerate () const {
return static_cast<int>(CoreManager::getInstance()->getCore()->getPreferredFramerate());
}
void SettingsModel::setVideoFramerate (int framerate) {
CoreManager::getInstance()->getCore()->setPreferredFramerate(static_cast<float>(framerate));
emit videoFramerateChanged(framerate);
}
// =============================================================================
// Chat & calls.
// =============================================================================
......
......@@ -49,6 +49,15 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool echoCancellationEnabled READ getEchoCancellationEnabled WRITE setEchoCancellationEnabled NOTIFY echoCancellationEnabledChanged);
// Video. --------------------------------------------------------------------
Q_PROPERTY(QStringList videoDevices READ getVideoDevices CONSTANT);
Q_PROPERTY(QString videoDevice READ getVideoDevice WRITE setVideoDevice NOTIFY videoDeviceChanged);
Q_PROPERTY(QString videoPreset READ getVideoPreset WRITE setVideoPreset NOTIFY videoPresetChanged);
Q_PROPERTY(int videoFramerate READ getVideoFramerate WRITE setVideoFramerate NOTIFY videoFramerateChanged);
// Chat & calls. -------------------------------------------------------------
Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
......@@ -147,6 +156,19 @@ public:
bool getEchoCancellationEnabled () const;
void setEchoCancellationEnabled (bool status);
// Video. --------------------------------------------------------------------
QStringList getVideoDevices () const;
QString getVideoDevice () const;
void setVideoDevice (const QString &device);
QString getVideoPreset () const;
void setVideoPreset (const QString &preset);
int getVideoFramerate () const;
void setVideoFramerate (int framerate);
// Chat & calls. -------------------------------------------------------------
bool getAutoAnswerStatus () const;
......@@ -249,6 +271,13 @@ signals:
void echoCancellationEnabledChanged (bool status);
// Video. --------------------------------------------------------------------
void videoDeviceChanged (const QString &device);
void videoPresetChanged (const QString &preset);
void videoFramerateChanged (int framerate);
// Chat & calls. -------------------------------------------------------------
void autoAnswerStatusChanged (bool status);
......
import QtQuick 2.7
import Common 1.0
import Linphone 1.0
import Utils 1.0
// =============================================================================
TabContainer {
Form {
title: qsTr('videoCaptureTitle')
width: parent.width
FormLine {
FormGroup {
label: qsTr('videoInputDeviceLabel')
ComboBox {
model: SettingsModel.videoDevices
Component.onCompleted: currentIndex = Utils.findIndex(model, function (device) {
return device === SettingsModel.videoDevice
})
onActivated: SettingsModel.videoDevice = model[index]
}
}
}
FormLine {
FormGroup {
label: qsTr('videoPresetLabel')
ComboBox {
model: ListModel {
id: presets
ListElement {
key: qsTr('presetDefault')
value: 'default'
}
ListElement {
key: qsTr('presetHighFps')
value: 'high-fps'
}
ListElement {
key: qsTr('presetCustom')
value: 'custom'
}
}
textRole: 'key'
Component.onCompleted: {
var preset = SettingsModel.videoPreset
currentIndex = Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) {
return preset === value
}))
}
onActivated: SettingsModel.videoPreset = presets.get(index).value
}
}
}
FormLine {
FormGroup {
label: qsTr('videoSizeLabel')
ComboBox {
// TODO
}
}
FormGroup {
label: qsTr('videoFramerateLabel')
NumericField {
maxValue: 60
minValue: 1
readOnly: SettingsModel.videoPreset !== 'custom'
text: SettingsModel.videoFramerate
onEditingFinished: SettingsModel.videoFramerate = text
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment