diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 71311234a..3a6717555 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -706,15 +706,15 @@ Server url not configured. SettingsNetwork forceMtuLabel - Forcer MTU + Forcer MTU mtuLabel - MTU + MTU sendDtmfsLabel - Send DTMFs as SIP info + DTMFs send method allowIpV6Label diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 810e2f75c..9a9a592ef 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -716,15 +716,15 @@ Url du serveur non configurée. SettingsNetwork forceMtuLabel - Forcer MTU + Forcer MTU mtuLabel - MTU + MTU sendDtmfsLabel - Envoyer DTMFs en SIP info + Méthode d'envoi des DTMFs allowIpV6Label diff --git a/linphone-desktop/src/components/settings/SettingsModel.cpp b/linphone-desktop/src/components/settings/SettingsModel.cpp index 1dc1999dc..616db664a 100644 --- a/linphone-desktop/src/components/settings/SettingsModel.cpp +++ b/linphone-desktop/src/components/settings/SettingsModel.cpp @@ -20,12 +20,12 @@ * Author: Ronan Abhamon */ +#include + #include "../../app/Paths.hpp" #include "../../utils.hpp" #include "../core/CoreManager.hpp" -#include - #include "SettingsModel.hpp" using namespace std; @@ -38,8 +38,63 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { m_config = CoreManager::getInstance()->getCore()->getConfig(); } +// ============================================================================= +// Network. +// ============================================================================= + +bool SettingsModel::getUseRfc2833ForDtmfs () const { + return CoreManager::getInstance()->getCore()->getUseRfc2833ForDtmf(); +} + +void SettingsModel::setUseRfc2833ForDtmfs (bool status) { + shared_ptr core = CoreManager::getInstance()->getCore(); + + if (status) { + core->setUseInfoForDtmf(false); + core->setUseRfc2833ForDtmf(true); + } else { + core->setUseRfc2833ForDtmf(false); + core->setUseInfoForDtmf(true); + } + + emit dtmfsProtocolChanged(); +} + // ----------------------------------------------------------------------------- +bool SettingsModel::getUseSipInfoForDtmfs () const { + return CoreManager::getInstance()->getCore()->getUseInfoForDtmf(); +} + +void SettingsModel::setUseSipInfoForDtmfs (bool status) { + shared_ptr core = CoreManager::getInstance()->getCore(); + + if (status) { + core->setUseRfc2833ForDtmf(false); + core->setUseInfoForDtmf(true); + } else { + core->setUseInfoForDtmf(false); + core->setUseRfc2833ForDtmf(true); + } + + emit dtmfsProtocolChanged(); +} + +// ----------------------------------------------------------------------------- + +bool SettingsModel::getIpv6Enabled () const { + return CoreManager::getInstance()->getCore()->ipv6Enabled(); +} + +void SettingsModel::setIpv6Enabled (bool status) { + CoreManager::getInstance()->getCore()->enableIpv6(status); + emit ipv6EnabledChanged(status); +} + +// ============================================================================= +// Misc. +// ============================================================================= + bool SettingsModel::getAutoAnswerStatus () const { return !!m_config->getInt(UI_SECTION, "auto_answer", 0); } @@ -61,6 +116,7 @@ void SettingsModel::setFileTransferUrl (const QString &url) { CoreManager::getInstance()->getCore()->setFileTransferServer( ::Utils::qStringToLinphoneString(url) ); + emit fileTransferUrlChanged(url); } // ----------------------------------------------------------------------------- diff --git a/linphone-desktop/src/components/settings/SettingsModel.hpp b/linphone-desktop/src/components/settings/SettingsModel.hpp index 41e4b3753..89247a279 100644 --- a/linphone-desktop/src/components/settings/SettingsModel.hpp +++ b/linphone-desktop/src/components/settings/SettingsModel.hpp @@ -31,6 +31,11 @@ class SettingsModel : public QObject { Q_OBJECT; + Q_PROPERTY(bool useSipInfoForDtmfs READ getUseSipInfoForDtmfs WRITE setUseSipInfoForDtmfs NOTIFY dtmfsProtocolChanged); + Q_PROPERTY(bool useRfc2833ForDtmfs READ getUseRfc2833ForDtmfs WRITE setUseRfc2833ForDtmfs NOTIFY dtmfsProtocolChanged); + + Q_PROPERTY(bool ipv6Enabled READ getIpv6Enabled WRITE setIpv6Enabled NOTIFY ipv6EnabledChanged); + Q_PROPERTY(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged); Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged); @@ -40,6 +45,19 @@ class SettingsModel : public QObject { public: SettingsModel (QObject *parent = Q_NULLPTR); + // Network. ------------------------------------------------------------------ + + bool getUseSipInfoForDtmfs () const; + void setUseSipInfoForDtmfs (bool status); + + bool getUseRfc2833ForDtmfs () const; + void setUseRfc2833ForDtmfs (bool status); + + bool getIpv6Enabled () const; + void setIpv6Enabled (bool status); + + // Misc. --------------------------------------------------------------------- + bool getAutoAnswerStatus () const; void setAutoAnswerStatus (bool status); @@ -52,9 +70,15 @@ public: QString getSavedVideosFolder () const; void setSavedVideosFolder (const QString &folder); + // --------------------------------------------------------------------------- + static const std::string UI_SECTION; signals: + void dtmfsProtocolChanged (); + + void ipv6EnabledChanged (bool status); + void autoAnswerStatusChanged (bool status); void fileTransferUrlChanged (const QString &url); diff --git a/linphone-desktop/ui/modules/Common/Form/Switch.qml b/linphone-desktop/ui/modules/Common/Form/Switch.qml index 1232f00c3..799bacafa 100644 --- a/linphone-desktop/ui/modules/Common/Form/Switch.qml +++ b/linphone-desktop/ui/modules/Common/Form/Switch.qml @@ -14,6 +14,10 @@ Switch { // --------------------------------------------------------------------------- + signal clicked + + // --------------------------------------------------------------------------- + checked: false indicator: Rectangle { @@ -94,6 +98,6 @@ Switch { MouseArea { anchors.fill: parent - onClicked: control.enabled && control.toggle() + onClicked: control.enabled && control.clicked() } } diff --git a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml index 7369da18a..4f3f1e230 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsNetwork.qml @@ -1,6 +1,7 @@ import QtQuick 2.7 import Common 1.0 +import Linphone 1.0 import App.Styles 1.0 @@ -21,35 +22,29 @@ TabContainer { FormLine { FormGroup { - label: qsTr('forceMtuLabel') + label: qsTr('sendDtmfsLabel') - Switch { - id: forceMtu + ExclusiveButtons { + selectedButton: Number(!SettingsModel.useSipInfoForDtmfs) + texts: [ + 'SIP INFO', + 'RFC 2833' + ] + + onClicked: SettingsModel.useSipInfoForDtmfs = !button } } FormGroup { - label: qsTr('mtuLabel') + label: qsTr('allowIpV6Label') - NumericField { - minValue: 500 - maxValue: 3001 - readOnly: !forceMtu.checked + Switch { + checked: SettingsModel.ipv6Enabled + + onClicked: SettingsModel.ipv6Enabled = !checked } } } - - FormGroup { - label: qsTr('sendDtmfsLabel') - - Switch {} - } - - FormGroup { - label: qsTr('allowIpV6Label') - - Switch {} - } } // -------------------------------------------------------------------------