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
37d0ac55
Commit
37d0ac55
authored
Feb 27, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/views/App/ManageAccounts): account selection is supported
parent
4a2674be
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
158 additions
and
165 deletions
+158
-165
en.ts
linphone-desktop/assets/languages/en.ts
+20
-12
fr.ts
linphone-desktop/assets/languages/fr.ts
+20
-12
resources.qrc
linphone-desktop/resources.qrc
+1
-0
AccountSettingsModel.cpp
...-desktop/src/components/settings/AccountSettingsModel.cpp
+33
-5
AccountSettingsModel.hpp
...-desktop/src/components/settings/AccountSettingsModel.hpp
+10
-15
ComboBox.qml
linphone-desktop/ui/modules/Common/Form/ComboBox.qml
+3
-3
ManageAccounts.qml
linphone-desktop/ui/views/App/ManageAccounts.qml
+47
-118
SettingsUi.qml
linphone-desktop/ui/views/App/Settings/SettingsUi.qml
+1
-0
ManageAccountsStyle.qml
linphone-desktop/ui/views/App/Styles/ManageAccountsStyle.qml
+22
-0
qmldir
linphone-desktop/ui/views/App/Styles/qmldir
+1
-0
No files found.
linphone-desktop/assets/languages/en.ts
View file @
37d0ac55
...
...
@@ -543,7 +543,7 @@ Server url not configured.</translation>
<
name
>
ManageAccounts
<
/name
>
<
message
>
<
source
>
manageAccountsDescription
<
/source
>
<
translation
>
Select
your
active
account
and
choose
all
necessary
presence
status
.
<
/translation
>
<
translation
type
=
"
vanished
"
>
Select
your
active
account
and
choose
all
necessary
presence
status
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
manageAccountsTitle
<
/source
>
...
...
@@ -551,47 +551,55 @@ Server url not configured.</translation>
<
/message
>
<
message
>
<
source
>
validate
<
/source
>
<
translation
>
VALIDATE
<
/translation
>
<
translation
type
=
"
vanished
"
>
VALIDATE
<
/translation
>
<
/message
>
<
message
>
<
source
>
onlinePresence
<
/source
>
<
translation
>
Connected
<
/translation
>
<
translation
type
=
"
vanished
"
>
Connected
<
/translation
>
<
/message
>
<
message
>
<
source
>
busyPresence
<
/source
>
<
translation
>
Busy
<
/translation
>
<
translation
type
=
"
vanished
"
>
Busy
<
/translation
>
<
/message
>
<
message
>
<
source
>
beRightBackPresence
<
/source
>
<
translation
>
Be
right
back
<
/translation
>
<
translation
type
=
"
vanished
"
>
Be
right
back
<
/translation
>
<
/message
>
<
message
>
<
source
>
awayPresence
<
/source
>
<
translation
>
Away
<
/translation
>
<
translation
type
=
"
vanished
"
>
Away
<
/translation
>
<
/message
>
<
message
>
<
source
>
onThePhonePresence
<
/source
>
<
translation
>
On
the
phone
<
/translation
>
<
translation
type
=
"
vanished
"
>
On
the
phone
<
/translation
>
<
/message
>
<
message
>
<
source
>
outToLunchPresence
<
/source
>
<
translation
>
Out
to
lunch
<
/translation
>
<
translation
type
=
"
vanished
"
>
Out
to
lunch
<
/translation
>
<
/message
>
<
message
>
<
source
>
doNotDisturbPresence
<
/source
>
<
translation
>
Away
<
/translation
>
<
translation
type
=
"
vanished
"
>
Away
<
/translation
>
<
/message
>
<
message
>
<
source
>
movedPresence
<
/source
>
<
translation
>
Moved
<
/translation
>
<
translation
type
=
"
vanished
"
>
Moved
<
/translation
>
<
/message
>
<
message
>
<
source
>
usingAnotherMessagingServicePresence
<
/source
>
<
translation
>
Using
another
messaging
service
<
/translation
>
<
translation
type
=
"
vanished
"
>
Using
another
messaging
service
<
/translation
>
<
/message
>
<
message
>
<
source
>
offlinePresence
<
/source
>
<
translation
>
Disconnected
<
/translation
>
<
translation
type
=
"
vanished
"
>
Disconnected
<
/translation
>
<
/message
>
<
message
>
<
source
>
ok
<
/source
>
<
translation
>
OK
<
/translation
>
<
/message
>
<
message
>
<
source
>
selectAccountLabel
<
/source
>
<
translation
>
Select
you
active
account
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
37d0ac55
...
...
@@ -542,7 +542,7 @@ Url du serveur non configurée.</translation>
<
name
>
ManageAccounts
<
/name
>
<
message
>
<
source
>
manageAccountsDescription
<
/source
>
<
translation
>
S
é
lectionner
votre
compte
actif
ainsi
que
vos
status
de
pr
é
sence
.
<
/translation
>
<
translation
type
=
"
vanished
"
>
S
é
lectionner
votre
compte
actif
ainsi
que
vos
status
de
pr
é
sence
.
<
/translation
>
<
/message
>
<
message
>
<
source
>
manageAccountsTitle
<
/source
>
...
...
@@ -550,47 +550,55 @@ Url du serveur non configurée.</translation>
<
/message
>
<
message
>
<
source
>
validate
<
/source
>
<
translation
>
VALIDER
<
/translation
>
<
translation
type
=
"
vanished
"
>
VALIDER
<
/translation
>
<
/message
>
<
message
>
<
source
>
onlinePresence
<
/source
>
<
translation
>
Disponible
<
/translation
>
<
translation
type
=
"
vanished
"
>
Disponible
<
/translation
>
<
/message
>
<
message
>
<
source
>
busyPresence
<
/source
>
<
translation
>
Occup
é
<
/translation
>
<
translation
type
=
"
vanished
"
>
Occup
é
<
/translation
>
<
/message
>
<
message
>
<
source
>
beRightBackPresence
<
/source
>
<
translation
>
De
retour
<
/translation
>
<
translation
type
=
"
vanished
"
>
De
retour
<
/translation
>
<
/message
>
<
message
>
<
source
>
awayPresence
<
/source
>
<
translation
>
Absent
<
/translation
>
<
translation
type
=
"
vanished
"
>
Absent
<
/translation
>
<
/message
>
<
message
>
<
source
>
onThePhonePresence
<
/source
>
<
translation
>
Au
t
é
l
é
phone
<
/translation
>
<
translation
type
=
"
vanished
"
>
Au
t
é
l
é
phone
<
/translation
>
<
/message
>
<
message
>
<
source
>
outToLunchPresence
<
/source
>
<
translation
>
A
table
<
/translation
>
<
translation
type
=
"
vanished
"
>
A
table
<
/translation
>
<
/message
>
<
message
>
<
source
>
doNotDisturbPresence
<
/source
>
<
translation
>
Ne
pas
d
é
ranger
<
/translation
>
<
translation
type
=
"
vanished
"
>
Ne
pas
d
é
ranger
<
/translation
>
<
/message
>
<
message
>
<
source
>
movedPresence
<
/source
>
<
translation
>
Parti
<
/translation
>
<
translation
type
=
"
vanished
"
>
Parti
<
/translation
>
<
/message
>
<
message
>
<
source
>
usingAnotherMessagingServicePresence
<
/source
>
<
translation
>
Utilisation
d
&
apos
;
un
autre
service
de
messagerie
<
/translation
>
<
translation
type
=
"
vanished
"
>
Utilisation
d
&
apos
;
un
autre
service
de
messagerie
<
/translation
>
<
/message
>
<
message
>
<
source
>
offlinePresence
<
/source
>
<
translation
>
D
é
connect
é
<
/translation
>
<
translation
type
=
"
vanished
"
>
D
é
connect
é
<
/translation
>
<
/message
>
<
message
>
<
source
>
ok
<
/source
>
<
translation
>
OK
<
/translation
>
<
/message
>
<
message
>
<
source
>
selectAccountLabel
<
/source
>
<
translation
>
S
é
lectionner
votre
compte
principal
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
linphone-desktop/resources.qrc
View file @
37d0ac55
...
...
@@ -337,6 +337,7 @@
<file>
ui/views/App/Styles/Main/HomeStyle.qml
</file>
<file>
ui/views/App/Styles/Main/MainWindowMenuBarStyle.qml
</file>
<file>
ui/views/App/Styles/Main/MainWindowStyle.qml
</file>
<file>
ui/views/App/Styles/ManageAccountsStyle.qml
</file>
<file>
ui/views/App/Styles/qmldir
</file>
<file>
ui/views/App/Styles/Settings/SettingsWindowStyle.qml
</file>
</qresource>
...
...
linphone-desktop/src/components/settings/AccountSettingsModel.cpp
View file @
37d0ac55
...
...
@@ -29,10 +29,13 @@
// =============================================================================
AccountSettingsModel
::
AccountSettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
m_default_proxy
=
CoreManager
::
getInstance
()
->
getCore
()
->
getDefaultProxyConfig
();
void
AccountSettingsModel
::
setDefaultProxyConfig
(
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
)
{
CoreManager
::
getInstance
()
->
getCore
()
->
setDefaultProxyConfig
(
proxy_config
);
emit
accountUpdated
();
}
// -----------------------------------------------------------------------------
QString
AccountSettingsModel
::
getUsername
()
const
{
shared_ptr
<
linphone
::
Address
>
address
=
getDefaultSipAddress
();
const
string
&
display_name
=
address
->
getDisplayName
();
...
...
@@ -52,6 +55,8 @@ void AccountSettingsModel::setUsername (const QString &username) {
emit
accountUpdated
();
}
// -----------------------------------------------------------------------------
Presence
::
PresenceLevel
AccountSettingsModel
::
getPresenceLevel
()
const
{
return
Presence
::
Green
;
}
...
...
@@ -60,15 +65,38 @@ Presence::PresenceStatus AccountSettingsModel::getPresenceStatus () const {
return
Presence
::
Online
;
}
// -----------------------------------------------------------------------------
QString
AccountSettingsModel
::
getSipAddress
()
const
{
return
::
Utils
::
linphoneStringToQString
(
getDefaultSipAddress
()
->
asStringUriOnly
());
}
QVariantList
AccountSettingsModel
::
getAccounts
()
const
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
QVariantList
accounts
;
{
QVariantMap
account
;
account
[
"sipAddress"
]
=
::
Utils
::
linphoneStringToQString
(
core
->
getPrimaryContactParsed
()
->
asStringUriOnly
());
account
[
"proxyConfig"
].
setValue
(
shared_ptr
<
linphone
::
ProxyConfig
>
());
accounts
<<
account
;
}
for
(
const
auto
&
proxy_config
:
core
->
getProxyConfigList
())
{
QVariantMap
account
;
account
[
"sipAddress"
]
=
::
Utils
::
linphoneStringToQString
(
proxy_config
->
getIdentityAddress
()
->
asStringUriOnly
());
account
[
"proxyConfig"
].
setValue
(
proxy_config
);
accounts
<<
account
;
}
return
accounts
;
}
// -----------------------------------------------------------------------------
shared_ptr
<
linphone
::
Address
>
AccountSettingsModel
::
getDefaultSipAddress
()
const
{
if
(
m_default_proxy
)
return
m_default_proxy
->
getIdentityAddress
();
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
shared_ptr
<
linphone
::
ProxyConfig
>
proxy_config
=
core
->
getDefaultProxyConfig
();
return
CoreManager
::
getInstance
()
->
getCore
()
->
getPrimaryContactParsed
();
return
proxy_config
?
proxy_config
->
getIdentityAddress
()
:
core
->
getPrimaryContactParsed
();
}
linphone-desktop/src/components/settings/AccountSettingsModel.hpp
View file @
37d0ac55
...
...
@@ -27,28 +27,22 @@
#include <QObject>
// ===================================================================
// ===================================================================
==========
class
AccountSettingsModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
QString
username
READ
getUsername
WRITE
setUsername
NOTIFY
accountUpdated
);
Q_PROPERTY
(
QString
sipAddress
READ
getSipAddress
NOTIFY
accountUpdated
);
Q_PROPERTY
(
QVariantList
accounts
READ
getAccounts
NOTIFY
accountUpdated
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
CONSTANT
);
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
CONSTANT
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
CONSTANT
);
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
CONSTANT
);
public:
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
);
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{}
Q_INVOKABLE
void
setDefaultProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
);
signals:
void
accountUpdated
();
...
...
@@ -61,10 +55,11 @@ private:
Presence
::
PresenceStatus
getPresenceStatus
()
const
;
QString
getSipAddress
()
const
;
QVariantList
getAccounts
()
const
;
std
::
shared_ptr
<
linphone
::
Address
>
getDefaultSipAddress
()
const
;
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
m_default_proxy
;
};
Q_DECLARE_METATYPE
(
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
);
#endif // ACCOUNT_SETTINGS_MODEL_H_
linphone-desktop/ui/modules/Common/Form/ComboBox.qml
View file @
37d0ac55
...
...
@@ -9,8 +9,6 @@ import Common.Styles 1.0
ComboBox
{
id
:
comboBox
textRole
:
'
key
'
// ---------------------------------------------------------------------------
background
:
Rectangle
{
...
...
@@ -67,7 +65,9 @@ ComboBox {
font.bold
:
comboBox
.
currentIndex
===
index
hoverEnabled
:
true
text
:
key
text
:
textRole
.
length
?
(
typeof
modelData
!==
'
undefined
'
?
modelData
[
textRole
]
:
model
[
textRole
])
:
modelData
width
:
comboBox
.
width
}
}
linphone-desktop/ui/views/App/ManageAccounts.qml
View file @
37d0ac55
import
QtQuick
2.7
import
QtQuick
.
Controls
2.0
import
QtQuick
.
Layouts
1.3
import
Common
1.0
import
Linphone
1.0
import
Utils
1.0
import
App
.
Styles
1.0
// =============================================================================
DialogPlus
{
descriptionText
:
qsTr
(
'
manageAccountsDescription
'
)
minimumHeight
:
328
minimumWidth
:
480
title
:
qsTr
(
'
manageAccountsTitle
'
)
buttons
:
[
TextButtonB
{
text
:
qsTr
(
'
ok
'
)
buttons
:
TextButtonA
{
text
:
qsTr
(
'
validate
'
)
onClicked
:
exit
(
0
)
}
]
// TODO: Compute list max.
ScrollableListView
{
id
:
accounts
anchors.fill
:
parent
model
:
model1
// TMP
delegate
:
Item
{
function
isDefaultAccount
()
{
return
accounts
.
currentIndex
===
index
}
centeredButtons
:
true
title
:
qsTr
(
'
manageAccountsTitle
'
)
height
:
34
width
:
parent
.
width
height
:
ManageAccountsStyle
.
height
width
:
ManageAccountsStyle
.
width
Rectangle
{
anchors.fill
:
parent
color
:
isDefaultAccount
()
?
'
#EAEAEA
'
:
'
transparent
'
minimumHeight
:
ManageAccountsStyle
.
height
minimumWidth
:
ManageAccountsStyle
.
width
maximumHeight
:
ManageAccountsStyle
.
height
maximumWidth
:
ManageAccountsStyle
.
width
RowLayout
{
anchors.fill
:
parent
anchors.leftMargin
:
15
anchors.rightMargin
:
15
spacing
:
15
// ---------------------------------------------------------------------------
// Is default account?
Icon
{
Layout.preferredHeight
:
20
Layout.preferredWidth
:
20
icon
:
isDefaultAccount
()
?
'
valid
'
:
''
Column
{
anchors
{
fill
:
parent
leftMargin
:
ManageAccountsStyle
.
leftMargin
rightMargin
:
ManageAccountsStyle
.
rightMargin
}
// Sip account.
spacing
:
ManageAccountsStyle
.
input
.
spacing
Text
{
Layout.fillWidth
:
true
clip
:
true
color
:
'
#59575A
'
text
:
$sipAddress
verticalAlignment
:
Text
.
AlignVCenter
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
onClicked
:
accounts
.
currentIndex
=
index
}
}
color
:
ManageAccountsStyle
.
input
.
legend
.
color
elide
:
Text
.
ElideRight
// Presence.
Icon
{
Layout.preferredHeight
:
20
// TMP
Layout.preferredWidth
:
20
// TMP
icon
:
'
led_
'
+
$presence
font
{
bold
:
true
pointSize
:
ManageAccountsStyle
.
input
.
legend
.
fontSize
}
// Update presence.
TransparentComboBox
{
Layout.preferredWidth
:
160
model
:
model2
// TMP.
textRole
:
'
key
'
}
}
}
}
text
:
qsTr
(
'
selectAccountLabel
'
)
}
// =================================================================
// TMP
// =================================================================
ComboBox
{
id
:
email
ListModel
{
id
:
model1
currentIndex
:
Utils
.
findIndex
(
AccountSettingsModel
.
accounts
,
function
(
account
)
{
return
account
.
sipAddress
===
AccountSettingsModel
.
sipAddress
})
ListElement
{
$presence
:
'
connected
'
$sipAddress
:
'
jim.williams.zzzz.yyyy.kkkk.sip.linphone.org
'
}
ListElement
{
$presence
:
'
connected
'
$sipAddress
:
'
toto.lala.sip.linphone.org
'
}
ListElement
{
$presence
:
'
disconnected
'
$sipAddress
:
'
machin.truc.sip.linphone.org
'
}
ListElement
{
$presence
:
'
absent
'
$sipAddress
:
'
hey.listen.sip.linphone.org
'
}
ListElement
{
$presence
:
'
do_not_disturb
'
$sipAddress
:
'
valentin.cognito.sip.linphone.org
'
}
ListElement
{
$presence
:
'
do_not_disturb
'
$sipAddress
:
'
charles.henri.sip.linphone.org
'
}
ListElement
{
$presence
:
'
disconnected
'
$sipAddress
:
'
yesyes.nono.sip.linphone.org
'
}
ListElement
{
$presence
:
'
connected
'
$sipAddress
:
'
nsa.sip.linphone.org
'
}
}
model
:
AccountSettingsModel
.
accounts
textRole
:
'
sipAddress
'
ListModel
{
id
:
model2
ListElement
{
key
:
qsTr
(
'
onlinePresence
'
);
value
:
1
}
ListElement
{
key
:
qsTr
(
'
busyPresence
'
);
value
:
2
}
ListElement
{
key
:
qsTr
(
'
beRightBackPresence
'
);
value
:
3
}
ListElement
{
key
:
qsTr
(
'
awayPresence
'
);
value
:
4
}
ListElement
{
key
:
qsTr
(
'
onThePhonePresence
'
);
value
:
5
}
ListElement
{
key
:
qsTr
(
'
outToLunchPresence
'
);
value
:
6
}
ListElement
{
key
:
qsTr
(
'
doNotDisturbPresence
'
);
value
:
7
}
ListElement
{
key
:
qsTr
(
'
movedPresence
'
);
value
:
8
}
ListElement
{
key
:
qsTr
(
'
usingAnotherMessagingServicePresence
'
);
value
:
9
}
ListElement
{
key
:
qsTr
(
'
offlinePresence
'
);
value
:
10
}
onActivated
:
AccountSettingsModel
.
setDefaultProxyConfig
(
model
[
index
].
proxyConfig
)
}
}
}
linphone-desktop/ui/views/App/Settings/SettingsUi.qml
View file @
37d0ac55
...
...
@@ -41,6 +41,7 @@ TabContainer {
})
}
textRole
:
'
key
'
model
:
ListModel
{}
Component.onCompleted
:
{
...
...
linphone-desktop/ui/views/App/Styles/ManageAccountsStyle.qml
0 → 100644
View file @
37d0ac55
pragma
Singleton
import
QtQuick
2.7
import
Common
1.0
// =============================================================================
QtObject
{
property
int
height
:
316
property
int
leftMargin
:
35
property
int
rightMargin
:
35
property
int
width
:
480
property
QtObject
input
:
QtObject
{
property
int
spacing
:
6
property
QtObject
legend
:
QtObject
{
property
color
color
:
Colors
.
j
property
int
fontSize
:
10
}
}
}
linphone-desktop/ui/views/App/Styles/qmldir
View file @
37d0ac55
...
...
@@ -5,6 +5,7 @@ module App.Styles
# Views styles -----------------------------------------------------------------
singleton InviteFriendsStyle 1.0 InviteFriendsStyle.qml
singleton ManageAccountsStyle 1.0 ManageAccountsStyle.qml
singleton CallStyle 1.0 Calls/CallStyle.qml
singleton CallsWindowStyle 1.0 Calls/CallsWindowStyle.qml
...
...
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