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
06ecb0b2
Commit
06ecb0b2
authored
Oct 04, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(presence): refactoring
parent
877da996
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
65 deletions
+73
-65
linphone.pro
tests/linphone.pro
+1
-1
ContactModel.cpp
tests/src/components/contacts/ContactModel.cpp
+32
-0
ContactModel.hpp
tests/src/components/contacts/ContactModel.hpp
+16
-36
ContactsListModel.cpp
tests/src/components/contacts/ContactsListModel.cpp
+12
-12
Presence.hpp
tests/src/components/presence/Presence.hpp
+11
-11
main.cpp
tests/src/main.cpp
+1
-5
No files found.
tests/linphone.pro
View file @
06ecb0b2
...
...
@@ -23,7 +23,7 @@ HEADERS = \
src
/
components
/
contacts
/
ContactsListModel
.
hpp
\
src
/
components
/
contacts
/
ContactsListProxyModel
.
hpp
\
src
/
components
/
notification
/
Notification
.
hpp
\
src
/
components
/
presence
/
Presence
Model
.
hpp
\
src
/
components
/
presence
/
Presence
.
hpp
\
src
/
components
/
settings
/
AccountSettingsListModel
.
hpp
\
src
/
components
/
settings
/
AccountSettingsModel
.
hpp
\
src
/
components
/
settings
/
SettingsModel
.
hpp
\
...
...
tests/src/components/contacts/ContactModel.cpp
View file @
06ecb0b2
#include "ContactModel.hpp"
// ===================================================================
QString
ContactModel
::
getUsername
()
const
{
return
m_username
;
}
void
ContactModel
::
setUsername
(
const
QString
&
username
)
{
m_username
=
username
;
}
QString
ContactModel
::
getAvatar
()
const
{
return
m_avatar
;
}
void
ContactModel
::
setAvatar
(
const
QString
&
avatar
)
{
m_avatar
=
avatar
;
}
Presence
::
PresenceStatus
ContactModel
::
getPresenceStatus
()
const
{
return
m_presence_status
;
}
Presence
::
PresenceLevel
ContactModel
::
getPresenceLevel
()
const
{
return
Presence
::
getPresenceLevel
(
m_presence_status
);
}
QStringList
ContactModel
::
getSipAddresses
()
const
{
return
m_sip_addresses
;
}
void
ContactModel
::
setSipAddresses
(
const
QStringList
&
sip_addresses
)
{
m_sip_addresses
=
sip_addresses
;
}
tests/src/components/contacts/ContactModel.hpp
View file @
06ecb0b2
...
...
@@ -3,7 +3,7 @@
#include <QObject>
#include "../presence/Presence
Model
.hpp"
#include "../presence/Presence.hpp"
// ===================================================================
...
...
@@ -27,13 +27,13 @@ class ContactModel : public QObject {
);
Q_PROPERTY
(
Presence
Model
::
Presence
presence
READ
getPresence
Presence
::
PresenceStatus
presenceStatus
READ
getPresence
Status
CONSTANT
);
Q_PROPERTY
(
Presence
Model
::
PresenceLevel
presenceLevel
Presence
::
PresenceLevel
presenceLevel
READ
getPresenceLevel
CONSTANT
);
...
...
@@ -50,12 +50,12 @@ public:
ContactModel
(
const
QString
&
username
,
const
QString
&
avatar
,
const
Presence
Model
::
Presence
&
presence
,
const
Presence
::
PresenceStatus
&
presence_status
,
const
QStringList
&
sip_addresses
)
:
ContactModel
()
{
)
:
ContactModel
()
{
m_username
=
username
;
m_avatar
=
avatar
;
m_presence
=
presence
;
m_presence
_status
=
presence_status
;
m_sip_addresses
=
sip_addresses
;
}
...
...
@@ -63,41 +63,21 @@ signals:
void
contactUpdated
();
private:
QString
getUsername
()
const
{
return
m_username
;
}
void
setUsername
(
const
QString
&
username
)
{
m_username
=
username
;
}
QString
getUsername
()
const
;
void
setUsername
(
const
QString
&
username
);
QString
getAvatar
()
const
{
return
m_avatar
;
}
QString
getAvatar
()
const
;
void
setAvatar
(
const
QString
&
avatar
);
void
setAvatar
(
const
QString
&
avatar
)
{
m_avatar
=
avatar
;
}
Presence
::
PresenceStatus
getPresenceStatus
()
const
;
Presence
::
PresenceLevel
getPresenceLevel
()
const
;
PresenceModel
::
Presence
getPresence
()
const
{
return
m_presence
;
}
PresenceModel
::
PresenceLevel
getPresenceLevel
()
const
{
return
PresenceModel
::
getPresenceLevel
(
m_presence
);
}
QStringList
getSipAddresses
()
const
{
return
m_sip_addresses
;
}
void
setSipAddresses
(
const
QStringList
&
sip_addresses
)
{
m_sip_addresses
=
sip_addresses
;
}
QStringList
getSipAddresses
()
const
;
void
setSipAddresses
(
const
QStringList
&
sip_addresses
);
QString
m_username
;
QString
m_avatar
;
Presence
Model
::
Presence
m_presence
=
PresenceModel
::
On
line
;
Presence
::
PresenceStatus
m_presence_status
=
Presence
::
Off
line
;
QStringList
m_sip_addresses
;
};
...
...
tests/src/components/contacts/ContactsListModel.cpp
View file @
06ecb0b2
...
...
@@ -4,18 +4,18 @@
ContactsListModel
::
ContactsListModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
// TMP.
m_list
<<
new
ContactModel
(
"Toto Roi"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Mary Boreno"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Cecelia Cyler"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Daniel Elliott"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Effie Forton"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Agnes Hurner"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Luke Lemin"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Claire Manning"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Isabella Ahornton"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Mary Boreno"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Aman Than"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
" abdoul"
,
""
,
Presence
Model
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Toto Roi"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Mary Boreno"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Cecelia Cyler"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Daniel Elliott"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Effie Forton"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Agnes Hurner"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Luke Lemin"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Claire Manning"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Isabella Ahornton"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Mary Boreno"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Aman Than"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
" abdoul"
,
""
,
Presence
::
Online
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
}
...
...
tests/src/components/presence/Presence
Model
.hpp
→
tests/src/components/presence/Presence.hpp
View file @
06ecb0b2
#ifndef PRESENCE_
MODEL_
H_
#define PRESENCE_
MODEL_
H_
#ifndef PRESENCE_H_
#define PRESENCE_H_
#include <QObject>
// ===================================================================
class
Presence
Model
:
public
QObject
{
class
Presence
:
public
QObject
{
Q_OBJECT
;
public:
enum
Presence
{
enum
Presence
Status
{
Online
,
BeRightBack
,
Away
,
...
...
@@ -20,7 +20,7 @@ public:
UsingAnotherMessagingService
,
Offline
};
Q_ENUM
(
Presence
);
Q_ENUM
(
Presence
Status
);
enum
PresenceLevel
{
Green
,
...
...
@@ -30,18 +30,18 @@ public:
};
Q_ENUM
(
PresenceLevel
);
Presence
Model
(
QObject
*
parent
=
Q_NULLPTR
)
{
}
Presence
(
QObject
*
parent
=
Q_NULLPTR
)
:
QObject
(
parent
)
{
}
static
PresenceLevel
getPresenceLevel
(
const
Presence
&
presence
)
{
if
(
presence
==
Online
)
static
PresenceLevel
getPresenceLevel
(
const
Presence
Status
&
presenceStatus
)
{
if
(
presence
Status
==
Online
)
return
Green
;
if
(
presence
==
DoNotDisturb
)
if
(
presence
Status
==
DoNotDisturb
)
return
Red
;
if
(
presence
==
Offline
)
if
(
presence
Status
==
Offline
)
return
White
;
return
Orange
;
}
};
#endif // PRESENCE_
MODEL_
H_
#endif // PRESENCE_H_
tests/src/main.cpp
View file @
06ecb0b2
#include <cstdlib>
#include <QMenu>
#include <QQmlApplicationEngine>
...
...
@@ -10,8 +9,6 @@
#include "app.hpp"
#include "components/contacts/ContactsListProxyModel.hpp"
#include "components/contacts/ContactsListModel.hpp"
#include "components/notification/Notification.hpp"
// ===================================================================
...
...
@@ -50,7 +47,7 @@ void setTrayIcon (QQmlApplicationEngine &engine) {
}
void
registerTypes
()
{
qmlRegisterUncreatableType
<
Presence
Model
>
(
qmlRegisterUncreatableType
<
Presence
>
(
"Linphone"
,
1
,
0
,
"Presence"
,
"Presence is uncreatable"
);
...
...
@@ -62,7 +59,6 @@ void addContextProperties (QQmlApplicationEngine &engine) {
QQmlContext
*
context
=
engine
.
rootContext
();
context
->
setContextProperty
(
"Notification"
,
new
Notification
());
context
->
setContextProperty
(
"ContactsListModel"
,
new
ContactsListProxyModel
());
}
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
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