From c8b65fb5b2775f5b8ddabd1cbcfe124d270b6815 Mon Sep 17 00:00:00 2001 From: gaelle Date: Mon, 24 Feb 2025 14:20:36 +0100 Subject: [PATCH] fix flickable direction fix ui left panel call history/contact/meeting --- Linphone/model/tool/ToolModel.cpp | 4 + Linphone/model/tool/ToolModel.hpp | 2 + .../Display/Call/CallHistoryListView.qml | 4 +- Linphone/view/Control/Display/Flickable.qml | 3 +- Linphone/view/Page/Form/Call/NewCallForm.qml | 1 - Linphone/view/Page/Main/Call/CallPage.qml | 232 +++++++++--------- .../view/Page/Main/Contact/ContactPage.qml | 14 +- .../view/Page/Main/Meeting/MeetingPage.qml | 1 + 8 files changed, 137 insertions(+), 124 deletions(-) diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index ce64893b9..73aec9fca 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -122,6 +122,10 @@ std::shared_ptr ToolModel::findFriendByAddress(const QString & return CoreModel::getInstance()->getCore()->findFriend(linphoneAddr); } +std::shared_ptr ToolModel::findFriendByAddress(std::shared_ptr linphoneAddr) { + return CoreModel::getInstance()->getCore()->findFriend(linphoneAddr); +} + bool ToolModel::createCall(const QString &sipAddress, const QVariantMap &options, const QString &prepareTransfertAddress, diff --git a/Linphone/model/tool/ToolModel.hpp b/Linphone/model/tool/ToolModel.hpp index dea62383f..55c9e0327 100644 --- a/Linphone/model/tool/ToolModel.hpp +++ b/Linphone/model/tool/ToolModel.hpp @@ -51,6 +51,8 @@ public: static QString getDisplayName(QString address); static std::shared_ptr findFriendByAddress(const QString &address); + static std::shared_ptr findFriendByAddress(std::shared_ptr linphoneAddr); + static bool createCall(const QString &sipAddress, const QVariantMap &options = {}, diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 132dc7221..daad6e8b2 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -15,6 +15,7 @@ ListView { property SearchBar searchBar property bool loading: false property string searchText: searchBar?.text + property double busyIndicatorSize: 60 * DefaultStyle.dp signal resultsReceived() @@ -98,6 +99,7 @@ ListView { onVisibleChanged: { if (!visible) currentIndex = -1 } + // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. // So we need to use this variable to switch off all hovered items. property int lastMouseContainsIndex: -1 @@ -221,6 +223,4 @@ ListView { } } } - - Control.ScrollBar.vertical: scrollbar } diff --git a/Linphone/view/Control/Display/Flickable.qml b/Linphone/view/Control/Display/Flickable.qml index 999348d7c..9bacef8ef 100644 --- a/Linphone/view/Control/Display/Flickable.qml +++ b/Linphone/view/Control/Display/Flickable.qml @@ -6,4 +6,5 @@ Flickable { contentWidth: contentItem.childrenRect.width contentHeight: contentItem.childrenRect.height clip: true -} \ No newline at end of file + flickableDirection: Flickable.VerticalFlick +} diff --git a/Linphone/view/Page/Form/Call/NewCallForm.qml b/Linphone/view/Page/Form/Call/NewCallForm.qml index f254cb76a..1d8ac8f8a 100644 --- a/Linphone/view/Page/Form/Call/NewCallForm.qml +++ b/Linphone/view/Page/Form/Call/NewCallForm.qml @@ -38,7 +38,6 @@ FocusScope { Layout.fillWidth: true Layout.preferredHeight: callList.height Layout.maximumHeight: mainItem.height/2 - // Layout.fillHeight: true contentHeight: callList.height contentWidth: width RoundedPane { diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index ceec8757d..be4ec187e 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -195,39 +195,43 @@ AbstractMainPage { } } Item { - Layout.topMargin: 38 * DefaultStyle.dp Layout.fillWidth: true Layout.fillHeight: true Control.Control { id: listLayout anchors.fill: parent anchors.rightMargin: 39 * DefaultStyle.dp - + padding: 0 background: Item{} contentItem: ColumnLayout { Text { visible: historyListView.count === 0 - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: 137 * DefaultStyle.dp text: qsTr("Aucun appel%1").arg(searchBar.text.length != 0 ? " correspondant" : "") font { pixelSize: 16 * DefaultStyle.dp 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 + Layout.fillHeight: true + Layout.topMargin: 38 * DefaultStyle.dp searchBar: searchBar + Control.ScrollBar.vertical: scrollbar + + BusyIndicator { + anchors.horizontalCenter: historyListView.horizontalCenter + visible: historyListView.loading && historyListView.count === 0 && searchBar.text.length === 0 + height: visible ? historyListView.busyIndicatorSize : 0 + width: historyListView.busyIndicatorSize + indicatorHeight: historyListView.busyIndicatorSize + indicatorWidth: historyListView.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } + Connections{ target: mainItem function onListViewUpdated(){ @@ -245,11 +249,12 @@ AbstractMainPage { } ScrollBar { id: scrollbar + visible: historyListView.contentHeight > parent.height + active: visible anchors.top: parent.top anchors.bottom: parent.bottom anchors.right: parent.right anchors.rightMargin: 8 * DefaultStyle.dp - active: true policy: Control.ScrollBar.AsNeeded } } @@ -544,7 +549,9 @@ AbstractMainPage { detailContent: RoundedPane { id: detailControl Layout.preferredWidth: 360 * DefaultStyle.dp - + Layout.fillHeight: true +// height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) + topPadding + bottomPadding + background: Rectangle { id: detailListBackground anchors.fill: parent @@ -552,104 +559,103 @@ AbstractMainPage { radius: 15 * DefaultStyle.dp } - contentItem: StackLayout { - currentIndex: detailListView.loading ? 0 : 1 - height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) - 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 - indicatorColor: DefaultStyle.main1_500_main - } - CallHistoryListView { - id: detailListView - Layout.fillWidth: true - Layout.preferredHeight: 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: UtilsCpp.formatDate(modelData.core.date) - color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main - 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 - } - } - } - } - } - } + contentItem: CallHistoryListView { + id: detailListView + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 14 * DefaultStyle.dp + clip: true + searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" + busyIndicatorSize: 40 * DefaultStyle.dp + + BusyIndicator { + anchors.horizontalCenter: detailListView.horizontalCenter + visible: detailListView.loading && detailListView.count === 0 + height: visible ? detailListView.busyIndicatorSize : 0 + width: detailListView.busyIndicatorSize + indicatorHeight: detailListView.busyIndicatorSize + indicatorWidth: detailListView.busyIndicatorSize + indicatorColor: DefaultStyle.main1_500_main + } + + 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: UtilsCpp.formatDate(modelData.core.date) + color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main + 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 + } + } + } + } + } } Item{ Layout.fillHeight: true diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index 7375273d5..156b87e28 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -210,14 +210,15 @@ AbstractMainPage { ColumnLayout { anchors.top: title.bottom anchors.right: leftPanel.right - anchors.left: leftPanel.left + anchors.left: leftPanel.left + anchors.leftMargin: leftPanel.leftMargin anchors.bottom: leftPanel.bottom enabled: mainItem.leftPanelEnabled - spacing: 38 * DefaultStyle.dp + spacing: 38 * DefaultStyle.dp SearchBar { id: searchBar - Layout.leftMargin: leftPanel.leftMargin - Layout.rightMargin: leftPanel.rightMargin + visible: contactList.haveContacts || text.length !== 0 + Layout.rightMargin: leftPanel.rightMargin Layout.topMargin: 18 * DefaultStyle.dp Layout.fillWidth: true placeholderText: qsTr("Rechercher un contact") @@ -226,11 +227,10 @@ AbstractMainPage { } ColumnLayout { id: content - spacing: 15 * DefaultStyle.dp - Layout.leftMargin: 45 * DefaultStyle.dp + spacing: 15 * DefaultStyle.dp Text { visible: !contactList.loading && !contactList.haveContacts - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter Layout.topMargin: 137 * DefaultStyle.dp text: qsTr("Aucun contact%1").arg(searchBar.text.length !== 0 ? " correspondant" : "") font { diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index c92b97d66..06dbba317 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -162,6 +162,7 @@ AbstractMainPage { placeholderText: qsTr("Rechercher une réunion") KeyNavigation.up: conferenceList KeyNavigation.down: conferenceList + visible: conferenceList.count !== 0 || text.length !== 0 Binding { target: mainItem property: "showDefaultItem"