Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
4245c13a
Commit
4245c13a
authored
2 years ago
by
Andreas Traczyk
Committed by
Sébastien Blin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
chatview: fix message styling and timestamps after removing a msg
jami-daemon#316
Change-Id: I26cd21f91571021de960f83f189d7323336fa41b
parent
9195cb0b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/mainview/components/MessageListView.qml
+44
-24
44 additions, 24 deletions
src/app/mainview/components/MessageListView.qml
with
44 additions
and
24 deletions
src/app/mainview/components/MessageListView.qml
+
44
−
24
View file @
4245c13a
...
...
@@ -59,53 +59,52 @@ JamiListView {
return
false
}
function
computeChatview
(
item
,
itemIndex
)
{
if
(
!
root
)
return
function
computeChatview
(
item
,
itemIndex
)
{
if
(
!
root
)
return
var
rootItem
=
root
.
itemAtIndex
(
0
)
var
pItem
=
root
.
itemAtIndex
(
itemIndex
-
1
)
var
pItemIndex
=
itemIndex
-
1
var
nItem
=
root
.
itemAtIndex
(
itemIndex
+
1
)
var
nItemIndex
=
itemIndex
+
1
//
M
iddle insertion
//
m
iddle insertion
if
(
pItem
&&
nItem
)
{
computeTimestampVisibility
(
item
,
itemIndex
,
nItem
,
nItemIndex
)
computeSequencing
(
nI
tem
Index
,
nItem
,
root
.
itemAtIndex
(
itemIndex
+
2
)
,
item
)
computeSequencing
(
i
tem
,
nItem
,
root
.
itemAtIndex
(
itemIndex
+
2
))
}
//top buffer insertion = scroll up
//
top buffer insertion = scroll up
if
(
pItem
&&
!
nItem
)
{
computeTimestampVisibility
(
item
,
itemIndex
,
pItem
,
pItemIndex
)
computeSequencing
(
pItemIndex
,
pItem
,
item
,
root
.
itemAtIndex
(
itemIndex
-
2
))
computeSequencing
(
root
.
itemAtIndex
(
itemIndex
-
2
)
,
pItem
,
item
)
}
//bottom buffer insertion = scroll down
//
bottom buffer insertion = scroll down
if
(
!
pItem
&&
nItem
)
{
computeTimestampVisibility
(
item
,
itemIndex
,
nItem
,
nItemIndex
)
computeSequencing
(
nI
tem
Index
,
nItem
,
root
.
itemAtIndex
(
itemIndex
+
2
)
,
item
)
computeSequencing
(
i
tem
,
nItem
,
root
.
itemAtIndex
(
itemIndex
+
2
))
}
//index 0 insertion = new message
//
index 0 insertion = new message
if
(
itemIndex
===
0
)
{
Qt
.
callLater
(
computeSequencing
,
itemIndex
,
item
,
root
.
itemAtIndex
(
itemIndex
+
1
)
,
null
)
if
(
!
computeTimestampVisibility
(
item
,
itemIndex
,
nItem
,
nItemIndex
))
{
Qt
.
callLater
(
computeSequencing
,
null
,
item
,
root
.
itemAtIndex
(
itemIndex
+
1
))
if
(
!
computeTimestampVisibility
(
item
,
itemIndex
,
nItem
,
nItemIndex
))
{
Qt
.
callLater
(
computeChatview
,
item
,
itemIndex
)
}
}
//top element
//
top element
if
(
itemIndex
===
root
.
count
-
1
&&
CurrentConversation
.
allMessagesLoaded
)
{
item
.
showTime
=
true
item
.
showDay
=
true
}
}
function
computeSequencing
(
index
,
item
,
nItem
,
pItem
)
{
function
computeSequencing
(
pItem
,
item
,
nItem
)
{
if
(
root
===
undefined
||
!
item
)
return
function
isFirst
()
{
if
(
!
nItem
)
return
true
else
{
else
{
if
(
item
.
showTime
)
{
return
true
}
if
(
nItem
.
author
!==
item
.
author
)
{
}
else
if
(
nItem
.
author
!==
item
.
author
)
{
return
true
}
}
...
...
@@ -114,11 +113,10 @@ JamiListView {
function
isLast
()
{
if
(
!
pItem
)
return
true
else
{
else
{
if
(
pItem
.
showTime
)
{
return
true
}
if
(
pItem
.
author
!==
item
.
author
)
{
}
else
if
(
pItem
.
author
!==
item
.
author
)
{
return
true
}
}
...
...
@@ -184,7 +182,29 @@ JamiListView {
boundsBehavior
:
Flickable
.
StopAtBounds
currentIndex
:
-
1
// This connection to dataChanged resolves the styling for
// messages before and after an erased message.
Connections
{
target
:
MessagesAdapter
.
messageListModel
function
onDataChanged
(
tl
,
br
,
roles
)
{
if
(
!
(
roles
.
includes
(
MessageList
.
Body
)
&&
roles
.
includes
(
MessageList
.
PreviousBodies
)))
{
return
}
const
staleIndex
=
proxyModel
.
mapFromSource
(
tl
).
row
var
pItem
=
root
.
itemAtIndex
(
staleIndex
-
1
)
var
nItem
=
root
.
itemAtIndex
(
staleIndex
+
1
)
var
ppItem
=
root
.
itemAtIndex
(
staleIndex
+
2
)
var
nnItem
=
root
.
itemAtIndex
(
staleIndex
+
2
)
computeTimestampVisibility
(
ppItem
,
staleIndex
-
2
,
pItem
,
staleIndex
-
1
)
computeSequencing
(
ppItem
,
pItem
,
nItem
)
computeTimestampVisibility
(
nItem
,
staleIndex
+
1
,
nnItem
,
staleIndex
+
2
)
computeSequencing
(
pItem
,
nItem
,
nnItem
)
}
}
model
:
SortFilterProxyModel
{
id
:
proxyModel
// There doesn't seem to a subscription to property change
// events in the expression for sourceModel. This was originally
// masked behind an unchanging QSortFilterProxyModel object that
...
...
@@ -213,7 +233,7 @@ JamiListView {
TextMessageDelegate
{
Component.onCompleted
:
{
computeChatview
(
this
,
index
)
computeChatview
(
this
,
index
)
}
}
}
...
...
@@ -223,7 +243,7 @@ JamiListView {
GeneratedMessageDelegate
{
Component.onCompleted
:
{
computeChatview
(
this
,
index
)
computeChatview
(
this
,
index
)
}
}
}
...
...
@@ -233,7 +253,7 @@ JamiListView {
ContactMessageDelegate
{
Component.onCompleted
:
{
computeChatview
(
this
,
index
)
computeChatview
(
this
,
index
)
}
}
}
...
...
@@ -244,7 +264,7 @@ JamiListView {
GeneratedMessageDelegate
{
font.bold
:
true
Component.onCompleted
:
{
computeChatview
(
this
,
index
)
computeChatview
(
this
,
index
)
}
}
}
...
...
@@ -253,7 +273,7 @@ JamiListView {
DataTransferMessageDelegate
{
Component.onCompleted
:
{
computeChatview
(
this
,
index
)
computeChatview
(
this
,
index
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment