fix flickable direction

fix ui left panel call history/contact/meeting
This commit is contained in:
gaelle 2025-02-24 14:20:36 +01:00
parent 8c5ebd8b5e
commit c8b65fb5b2
8 changed files with 137 additions and 124 deletions

View file

@ -122,6 +122,10 @@ std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(const QString &
return CoreModel::getInstance()->getCore()->findFriend(linphoneAddr); return CoreModel::getInstance()->getCore()->findFriend(linphoneAddr);
} }
std::shared_ptr<linphone::Friend> ToolModel::findFriendByAddress(std::shared_ptr<linphone::Address> linphoneAddr) {
return CoreModel::getInstance()->getCore()->findFriend(linphoneAddr);
}
bool ToolModel::createCall(const QString &sipAddress, bool ToolModel::createCall(const QString &sipAddress,
const QVariantMap &options, const QVariantMap &options,
const QString &prepareTransfertAddress, const QString &prepareTransfertAddress,

View file

@ -51,6 +51,8 @@ public:
static QString getDisplayName(QString address); static QString getDisplayName(QString address);
static std::shared_ptr<linphone::Friend> findFriendByAddress(const QString &address); static std::shared_ptr<linphone::Friend> findFriendByAddress(const QString &address);
static std::shared_ptr<linphone::Friend> findFriendByAddress(std::shared_ptr<linphone::Address> linphoneAddr);
static bool createCall(const QString &sipAddress, static bool createCall(const QString &sipAddress,
const QVariantMap &options = {}, const QVariantMap &options = {},

View file

@ -15,6 +15,7 @@ ListView {
property SearchBar searchBar property SearchBar searchBar
property bool loading: false property bool loading: false
property string searchText: searchBar?.text property string searchText: searchBar?.text
property double busyIndicatorSize: 60 * DefaultStyle.dp
signal resultsReceived() signal resultsReceived()
@ -98,6 +99,7 @@ ListView {
onVisibleChanged: { onVisibleChanged: {
if (!visible) currentIndex = -1 if (!visible) currentIndex = -1
} }
// Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. // 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. // So we need to use this variable to switch off all hovered items.
property int lastMouseContainsIndex: -1 property int lastMouseContainsIndex: -1
@ -221,6 +223,4 @@ ListView {
} }
} }
} }
Control.ScrollBar.vertical: scrollbar
} }

View file

@ -6,4 +6,5 @@ Flickable {
contentWidth: contentItem.childrenRect.width contentWidth: contentItem.childrenRect.width
contentHeight: contentItem.childrenRect.height contentHeight: contentItem.childrenRect.height
clip: true clip: true
} flickableDirection: Flickable.VerticalFlick
}

View file

