Commit aabbcf39 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Settings): transport settings working

parent 47e70789
...@@ -706,15 +706,15 @@ Server url not configured.</translation> ...@@ -706,15 +706,15 @@ Server url not configured.</translation>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
<message> <message>
<source>forceMtuLabel</source> <source>forceMtuLabel</source>
<translation>Forcer MTU</translation> <translation type="vanished">Forcer MTU</translation>
</message> </message>
<message> <message>
<source>mtuLabel</source> <source>mtuLabel</source>
<translation>MTU</translation> <translation type="vanished">MTU</translation>
</message> </message>
<message> <message>
<source>sendDtmfsLabel</source> <source>sendDtmfsLabel</source>
<translation>Send DTMFs as SIP info</translation> <translation>DTMFs send method</translation>
</message> </message>
<message> <message>
<source>allowIpV6Label</source> <source>allowIpV6Label</source>
......
...@@ -716,15 +716,15 @@ Url du serveur non configurée.</translation> ...@@ -716,15 +716,15 @@ Url du serveur non configurée.</translation>
<name>SettingsNetwork</name> <name>SettingsNetwork</name>
<message> <message>
<source>forceMtuLabel</source> <source>forceMtuLabel</source>
<translation>Forcer MTU</translation> <translation type="vanished">Forcer MTU</translation>
</message> </message>
<message> <message>
<source>mtuLabel</source> <source>mtuLabel</source>
<translation>MTU</translation> <translation type="vanished">MTU</translation>
</message> </message>
<message> <message>
<source>sendDtmfsLabel</source> <source>sendDtmfsLabel</source>
<translation>Envoyer DTMFs en SIP info</translation> <translation>Méthode d&apos;envoi des DTMFs</translation>
</message> </message>
<message> <message>
<source>allowIpV6Label</source> <source>allowIpV6Label</source>
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include <QDir>
#include "../../app/Paths.hpp" #include "../../app/Paths.hpp"
#include "../../utils.hpp" #include "../../utils.hpp"
#include "../core/CoreManager.hpp" #include "../core/CoreManager.hpp"
#include <QDir>
#include "SettingsModel.hpp" #include "SettingsModel.hpp"
using namespace std; using namespace std;
...@@ -38,8 +38,63 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { ...@@ -38,8 +38,63 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
m_config = CoreManager::getInstance()->getCore()->getConfig(); m_config = CoreManager::getInstance()->getCore()->getConfig();
} }
// =============================================================================
// Network.
// =============================================================================
bool SettingsModel::getUseRfc2833ForDtmfs () const {
return CoreManager::getInstance()->getCore()->getUseRfc2833ForDtmf();
}
void SettingsModel::setUseRfc2833ForDtmfs (bool status) {
shared_ptr<linphone::Core> 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<linphone::Core> 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 { bool SettingsModel::getAutoAnswerStatus () const {
return !!m_config->getInt(UI_SECTION, "auto_answer", 0); return !!m_config->getInt(UI_SECTION, "auto_answer", 0);
} }
...@@ -61,6 +116,7 @@ void SettingsModel::setFileTransferUrl (const QString &url) { ...@@ -61,6 +116,7 @@ void SettingsModel::setFileTransferUrl (const QString &url) {
CoreManager::getInstance()->getCore()->setFileTransferServer( CoreManager::getInstance()->getCore()->setFileTransferServer(
::Utils::qStringToLinphoneString(url) ::Utils::qStringToLinphoneString(url)
); );
emit fileTransferUrlChanged(url);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
class SettingsModel : public QObject { class SettingsModel : public QObject {
Q_OBJECT; 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(bool autoAnswerStatus READ getAutoAnswerStatus WRITE setAutoAnswerStatus NOTIFY autoAnswerStatusChanged);
Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged); Q_PROPERTY(QString fileTransferUrl READ getFileTransferUrl WRITE setFileTransferUrl NOTIFY fileTransferUrlChanged);
...@@ -40,6 +45,19 @@ class SettingsModel : public QObject { ...@@ -40,6 +45,19 @@ class SettingsModel : public QObject {
public: public:
SettingsModel (QObject *parent = Q_NULLPTR); 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; bool getAutoAnswerStatus () const;
void setAutoAnswerStatus (bool status); void setAutoAnswerStatus (bool status);
...@@ -52,9 +70,15 @@ public: ...@@ -52,9 +70,15 @@ public:
QString getSavedVideosFolder () const; QString getSavedVideosFolder () const;
void setSavedVideosFolder (const QString &folder); void setSavedVideosFolder (const QString &folder);
// ---------------------------------------------------------------------------
static const std::string UI_SECTION; static const std::string UI_SECTION;
signals: signals:
void dtmfsProtocolChanged ();
void ipv6EnabledChanged (bool status);
void autoAnswerStatusChanged (bool status); void autoAnswerStatusChanged (bool status);
void fileTransferUrlChanged (const QString &url); void fileTransferUrlChanged (const QString &url);
......
...@@ -14,6 +14,10 @@ Switch { ...@@ -14,6 +14,10 @@ Switch {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
signal clicked
// ---------------------------------------------------------------------------
checked: false checked: false
indicator: Rectangle { indicator: Rectangle {
...@@ -94,6 +98,6 @@ Switch { ...@@ -94,6 +98,6 @@ Switch {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: control.enabled && control.toggle() onClicked: control.enabled && control.clicked()
} }
} }
import QtQuick 2.7 import QtQuick 2.7
import Common 1.0 import Common 1.0
import Linphone 1.0
import App.Styles 1.0 import App.Styles 1.0
...@@ -21,35 +22,29 @@ TabContainer { ...@@ -21,35 +22,29 @@ TabContainer {
FormLine { FormLine {
FormGroup { FormGroup {
label: qsTr('forceMtuLabel') label: qsTr('sendDtmfsLabel')
Switch { ExclusiveButtons {
id: forceMtu selectedButton: Number(!SettingsModel.useSipInfoForDtmfs)
texts: [
'SIP INFO',
'RFC 2833'
]
onClicked: SettingsModel.useSipInfoForDtmfs = !button
} }
} }
FormGroup { FormGroup {
label: qsTr('mtuLabel') label: qsTr('allowIpV6Label')
NumericField { Switch {
minValue: 500 checked: SettingsModel.ipv6Enabled
maxValue: 3001
readOnly: !forceMtu.checked onClicked: SettingsModel.ipv6Enabled = !checked
} }
} }
} }
FormGroup {
label: qsTr('sendDtmfsLabel')
Switch {}
}
FormGroup {
label: qsTr('allowIpV6Label')
Switch {}
}
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
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