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>
<name>SettingsNetwork</name>
<message>
<source>forceMtuLabel</source>
<translation>Forcer MTU</translation>
<translation type="vanished">Forcer MTU</translation>
</message>
<message>
<source>mtuLabel</source>
<translation>MTU</translation>
<translation type="vanished">MTU</translation>
</message>
<message>
<source>sendDtmfsLabel</source>
<translation>Send DTMFs as SIP info</translation>
<translation>DTMFs send method</translation>
</message>
<message>
<source>allowIpV6Label</source>
......
......@@ -716,15 +716,15 @@ Url du serveur non configurée.</translation>
<name>SettingsNetwork</name>
<message>
<source>forceMtuLabel</source>
<translation>Forcer MTU</translation>
<translation type="vanished">Forcer MTU</translation>
</message>
<message>
<source>mtuLabel</source>
<translation>MTU</translation>
<translation type="vanished">MTU</translation>
</message>
<message>
<source>sendDtmfsLabel</source>
<translation>Envoyer DTMFs en SIP info</translation>
<translation>Méthode d&apos;envoi des DTMFs</translation>
</message>
<message>
<source>allowIpV6Label</source>
......
......@@ -20,12 +20,12 @@
* Author: Ronan Abhamon
*/
#include <QDir>
#include "../../app/Paths.hpp"
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include <QDir>
#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<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 {
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);
}
// -----------------------------------------------------------------------------
......
......@@ -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);
......
......@@ -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()
}
}
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 {}
}
}
// -------------------------------------------------------------------------
......
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