From ec91bd25a60c06364242bc8986f2bf89cbe01fbf Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 6 Feb 2025 09:15:27 +0100 Subject: [PATCH] spinner call history --- .../Display/Call/CallHistoryListView.qml | 16 +- Linphone/view/Page/Layout/Main/MainLayout.qml | 40 ++--- Linphone/view/Page/Main/Call/CallPage.qml | 166 ++++++++++-------- 3 files changed, 118 insertions(+), 104 deletions(-) diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 5ab54db89..a0bf73d09 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -11,11 +11,10 @@ import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils ListView { id: mainItem clip: true - Layout.fillWidth: true - Layout.fillHeight: true + property SearchBar searchBar property bool loading: false - property string searchText: searchBar.text + property string searchText: searchBar?.text signal resultsReceived() @@ -27,16 +26,14 @@ ListView { model: CallHistoryProxy { id: callHistoryProxy - filterText: searchBar.text + filterText: mainItem.searchText onFilterTextChanged: maxDisplayItems = initialDisplayItems initialDisplayItems: Math.max(20, 2 * mainItem.height / (56 * DefaultStyle.dp)) displayItemsStep: 3 * initialDisplayItems / 2 onModelReset: { - console.log("model reset================") mainItem.resultsReceived() } } - cacheBuffer: contentHeight>0 ? contentHeight : 0// cache all items flickDeceleration: 10000 spacing: 10 * DefaultStyle.dp @@ -47,10 +44,13 @@ ListView { event.accepted = true } } + + Component.onCompleted: cacheBuffer = Math.max(contentHeight,0)//contentHeight>0 ? contentHeight : 0// cache all items // remove binding loop onContentHeightChanged: Qt.callLater(function(){ - mainItem.cacheBuffer = Math.max(contentHeight,0) + if (mainItem) mainItem.cacheBuffer = Math?.max(contentHeight,0) || 0 }) + onActiveFocusChanged: if(activeFocus && currentIndex < 0 && count > 0) currentIndex = 0 onCountChanged: { if(currentIndex < 0 && count > 0){ @@ -68,7 +68,7 @@ ListView { onAtYEndChanged: { if(atYEnd && count > 0){ - callHistoryProxy.displayMore() + callHistoryProxy.displayMore() } } //---------------------------------------------------------------- diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index aaf6ddb1d..2104b97b9 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -233,26 +233,26 @@ Item { } } contentItem: AllContactListView { - id: contactList - visible: !loading && magicSearchBar.text.length != 0 - Layout.preferredHeight: visible ? contentHeight : 0 - Layout.fillWidth: true - itemsRightMargin: 5 * DefaultStyle.dp //(Actions have already 10 of margin) - showInitials: false - showContactMenu: false - showActions: true - showFavorites: false - selectionEnabled: false - showDefaultAddress: true - searchOnEmpty: false - - sectionsPixelSize: 13 * DefaultStyle.dp - sectionsWeight: 700 * DefaultStyle.dp - sectionsSpacing: 5 * DefaultStyle.dp - - Control.ScrollBar.vertical: scrollbar - searchBarText: magicSearchBar.text - } + id: contactList + visible: !loading && magicSearchBar.text.length != 0 + Layout.preferredHeight: visible ? contentHeight : 0 + Layout.fillWidth: true + itemsRightMargin: 5 * DefaultStyle.dp //(Actions have already 10 of margin) + showInitials: false + showContactMenu: false + showActions: true + showFavorites: false + selectionEnabled: false + showDefaultAddress: true + searchOnEmpty: false + + sectionsPixelSize: 13 * DefaultStyle.dp + sectionsWeight: 700 * DefaultStyle.dp + sectionsSpacing: 5 * DefaultStyle.dp + + Control.ScrollBar.vertical: scrollbar + searchBarText: magicSearchBar.text + } } } RowLayout { diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index fdba8ad2d..0983c69be 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -214,8 +214,19 @@ AbstractMainPage { weight: 800 * DefaultStyle.dp } } + BusyIndicator { + Layout.alignment: Qt.AlignCenter + Layout.preferredHeight: visible ? 60 * DefaultStyle.dp : 0 + Layout.preferredWidth: 60 * DefaultStyle.dp + indicatorHeight: 60 * DefaultStyle.dp + indicatorWidth: 60 * DefaultStyle.dp + visible: historyListView.loading + indicatorColor: DefaultStyle.main1_500_main + } CallHistoryListView { id: historyListView + Layout.fillWidth: true + Layout.fillHeight: true searchBar: searchBar Connections{ target: mainItem @@ -543,98 +554,101 @@ AbstractMainPage { color: DefaultStyle.grey_0 radius: 15 * DefaultStyle.dp } - - ListView { - id: detailListView - width: parent.width - height: Math.min(detailControl.implicitHeight, contentHeight) - - spacing: 20 * DefaultStyle.dp - clip: true - - model: CallHistoryProxy { - id: detailsHistoryProxy - filterText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" - onFilterTextChanged: maxDisplayItems = initialDisplayItems - initialDisplayItems: Math.max(20, 2 * detailListView.height / (56 * DefaultStyle.dp)) - displayItemsStep: 3 * initialDisplayItems / 2 + + ColumnLayout { + BusyIndicator { + Layout.alignment: Qt.AlignCenter + Layout.preferredHeight: visible ? 60 * DefaultStyle.dp : 0 + Layout.preferredWidth: 60 * DefaultStyle.dp + indicatorHeight: 60 * DefaultStyle.dp + indicatorWidth: 60 * DefaultStyle.dp + visible: detailListView.loading + indicatorColor: DefaultStyle.main1_500_main } - onAtYEndChanged: if(atYEnd) detailsHistoryProxy.displayMore() - delegate: Item { - width:detailListView.width - height: 56 * DefaultStyle.dp - RowLayout { - anchors.fill: parent - anchors.leftMargin: 20 * DefaultStyle.dp - anchors.rightMargin: 20 * DefaultStyle.dp - anchors.verticalCenter: parent.verticalCenter - ColumnLayout { - Layout.alignment: Qt.AlignVCenter - RowLayout { - EffectImage { - id: statusIcon - imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted - ? AppIcons.arrowElbow - : modelData.core.isOutgoing - ? AppIcons.arrowUpRight - : AppIcons.arrowDownLeft - colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted - || modelData.core.status === LinphoneEnums.CallStatus.Missed - ? DefaultStyle.danger_500main - : modelData.core.isOutgoing - ? DefaultStyle.info_500_main - : DefaultStyle.success_500main - Layout.preferredWidth: 16 * DefaultStyle.dp - Layout.preferredHeight: 16 * DefaultStyle.dp - transform: Rotation { - angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 - origin { - x: statusIcon.width/2 - y: statusIcon.height/2 + CallHistoryListView { + id: detailListView + width: parent.width + height: Math.min(detailControl.implicitHeight, contentHeight) + spacing: 14 * DefaultStyle.dp + clip: true + searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" + + delegate: Item { + width:detailListView.width + height: 56 * DefaultStyle.dp + RowLayout { + anchors.fill: parent + anchors.leftMargin: 20 * DefaultStyle.dp + anchors.rightMargin: 20 * DefaultStyle.dp + anchors.verticalCenter: parent.verticalCenter + ColumnLayout { + Layout.alignment: Qt.AlignVCenter + RowLayout { + EffectImage { + id: statusIcon + imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined + || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere + || modelData.core.status === LinphoneEnums.CallStatus.Aborted + || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted + ? AppIcons.arrowElbow + : modelData.core.isOutgoing + ? AppIcons.arrowUpRight + : AppIcons.arrowDownLeft + colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined + || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere + || modelData.core.status === LinphoneEnums.CallStatus.Aborted + || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted + || modelData.core.status === LinphoneEnums.CallStatus.Missed + ? DefaultStyle.danger_500main + : modelData.core.isOutgoing + ? DefaultStyle.info_500_main + : DefaultStyle.success_500main + Layout.preferredWidth: 16 * DefaultStyle.dp + Layout.preferredHeight: 16 * DefaultStyle.dp + transform: Rotation { + angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined + || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere + || modelData.core.status === LinphoneEnums.CallStatus.Aborted + || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 + origin { + x: statusIcon.width/2 + y: statusIcon.height/2 + } + } + } + Text { + text: modelData.core.status === LinphoneEnums.CallStatus.Missed + ? qsTr("Appel manqué") + : modelData.core.isOutgoing + ? qsTr("Appel sortant") + : qsTr("Appel entrant") + font { + pixelSize: 14 * DefaultStyle.dp + weight: 400 * DefaultStyle.dp } } } Text { - text: modelData.core.status === LinphoneEnums.CallStatus.Missed - ? qsTr("Appel manqué") - : modelData.core.isOutgoing - ? qsTr("Appel sortant") - : qsTr("Appel entrant") + text: UtilsCpp.formatDate(modelData.core.date) + color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main font { - pixelSize: 14 * DefaultStyle.dp - weight: 400 * DefaultStyle.dp + pixelSize: 12 * DefaultStyle.dp + weight: 300 * DefaultStyle.dp } } } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } Text { - text: UtilsCpp.formatDate(modelData.core.date) - color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main + text: UtilsCpp.formatElapsedTime(modelData.core.duration, false) font { pixelSize: 12 * DefaultStyle.dp weight: 300 * DefaultStyle.dp } } } - Item { - Layout.fillHeight: true - Layout.fillWidth: true - } - Text { - text: UtilsCpp.formatElapsedTime(modelData.core.duration, false) - font { - pixelSize: 12 * DefaultStyle.dp - weight: 300 * DefaultStyle.dp - } - } } } }