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
b08682a3
Commit
b08682a3
authored
Nov 30, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone): supports scrollbar
parent
a9d43492
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
13 deletions
+44
-13
ChatProxyModel.cpp
tests/src/components/chat/ChatProxyModel.cpp
+12
-0
ChatProxyModel.hpp
tests/src/components/chat/ChatProxyModel.hpp
+2
-3
Chat.qml
tests/ui/modules/Linphone/Chat/Chat.qml
+30
-10
No files found.
tests/src/components/chat/ChatProxyModel.cpp
View file @
b08682a3
...
...
@@ -32,6 +32,11 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
}
void
ChatProxyModel
::
loadMoreEntries
()
{
// Do not increase `m_n_max_displayed_entries` if it's not necessary...
// Limit qml calls.
if
(
m_chat_model_filter
.
rowCount
()
<=
m_n_max_displayed_entries
)
return
;
int
count
=
rowCount
();
m_n_max_displayed_entries
+=
ENTRIES_CHUNK_SIZE
;
...
...
@@ -41,6 +46,13 @@ void ChatProxyModel::loadMoreEntries () {
emit
moreEntriesLoaded
();
}
void
ChatProxyModel
::
setEntryTypeFilter
(
ChatModel
::
EntryType
type
)
{
if
(
m_chat_model_filter
.
m_entry_type_filter
!=
type
)
{
m_chat_model_filter
.
setEntryTypeFilter
(
type
);
emit
entryTypeFilterChanged
(
type
);
}
}
void
ChatProxyModel
::
removeEntry
(
int
id
)
{
QModelIndex
source_index
=
mapToSource
(
index
(
id
,
0
));
static_cast
<
ChatModel
*>
(
m_chat_model_filter
.
sourceModel
())
->
removeEntry
(
...
...
tests/src/components/chat/ChatProxyModel.hpp
View file @
b08682a3
...
...
@@ -43,6 +43,7 @@ class ChatProxyModel : public QSortFilterProxyModel {
signals:
void
sipAddressChanged
(
const
QString
&
sipAddress
);
void
moreEntriesLoaded
();
void
entryTypeFilterChanged
(
ChatModel
::
EntryType
type
);
public:
ChatProxyModel
(
QObject
*
parent
=
Q_NULLPTR
);
...
...
@@ -50,9 +51,7 @@ public:
public
slots
:
void
loadMoreEntries
();
void
setEntryTypeFilter
(
ChatModel
::
EntryType
type
)
{
m_chat_model_filter
.
setEntryTypeFilter
(
type
);
}
void
setEntryTypeFilter
(
ChatModel
::
EntryType
type
);
void
removeEntry
(
int
id
);
...
...
tests/ui/modules/Linphone/Chat/Chat.qml
View file @
b08682a3
...
...
@@ -5,6 +5,7 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Linphone
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
// ===================================================================
...
...
@@ -16,7 +17,7 @@ ColumnLayout {
// Set the offset position to load more entries.
// Not a style property.
property
int
_loadMoreEntriesAtPosition
:
1
property
int
_loadMoreEntriesAtPosition
:
25
// -----------------------------------------------------------------
...
...
@@ -27,11 +28,11 @@ ColumnLayout {
property
bool
_tryToLoadMoreEntries
:
true
function
_loadMoreEntries
()
{
if
(
function
_loadMoreEntries
(
force
)
{
if
(
(
chat
.
visibleArea
.
yPosition
*
chat
.
height
<=
_loadMoreEntriesAtPosition
&&
!
_tryToLoadMoreEntries
)
{
)
||
force
)
{
_tryToLoadMoreEntries
=
true
proxyModel
.
loadMoreEntries
()
}
...
...
@@ -181,16 +182,35 @@ ColumnLayout {
}
}
onContentYChanged
:
_loadMoreEntries
()
Component.onCompleted
:
{
var
initView
=
function
()
{
positionViewAtEnd
()
_tryToLoadMoreEntries
=
false
}
// Received only if more entries was loaded.
proxyModel
.
moreEntriesLoaded
.
connect
(
function
()
{
if
(
ScrollBar
.
vertical
.
pressed
&&
atYBeginning
)
{
// Use a timeout to not increase call stack.
Utils
.
setTimeout
(
chat
,
0
,
function
()
{
_loadMoreEntries
(
true
)
positionViewAtIndex
(
1
,
ListView
.
Beginning
)
})
}
else
{
_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