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
5f4e3cf3
Commit
5f4e3cf3
authored
Nov 24, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(Linphone/Chat): supports sections
parent
abaa1519
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+8
-3
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+5
-0
Chat.qml
tests/ui/modules/Linphone/Chat/Chat.qml
+1
-1
No files found.
tests/src/components/chat/ChatModel.cpp
View file @
5f4e3cf3
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
QHash
<
int
,
QByteArray
>
ChatModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
ChatModel
::
roleNames
()
const
{
QHash
<
int
,
QByteArray
>
roles
;
QHash
<
int
,
QByteArray
>
roles
;
roles
[
Qt
::
DisplayRole
]
=
"$chatEntry"
;
roles
[
Roles
::
ChatEntry
]
=
"$chatEntry"
;
roles
[
Roles
::
SectionDate
]
=
"$sectionDate"
;
return
roles
;
return
roles
;
}
}
...
@@ -19,8 +20,12 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const {
...
@@ -19,8 +20,12 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const {
if
(
row
<
0
||
row
>=
m_entries
.
count
())
if
(
row
<
0
||
row
>=
m_entries
.
count
())
return
QVariant
();
return
QVariant
();
if
(
role
==
Qt
::
DisplayRole
)
switch
(
role
)
{
case:
Roles
::
ChatEntry
return
QVariant
::
fromValue
(
m_entries
[
row
]);
return
QVariant
::
fromValue
(
m_entries
[
row
]);
case:
Roles
::
SectionDate
return
QVariant
::
fromValue
(
m_entries
[
row
][
"sectionDate"
]);
}
return
QVariant
();
return
QVariant
();
}
}
...
...
tests/src/components/chat/ChatModel.hpp
View file @
5f4e3cf3
...
@@ -17,6 +17,11 @@ class ChatModel : public QAbstractListModel {
...
@@ -17,6 +17,11 @@ class ChatModel : public QAbstractListModel {
);
);
public:
public:
enum
Roles
{
ChatEntry
=
Qt
::
DisplayRole
,
SectionDate
};
ChatModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QAbstractListModel
(
parent
)
{}
ChatModel
(
QObject
*
parent
=
Q_NULLPTR
)
:
QAbstractListModel
(
parent
)
{}
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
{
int
rowCount
(
const
QModelIndex
&
index
=
QModelIndex
())
const
{
...
...
tests/ui/modules/Linphone/Chat/Chat.qml
View file @
5f4e3cf3
...
@@ -26,7 +26,7 @@ ColumnLayout {
...
@@ -26,7 +26,7 @@ ColumnLayout {
section
{
section
{
criteria
:
ViewSection
.
FullString
criteria
:
ViewSection
.
FullString
delegate
:
sectionHeading
delegate
:
sectionHeading
property
:
'
$
chatEntry.
sectionDate
'
property
:
'
$sectionDate
'
}
}
// ---------------------------------------------------------------
// ---------------------------------------------------------------
...
...
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