@ -38,7 +38,6 @@ FocusScope {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: callList.height Layout.preferredHeight: callList.height
Layout.maximumHeight: mainItem.height/2 Layout.maximumHeight: mainItem.height/2
// Layout.fillHeight: true
contentHeight: callList.height contentHeight: callList.height
contentWidth: width contentWidth: width
RoundedPane { RoundedPane {

View file

@ -195,39 +195,43 @@ AbstractMainPage {
} }
} }
Item { Item {
Layout.topMargin: 38 * DefaultStyle.dp
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Control.Control { Control.Control {
id: listLayout id: listLayout
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: 39 * DefaultStyle.dp anchors.rightMargin: 39 * DefaultStyle.dp
padding: 0
background: Item{} background: Item{}
contentItem: ColumnLayout { contentItem: ColumnLayout {
Text { Text {
visible: historyListView.count === 0 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" : "") text: qsTr("Aucun appel%1").arg(searchBar.text.length != 0 ? " correspondant" : "")
font { font {
pixelSize: 16 * DefaultStyle.dp pixelSize: 16 * DefaultStyle.dp
weight: 800 * 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 { CallHistoryListView {
id: historyListView id: historyListView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.topMargin: 38 * DefaultStyle.dp
searchBar: searchBar 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{ Connections{
target: mainItem target: mainItem
function onListViewUpdated(){ function onListViewUpdated(){
@ -245,11 +249,12 @@ AbstractMainPage {
} }
ScrollBar { ScrollBar {
id: scrollbar id: scrollbar
visible: historyListView.contentHeight > parent.height
active: visible
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 8 * DefaultStyle.dp anchors.rightMargin: 8 * DefaultStyle.dp
active: true
policy: Control.ScrollBar.AsNeeded policy: Control.ScrollBar.AsNeeded
} }
} }
@ -544,7 +549,9 @@ AbstractMainPage {
detailContent: RoundedPane { detailContent: RoundedPane {
id: detailControl id: detailControl
Layout.preferredWidth: 360 * DefaultStyle.dp Layout.preferredWidth: 360 * DefaultStyle.dp
Layout.fillHeight: true
// height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) + topPadding + bottomPadding
background: Rectangle { background: Rectangle {
id: detailListBackground id: detailListBackground
anchors.fill: parent anchors.fill: parent
@ -552,104 +559,103 @@ AbstractMainPage {
radius: 15 * DefaultStyle.dp radius: 15 * DefaultStyle.dp
} }
contentItem: StackLayout { contentItem: CallHistoryListView {
currentIndex: detailListView.loading ? 0 : 1 id: detailListView
height: Math.min(430 * DefaultStyle.dp, detailListView.contentHeight) Layout.fillWidth: true
BusyIndicator { Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter spacing: 14 * DefaultStyle.dp
Layout.preferredHeight: visible ? 60 * DefaultStyle.dp : 0 clip: true
Layout.preferredWidth: 60 * DefaultStyle.dp searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : ""
indicatorHeight: 60 * DefaultStyle.dp busyIndicatorSize: 40 * DefaultStyle.dp
indicatorWidth: 60 * DefaultStyle.dp
indicatorColor: DefaultStyle.main1_500_main BusyIndicator {
} anchors.horizontalCenter: detailListView.horizontalCenter
CallHistoryListView { visible: detailListView.loading && detailListView.count === 0
id: detailListView height: visible ? detailListView.busyIndicatorSize : 0
Layout.fillWidth: true width: detailListView.busyIndicatorSize
Layout.preferredHeight: Math.min(detailControl.implicitHeight, contentHeight) indicatorHeight: detailListView.busyIndicatorSize
spacing: 14 * DefaultStyle.dp indicatorWidth: detailListView.busyIndicatorSize
clip: true indicatorColor: DefaultStyle.main1_500_main
searchText: mainItem.selectedRowHistoryGui ? mainItem.selectedRowHistoryGui.core.remoteAddress : "" }
delegate: Item { delegate: Item {
width:detailListView.width width:detailListView.width
height: 56 * DefaultStyle.dp height: 56 * DefaultStyle.dp
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 20 * DefaultStyle.dp anchors.leftMargin: 20 * DefaultStyle.dp
anchors.rightMargin: 20 * DefaultStyle.dp anchors.rightMargin: 20 * DefaultStyle.dp
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
ColumnLayout { ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
RowLayout { RowLayout {
EffectImage { EffectImage {
id: statusIcon id: statusIcon
imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.Aborted
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted
? AppIcons.arrowElbow ? AppIcons.arrowElbow
: modelData.core.isOutgoing : modelData.core.isOutgoing
? AppIcons.arrowUpRight ? AppIcons.arrowUpRight
: AppIcons.arrowDownLeft : AppIcons.arrowDownLeft
colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined colorizationColor: modelData.core.status === LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.Aborted
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted
|| modelData.core.status === LinphoneEnums.CallStatus.Missed || modelData.core.status === LinphoneEnums.CallStatus.Missed
? DefaultStyle.danger_500main ? DefaultStyle.danger_500main
: modelData.core.isOutgoing : modelData.core.isOutgoing
? DefaultStyle.info_500_main ? DefaultStyle.info_500_main
: DefaultStyle.success_500main : DefaultStyle.success_500main
Layout.preferredWidth: 16 * DefaultStyle.dp Layout.preferredWidth: 16 * DefaultStyle.dp
Layout.preferredHeight: 16 * DefaultStyle.dp Layout.preferredHeight: 16 * DefaultStyle.dp
transform: Rotation { transform: Rotation {
angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined angle: modelData.core.isOutgoing && (modelData.core.status === LinphoneEnums.CallStatus.Declined
|| modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere || modelData.core.status === LinphoneEnums.CallStatus.DeclinedElsewhere
|| modelData.core.status === LinphoneEnums.CallStatus.Aborted || modelData.core.status === LinphoneEnums.CallStatus.Aborted
|| modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0
origin { origin {
x: statusIcon.width/2 x: statusIcon.width/2
y: statusIcon.height/2 y: statusIcon.height/2
} }
} }
} }
Text { Text {
text: modelData.core.status === LinphoneEnums.CallStatus.Missed text: modelData.core.status === LinphoneEnums.CallStatus.Missed
? qsTr("Appel manqué") ? qsTr("Appel manqué")
: modelData.core.isOutgoing : modelData.core.isOutgoing
? qsTr("Appel sortant") ? qsTr("Appel sortant")
: qsTr("Appel entrant") : qsTr("Appel entrant")
font { font {
pixelSize: 14 * DefaultStyle.dp pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp weight: 400 * DefaultStyle.dp
} }
} }
} }
Text { Text {
text: UtilsCpp.formatDate(modelData.core.date) text: UtilsCpp.formatDate(modelData.core.date)
color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main color: modelData.core.status === LinphoneEnums.CallStatus.Missed? DefaultStyle.danger_500main : DefaultStyle.main2_500main
font { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
} }
} }
} }
Item { Item {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
} }
Text { Text {
text: UtilsCpp.formatElapsedTime(modelData.core.duration, false) text: UtilsCpp.formatElapsedTime(modelData.core.duration, false)
font { font {
pixelSize: 12 * DefaultStyle.dp pixelSize: 12 * DefaultStyle.dp
weight: 300 * DefaultStyle.dp weight: 300 * DefaultStyle.dp
} }
} }
} }
} }
} }
}
} }
Item{ Item{
Layout.fillHeight: true Layout.fillHeight: true

View file

@ -210,14 +210,15 @@ AbstractMainPage {
ColumnLayout { ColumnLayout {
anchors.top: title.bottom anchors.top: title.bottom
anchors.right: leftPanel.right anchors.right: leftPanel.right
anchors.left: leftPanel.left anchors.left: leftPanel.left
anchors.leftMargin: leftPanel.leftMargin
anchors.bottom: leftPanel.bottom anchors.bottom: leftPanel.bottom
enabled: mainItem.leftPanelEnabled enabled: mainItem.leftPanelEnabled
spacing: 38 * DefaultStyle.dp spacing: 38 * DefaultStyle.dp
SearchBar { SearchBar {
id: searchBar id: searchBar
Layout.leftMargin: leftPanel.leftMargin visible: contactList.haveContacts || text.length !== 0
Layout.rightMargin: leftPanel.rightMargin Layout.rightMargin: leftPanel.rightMargin
Layout.topMargin: 18 * DefaultStyle.dp Layout.topMargin: 18 * DefaultStyle.dp
Layout.fillWidth: true Layout.fillWidth: true
placeholderText: qsTr("Rechercher un contact") placeholderText: qsTr("Rechercher un contact")
@ -226,11 +227,10 @@ AbstractMainPage {
} }
ColumnLayout { ColumnLayout {
id: content id: content
spacing: 15 * DefaultStyle.dp spacing: 15 * DefaultStyle.dp
Layout.leftMargin: 45 * DefaultStyle.dp
Text { Text {
visible: !contactList.loading && !contactList.haveContacts visible: !contactList.loading && !contactList.haveContacts
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 137 * DefaultStyle.dp Layout.topMargin: 137 * DefaultStyle.dp
text: qsTr("Aucun contact%1").arg(searchBar.text.length !== 0 ? " correspondant" : "") text: qsTr("Aucun contact%1").arg(searchBar.text.length !== 0 ? " correspondant" : "")
font { font {

View file

@ -162,6 +162,7 @@ AbstractMainPage {
placeholderText: qsTr("Rechercher une réunion") placeholderText: qsTr("Rechercher une réunion")
KeyNavigation.up: conferenceList KeyNavigation.up: conferenceList
KeyNavigation.down: conferenceList KeyNavigation.down: conferenceList
visible: conferenceList.count !== 0 || text.length !== 0
Binding { Binding {
target: mainItem target: mainItem
property: "showDefaultItem" property: "showDefaultItem"