1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-23 08:13:51 +02:00

misc: improve minimum width swarm panels in chatview

GitLab: #954

Change-Id: I6fe7537b0de7fb904a05159072476003ee835eea
This commit is contained in:
Aline Gondim Santos 2023-02-03 13:49:25 -03:00
parent 6348d3ee0b
commit c0fdeb3f34
3 changed files with 59 additions and 24 deletions

View file

@ -32,14 +32,10 @@ Rectangle {
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
property int type: ContactList.ADDCONVMEMBER property int type: ContactList.ADDCONVMEMBER
width: 250
ColumnLayout { ColumnLayout {
id: contactPickerPopupRectColumnLayout id: contactPickerPopupRectColumnLayout
anchors.top: root.top anchors.fill: parent
anchors.bottom: root.bottom
anchors.margins: 16
ContactSearchBar { ContactSearchBar {
id: contactPickerContactSearchBar id: contactPickerContactSearchBar
@ -59,9 +55,10 @@ Rectangle {
JamiListView { JamiListView {
id: contactPickerListView id: contactPickerListView
Layout.alignment: Qt.AlignCenter Layout.fillHeight: true
Layout.preferredWidth: root.width - 8 Layout.fillWidth: true
Layout.preferredHeight: contactPickerPopupRectColumnLayout.height - contactPickerContactSearchBar.height Layout.leftMargin: 4
Layout.rightMargin: 4
model: ContactAdapter.getContactSelectableModel(type) model: ContactAdapter.getContactSelectableModel(type)

View file

@ -35,6 +35,11 @@ Rectangle {
property bool allMessagesLoaded property bool allMessagesLoaded
property var mapPositions: PositionManager.mapStatus property var mapPositions: PositionManager.mapStatus
property int lastContentsSplitSize: JamiTheme.detailsPageMinWidth
property int lastDetailsSplitSize: JamiTheme.detailsPageMinWidth
property int previousWidth: width
signal needToHideConversationInCall signal needToHideConversationInCall
signal messagesCleared signal messagesCleared
signal messagesLoaded signal messagesLoaded
@ -107,9 +112,33 @@ Rectangle {
onShowDetailsClicked: { onShowDetailsClicked: {
addMemberPanel.visible = false addMemberPanel.visible = false
if (swarmDetailsPanel.visible) {
chatContents.visible = true
} else {
if (chatViewHeader.width - JamiTheme.detailsPageMinWidth < JamiTheme.chatViewHeaderMinimumWidth)
chatContents.visible = false
}
swarmDetailsPanel.visible = !swarmDetailsPanel.visible swarmDetailsPanel.visible = !swarmDetailsPanel.visible
} }
onWidthChanged: {
var isExpanding = previousWidth < width
if (!swarmDetailsPanel.visible && !addMemberPanel.visible)
return
if (chatViewHeader.width < JamiTheme.detailsPageMinWidth + JamiTheme.chatViewHeaderMinimumWidth
&& !isExpanding && chatContents.visible) {
lastContentsSplitSize = chatContents.width
lastDetailsSplitSize = swarmDetailsPanel.visible ? swarmDetailsPanel.width : addMemberPanel.width
chatContents.visible = false
} else if (chatViewHeader.width >= JamiTheme.chatViewHeaderMinimumWidth + lastDetailsSplitSize
&& isExpanding && !layoutManager.isFullScreen && !chatContents.visible) {
chatContents.visible = true
}
previousWidth = width
}
Connections { Connections {
target: CurrentConversation target: CurrentConversation
@ -127,6 +156,12 @@ Rectangle {
onAddToConversationClicked: { onAddToConversationClicked: {
swarmDetailsPanel.visible = false swarmDetailsPanel.visible = false
if (addMemberPanel.visible) {
chatContents.visible = true
} else {
if (chatViewHeader.width - JamiTheme.detailsPageMinWidth < JamiTheme.chatViewHeaderMinimumWidth)
chatContents.visible = false
}
addMemberPanel.visible = !addMemberPanel.visible addMemberPanel.visible = !addMemberPanel.visible
} }
@ -212,10 +247,13 @@ Rectangle {
} }
ColumnLayout { ColumnLayout {
id: chatContents
SplitView.maximumWidth: splitView.width SplitView.maximumWidth: splitView.width
// Note, without JamiTheme.detailsPageMinWidth, sometimes the details page is hidden at the right SplitView.minimumWidth: JamiTheme.chatViewHeaderMinimumWidth
SplitView.preferredWidth: Math.max(0, 2 * splitView.width / 3 - JamiTheme.detailsPageMinWidth)
SplitView.fillHeight: true SplitView.preferredWidth: chatViewHeader.width -
(swarmDetailsPanel.visible ? swarmDetailsPanel.width :
( addMemberPanel.visible ? addMemberPanel.width : 0))
StackLayout { StackLayout {
id: chatViewStack id: chatViewStack
@ -288,11 +326,8 @@ Rectangle {
visible: false visible: false
SplitView.maximumWidth: splitView.width SplitView.maximumWidth: splitView.width
SplitView.preferredWidth: Math.max(JamiTheme.detailsPageMinWidth, splitView.width / 3) SplitView.preferredWidth: JamiTheme.detailsPageMinWidth
SplitView.minimumWidth: JamiTheme.detailsPageMinWidth SplitView.minimumWidth: JamiTheme.detailsPageMinWidth
SplitView.fillHeight: true
Layout.fillHeight: true
Layout.fillWidth: true
} }
AddMemberPanel { AddMemberPanel {
@ -300,11 +335,8 @@ Rectangle {
visible: false visible: false
SplitView.maximumWidth: splitView.width SplitView.maximumWidth: splitView.width
SplitView.preferredWidth: Math.max(JamiTheme.detailsPageMinWidth, splitView.width / 3) SplitView.preferredWidth: JamiTheme.detailsPageMinWidth
SplitView.minimumWidth: JamiTheme.detailsPageMinWidth SplitView.minimumWidth: JamiTheme.detailsPageMinWidth
SplitView.fillHeight: true
Layout.fillHeight: true
Layout.fillWidth: true
} }
} }
} }

View file

@ -43,8 +43,7 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: swarmProfileDetails id: swarmProfileDetails
Layout.fillHeight: true anchors.fill: parent
Layout.fillWidth: true
spacing: 0 spacing: 0
ColumnLayout { ColumnLayout {
@ -71,7 +70,9 @@ Rectangle {
id: titleLine id: titleLine
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: parent.width - 32 Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 5 Layout.topMargin: 5
TextMetrics { TextMetrics {
@ -130,7 +131,9 @@ Rectangle {
id: descriptionLine id: descriptionLine
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: parent.width - 32 Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
font.pointSize: JamiTheme.menuFontSize font.pointSize: JamiTheme.menuFontSize
@ -616,6 +619,8 @@ Rectangle {
RowLayout { RowLayout {
spacing: 10 spacing: 10
anchors.fill: parent
anchors.rightMargin: JamiTheme.preferredMarginSize
Avatar { Avatar {
width: JamiTheme.smartListAvatarSize width: JamiTheme.smartListAvatarSize
@ -638,9 +643,10 @@ Rectangle {
Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.topMargin: JamiTheme.preferredMarginSize / 2 Layout.topMargin: JamiTheme.preferredMarginSize / 2
Layout.fillWidth: true
eText: UtilsAdapter.getContactBestName(CurrentAccount.id, modelData) eText: UtilsAdapter.getContactBestName(CurrentAccount.id, modelData)
maxWidth: JamiTheme.preferredFieldWidth maxWidth: width
font.pointSize: JamiTheme.participantFontSize font.pointSize: JamiTheme.participantFontSize
color: JamiTheme.primaryForegroundColor color: JamiTheme.primaryForegroundColor