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
25183046
Commit
25183046
authored
Oct 06, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(MainWindow/Contacts): the contacts list can be filtered with the presence level
parent
c6d0d188
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
6 deletions
+38
-6
ContactsListModel.cpp
tests/src/components/contacts/ContactsListModel.cpp
+2
-2
ContactsListProxyModel.cpp
tests/src/components/contacts/ContactsListProxyModel.cpp
+17
-1
ContactsListProxyModel.hpp
tests/src/components/contacts/ContactsListProxyModel.hpp
+12
-0
ExclusiveButtons.qml
tests/ui/modules/Linphone/Form/ExclusiveButtons.qml
+3
-1
Contacts.qml
tests/ui/views/MainWindow/Contacts.qml
+2
-0
Conversation.qml
tests/ui/views/MainWindow/Conversation.qml
+1
-1
MainWindow.qml
tests/ui/views/MainWindow/MainWindow.qml
+1
-1
No files found.
tests/src/components/contacts/ContactsListModel.cpp
View file @
25183046
...
...
@@ -9,11 +9,11 @@ ContactsListModel::ContactsListModel (QObject *parent): QAbstractListModel(paren
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
::
O
n
line
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Agnes Hurner"
,
""
,
Presence
::
O
ff
line
,
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
::
O
n
line
,
QStringList
(
"toto.linphone.sip.linphone.org"
));
m_list
<<
new
ContactModel
(
"Mary Boreno"
,
""
,
Presence
::
O
ff
line
,
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/contacts/ContactsListProxyModel.cpp
View file @
25183046
...
...
@@ -54,7 +54,11 @@ bool ContactsListProxyModel::filterAcceptsRow (int source_row, const QModelIndex
int
weight
=
m_weights
[
contact
]
=
static_cast
<
int
>
(
computeContactWeight
(
*
contact
)
);
return
weight
>
0
;
return
weight
>
0
&&
(
!
m_use_connected_filter
||
contact
->
getPresenceLevel
()
!=
Presence
::
PresenceLevel
::
White
);
}
bool
ContactsListProxyModel
::
lessThan
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
{
...
...
@@ -124,3 +128,15 @@ float ContactsListProxyModel::computeContactWeight (const ContactModel &contact)
return
weight
;
}
// -------------------------------------------------------------------
bool
ContactsListProxyModel
::
isConnectedFilterUsed
()
const
{
return
m_use_connected_filter
;
}
void
ContactsListProxyModel
::
setConnectedFilter
(
bool
useConnectedFilter
)
{
m_use_connected_filter
=
useConnectedFilter
;
qDebug
()
<<
useConnectedFilter
;
invalidate
();
}
tests/src/components/contacts/ContactsListProxyModel.hpp
View file @
25183046
...
...
@@ -10,6 +10,13 @@
class
ContactsListProxyModel
:
public
QSortFilterProxyModel
{
Q_OBJECT
;
Q_PROPERTY
(
bool
useConnectedFilter
READ
isConnectedFilterUsed
WRITE
setConnectedFilter
CONSTANT
);
public:
ContactsListProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
static
void
initContactsListModel
(
ContactsListModel
*
list
);
...
...
@@ -22,6 +29,9 @@ private:
float
computeStringWeight
(
const
QString
&
string
,
float
percentage
)
const
;
float
computeContactWeight
(
const
ContactModel
&
contact
)
const
;
bool
isConnectedFilterUsed
()
const
;
void
setConnectedFilter
(
bool
useConnectedFilter
);
static
const
QRegExp
m_search_separators
;
// The contacts list is shared between `ContactsListProxyModel`
...
...
@@ -31,6 +41,8 @@ private:
// It's just a cache to save values computed by `filterAcceptsRow`
// and reused by `lessThan`.
mutable
QHash
<
const
ContactModel
*
,
int
>
m_weights
;
bool
m_use_connected_filter
;
};
#endif // CONTACTS_LIST_PROXY_MODEL_H
tests/ui/modules/Linphone/Form/ExclusiveButtons.qml
View file @
25183046
...
...
@@ -5,6 +5,8 @@ import Linphone.Styles 1.0
// ===================================================================
Row
{
id
:
item
property
var
texts
property
int
_selectedButton
:
0
...
...
@@ -32,7 +34,7 @@ Row {
onClicked
:
{
if
(
_selectedButton
!==
index
)
{
_selectedButton
=
index
clicked
(
index
)
item
.
clicked
(
index
)
}
}
}
...
...
tests/ui/views/MainWindow/Contacts.qml
View file @
25183046
...
...
@@ -43,6 +43,8 @@ ColumnLayout {
qsTr
(
'
selectAllContacts
'
),
qsTr
(
'
selectConnectedContacts
'
)
]
onClicked
:
contacts
.
useConnectedFilter
=
(
button
===
1
)
}
TextButtonB
{
...
...
tests/ui/views/MainWindow/Conversation.qml
View file @
25183046
...
...
@@ -26,7 +26,7 @@ ColumnLayout {
Avatar
{
Layout.fillHeight
:
true
Layout.preferredWidth
:
80
presence
:
'
connected
'
// TODO: Use C++.
presence
Level
:
Presence
.
Green
// TODO: Use C++.
username
:
'
Cameron Andrews
'
// TODO: Use C++.
}
...
...
tests/ui/views/MainWindow/MainWindow.qml
View file @
25183046
...
...
@@ -40,7 +40,7 @@ ApplicationWindow {
Layout.fillHeight
:
parent
.
height
id
:
collapse
onCollapsed
:
windowStates
.
state
=
isCollapsed
()
onCollapsed
:
windowStates
.
state
=
collapsed
?
'
collapsed
'
:
''
}
...
...
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