From 3577df44988cc12a4c7bd536d69f84cce55da59e Mon Sep 17 00:00:00 2001 From: Wescoeur Date: Mon, 3 Apr 2017 18:29:22 +0200 Subject: [PATCH] feat(ui/modules/Linphone/Codecs): in progress --- linphone-desktop/assets/languages/en.ts | 14 +- linphone-desktop/assets/languages/fr.ts | 14 +- linphone-desktop/resources.qrc | 1 + .../modules/Linphone/Codecs/CodecsViewer.qml | 60 +++++++ linphone-desktop/ui/modules/Linphone/qmldir | 2 + .../ui/views/App/Settings/SettingsAudio.qml | 145 +++++++++------- .../ui/views/App/Settings/SettingsVideo.qml | 161 ++++++++++-------- 7 files changed, 263 insertions(+), 134 deletions(-) create mode 100644 linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 558d67614..dfb1dc257 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -616,6 +616,10 @@ Server url not configured. echoCancellationLabel Enable echo cancellation + + audioCodecsTitle + Audio codecs + SettingsCallsChat @@ -819,7 +823,7 @@ Server url not configured. deleteAccountDescription - + Are you sure you want to delete this account? @@ -866,11 +870,11 @@ Server url not configured. cancel - CANCEL + CANCEL confirm - CONFIRM + CONFIRM @@ -934,6 +938,10 @@ Server url not configured. videoSizeLabel Video resolution + + videoCodecsTitle + Video codecs + SettingsWindow diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 853887279..f8f014b64 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -616,6 +616,10 @@ Url du serveur non configurée. echoCancellationLabel Activer annulation d'écho + + audioCodecsTitle + Codecs audio + SettingsCallsChat @@ -819,7 +823,7 @@ Url du serveur non configurée. deleteAccountDescription - + Êtes-vous sûr de vouloir supprimer ce compte ? @@ -866,11 +870,11 @@ Url du serveur non configurée. cancel - ANNULER + ANNULER confirm - CONFIRMER + CONFIRMER @@ -934,6 +938,10 @@ Url du serveur non configurée. videoSizeLabel Définition + + videoCodecsTitle + Codecs vidéo + SettingsWindow diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index b01b38457..3c228dd78 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -275,6 +275,7 @@ ui/modules/Linphone/Chat/Message.js ui/modules/Linphone/Chat/Message.qml ui/modules/Linphone/Chat/OutgoingMessage.qml + ui/modules/Linphone/Codecs/CodecsViewer.qml ui/modules/Linphone/Contact/Avatar.qml ui/modules/Linphone/Contact/ContactDescription.qml ui/modules/Linphone/Contact/Contact.qml diff --git a/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml b/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml new file mode 100644 index 000000000..01098327d --- /dev/null +++ b/linphone-desktop/ui/modules/Linphone/Codecs/CodecsViewer.qml @@ -0,0 +1,60 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +import Common 1.0 + +// ============================================================================= + +ColumnLayout { + property alias model: view.model + + // --------------------------------------------------------------------------- + + height: 350 + + // --------------------------------------------------------------------------- + // Header. + // --------------------------------------------------------------------------- + + Row { + Layout.fillWidth: true + height: 50 + } + + // --------------------------------------------------------------------------- + // Codecs. + // --------------------------------------------------------------------------- + + ScrollableListView { + id: view + + Layout.fillWidth: true + Layout.fillHeight: true + + delegate: Rectangle { + color: 'red' + height: 30 + width: view.width + + Row { + anchors.fill: parent + + Text { + text: $codec.mime + } + + Text { + text: $codec.description + } + + Text { + text: $codec.channels + } + + Text { + text: $codec.bitrate + } + } + } + } +} diff --git a/linphone-desktop/ui/modules/Linphone/qmldir b/linphone-desktop/ui/modules/Linphone/qmldir index 476c1a3e8..ca67e14fd 100644 --- a/linphone-desktop/ui/modules/Linphone/qmldir +++ b/linphone-desktop/ui/modules/Linphone/qmldir @@ -14,6 +14,8 @@ Calls 1.0 Calls/Calls.qml Chat 1.0 Chat/Chat.qml +CodecsViewer 1.0 Codecs/CodecsViewer.qml + Avatar 1.0 Contact/Avatar.qml Contact 1.0 Contact/Contact.qml ContactDescription 1.0 Contact/ContactDescription.qml diff --git a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml index 4beb5e16d..4f6cc53b2 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsAudio.qml @@ -4,79 +4,104 @@ import Common 1.0 import Linphone 1.0 import Utils 1.0 +import App.Styles 1.0 + // ============================================================================= TabContainer { - Form { - title: qsTr('audioTitle') + Column { + spacing: SettingsWindowStyle.forms.spacing width: parent.width - FormLine { - FormGroup { - label: qsTr('playbackDeviceLabel') + // ------------------------------------------------------------------------- + // Audio parameters. + // ------------------------------------------------------------------------- - ComboBox { - currentIndex: Utils.findIndex(model, function (device) { - return device === SettingsModel.playbackDevice - }) - model: SettingsModel.audioDevices + Form { + title: qsTr('audioTitle') + width: parent.width - onActivated: SettingsModel.playbackDevice = model[index] + FormLine { + FormGroup { + label: qsTr('playbackDeviceLabel') + + ComboBox { + currentIndex: Utils.findIndex(model, function (device) { + return device === SettingsModel.playbackDevice + }) + model: SettingsModel.audioDevices + + onActivated: SettingsModel.playbackDevice = model[index] + } + } + } + + FormLine { + FormGroup { + label: qsTr('captureDeviceLabel') + + ComboBox { + currentIndex: Utils.findIndex(model, function (device) { + return device === SettingsModel.captureDevice + }) + model: SettingsModel.audioDevices + + onActivated: SettingsModel.captureDevice = model[index] + } + } + } + + FormLine { + FormGroup { + label: qsTr('ringerDeviceLabel') + + ComboBox { + currentIndex: Utils.findIndex(model, function (device) { + return device === SettingsModel.ringerDevice + }) + model: SettingsModel.audioDevices + + onActivated: SettingsModel.ringerDevice = model[index] + } + } + } + + FormLine { + FormGroup { + label: qsTr('ringLabel') + + FileChooserButton { + selectedFile: SettingsModel.ringPath + + onAccepted: SettingsModel.ringPath = selectedFile + } + } + } + + FormLine { + FormGroup { + label: qsTr('echoCancellationLabel') + + Switch { + checked: SettingsModel.echoCancellationEnabled + + onClicked: SettingsModel.echoCancellationEnabled = !checked + } } } } - FormLine { - FormGroup { - label: qsTr('captureDeviceLabel') + // ------------------------------------------------------------------------- + // Audio Codecs. + // ------------------------------------------------------------------------- - ComboBox { - currentIndex: Utils.findIndex(model, function (device) { - return device === SettingsModel.captureDevice - }) - model: SettingsModel.audioDevices + Form { + title: qsTr('audioCodecsTitle') + width: parent.width - onActivated: SettingsModel.captureDevice = model[index] - } - } - } - - FormLine { - FormGroup { - label: qsTr('ringerDeviceLabel') - - ComboBox { - currentIndex: Utils.findIndex(model, function (device) { - return device === SettingsModel.ringerDevice - }) - model: SettingsModel.audioDevices - - onActivated: SettingsModel.ringerDevice = model[index] - } - } - } - - FormLine { - FormGroup { - label: qsTr('ringLabel') - - FileChooserButton { - selectedFile: SettingsModel.ringPath - - onAccepted: SettingsModel.ringPath = selectedFile - } - } - } - - FormLine { - FormGroup { - label: qsTr('echoCancellationLabel') - - Switch { - checked: SettingsModel.echoCancellationEnabled - - onClicked: SettingsModel.echoCancellationEnabled = !checked - } + CodecsViewer { + model: AudioCodecsModel + width: parent.width } } } diff --git a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml index 843475921..9f9d548fd 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsVideo.qml @@ -4,87 +4,112 @@ import Common 1.0 import Linphone 1.0 import Utils 1.0 +import App.Styles 1.0 + // ============================================================================= TabContainer { - Form { - title: qsTr('videoCaptureTitle') + Column { + spacing: SettingsWindowStyle.forms.spacing width: parent.width - FormLine { - FormGroup { - label: qsTr('videoInputDeviceLabel') + // ------------------------------------------------------------------------- + // Video parameters. + // ------------------------------------------------------------------------- - ComboBox { - currentIndex: Utils.findIndex(model, function (device) { - return device === SettingsModel.videoDevice - }) - model: SettingsModel.videoDevices + Form { + title: qsTr('videoCaptureTitle') + width: parent.width - onActivated: SettingsModel.videoDevice = model[index] + FormLine { + FormGroup { + label: qsTr('videoInputDeviceLabel') + + ComboBox { + currentIndex: Utils.findIndex(model, function (device) { + return device === SettingsModel.videoDevice + }) + model: SettingsModel.videoDevices + + onActivated: SettingsModel.videoDevice = model[index] + } + } + } + + FormLine { + FormGroup { + label: qsTr('videoPresetLabel') + + ComboBox { + currentIndex: { + var preset = SettingsModel.videoPreset + + return Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) { + return preset === value + })) + } + + 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' + + 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 + } } } } - FormLine { - FormGroup { - label: qsTr('videoPresetLabel') + // ------------------------------------------------------------------------- + // Video Codecs. + // ------------------------------------------------------------------------- - ComboBox { - currentIndex: { - var preset = SettingsModel.videoPreset + Form { + title: qsTr('videoCodecsTitle') + width: parent.width - return Number(Utils.findIndex([ 'default', 'high-fps', 'custom' ], function (value) { - return preset === value - })) - } - - 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' - - 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 - } + CodecsViewer { + model: VideoCodecsModel + width: parent.width } } }