Change display limit values to avoid erratic loading behavior on lists.

Select first history call item on load.
This commit is contained in:
Julien Wadel 2025-01-08 11:38:49 +01:00
parent f1c9301533
commit d9692265be
4 changed files with 34 additions and 21 deletions

View file

@ -303,8 +303,8 @@ Flickable{
id: contactsProxy
parentProxy: mainItem.mainModel
filterType: MagicSearchProxy.FilteringTypes.App | (mainItem.searchText != '*' && mainItem.searchText != '' || SettingsCpp.syncLdapContacts ? MagicSearchProxy.FilteringTypes.Ldap : 0)
initialDisplayItems: 20
displayItemsStep: 5
initialDisplayItems: Math.max(20, 2 * mainItem.height / (63 * DefaultStyle.dp))
displayItemsStep: 3 * initialDisplayItems / 2
onLocalFriendCreated: (index) => {
contactsList.selectIndex(index)
}
@ -338,9 +338,9 @@ Flickable{
id: suggestionsProxy
parentProxy: mainItem.mainModel
filterType: mainItem.hideSuggestions ? MagicSearchProxy.FilteringTypes.None : MagicSearchProxy.FilteringTypes.Other
initialDisplayItems: contactsProxy.haveMore && contactsList.expanded ? 0 : 20
initialDisplayItems: contactsProxy.haveMore && contactsList.expanded ? 0 : Math.max(20, 2 * mainItem.height / (63 * DefaultStyle.dp))
onInitialDisplayItemsChanged: maxDisplayItems = initialDisplayItems
displayItemsStep: 5
displayItemsStep: 3 * initialDisplayItems / 2
onModelReset: maxDisplayItems = initialDisplayItems
}
}

View file

@ -103,7 +103,7 @@ ListView {
id: confInfoProxy
filterText: searchBarText
filterType: ConferenceInfoProxy.None
initialDisplayItems: mainItem.height / (63 * DefaultStyle.dp) + 5
initialDisplayItems: 2 * mainItem.height / (63 * DefaultStyle.dp)
displayItemsStep: initialDisplayItems/2
function selectData(confInfoGui){
mainItem.currentIndex = loadUntil(confInfoGui)

View file

@ -79,6 +79,8 @@ Item {
}
Item{
anchors.fill: parent
Popup {
id: currentCallNotif
background: Item{}
@ -103,7 +105,6 @@ Item {
}
}
}
anchors.fill: parent
RowLayout {
anchors.fill: parent

View file

@ -249,9 +249,8 @@ AbstractMainPage {
id: callHistoryProxy
filterText: searchBar.text
onFilterTextChanged: maxDisplayItems = initialDisplayItems
initialDisplayItems: historyListView.height / (56 * DefaultStyle.dp) + 5
displayItemsStep: initialDisplayItems / 2
initialDisplayItems: Math.max(20, 2 * historyListView.height / (56 * DefaultStyle.dp))
displayItemsStep: 3 * initialDisplayItems / 2
}
cacheBuffer: contentHeight>0 ? contentHeight : 0// cache all items
flickDeceleration: 10000
@ -271,8 +270,14 @@ AbstractMainPage {
onContentHeightChanged: Qt.callLater(function(){
historyListView.cacheBuffer = Math.max(contentHeight,0)
})
onActiveFocusChanged: if(activeFocus && currentIndex <0) currentIndex = 0
onActiveFocusChanged: if(activeFocus && currentIndex < 0 && count > 0) currentIndex = 0
onCountChanged: {
if(currentIndex < 0 && count > 0){
historyListView.currentIndex = 0 // Select first item after loading model
}
if(atYBeginning)
positionViewAtBeginning()// Stay at beginning
}
Connections {
target: deleteHistoryPopup
function onAccepted() {
@ -285,7 +290,20 @@ AbstractMainPage {
callHistoryProxy.reload()
}
}
onAtYEndChanged: if(atYEnd) callHistoryProxy.displayMore()
onAtYEndChanged: {
if(atYEnd && count > 0){
callHistoryProxy.displayMore()
}
}
onCurrentIndexChanged: {
if(currentIndex == 0) positionViewAtBeginning()
else positionViewAtIndex(currentIndex, ListView.Visible)
mainItem.selectedRowHistoryGui = model.getAt(currentIndex)
}
onVisibleChanged: {
if (!visible) currentIndex = -1
}
delegate: FocusScope {
width:historyListView.width
height: 56 * DefaultStyle.dp
@ -408,13 +426,7 @@ AbstractMainPage {
}
}
}
onCurrentIndexChanged: {
positionViewAtIndex(currentIndex, ListView.Visible)
mainItem.selectedRowHistoryGui = model.getAt(currentIndex)
}
onVisibleChanged: {
if (!visible) currentIndex = -1
}
Control.ScrollBar.vertical: scrollbar
}
}
@ -788,8 +800,8 @@ AbstractMainPage {
id: detailsHistoryProxy
filterText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : ""
onFilterTextChanged: maxDisplayItems = initialDisplayItems
initialDisplayItems: detailListView.height / (56 * DefaultStyle.dp) + 5
displayItemsStep: initialDisplayItems / 2
initialDisplayItems: Math.max(20, 2 * detailListView.height / (56 * DefaultStyle.dp))
displayItemsStep: 3 * initialDisplayItems / 2
}
onAtYEndChanged: if(atYEnd) detailsHistoryProxy.displayMore()
delegate: Item {