Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
5689d885
Commit
5689d885
authored
Mar 31, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/Settings/SettingsSipAccounts): in progress
parent
ef73f050
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
14 deletions
+209
-14
en.ts
linphone-desktop/assets/languages/en.ts
+8
-0
fr.ts
linphone-desktop/assets/languages/fr.ts
+8
-0
AccountSettingsModel.cpp
...-desktop/src/components/settings/AccountSettingsModel.cpp
+106
-1
AccountSettingsModel.hpp
...-desktop/src/components/settings/AccountSettingsModel.hpp
+7
-0
ConfirmDialog.qml
linphone-desktop/ui/modules/Common/Dialog/ConfirmDialog.qml
+1
-1
SettingsSipAccounts.qml
...one-desktop/ui/views/App/Settings/SettingsSipAccounts.qml
+2
-0
SettingsSipAccountsEdit.js
...-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js
+38
-7
SettingsSipAccountsEdit.qml
...desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml
+37
-5
SettingsSipAccountsEditStyle.qml
...iews/App/Styles/Settings/SettingsSipAccountsEditStyle.qml
+2
-0
No files found.
linphone-desktop/assets/languages/en.ts
View file @
5689d885
...
...
@@ -864,6 +864,14 @@ Server url not configured.</translation>
<
source
>
avpfEnabledLabel
<
/source
>
<
translation
>
Enable
AVPF
<
/translation
>
<
/message
>
<
message
>
<
source
>
cancel
<
/source
>
<
translation
type
=
"
unfinished
"
>
CANCEL
<
/translation
>
<
/message
>
<
message
>
<
source
>
confirm
<
/source
>
<
translation
type
=
"
unfinished
"
>
CONFIRM
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SettingsUi
<
/name
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
5689d885
...
...
@@ -864,6 +864,14 @@ Url du serveur non configurée.</translation>
<
source
>
avpfEnabledLabel
<
/source
>
<
translation
>
Activer
AVPF
<
/translation
>
<
/message
>
<
message
>
<
source
>
cancel
<
/source
>
<
translation
type
=
"
unfinished
"
>
ANNULER
<
/translation
>
<
/message
>
<
message
>
<
source
>
confirm
<
/source
>
<
translation
type
=
"
unfinished
"
>
CONFIRMER
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
SettingsUi
<
/name
>
...
...
linphone-desktop/src/components/settings/AccountSettingsModel.cpp
View file @
5689d885
...
...
@@ -34,7 +34,13 @@ QVariantMap AccountSettingsModel::getProxyConfigDescription (const std::shared_p
QVariantMap
map
;
map
[
"sipAddress"
]
=
::
Utils
::
linphoneStringToQString
(
proxy_config
->
getIdentityAddress
()
->
asStringUriOnly
());
{
const
shared_ptr
<
const
linphone
::
Address
>
address
=
proxy_config
->
getIdentityAddress
();
map
[
"sipAddress"
]
=
address
?
::
Utils
::
linphoneStringToQString
(
proxy_config
->
getIdentityAddress
()
->
asStringUriOnly
())
:
""
;
}
map
[
"serverAddress"
]
=
::
Utils
::
linphoneStringToQString
(
proxy_config
->
getServerAddr
());
map
[
"registrationDuration"
]
=
proxy_config
->
getPublishExpires
();
map
[
"transport"
]
=
::
Utils
::
linphoneStringToQString
(
proxy_config
->
getTransport
());
...
...
@@ -58,6 +64,105 @@ void AccountSettingsModel::removeProxyConfig (const shared_ptr<linphone::ProxyCo
emit
accountSettingsUpdated
();
}
void
AccountSettingsModel
::
addOrUpdateProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
,
const
QVariantMap
&
data
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
QString
literal
=
data
[
"sipAddress"
].
toString
();
// Sip address.
{
shared_ptr
<
linphone
::
Address
>
address
=
linphone
::
Factory
::
get
()
->
createAddress
(
::
Utils
::
qStringToLinphoneString
(
literal
)
);
if
(
!
address
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to create sip address object from: `%1`."
).
arg
(
literal
);
return
;
}
proxy_config
->
setIdentityAddress
(
address
);
}
// Server address.
{
QString
q_server_address
=
data
[
"serverAddress"
].
toString
();
string
s_server_address
=
::
Utils
::
qStringToLinphoneString
(
q_server_address
);
if
(
!
proxy_config
->
setServerAddr
(
s_server_address
))
{
shared_ptr
<
linphone
::
Address
>
address
=
linphone
::
Factory
::
get
()
->
createAddress
(
s_server_address
);
if
(
!
address
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to add server address: `%1`."
).
arg
(
q_server_address
);
return
;
}
QString
transport
=
data
[
"transport"
].
toString
();
if
(
transport
==
"TCP"
)
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeTcp
);
else
if
(
transport
==
"UDP"
)
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeTcp
);
else
address
->
setTransport
(
linphone
::
TransportType
::
TransportTypeTls
);
if
(
!
proxy_config
->
setServerAddr
(
address
->
asString
()))
{
qWarning
()
<<
QStringLiteral
(
"Unable to add server address: `%1`."
).
arg
(
q_server_address
);
return
;
}
}
}
proxy_config
->
setPublishExpires
(
data
[
"registrationDuration"
].
toInt
());
proxy_config
->
setRoute
(
::
Utils
::
qStringToLinphoneString
(
data
[
"route"
].
toString
()));
proxy_config
->
setContactParameters
(
::
Utils
::
qStringToLinphoneString
(
data
[
"contactParams"
].
toString
()));
proxy_config
->
setAvpfRrInterval
(
data
[
"contactParams"
].
toInt
());
proxy_config
->
enableRegister
(
data
[
"registerEnabled"
].
toBool
());
proxy_config
->
enablePublish
(
data
[
"publishEnabled"
].
toBool
());
proxy_config
->
setAvpfMode
(
data
[
"avpfEnabled"
].
toBool
()
?
linphone
::
AVPFMode
::
AVPFModeEnabled
:
linphone
::
AVPFMode
::
AVPFModeDefault
);
list
<
shared_ptr
<
linphone
::
ProxyConfig
>
>
proxy_configs
=
core
->
getProxyConfigList
();
if
(
find
(
proxy_configs
.
cbegin
(),
proxy_configs
.
cend
(),
proxy_config
)
!=
proxy_configs
.
cend
())
{
if
(
proxy_config
->
done
()
==
-
1
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to update proxy config: `%1`."
).
arg
(
literal
);
return
;
}
}
else
if
(
core
->
addProxyConfig
(
proxy_config
)
==
-
1
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to add proxy config: `%1`."
).
arg
(
literal
);
return
;
}
emit
accountSettingsUpdated
();
}
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
AccountSettingsModel
::
createProxyConfig
()
{
return
CoreManager
::
getInstance
()
->
getCore
()
->
createProxyConfig
();
}
QString
AccountSettingsModel
::
getTransportFromServerAddress
(
const
QString
&
server_address
)
{
const
shared_ptr
<
const
linphone
::
Address
>
address
=
linphone
::
Factory
::
get
()
->
createAddress
(
::
Utils
::
qStringToLinphoneString
(
server_address
)
);
if
(
!
address
)
return
QStringLiteral
(
""
);
switch
(
address
->
getTransport
())
{
case
linphone
:
:
TransportTypeUdp
:
return
QStringLiteral
(
"UDP"
);
case
linphone
:
:
TransportTypeTcp
:
return
QStringLiteral
(
"TCP"
);
case
linphone
:
:
TransportTypeTls
:
return
QStringLiteral
(
"TLS"
);
case
linphone
:
:
TransportTypeDtls
:
break
;
}
return
QStringLiteral
(
""
);
}
// -----------------------------------------------------------------------------
QString
AccountSettingsModel
::
getUsername
()
const
{
...
...
linphone-desktop/src/components/settings/AccountSettingsModel.hpp
View file @
5689d885
...
...
@@ -44,9 +44,16 @@ public:
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{}
Q_INVOKABLE
QVariantMap
getProxyConfigDescription
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
);
Q_INVOKABLE
void
setDefaultProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
);
Q_INVOKABLE
void
addOrUpdateProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
,
const
QVariantMap
&
data
);
Q_INVOKABLE
void
removeProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
);
Q_INVOKABLE
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
createProxyConfig
();
Q_INVOKABLE
QString
getTransportFromServerAddress
(
const
QString
&
server_address
);
signals:
void
accountSettingsUpdated
();
...
...
linphone-desktop/ui/modules/Common/Dialog/ConfirmDialog.qml
View file @
5689d885
...
...
@@ -12,7 +12,7 @@ DialogPlus {
onClicked
:
exit
(
0
)
},
TextButton
A
{
TextButton
B
{
text
:
qsTr
(
'
confirm
'
)
onClicked
:
exit
(
1
)
...
...
linphone-desktop/ui/views/App/Settings/SettingsSipAccounts.qml
View file @
5689d885
...
...
@@ -121,6 +121,8 @@ TabContainer {
TextButtonB
{
text
:
qsTr
(
'
addAccount
'
)
onClicked
:
Logic
.
editAccount
()
}
}
}
...
...
linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.js
View file @
5689d885
...
...
@@ -8,21 +8,27 @@
// =============================================================================
var
proxyConfig
function
initForm
(
account
)
{
if
(
!
account
)
{
return
}
var
AccountSettingsModel
=
Linphone
.
AccountSettingsModel
proxyConfig
=
account
?
account
.
proxyConfig
:
AccountSettingsModel
.
createProxyConfig
()
var
config
=
Linphone
.
AccountSettingsModel
.
getProxyConfigDescription
(
account
.
proxyConfig
)
var
config
=
AccountSettingsModel
.
getProxyConfigDescription
(
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
})
transport
.
currentIndex
=
Number
(
Utils
.
findIndex
(
transport
.
model
,
function
(
value
)
{
return
value
===
currentTransport
})
)
route
.
text
=
config
.
route
contactParams
.
text
=
config
.
contactParams
...
...
@@ -31,3 +37,28 @@ function initForm (account) {
publishPresence
.
checked
=
config
.
publishPresence
avpfEnabled
.
checked
=
config
.
avpfEnabled
}
function
handleServerAddressChanged
(
address
)
{
var
newTransport
=
Linphone
.
AccountSettingsModel
.
getTransportFromServerAddress
(
address
)
if
(
newTransport
.
length
>
0
)
{
transport
.
currentIndex
=
Utils
.
findIndex
(
transport
.
model
,
function
(
value
)
{
return
value
===
newTransport
})
}
}
function
validProxyConfig
()
{
// TODO: Display errors on the form (if necessary).
Linphone
.
AccountSettingsModel
.
addOrUpdateProxyConfig
(
proxyConfig
,
{
sipAddress
:
sipAddress
.
text
,
serverAddress
:
serverAddress
.
text
,
registrationDuration
:
registrationDuration
.
text
,
transport
:
transport
.
currentText
,
route
:
route
.
text
,
contactParams
:
contactParams
.
text
,
avpfInterval
:
avpfInterval
.
text
,
registerEnabled
:
registerEnabled
.
checked
,
publishPresence
:
publishPresence
.
checked
,
avpfEnabled
:
avpfEnabled
.
checked
})
}
linphone-desktop/ui/views/App/Settings/SettingsSipAccountsEdit.qml
View file @
5689d885
...
...
@@ -10,8 +10,29 @@ import 'SettingsSipAccountsEdit.js' as Logic
// =============================================================================
ConfirmDialog
{
property
var
account
DialogPlus
{
id
:
dialog
property
var
account
// Optional.
buttons
:
[
TextButtonA
{
text
:
qsTr
(
'
cancel
'
)
onClicked
:
exit
(
0
)
},
TextButtonB
{
enabled
:
sipAddress
.
length
>
0
&&
serverAddress
.
length
>
0
text
:
qsTr
(
'
confirm
'
)
onClicked
:
{
Logic
.
validProxyConfig
()
exit
(
1
)
}
}
]
centeredButtons
:
true
height
:
SettingsSipAccountsEditStyle
.
height
width
:
SettingsSipAccountsEditStyle
.
width
...
...
@@ -25,9 +46,9 @@ ConfirmDialog {
Form
{
anchors
{
left
:
parent
.
left
leftMargin
:
ManageAccounts
Style
.
leftMargin
leftMargin
:
SettingsSipAccountsEdit
Style
.
leftMargin
right
:
parent
.
right
rightMargin
:
ManageAccounts
Style
.
rightMargin
rightMargin
:
SettingsSipAccountsEdit
Style
.
rightMargin
}
FormLine
{
...
...
@@ -46,6 +67,8 @@ ConfirmDialog {
TextField
{
id
:
serverAddress
onTextChanged
:
Logic
.
handleServerAddressChanged
(
text
)
}
}
}
...
...
@@ -67,7 +90,7 @@ ConfirmDialog {
ComboBox
{
id
:
transport
model
:
[
'
TCP
'
,
'
UD
P
'
,
'
TLS
'
]
model
:
[
'
UDP
'
,
'
TC
P
'
,
'
TLS
'
]
}
}
}
...
...
@@ -98,6 +121,9 @@ ConfirmDialog {
NumericField
{
id
:
avpfInterval
maxValue
:
5
minValue
:
1
}
}
}
...
...
@@ -108,6 +134,8 @@ ConfirmDialog {
Switch
{
id
:
registerEnabled
onClicked
:
checked
=
!
checked
}
}
}
...
...
@@ -118,6 +146,8 @@ ConfirmDialog {
Switch
{
id
:
publishPresence
onClicked
:
checked
=
!
checked
}
}
}
...
...
@@ -128,6 +158,8 @@ ConfirmDialog {
Switch
{
id
:
avpfEnabled
onClicked
:
checked
=
!
checked
}
}
}
...
...
linphone-desktop/ui/views/App/Styles/Settings/SettingsSipAccountsEditStyle.qml
View file @
5689d885
...
...
@@ -5,5 +5,7 @@ import QtQuick 2.7
QtObject
{
property
int
height
:
550
property
int
leftMargin
:
35
property
int
rightMargin
:
35
property
int
width
:
600
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment