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
66c8bb6d
Commit
66c8bb6d
authored
Jan 10, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ui/modules/Linphone/Chat/Chat): workaround to scroll correctly at chat end
parent
6a91163a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
31 deletions
+56
-31
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+1
-3
ScrollableListView.qml
tests/ui/modules/Common/View/ScrollableListView.qml
+4
-0
Chat.qml
tests/ui/modules/Linphone/Chat/Chat.qml
+51
-28
No files found.
tests/src/components/chat/ChatModel.cpp
View file @
66c8bb6d
...
...
@@ -17,9 +17,7 @@ class ChatModel::MessageHandlers : public linphone::ChatMessageListener {
public:
MessageHandlers
(
ChatModel
*
chat_model
)
:
m_chat_model
(
chat_model
)
{}
~
MessageHandlers
()
{
qDebug
()
<<
"handlers"
;
}
~
MessageHandlers
()
=
default
;
private:
...
...
tests/ui/modules/Common/View/ScrollableListView.qml
View file @
66c8bb6d
...
...
@@ -6,8 +6,12 @@ import Common 1.0
// =============================================================================
ListView
{
id
:
listView
ScrollBar.vertical
:
ForceScrollBar
{
id
:
scrollBar
onPressedChanged
:
pressed
?
listView
.
movementStarted
()
:
listView
.
movementEnded
()
}
boundsBehavior
:
Flickable
.
StopAtBounds
...
...
tests/ui/modules/Linphone/Chat/Chat.qml
View file @
66c8bb6d
...
...
@@ -25,16 +25,23 @@ ColumnLayout {
ScrollableListView
{
id
:
chat
// -------------------------------------------------------------------------
property
bool
_bindToEnd
:
false
property
bool
_tryToLoadMoreEntries
:
true
// -------------------------------------------------------------------------
function
_loadMoreEntries
()
{
if
(
atYBeginning
&&
!
_tryToLoadMoreEntries
)
{
_tryToLoadMoreEntries
=
true
positionViewAt
Index
(
0
,
ListView
.
Beginning
)
positionViewAt
Beginning
(
)
proxyModel
.
loadMoreEntries
()
}
}
// -------------------------------------------------------------------------
Layout.fillHeight
:
true
Layout.fillWidth
:
true
...
...
@@ -44,6 +51,49 @@ ColumnLayout {
property
:
'
$sectionDate
'
}
// -------------------------------------------------------------------------
Component.onCompleted
:
{
function
goToEnd
()
{
return
Utils
.
setTimeout
(
chat
,
100
,
function
()
{
if
(
_bindToEnd
)
{
positionViewAtEnd
()
}
return
goToEnd
()
})
}
goToEnd
()
var
initView
=
function
()
{
_tryToLoadMoreEntries
=
false
_bindToEnd
=
true
}
// Received only if more entries were loaded.
proxyModel
.
moreEntriesLoaded
.
connect
(
function
(
n
)
{
positionViewAtIndex
(
n
-
1
,
ListView
.
Beginning
)
_tryToLoadMoreEntries
=
false
})
// When the view is changed (for example `Calls` -> `Messages`),
// the position is set at end and it can be possible to load
// more entries.
proxyModel
.
entryTypeFilterChanged
.
connect
(
initView
)
// First render.
initView
()
}
onMovementStarted
:
_bindToEnd
=
false
onMovementEnded
:
{
if
(
atYEnd
)
{
_bindToEnd
=
true
}
}
onContentYChanged
:
_loadMoreEntries
()
// -------------------------------------------------------------------------
// Heading.
// -------------------------------------------------------------------------
...
...
@@ -178,33 +228,6 @@ ColumnLayout {
}
}
}
Component.onCompleted
:
{
var
initView
=
function
()
{
positionViewAtEnd
()
_tryToLoadMoreEntries
=
false
// TODO: Remove these lines when this issue will not be longer valid :
// https://bugreports.qt.io/browse/QTBUG-49989
Utils
.
setTimeout
(
chat
,
10
,
positionViewAtEnd
)
}
// Received only if more entries were loaded.
proxyModel
.
moreEntriesLoaded
.
connect
(
function
(
n
)
{
positionViewAtIndex
(
n
-
1
,
ListView
.
Beginning
)
_tryToLoadMoreEntries
=
false
})
// When the view is changed (for example `Calls` -> `Messages`),
// the position is set at end and it can be possible to load
// more entries.
proxyModel
.
entryTypeFilterChanged
.
connect
(
initView
)
// First render.
initView
()
}
onContentYChanged
:
_loadMoreEntries
()
}
// ---------------------------------------------------------------------------
...
...
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