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
7339b7e4
Commit
7339b7e4
authored
Mar 17, 2017
by
Ghislain MARY
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle presence.
parent
28815a2e
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
316 additions
and
222 deletions
+316
-222
CMakeLists.txt
linphone-desktop/CMakeLists.txt
+3
-0
chevron_green.svg
linphone-desktop/assets/images/chevron_green.svg
+0
-13
chevron_orange.svg
linphone-desktop/assets/images/chevron_orange.svg
+0
-13
chevron_red.svg
linphone-desktop/assets/images/chevron_red.svg
+0
-13
chevron_white.svg
linphone-desktop/assets/images/chevron_white.svg
+0
-13
en.ts
linphone-desktop/assets/languages/en.ts
+10
-30
fr.ts
linphone-desktop/assets/languages/fr.ts
+15
-24
resources.qrc
linphone-desktop/resources.qrc
+0
-6
App.cpp
linphone-desktop/src/app/App.cpp
+15
-3
ContactModel.cpp
linphone-desktop/src/components/contact/ContactModel.cpp
+8
-1
ContactModel.hpp
linphone-desktop/src/components/contact/ContactModel.hpp
+6
-2
CoreHandlers.cpp
linphone-desktop/src/components/core/CoreHandlers.cpp
+10
-0
CoreHandlers.hpp
linphone-desktop/src/components/core/CoreHandlers.hpp
+7
-0
Presence.cpp
linphone-desktop/src/components/presence/Presence.cpp
+69
-0
Presence.hpp
linphone-desktop/src/components/presence/Presence.hpp
+7
-19
PresenceStatusModel.cpp
...e-desktop/src/components/presence/PresenceStatusModel.cpp
+81
-0
PresenceStatusModel.hpp
...e-desktop/src/components/presence/PresenceStatusModel.hpp
+55
-0
AccountStatus.qml
...one-desktop/ui/modules/Linphone/Account/AccountStatus.qml
+3
-3
PresenceLevel.qml
...ne-desktop/ui/modules/Linphone/Presence/PresenceLevel.qml
+1
-22
PresenceString.qml
...e-desktop/ui/modules/Linphone/Presence/PresenceString.qml
+0
-44
PresenceStringStyle.qml
.../modules/Linphone/Styles/Presence/PresenceStringStyle.qml
+0
-11
qmldir
linphone-desktop/ui/modules/Linphone/Styles/qmldir
+0
-2
qmldir
linphone-desktop/ui/modules/Linphone/qmldir
+0
-1
Contacts.qml
linphone-desktop/ui/views/App/Main/Contacts.qml
+5
-2
MainWindow.qml
linphone-desktop/ui/views/App/Main/MainWindow.qml
+1
-0
ManageAccountsWindow.qml
linphone-desktop/ui/views/App/ManageAccountsWindow.qml
+18
-0
ContactsStyle.qml
linphone-desktop/ui/views/App/Styles/Main/ContactsStyle.qml
+2
-0
No files found.
linphone-desktop/CMakeLists.txt
View file @
7339b7e4
...
...
@@ -90,6 +90,8 @@ set(SOURCES
src/components/core/CoreHandlers.cpp
src/components/core/CoreManager.cpp
src/components/notifier/Notifier.cpp
src/components/presence/Presence.cpp
src/components/presence/PresenceStatusModel.cpp
src/components/settings/AccountSettingsModel.cpp
src/components/settings/SettingsModel.cpp
src/components/sip-addresses/SipAddressesModel.cpp
...
...
@@ -121,6 +123,7 @@ set(HEADERS
src/components/core/CoreManager.hpp
src/components/notifier/Notifier.hpp
src/components/presence/Presence.hpp
src/components/presence/PresenceStatusModel.hpp
src/components/settings/AccountSettingsModel.hpp
src/components/settings/SettingsModel.hpp
src/components/sip-addresses/SipAddressesModel.hpp
...
...
linphone-desktop/assets/images/chevron_green.svg
deleted
100644 → 0
View file @
28815a2e
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
<title>
status_username_available
</title>
<desc>
Created with Sketch.
</desc>
<defs></defs>
<g
id=
"Symbols"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"status_username_available"
>
<circle
fill=
"#9ECD1D"
transform=
"translate(8.000000, 8.000000) rotate(-180.000000) translate(-8.000000, -8.000000) "
cx=
"8"
cy=
"8"
r=
"8"
></circle>
<path
d=
"M6.28571429,12 L9.71428571,8.57142857 M6.28859181,5.14285714 L9.71428571,8.57142857"
stroke=
"#FFFFFF"
stroke-width=
"2"
stroke-linecap=
"round"
stroke-linejoin=
"round"
transform=
"translate(8.000000, 8.571429) rotate(-270.000000) translate(-8.000000, -8.571429) "
></path>
</g>
</g>
</svg>
\ No newline at end of file
linphone-desktop/assets/images/chevron_orange.svg
deleted
100644 → 0
View file @
28815a2e
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
<title>
status_username_absent
</title>
<desc>
Created with Sketch.
</desc>
<defs></defs>
<g
id=
"Symbols"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"status_username_absent"
>
<circle
fill=
"#EFAE00"
transform=
"translate(8.000000, 8.000000) rotate(-180.000000) translate(-8.000000, -8.000000) "
cx=
"8"
cy=
"8"
r=
"8"
></circle>
<path
d=
"M6.28571429,12 L9.71428571,8.57142857 M6.28859181,5.14285714 L9.71428571,8.57142857"
stroke=
"#FFFFFF"
stroke-width=
"2"
stroke-linecap=
"round"
stroke-linejoin=
"round"
transform=
"translate(8.000000, 8.571429) rotate(-270.000000) translate(-8.000000, -8.571429) "
></path>
</g>
</g>
</svg>
\ No newline at end of file
linphone-desktop/assets/images/chevron_red.svg
deleted
100644 → 0
View file @
28815a2e
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
<title>
status_username_busy
</title>
<desc>
Created with Sketch.
</desc>
<defs></defs>
<g
id=
"Symbols"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"status_username_busy"
>
<circle
fill=
"#DC4100"
transform=
"translate(8.000000, 8.000000) rotate(-180.000000) translate(-8.000000, -8.000000) "
cx=
"8"
cy=
"8"
r=
"8"
></circle>
<path
d=
"M6.28571429,12 L9.71428571,8.57142857 M6.28859181,5.14285714 L9.71428571,8.57142857"
stroke=
"#FFFFFF"
stroke-width=
"2"
stroke-linecap=
"round"
stroke-linejoin=
"round"
transform=
"translate(8.000000, 8.571429) rotate(-270.000000) translate(-8.000000, -8.571429) "
></path>
</g>
</g>
</svg>
\ No newline at end of file
linphone-desktop/assets/images/chevron_white.svg
deleted
100644 → 0
View file @
28815a2e
<?xml version="1.0" encoding="UTF-8"?>
<svg
width=
"16px"
height=
"16px"
viewBox=
"0 0 16 16"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
<title>
status_username_disconnected
</title>
<desc>
Created with Sketch.
</desc>
<defs></defs>
<g
id=
"Symbols"
stroke=
"none"
stroke-width=
"1"
fill=
"none"
fill-rule=
"evenodd"
>
<g
id=
"status_username_disconnected"
>
<circle
fill=
"#B1B1B1"
transform=
"translate(8.000000, 8.000000) rotate(-180.000000) translate(-8.000000, -8.000000) "
cx=
"8"
cy=
"8"
r=
"8"
></circle>
<path
d=
"M6.28571429,12 L9.71428571,8.57142857 M6.28859181,5.14285714 L9.71428571,8.57142857"
stroke=
"#FFFFFF"
stroke-width=
"2"
stroke-linecap=
"round"
stroke-linejoin=
"round"
transform=
"translate(8.000000, 8.571429) rotate(-270.000000) translate(-8.000000, -8.571429) "
></path>
</g>
</g>
</svg>
\ No newline at end of file
linphone-desktop/assets/languages/en.ts
View file @
7339b7e4
...
...
@@ -586,48 +586,28 @@ Server url not configured.</translation>
<
source
>
selectAccountLabel
<
/source
>
<
translation
type
=
"
unfinished
"
>
Select
you
active
account
<
/translation
>
<
/message
>
<
message
>
<
source
>
selectPresenceLabel
<
/source
>
<
translation
>
Select
a
presence
status
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Presence
String
<
/name
>
<
name
>
Presence
<
/name
>
<
message
>
<
source
>
presenceOnline
<
/source
>
<
translation
type
=
"
unfinished
"
>
<
/translation
>
<
translation
>
Available
<
/translation
>
<
/message
>
<
message
>
<
source
>
presence
OutToLunch
<
/source
>
<
translation
type
=
"
unfinished
"
>
<
/translation
>
<
source
>
presence
Busy
<
/source
>
<
translation
>
Busy
<
/translation
>
<
/message
>
<
message
>
<
source
>
presenceDoNotDisturb
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceMoved
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceUsingAnotherMessagingService
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
>
Do
not
disturb
<
/translation
>
<
/message
>
<
message
>
<
source
>
presenceOffline
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceUnknown
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceBeRightBack
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceAway
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceOnThePhone
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
>
Offline
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
7339b7e4
...
...
@@ -586,48 +586,39 @@ Url du serveur non configurée.</translation>
<
source
>
selectAccountLabel
<
/source
>
<
translation
type
=
"
unfinished
"
>
S
é
lectionner
votre
compte
principal
<
/translation
>
<
/message
>
<
message
>
<
source
>
selectPresenceLabel
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Presence
String
<
/name
>
<
name
>
Presence
<
/name
>
<
message
>
<
source
>
presenceOnline
<
/source
>
<
translation
>
En
ligne
<
/translation
>
<
translation
type
=
"
unfinished
"
>
En
ligne
<
/translation
>
<
/message
>
<
message
>
<
source
>
presence
OutToLunch
<
/source
>
<
source
>
presence
Busy
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceDoNotDisturb
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceMoved
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceUsingAnotherMessagingService
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceOffline
<
/source
>
<
translation
>
Hors
-
ligne
<
/translation
>
<
/message
>
<
message
>
<
source
>
presenceUnknown
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
presenceBeRightBack
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
translation
type
=
"
unfinished
"
>
Hors
-
ligne
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
PresenceString
<
/name
>
<
message
>
<
source
>
presence
Away
<
/source
>
<
translation
type
=
"
unfinished
"
>
<
/translation
>
<
source
>
presence
Online
<
/source
>
<
translation
type
=
"
vanished
"
>
En
ligne
<
/translation
>
<
/message
>
<
message
>
<
source
>
presenceO
nThePho
ne
<
/source
>
<
translation
type
=
"
unfinished
"
>
<
/translation
>
<
source
>
presenceO
ffli
ne
<
/source
>
<
translation
type
=
"
vanished
"
>
Hors
-
ligne
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
linphone-desktop/resources.qrc
View file @
7339b7e4
...
...
@@ -45,10 +45,6 @@
<file>
assets/images/chat_normal.svg
</file>
<file>
assets/images/chat_pressed.svg
</file>
<file>
assets/images/chat_send.svg
</file>
<file>
assets/images/chevron_green.svg
</file>
<file>
assets/images/chevron_orange.svg
</file>
<file>
assets/images/chevron_red.svg
</file>
<file>
assets/images/chevron_white.svg
</file>
<file>
assets/images/collapse.svg
</file>
<file>
assets/images/contact_add_hovered.svg
</file>
<file>
assets/images/contact_add_normal.svg
</file>
...
...
@@ -283,7 +279,6 @@
<file>
ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml
</file>
<file>
ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml
</file>
<file>
ui/modules/Linphone/Presence/PresenceLevel.qml
</file>
<file>
ui/modules/Linphone/Presence/PresenceString.qml
</file>
<file>
ui/modules/Linphone/qmldir
</file>
<file>
ui/modules/Linphone/SmartSearchBar.qml
</file>
<file>
ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml
</file>
...
...
@@ -300,7 +295,6 @@
<file>
ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Notifications/NotificationStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/qmldir
</file>
<file>
ui/modules/Linphone/Styles/SmartSearchBarStyle.qml
</file>
<file>
ui/modules/Linphone/Styles/TimelineStyle.qml
</file>
...
...
linphone-desktop/src/app/App.cpp
View file @
7339b7e4
...
...
@@ -25,6 +25,7 @@
#include "../components/chat/ChatProxyModel.hpp"
#include "../components/contacts/ContactsListProxyModel.hpp"
#include "../components/core/CoreManager.hpp"
#include "../components/presence/PresenceStatusModel.hpp"
#include "../components/settings/AccountSettingsModel.hpp"
#include "../components/smart-search-bar/SmartSearchBarModel.hpp"
#include "../components/timeline/TimelineModel.hpp"
...
...
@@ -248,9 +249,6 @@ void App::registerTypes () {
qmlRegisterUncreatableType
<
ContactObserver
>
(
"Linphone"
,
1
,
0
,
"ContactObserver"
,
"ContactObserver is uncreatable."
);
qmlRegisterUncreatableType
<
Presence
>
(
"Linphone"
,
1
,
0
,
"Presence"
,
"Presence is uncreatable."
);
qmlRegisterUncreatableType
<
VcardModel
>
(
"Linphone"
,
1
,
0
,
"VcardModel"
,
"VcardModel is uncreatable."
);
...
...
@@ -290,6 +288,20 @@ void App::registerTypes () {
}
);
qmlRegisterSingletonType
<
Presence
>
(
"Linphone"
,
1
,
0
,
"Presence"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
new
Presence
();
}
);
qmlRegisterSingletonType
<
PresenceStatusModel
>
(
"Linphone"
,
1
,
0
,
"PresenceStatusModel"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
return
new
PresenceStatusModel
();
}
);
qmlRegisterSingletonType
<
SettingsModel
>
(
"Linphone"
,
1
,
0
,
"SettingsModel"
,
[](
QQmlEngine
*
,
QJSEngine
*
)
->
QObject
*
{
...
...
linphone-desktop/src/components/contact/ContactModel.cpp
View file @
7339b7e4
...
...
@@ -35,6 +35,7 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
m_vcard
=
make_shared
<
VcardModel
>
(
linphone_friend
->
getVcard
());
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
m_vcard
.
get
(),
QQmlEngine
::
CppOwnership
);
m_linphone_friend
->
setData
(
"contact-model"
,
*
this
);
}
ContactModel
::
ContactModel
(
VcardModel
*
vcard
)
{
...
...
@@ -48,6 +49,12 @@ ContactModel::ContactModel (VcardModel *vcard) {
engine
->
setObjectOwnership
(
vcard
,
QQmlEngine
::
CppOwnership
);
}
void
ContactModel
::
presenceReceived
()
{
Presence
::
PresenceStatus
status
=
static_cast
<
Presence
::
PresenceStatus
>
(
m_linphone_friend
->
getConsolidatedPresence
());
emit
presenceStatusChanged
(
status
);
emit
presenceLevelChanged
(
Presence
::
getPresenceLevel
(
status
));
}
void
ContactModel
::
startEdit
()
{
m_linphone_friend
->
edit
();
m_old_sip_addresses
=
m_vcard
->
getSipAddresses
();
...
...
@@ -98,7 +105,7 @@ void ContactModel::abortEdit () {
}
Presence
::
PresenceStatus
ContactModel
::
getPresenceStatus
()
const
{
return
Presence
::
PresenceStatus
::
Offline
;
return
static_cast
<
Presence
::
PresenceStatus
>
(
m_linphone_friend
->
getConsolidatedPresence
())
;
}
Presence
::
PresenceLevel
ContactModel
::
getPresenceLevel
()
const
{
...
...
linphone-desktop/src/components/contact/ContactModel.hpp
View file @
7339b7e4
...
...
@@ -31,8 +31,8 @@
class
ContactModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
NOTIFY
contactUpdat
ed
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
NOTIFY
contactUpdat
ed
);
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
NOTIFY
presenceStatusChang
ed
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
NOTIFY
presenceLevelChang
ed
);
Q_PROPERTY
(
VcardModel
*
vcard
READ
getVcardModelPtr
NOTIFY
contactUpdated
);
friend
class
ContactsListModel
;
...
...
@@ -48,12 +48,16 @@ public:
return
m_vcard
;
}
void
presenceReceived
();
Q_INVOKABLE
void
startEdit
();
Q_INVOKABLE
void
endEdit
();
Q_INVOKABLE
void
abortEdit
();
signals:
void
contactUpdated
();
void
presenceStatusChanged
(
Presence
::
PresenceStatus
status
);
void
presenceLevelChanged
(
Presence
::
PresenceLevel
level
);
void
sipAddressAdded
(
const
QString
&
sip_address
);
void
sipAddressRemoved
(
const
QString
&
sip_address
);
...
...
linphone-desktop/src/components/core/CoreHandlers.cpp
View file @
7339b7e4
...
...
@@ -67,6 +67,16 @@ void CoreHandlers::onMessageReceived (
}
}
void
CoreHandlers
::
onNotifyPresenceReceivedForUriOrTel
(
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
Friend
>
&
lf
,
const
string
&
,
const
shared_ptr
<
linphone
::
PresenceModel
>
&
)
{
ContactModel
*
contact_model
=
&
lf
->
getData
<
ContactModel
>
(
"contact-model"
);
if
(
contact_model
)
contact_model
->
presenceReceived
();
}
void
CoreHandlers
::
onRegistrationStateChanged
(
const
shared_ptr
<
linphone
::
Core
>
&
core
,
const
shared_ptr
<
linphone
::
ProxyConfig
>
&
config
,
...
...
linphone-desktop/src/components/core/CoreHandlers.hpp
View file @
7339b7e4
...
...
@@ -57,6 +57,13 @@ private:
const
std
::
shared_ptr
<
linphone
::
ChatMessage
>
&
message
)
override
;
void
onNotifyPresenceReceivedForUriOrTel
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
lc
,
const
std
::
shared_ptr
<
linphone
::
Friend
>
&
lf
,
const
std
::
string
&
uri_or_tel
,
const
std
::
shared_ptr
<
linphone
::
PresenceModel
>
&
presence_model
)
override
;
void
onRegistrationStateChanged
(
const
std
::
shared_ptr
<
linphone
::
Core
>
&
core
,
const
std
::
shared_ptr
<
linphone
::
ProxyConfig
>
&
config
,
...
...
linphone-desktop/src/components/presence/Presence.cpp
0 → 100644
View file @
7339b7e4
/*
* Presence.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: March 14, 2017
* Author: Ghislain MARY
*/
#include <QtDebug>
#include "Presence.hpp"
// =============================================================================
Presence
::
PresenceLevel
Presence
::
getPresenceLevel
(
const
PresenceStatus
&
status
)
{
switch
(
status
)
{
case
Online
:
return
Green
;
case
Busy
:
return
Orange
;
case
DoNotDisturb
:
return
Red
;
case
Offline
:
default:
return
White
;
}
}
QString
Presence
::
getPresenceStatusAsString
(
const
PresenceStatus
&
status
)
{
switch
(
status
)
{
case
Online
:
return
tr
(
"presenceOnline"
);
case
Busy
:
return
tr
(
"presenceBusy"
);
case
DoNotDisturb
:
return
tr
(
"presenceDoNotDisturb"
);
case
Offline
:
default:
return
tr
(
"presenceOffline"
);
}
}
QString
Presence
::
getPresenceLevelIconName
(
const
PresenceLevel
&
level
)
{
switch
(
level
)
{
case
Green
:
return
"led_green"
;
case
Orange
:
return
"led_orange"
;
case
Red
:
return
"led_red"
;
case
White
:
default:
return
"led_white"
;
}
}
linphone-desktop/src/components/presence/Presence.hpp
View file @
7339b7e4
...
...
@@ -33,15 +33,10 @@ class Presence : public QObject {
public:
enum
PresenceStatus
{
Online
,
BeRightBack
,
Away
,
OnThePhone
,
OutToLunch
,
DoNotDisturb
,
Moved
,
UsingAnotherMessagingService
,
Offline
Online
=
linphone
::
ConsolidatedPresenceOnline
,
Busy
=
linphone
::
ConsolidatedPresenceBusy
,
DoNotDisturb
=
linphone
::
ConsolidatedPresenceDoNotDisturb
,
Offline
=
linphone
::
ConsolidatedPresenceOffline
};
Q_ENUM
(
PresenceStatus
);
...
...
@@ -59,16 +54,9 @@ public:
~
Presence
()
=
default
;
static
PresenceLevel
getPresenceLevel
(
const
PresenceStatus
&
presenceStatus
)
{
if
(
presenceStatus
==
Online
)
return
Green
;
if
(
presenceStatus
==
DoNotDisturb
)
return
Red
;
if
(
presenceStatus
==
Offline
)
return
White
;
return
Orange
;
}
static
PresenceLevel
getPresenceLevel
(
const
PresenceStatus
&
status
);
Q_INVOKABLE
static
QString
getPresenceStatusAsString
(
const
PresenceStatus
&
status
);
Q_INVOKABLE
static
QString
getPresenceLevelIconName
(
const
PresenceLevel
&
level
);
};
#endif // PRESENCE_H_
linphone-desktop/src/components/presence/PresenceStatusModel.cpp
0 → 100644
View file @
7339b7e4
/*
* PresenceStatusModel.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: March 14, 2017
* Author: Ghislain MARY
*/
#include <QtDebug>
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include "PresenceStatusModel.hpp"
// =============================================================================
Presence
::
PresenceLevel
PresenceStatusModel
::
getPresenceLevel
()
const
{
return
Presence
::
getPresenceLevel
(
getPresenceStatus
());
}
Presence
::
PresenceStatus
PresenceStatusModel
::
getPresenceStatus
()
const
{
return
static_cast
<
Presence
::
PresenceStatus
>
(
CoreManager
::
getInstance
()
->
getCore
()
->
getConsolidatedPresence
());
}
void
PresenceStatusModel
::
setPresenceStatus
(
Presence
::
PresenceStatus
status
)
{
shared_ptr
<
linphone
::
Core
>
core
=
CoreManager
::
getInstance
()
->
getCore
();
core
->
setConsolidatedPresence
(
static_cast
<
linphone
::
ConsolidatedPresence
>
(
status
));
emit
presenceStatusChanged
(
status
);
emit
presenceLevelChanged
(
Presence
::
getPresenceLevel
(
status
));
}
// -----------------------------------------------------------------------------
QVariantList
PresenceStatusModel
::
getStatuses
()
const
{
QVariantList
statuses
;
QVariantMap
online_status
;
online_status
[
"presenceLevel"
]
=
Presence
::
Green
;
online_status
[
"presenceStatus"
]
=
Presence
::
Online
;
online_status
[
"presenceIcon"
]
=
Presence
::
getPresenceLevelIconName
(
Presence
::
Green
);
online_status
[
"presenceLabel"
]
=
Presence
::
getPresenceStatusAsString
(
Presence
::
Online
);
statuses
<<
online_status
;
QVariantMap
busy_status
;
busy_status
[
"presenceLevel"
]
=
Presence
::
Orange
;
busy_status
[
"presenceStatus"
]
=
Presence
::
Busy
;
busy_status
[
"presenceIcon"
]
=
Presence
::
getPresenceLevelIconName
(
Presence
::
Orange
);
busy_status
[
"presenceLabel"
]
=
Presence
::
getPresenceStatusAsString
(
Presence
::
Busy
);
statuses
<<
busy_status
;
QVariantMap
do_not_disturb_status
;
do_not_disturb_status
[
"presenceLevel"
]
=
Presence
::
Red
;
do_not_disturb_status
[
"presenceStatus"
]
=
Presence
::
DoNotDisturb
;
do_not_disturb_status
[
"presenceIcon"
]
=
Presence
::
getPresenceLevelIconName
(
Presence
::
Red
);
do_not_disturb_status
[
"presenceLabel"
]
=
Presence
::
getPresenceStatusAsString
(
Presence
::
DoNotDisturb
);
statuses
<<
do_not_disturb_status
;
QVariantMap
offline_status
;
offline_status
[
"presenceLevel"
]
=
Presence
::
White
;
offline_status
[
"presenceStatus"
]
=
Presence
::
Offline
;
offline_status
[
"presenceIcon"
]
=
Presence
::
getPresenceLevelIconName
(
Presence
::
White
);
offline_status
[
"presenceLabel"
]
=
Presence
::
getPresenceStatusAsString
(
Presence
::
Offline
);
statuses
<<
offline_status
;
return
statuses
;
}
linphone-desktop/src/components/presence/PresenceStatusModel.hpp
0 → 100644
View file @
7339b7e4
/*
* PresenceStatusModel.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: March 14, 2017
* Author: Ghislain MARY
*/
#ifndef PRESENCE_STATUS_MODEL_H_
#define PRESENCE_STATUS_MODEL_H_
#include "../presence/Presence.hpp"
#include <QObject>
// =============================================================================
class
PresenceStatusModel
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
QVariantList
statuses
READ
getStatuses
CONSTANT
);
Q_PROPERTY
(
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
NOTIFY
presenceLevelChanged
);
Q_PROPERTY
(
Presence
::
PresenceStatus
presenceStatus
READ
getPresenceStatus
WRITE
setPresenceStatus
NOTIFY
presenceStatusChanged
);
public:
PresenceStatusModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{}
signals:
void
presenceLevelChanged
(
Presence
::
PresenceLevel
level
);
void
presenceStatusChanged
(
Presence
::
PresenceStatus
status
);
private:
Presence
::
PresenceLevel
getPresenceLevel
()
const
;
Presence
::
PresenceStatus
getPresenceStatus
()
const
;
void
setPresenceStatus
(
Presence
::
PresenceStatus
status
);
QVariantList
getStatuses
()
const
;
};
#endif // PRESENCE_STATUS_MODEL_H_
linphone-desktop/ui/modules/Linphone/Account/AccountStatus.qml
View file @
7339b7e4
...
...
@@ -12,6 +12,7 @@ Item {
// ---------------------------------------------------------------------------
property
var
account
property
var
presence
signal
clicked
...
...
@@ -27,11 +28,10 @@ Item {
PresenceLevel
{
Layout.alignment
:
Qt
.
AlignBottom
Layout.bottomMargin
:
AccountStatusStyle
.
presenceLevel
.
bottoMargin
Layout.bottomMargin
:
AccountStatusStyle
.
presenceLevel
.
botto
m
Margin
Layout.preferredHeight
:
AccountStatusStyle
.
presenceLevel
.
size
Layout.preferredWidth
:
AccountStatusStyle
.
presenceLevel
.
size
icon
:
'
chevron
'
level
:
account
.
presenceLevel
level
:
presence
.
presenceLevel
}
Text
{
...
...
linphone-desktop/ui/modules/Linphone/Presence/PresenceLevel.qml
View file @
7339b7e4
...
...
@@ -8,32 +8,11 @@ import Linphone 1.0
// Wrapper to use `icon` property.
Item
{
property
int
level
:
-
1
property
string
icon
:
'
led
'
Icon
{
anchors.centerIn
:
parent
function
_getColorString
()
{
if
(
level
===
Presence
.
Green
)
{
return
'
green
'
}
if
(
level
===
Presence
.
Orange
)
{
return
'
orange
'
}
if
(
level
===
Presence
.
Red
)
{
return
'
red
'
}
if
(
level
===
Presence
.
White
)
{
return
'
white
'
}
}
icon
:
{
var
level
=
_getColorString
()
return
level
?
parent
.
icon
+
'
_
'
+
level
:
''
}
icon
:
Presence
.
getPresenceLevelIconName
(
level
)
iconSize
:
parent
.
height
>
parent
.
width
?
parent
.
width
:
parent
.
height
...
...
linphone-desktop/ui/modules/Linphone/Presence/PresenceString.qml
deleted
100644 → 0
View file @
28815a2e
import
QtQuick
2.7
import
Linphone
1.0
import
Linphone
.
Styles
1.0
// =============================================================================
Text
{
property
int
status
:
-
1
// ---------------------------------------------------------------------------
function
_getStatusString
()
{
switch
(
status
)
{
case
Presence.Online
:
return
qsTr
(
'
presenceOnline
'
)
case
Presence.BeRightBack
:
return
qsTr
(
'
presenceBeRightBack
'
)
case
Presence.Away
:
return
qsTr
(
'
presenceAway
'
)
case
Presence.OnThePhone
:
return
qsTr
(
'
presenceOnThePhone
'
)
case
Presence.OutToLunch
:
return
qsTr
(
'
presenceOutToLunch
'
)
case
Presence.DoNotDisturb
:
return
qsTr
(
'
presenceDoNotDisturb
'
)
case
Presence.Moved
:
return
qsTr
(
'
presenceMoved
'
)
case
Presence.UsingAnotherMessagingService
:
return
qsTr
(
'
presenceUsingAnotherMessagingService
'
)
case
Presence.Offline
:
return
qsTr
(
'
presenceOffline
'
)
default
:
return
qsTr
(
'
presenceUnknown
'
)
}
}
// ---------------------------------------------------------------------------
color
:
PresenceStringStyle
.
color
elide
:
Text
.
ElideRight
font.pointSize
:
PresenceStringStyle
.
fontSize
text
:
_getStatusString
()
}
linphone-desktop/ui/modules/Linphone/Styles/Presence/PresenceStringStyle.qml
deleted
100644 → 0
View file @
28815a2e
pragma
Singleton
import
QtQuick
2.7
import
Common
1.0
// =============================================================================
QtObject
{
property
color
color
:
Colors
.
w
property
int
fontSize
:
10
}
linphone-desktop/ui/modules/Linphone/Styles/qmldir
View file @
7339b7e4
...
...
@@ -25,8 +25,6 @@ singleton NotificationReceivedCallStyle 1.0 Notifications/NotificationRec
singleton NotificationReceivedMessageStyle 1.0 Notifications/NotificationReceivedMessageStyle.qml
singleton NotificationReceivedFileMessageStyle 1.0 Notifications/NotificationReceivedFileMessageStyle.qml
singleton PresenceStringStyle 1.0 Presence/PresenceStringStyle.qml
singleton SmartSearchBarStyle 1.0 SmartSearchBarStyle.qml
singleton TimelineStyle 1.0 TimelineStyle.qml
linphone-desktop/ui/modules/Linphone/qmldir
View file @
7339b7e4
...
...
@@ -21,7 +21,6 @@ ContactDescription 1.0 Contact/ContactDescription.qml
SipAddressesMenu 1.0 Menus/SipAddressesMenu.qml
PresenceLevel 1.0 Presence/PresenceLevel.qml
PresenceString 1.0 Presence/PresenceString.qml
SmartSearchBar 1.0 SmartSearchBar.qml
...
...
linphone-desktop/ui/views/App/Main/Contacts.qml
View file @
7339b7e4
...
...
@@ -111,9 +111,12 @@ ColumnLayout {
level
:
$contact
.
presenceLevel
}
PresenceString
{
Text
{
Layout.fillWidth
:
true
status
:
$contact
.
presenceStatus
color
:
ContactsStyle
.
contact
.
presenceStringColor
elide
:
Text
.
ElideRight
font.pointSize
:
ContactsStyle
.
contact
.
presenceStringFontSize
text
:
Presence
.
getPresenceStatusAsString
(
$contact
.
presenceStatus
)
}
}
}
...
...
linphone-desktop/ui/views/App/Main/MainWindow.qml
View file @
7339b7e4
...
...
@@ -160,6 +160,7 @@ Controls1.ApplicationWindow {
Layout.preferredWidth
:
MainWindowStyle
.
accountStatus
.
width
account
:
AccountSettingsModel
presence
:
PresenceStatusModel
TooltipArea
{
text
:
AccountSettingsModel
.
sipAddress
...
...
linphone-desktop/ui/views/App/ManageAccountsWindow.qml
View file @
7339b7e4
...
...
@@ -40,6 +40,24 @@ DialogPlus {
rightMargin
:
ManageAccountsWindowStyle
.
rightMargin
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
selectPresenceLabel
'
)
ComboBox
{
currentIndex
:
Utils
.
findIndex
(
PresenceStatusModel
.
statuses
,
function
(
status
)
{
return
status
.
presenceStatus
==
PresenceStatusModel
.
presenceStatus
})
model
:
PresenceStatusModel
.
statuses
iconRole
:
'
presenceIcon
'
textRole
:
'
presenceLabel
'
onActivated
:
PresenceStatusModel
.
presenceStatus
=
model
[
index
].
presenceStatus
}
}
}
FormLine
{
FormGroup
{
label
:
qsTr
(
'
selectAccountLabel
'
)
...
...
linphone-desktop/ui/views/App/Styles/Main/ContactsStyle.qml
View file @
7339b7e4
...
...
@@ -25,6 +25,8 @@ QtObject {
property
int
presenceLevelSize
:
12
property
int
rightMargin
:
25
property
int
spacing
:
15
property
int
presenceStringFontSize
:
10
property
color
presenceStringColor
:
Colors
.
w
property
QtObject
backgroundColor
:
QtObject
{
property
color
normal
:
Colors
.
k
...
...
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