From 2847cd7356339a6498862886782aff389bf5bf28 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Fri, 31 Mar 2017 10:59:39 +0200 Subject: [PATCH] feat(ui/views/App/Settings/SettingsSipAccounts): in progress --- linphone-desktop/assets/languages/en.ts | 16 ++++--- linphone-desktop/assets/languages/fr.ts | 14 ++++-- linphone-desktop/resources.qrc | 2 + .../settings/AccountSettingsModel.cpp | 19 ++++++++ .../settings/AccountSettingsModel.hpp | 1 + .../App/Settings/SettingsSipAccounts.qml | 2 +- .../App/Settings/SettingsSipAccountsEdit.js | 33 +++++++++++++ .../App/Settings/SettingsSipAccountsEdit.qml | 48 +++++++++++++------ .../Settings/SettingsSipAccountsEditStyle.qml | 9 ++++ linphone-desktop/ui/views/App/Styles/qmldir | 2 +- 10 files changed, 118 insertions(+), 28 deletions(-) create mode 100644 linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js create mode 100644 linphone-desktop/ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 53687d983..30f21bc9b 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -487,7 +487,7 @@ Server url not configured. defaultMessage - + getIdentityAddress()->asStringUriOnly()); + map["serverAddress"] = ::Utils::linphoneStringToQString(proxy_config->getServerAddr()); + map["registrationDuration"] = proxy_config->getPublishExpires(); + map["transport"] = ::Utils::linphoneStringToQString(proxy_config->getTransport()); + map["route"] = ::Utils::linphoneStringToQString(proxy_config->getRoute()); + map["contactParams"] = ::Utils::linphoneStringToQString(proxy_config->getContactParameters()); + map["avpfInterval"] = proxy_config->getAvpfRrInterval(); + map["registerEnabled"] = proxy_config->registerEnabled(); + map["publishPresence"] = proxy_config->publishEnabled(); + map["avpfEnabled"] = proxy_config->getAvpfMode() == linphone::AVPFMode::AVPFModeEnabled; + + return map; +} + void AccountSettingsModel::setDefaultProxyConfig (const shared_ptr &proxy_config) { CoreManager::getInstance()->getCore()->setDefaultProxyConfig(proxy_config); emit accountSettingsUpdated(); diff --git a/linphone-desktop/src/components/settings/AccountSettingsModel.hpp b/linphone-desktop/src/components/settings/AccountSettingsModel.hpp index 7affddb70..dfe7f7a6e 100644 --- a/linphone-desktop/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-desktop/src/components/settings/AccountSettingsModel.hpp @@ -43,6 +43,7 @@ class AccountSettingsModel : public QObject { public: AccountSettingsModel (QObject *parent = Q_NULLPTR) : QObject(parent) {} + Q_INVOKABLE QVariantMap getProxyConfigDescription (const std::shared_ptr &proxy_config); Q_INVOKABLE void setDefaultProxyConfig (const std::shared_ptr &proxy_config); Q_INVOKABLE void removeProxyConfig (const std::shared_ptr &proxy_config); diff --git a/linphone-desktop/ui/views/App/Settings/SettingsSipAccounts.qml b/linphone-desktop/ui/views/App/Settings/SettingsSipAccounts.qml index b13c5dbcb..f3ea06df5 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsSipAccounts.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsSipAccounts.qml @@ -77,7 +77,7 @@ TabContainer { ] Repeater { - model: AccountSettingsModel.accounts + model: AccountSettingsModel.accounts.slice(1) delegate: FormTableLine { title: modelData.sipAddress diff --git a/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js b/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js new file mode 100644 index 000000000..e7f3db53a --- /dev/null +++ b/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js @@ -0,0 +1,33 @@ +// ============================================================================= +// `SettingsSipAccounts.qml` Logic. +// ============================================================================= + +.import Linphone 1.0 as Linphone + +.import 'qrc:/ui/scripts/Utils/utils.js' as Utils + +// ============================================================================= + +function initForm (account) { + if (!account) { + return + } + + var config = Linphone.AccountSettingsModel.getProxyConfigDescription(account.proxyConfig) + + sipAddress.text = config.sipAddress + serverAddress.text = config.serverAddress + registrationDuration.text = config.registrationDuration + + var currentTransport = config.transport.toUpperCase() + transport.currentIndex = Utils.findIndex(transport.model, function (value) { + return value === currentTransport + }) + + route.text = config.route + contactParams.text = config.contactParams + avpfInterval.text = config.avpfInterval + registerEnabled.checked = config.registerEnabled + publishPresence.checked = config.publishPresence + avpfEnabled.checked = config.avpfEnabled +} diff --git a/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml b/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml index eba45d4f2..ec79597f0 100644 --- a/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml +++ b/linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml @@ -6,13 +6,19 @@ import Utils 1.0 import App.Styles 1.0 +import 'SettingsSipAccountsEdit.js' as Logic + // ============================================================================= ConfirmDialog { property var account - height: 500 - width: 600 + height: SettingsSipAccountsEditStyle.height + width: SettingsSipAccountsEditStyle.width + + // --------------------------------------------------------------------------- + + Component.onCompleted: Logic.initForm(account) // --------------------------------------------------------------------------- @@ -29,7 +35,7 @@ ConfirmDialog { label: qsTr('sipAddressLabel') + '*' TextField { - + id: sipAddress } } } @@ -39,26 +45,28 @@ ConfirmDialog { label: qsTr('serverAddressLabel') + '*' TextField { - + id: serverAddress } } } FormLine { FormGroup { - label: qsTr('registrationDurationLabel') + '*' - - TextField { + label: qsTr('registrationDurationLabel') + NumericField { + id: registrationDuration } } } FormLine { FormGroup { - label: qsTr('transportLabel') + '*' + label: qsTr('transportLabel') ComboBox { + id: transport + model: [ 'TCP', 'UDP', 'TLS' ] } } @@ -69,7 +77,7 @@ ConfirmDialog { label: qsTr('routeLabel') TextField { - + id: route } } } @@ -79,17 +87,27 @@ ConfirmDialog { label: qsTr('contactParamsLabel') TextField { - + id: contactParams } } } FormLine { FormGroup { - label: qsTr('registerLabel') + label: qsTr('avpfIntervalLabel') + + NumericField { + id: avpfInterval + } + } + } + + FormLine { + FormGroup { + label: qsTr('registerEnabledLabel') Switch { - + id: registerEnabled } } } @@ -99,17 +117,17 @@ ConfirmDialog { label: qsTr('publishPresenceLabel') Switch { - + id: publishPresence } } } FormLine { FormGroup { - label: qsTr('enableAvpfLabel') + label: qsTr('avpfEnabledLabel') Switch { - + id: avpfEnabled } } } diff --git a/linphone-desktop/ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml b/linphone-desktop/ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml new file mode 100644 index 000000000..4fabb6450 --- /dev/null +++ b/linphone-desktop/ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml @@ -0,0 +1,9 @@ +pragma Singleton +import QtQuick 2.7 + +// ============================================================================= + +QtObject { + property int height: 550 + property int width: 600 +} diff --git a/linphone-desktop/ui/views/App/Styles/qmldir b/linphone-desktop/ui/views/App/Styles/qmldir index 0521266f9..48de49ed6 100644 --- a/linphone-desktop/ui/views/App/Styles/qmldir +++ b/linphone-desktop/ui/views/App/Styles/qmldir @@ -23,5 +23,5 @@ singleton MainWindowStyle 1.0 Main/MainWindowStyle.qml singleton ManageAccountsStyle 1.0 Main/ManageAccountsStyle.qml singleton SettingsWindowStyle 1.0 Settings/SettingsWindowStyle.qml - +singleton SettingsSipAccountsEditStyle 1.0 Settings/SettingsSipAccountsEditStyle.qml singleton SplashScreenStyle 1.0 SplashScreen/SplashScreenStyle.qml