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
8d5e9a82
Commit
8d5e9a82
authored
Apr 12, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Account/AccountStatus): handle registration state
parent
873f9df4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
14 deletions
+99
-14
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+1
-0
CoreHandlers.cpp
linphone-desktop/src/components/core/CoreHandlers.cpp
+6
-6
CoreHandlers.hpp
linphone-desktop/src/components/core/CoreHandlers.hpp
+2
-1
AccountSettingsModel.cpp
...-desktop/src/components/settings/AccountSettingsModel.cpp
+43
-0
AccountSettingsModel.hpp
...-desktop/src/components/settings/AccountSettingsModel.hpp
+26
-1
AccountStatus.qml
...one-desktop/ui/modules/Linphone/Account/AccountStatus.qml
+21
-6
No files found.
linphone-desktop/CMakeLists.txt
View file @
8d5e9a82
...
...
@@ -42,6 +42,7 @@ if(NOT WIN32)
-Wall \
-Wcast-align \
-Wconversion \
-Werror=return-type \
-Wextra \
-Wfloat-equal \
-Winit-self \
...
...
linphone-desktop/src/components/core/CoreHandlers.cpp
View file @
8d5e9a82
...
...
@@ -78,17 +78,17 @@ void CoreHandlers::onNotifyPresenceReceivedForUriOrTel (
}
void
CoreHandlers
::
onNotifyPresenceReceived
(
const
s
td
::
s
hared_ptr
<
linphone
::
Core
>
&
,
const
s
td
::
s
hared_ptr
<
linphone
::
Friend
>
&
linphone_friend
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
Friend
>
&
linphone_friend
)
{
linphone_friend
->
getData
<
ContactModel
>
(
"contact-model"
).
refreshPresence
();
}
void
CoreHandlers
::
onRegistrationStateChanged
(
const
shared_ptr
<
linphone
::
Core
>
&
core
,
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
config
,
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_
config
,
linphone
::
RegistrationState
state
,
const
string
&
message
const
string
&
)
{
// TODO.
emit
registrationStateChanged
(
proxy_config
,
state
);
}
linphone-desktop/src/components/core/CoreHandlers.hpp
View file @
8d5e9a82
...
...
@@ -37,6 +37,7 @@ signals:
void
callStateChanged
(
const
std
::
shared_ptr
<
linphone
::
Call
>
&
call
,
linphone
::
CallState
state
);
void
messageReceived
(
const
std
::
shared_ptr
<
linphone
::
ChatMessage
>
&
message
);
void
presenceReceived
(
const
QString
&
sip_address
,
const
std
::
shared_ptr
<
const
linphone
::
PresenceModel
>
&
presence_model
);
void
registrationStateChanged
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
,
linphone
::
RegistrationState
state
);
private:
void
onAuthenticationRequested
(
...
...
@@ -72,7 +73,7 @@ private:
void
onRegistrationStateChanged
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
core
,
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
config
,
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_
config
,
linphone
::
RegistrationState
state
,
const
std
::
string
&
message
)
override
;
...
...
linphone-desktop/src/components/settings/AccountSettingsModel.cpp
View file @
8d5e9a82
...
...
@@ -31,6 +31,34 @@ using namespace std;
// =============================================================================
inline
AccountSettingsModel
::
RegistrationState
mapLinphoneRegistrationStateToUi
(
linphone
::
RegistrationState
state
)
{
switch
(
state
)
{
case
linphone
:
:
RegistrationStateNone
:
case
linphone
:
:
RegistrationStateCleared
:
case
linphone
:
:
RegistrationStateFailed
:
return
AccountSettingsModel
::
RegistrationStateNotRegistered
;
case
linphone
:
:
RegistrationStateProgress
:
return
AccountSettingsModel
::
RegistrationStateInProgress
;
case
linphone
:
:
RegistrationStateOk
:
break
;
}
return
AccountSettingsModel
::
RegistrationStateRegistered
;
}
// -----------------------------------------------------------------------------
AccountSettingsModel
::
AccountSettingsModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
QObject
::
connect
(
&
(
*
CoreManager
::
getInstance
()
->
getHandlers
()),
&
CoreHandlers
::
registrationStateChanged
,
this
,
&
AccountSettingsModel
::
handleRegistrationStateChanged
);
}
// -----------------------------------------------------------------------------
bool
AccountSettingsModel
::
addOrUpdateProxyConfig
(
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
...
...
@@ -73,6 +101,7 @@ QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr<li
map
[
"registerEnabled"
]
=
proxy_config
->
registerEnabled
();
map
[
"publishPresence"
]
=
proxy_config
->
publishEnabled
();
map
[
"avpfEnabled"
]
=
proxy_config
->
getAvpfMode
()
==
linphone
::
AVPFMode
::
AVPFModeEnabled
;
map
[
"registrationState"
]
=
mapLinphoneRegistrationStateToUi
(
proxy_config
->
getState
());
return
map
;
}
...
...
@@ -163,6 +192,11 @@ QString AccountSettingsModel::getSipAddress () const {
return
::
Utils
::
linphoneStringToQString
(
getUsedSipAddress
()
->
asStringUriOnly
());
}
AccountSettingsModel
::
RegistrationState
AccountSettingsModel
::
getRegistrationState
()
const
{
shared_ptr
<
linphone
::
ProxyConfig
>
proxy_config
=
CoreManager
::
getInstance
()
->
getCore
()
->
getDefaultProxyConfig
();
return
proxy_config
?
mapLinphoneRegistrationStateToUi
(
proxy_config
->
getState
())
:
RegistrationStateNotRegistered
;
}
// -----------------------------------------------------------------------------
QString
AccountSettingsModel
::
getPrimaryUsername
()
const
{
...
...
@@ -243,3 +277,12 @@ shared_ptr<const linphone::Address> AccountSettingsModel::getUsedSipAddress () c
return
proxy_config
?
proxy_config
->
getIdentityAddress
()
:
core
->
getPrimaryContactParsed
();
}
// -----------------------------------------------------------------------------
void
AccountSettingsModel
::
handleRegistrationStateChanged
(
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
,
linphone
::
RegistrationState
)
{
emit
accountSettingsUpdated
();
}
linphone-desktop/src/components/settings/AccountSettingsModel.hpp
View file @
8d5e9a82
...
...
@@ -31,9 +31,12 @@
class
AccountSettingsModel
:
public
QObject
{
Q_OBJECT
;
// Selected proxy config.
Q_PROPERTY
(
QString
username
READ
getUsername
WRITE
setUsername
NOTIFY
accountSettingsUpdated
);
Q_PROPERTY
(
QString
sipAddress
READ
getSipAddress
NOTIFY
accountSettingsUpdated
);
Q_PROPERTY
(
RegistrationState
registrationState
READ
getRegistrationState
NOTIFY
accountSettingsUpdated
);
// Default info.
Q_PROPERTY
(
QString
primaryDisplayname
READ
getPrimaryDisplayname
WRITE
setPrimaryDisplayname
NOTIFY
accountSettingsUpdated
);
Q_PROPERTY
(
QString
primaryUsername
READ
getPrimaryUsername
WRITE
setPrimaryUsername
NOTIFY
accountSettingsUpdated
);
Q_PROPERTY
(
QString
primarySipAddress
READ
getPrimarySipAddress
NOTIFY
accountSettingsUpdated
);
...
...
@@ -41,7 +44,16 @@ class AccountSettingsModel : public QObject {
Q_PROPERTY
(
QVariantList
accounts
READ
getAccounts
NOTIFY
accountSettingsUpdated
);
public:
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{}
enum
RegistrationState
{
RegistrationStateRegistered
,
RegistrationStateNotRegistered
,
RegistrationStateInProgress
};
Q_ENUM
(
RegistrationState
);
AccountSettingsModel
(
QObject
*
parent
=
Q_NULLPTR
);
~
AccountSettingsModel
()
=
default
;
bool
addOrUpdateProxyConfig
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
);
...
...
@@ -63,6 +75,10 @@ private:
QString
getSipAddress
()
const
;
RegistrationState
getRegistrationState
()
const
;
// ---------------------------------------------------------------------------
QString
getPrimaryUsername
()
const
;
void
setPrimaryUsername
(
const
QString
&
username
);
...
...
@@ -71,10 +87,19 @@ private:
QString
getPrimarySipAddress
()
const
;
// ---------------------------------------------------------------------------
QVariantList
getAccounts
()
const
;
void
setUsedSipAddress
(
const
std
::
shared_ptr
<
const
linphone
::
Address
>
&
address
);
std
::
shared_ptr
<
const
linphone
::
Address
>
getUsedSipAddress
()
const
;
// ---------------------------------------------------------------------------
void
handleRegistrationStateChanged
(
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
proxy_config
,
linphone
::
RegistrationState
state
);
};
Q_DECLARE_METATYPE
(
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
);
...
...
linphone-desktop/ui/modules/Linphone/Account/AccountStatus.qml
View file @
8d5e9a82
import
QtQuick
2.7
import
QtQuick
.
Layouts
1.3
import
Common
1.0
import
Linphone
1.0
import
Linphone
.
Styles
1.0
...
...
@@ -11,8 +12,6 @@ Item {
// ---------------------------------------------------------------------------
readonly
property
var
_account
:
AccountSettingsModel
signal
clicked
// ---------------------------------------------------------------------------
...
...
@@ -25,12 +24,28 @@ Item {
spacing
:
AccountStatusStyle
.
horizontalSpacing
width
:
parent
.
width
PresenceLevel
{
Item
{
Layout.alignment
:
Qt
.
AlignBottom
Layout.bottomMargin
:
AccountStatusStyle
.
presenceLevel
.
bottomMargin
Layout.preferredHeight
:
AccountStatusStyle
.
presenceLevel
.
size
Layout.preferredWidth
:
AccountStatusStyle
.
presenceLevel
.
size
level
:
OwnPresenceModel
.
presenceLevel
PresenceLevel
{
anchors.fill
:
parent
level
:
OwnPresenceModel
.
presenceLevel
visible
:
AccountSettingsModel
.
registrationState
===
AccountSettingsModel
.
RegistrationStateRegistered
}
BusyIndicator
{
anchors.fill
:
parent
running
:
AccountSettingsModel
.
registrationState
===
AccountSettingsModel
.
RegistrationStateInProgress
}
Icon
{
iconSize
:
parent
.
width
icon
:
'
generic_error
'
visible
:
AccountSettingsModel
.
registrationState
===
AccountSettingsModel
.
RegistrationStateNotRegistered
}
}
Text
{
...
...
@@ -40,7 +55,7 @@ Item {
elide
:
Text
.
ElideRight
font.bold
:
true
font.pointSize
:
AccountStatusStyle
.
username
.
fontSize
text
:
accountStatus
.
_account
.
username
text
:
AccountSettingsModel
.
username
verticalAlignment
:
Text
.
AlignBottom
}
}
...
...
@@ -50,7 +65,7 @@ Item {
elide
:
Text
.
ElideRight
font.pointSize
:
AccountStatusStyle
.
sipAddress
.
fontSize
height
:
parent
.
height
/
2
text
:
accountStatus
.
_account
.
sipAddress
text
:
AccountSettingsModel
.
sipAddress
verticalAlignment
:
Text
.
AlignTop
width
:
parent
.
width
}
...
...
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