From 3ad8dc29947b23037212c6fb2b9f4ff11c4128f8 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 20 Jul 2018 11:28:35 +0200 Subject: [PATCH] feat(Settings): add developer options to display audio or video codecs --- assets/languages/de.ts | 8 ++++++++ assets/languages/en.ts | 8 ++++++++ assets/languages/fr_FR.ts | 8 ++++++++ assets/languages/ja.ts | 8 ++++++++ assets/languages/lt.ts | 8 ++++++++ assets/languages/pt_BR.ts | 8 ++++++++ assets/languages/ru.ts | 8 ++++++++ assets/languages/sv.ts | 8 ++++++++ assets/languages/tr.ts | 8 ++++++++ src/components/settings/SettingsModel.cpp | 22 ++++++++++++++++++++++ src/components/settings/SettingsModel.hpp | 14 ++++++++++++++ ui/views/App/Settings/SettingsAudio.qml | 15 +++++++++++++++ ui/views/App/Settings/SettingsVideo.qml | 15 +++++++++++++++ 13 files changed, 138 insertions(+) diff --git a/assets/languages/de.ts b/assets/languages/de.ts index 17b9d5c22..b70fb581f 100644 --- a/assets/languages/de.ts +++ b/assets/languages/de.ts @@ -1148,6 +1148,10 @@ Server URL ist nicht konfiguriert. audioCodecsTitle Audiocodecs + + showAudioCodecsLabel + + SettingsCallsChat @@ -1618,6 +1622,10 @@ Server URL ist nicht konfiguriert. showCameraPreview VIDEOVORSCHAU + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/en.ts b/assets/languages/en.ts index bd34b8f17..cf95fc633 100644 --- a/assets/languages/en.ts +++ b/assets/languages/en.ts @@ -1153,6 +1153,10 @@ your friend's SIP address or username. audioCodecsTitle Audio codecs + + showAudioCodecsLabel + Show audio codecs + SettingsCallsChat @@ -1623,6 +1627,10 @@ your friend's SIP address or username. showCameraPreview VIDEO PREVIEW + + showVideoCodecsLabel + Show video codecs + SettingsVideoPreview diff --git a/assets/languages/fr_FR.ts b/assets/languages/fr_FR.ts index 0bda250b7..22f0d40b5 100644 --- a/assets/languages/fr_FR.ts +++ b/assets/languages/fr_FR.ts @@ -1151,6 +1151,10 @@ Cliquez ici : <a href="%1">%1</a> audioCodecsTitle Codecs audio + + showAudioCodecsLabel + Afficher les codecs audio + SettingsCallsChat @@ -1621,6 +1625,10 @@ Cliquez ici : <a href="%1">%1</a> showCameraPreview APERÇU DE LA VIDÉO + + showVideoCodecsLabel + Afficher les codecs vidéo + SettingsVideoPreview diff --git a/assets/languages/ja.ts b/assets/languages/ja.ts index e67b86bbe..beaa372c7 100644 --- a/assets/languages/ja.ts +++ b/assets/languages/ja.ts @@ -1148,6 +1148,10 @@ audioCodecsTitle オーディオコーデック + + showAudioCodecsLabel + + SettingsCallsChat @@ -1618,6 +1622,10 @@ showCameraPreview ビデオプレビュー + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/lt.ts b/assets/languages/lt.ts index 535407a55..90bb6aafa 100644 --- a/assets/languages/lt.ts +++ b/assets/languages/lt.ts @@ -1150,6 +1150,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą. audioCodecsTitle Garso kodekai + + showAudioCodecsLabel + + SettingsCallsChat @@ -1620,6 +1624,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą. showCameraPreview VAIZDO PERŽIŪRA + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/pt_BR.ts b/assets/languages/pt_BR.ts index 90c2e1e66..271510249 100644 --- a/assets/languages/pt_BR.ts +++ b/assets/languages/pt_BR.ts @@ -1153,6 +1153,10 @@ o endereço SIP ou nome de usuário do seu amigo. audioCodecsTitle Codecs de áudio + + showAudioCodecsLabel + + SettingsCallsChat @@ -1623,6 +1627,10 @@ o endereço SIP ou nome de usuário do seu amigo. showCameraPreview PREVIEW DO VÍDEO + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/ru.ts b/assets/languages/ru.ts index 28c7c9921..001ddfd45 100644 --- a/assets/languages/ru.ts +++ b/assets/languages/ru.ts @@ -1151,6 +1151,10 @@ audioCodecsTitle Аудио кодеки + + showAudioCodecsLabel + + SettingsCallsChat @@ -1621,6 +1625,10 @@ showCameraPreview ПРЕДПРОСМОТР ВИДЕО + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/sv.ts b/assets/languages/sv.ts index 50e927a4c..c2ba86a1b 100644 --- a/assets/languages/sv.ts +++ b/assets/languages/sv.ts @@ -1150,6 +1150,10 @@ Klicka här: <a href="%1">%1</a> audioCodecsTitle + + showAudioCodecsLabel + + SettingsCallsChat @@ -1620,6 +1624,10 @@ Klicka här: <a href="%1">%1</a> showCameraPreview + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/assets/languages/tr.ts b/assets/languages/tr.ts index b8ff869a9..ea4f3fc2e 100644 --- a/assets/languages/tr.ts +++ b/assets/languages/tr.ts @@ -1150,6 +1150,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin. audioCodecsTitle Ses çözücüler + + showAudioCodecsLabel + + SettingsCallsChat @@ -1620,6 +1624,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin. showCameraPreview GÖRÜNTÜ ÖNİZLEMESİ + + showVideoCodecsLabel + + SettingsVideoPreview diff --git a/src/components/settings/SettingsModel.cpp b/src/components/settings/SettingsModel.cpp index cae2d9de4..ecac9a40e 100644 --- a/src/components/settings/SettingsModel.cpp +++ b/src/components/settings/SettingsModel.cpp @@ -195,6 +195,17 @@ void SettingsModel::setEchoCancellationEnabled (bool status) { emit echoCancellationEnabledChanged(status); } +// ----------------------------------------------------------------------------- + +bool SettingsModel::getShowAudioCodecs () const { + return !!mConfig->getInt(UiSection, "show_audio_codecs", 1); +} + +void SettingsModel::setShowAudioCodecs (bool status) { + mConfig->setInt(UiSection, "show_audio_codecs", status); + emit showAudioCodecsChanged(status); +} + // ============================================================================= // Video. // ============================================================================= @@ -295,6 +306,17 @@ bool SettingsModel::getVideoSupported () const { return CoreManager::getInstance()->getCore()->videoSupported(); } +// ----------------------------------------------------------------------------- + +bool SettingsModel::getShowVideoCodecs () const { + return !!mConfig->getInt(UiSection, "show_video_codecs", 1); +} + +void SettingsModel::setShowVideoCodecs (bool status) { + mConfig->setInt(UiSection, "show_video_codecs", status); + emit showVideoCodecsChanged(status); +} + // ============================================================================= // Chat & calls. // ============================================================================= diff --git a/src/components/settings/SettingsModel.hpp b/src/components/settings/SettingsModel.hpp index 0bb483a30..bde12c009 100644 --- a/src/components/settings/SettingsModel.hpp +++ b/src/components/settings/SettingsModel.hpp @@ -57,6 +57,8 @@ class SettingsModel : public QObject { Q_PROPERTY(bool echoCancellationEnabled READ getEchoCancellationEnabled WRITE setEchoCancellationEnabled NOTIFY echoCancellationEnabledChanged); + Q_PROPERTY(bool showAudioCodecs READ getShowAudioCodecs WRITE setShowAudioCodecs NOTIFY showAudioCodecsChanged); + // Video. -------------------------------------------------------------------- Q_PROPERTY(QStringList videoDevices READ getVideoDevices CONSTANT); @@ -72,6 +74,8 @@ class SettingsModel : public QObject { Q_PROPERTY(bool videoSupported READ getVideoSupported CONSTANT); + Q_PROPERTY(bool showVideoCodecs READ getShowVideoCodecs WRITE setShowVideoCodecs NOTIFY showVideoCodecsChanged); + // Chat & calls. ------------------------------------------------------------- Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); @@ -217,6 +221,9 @@ public: bool getEchoCancellationEnabled () const; void setEchoCancellationEnabled (bool status); + bool getShowAudioCodecs () const; + void setShowAudioCodecs (bool status); + // Video. -------------------------------------------------------------------- QStringList getVideoDevices () const; @@ -237,6 +244,9 @@ public: bool getVideoSupported () const; + bool getShowVideoCodecs () const; + void setShowVideoCodecs (bool status); + // Chat & calls. ------------------------------------------------------------- bool getAutoAnswerStatus () const; @@ -416,6 +426,8 @@ signals: void echoCancellationEnabledChanged (bool status); + void showAudioCodecsChanged (bool status); + // Video. -------------------------------------------------------------------- void videoDeviceChanged (const QString &device); @@ -425,6 +437,8 @@ signals: void videoDefinitionChanged (const QVariantMap &definition); + void showVideoCodecsChanged (bool status); + // Chat & calls. ------------------------------------------------------------- void autoAnswerStatusChanged (bool status); diff --git a/ui/views/App/Settings/SettingsAudio.qml b/ui/views/App/Settings/SettingsAudio.qml index 3a0011fcf..b59634377 100644 --- a/ui/views/App/Settings/SettingsAudio.qml +++ b/ui/views/App/Settings/SettingsAudio.qml @@ -140,8 +140,23 @@ TabContainer { Form { title: qsTr('audioCodecsTitle') + visible: SettingsModel.showAudioCodecs || SettingsModel.developerSettingsEnabled width: parent.width + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('showAudioCodecsLabel') + + Switch { + checked: SettingsModel.showAudioCodecs + + onClicked: SettingsModel.showAudioCodecs = !checked + } + } + } + CodecsViewer { model: AudioCodecsModel width: parent.width diff --git a/ui/views/App/Settings/SettingsVideo.qml b/ui/views/App/Settings/SettingsVideo.qml index ecda36380..7197dc23e 100644 --- a/ui/views/App/Settings/SettingsVideo.qml +++ b/ui/views/App/Settings/SettingsVideo.qml @@ -137,8 +137,23 @@ TabContainer { Form { title: qsTr('videoCodecsTitle') + visible: SettingsModel.showVideoCodecs || SettingsModel.developerSettingsEnabled width: parent.width + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('showVideoCodecsLabel') + + Switch { + checked: SettingsModel.showVideoCodecs + + onClicked: SettingsModel.showVideoCodecs = !checked + } + } + } + CodecsViewer { model: VideoCodecsModel width: parent.width