1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-23 17:05:28 +02:00
jami-client-qt/src/mainview/components/ChatView.qml
Sébastien Blin 76896e7971
chatview: add the swarm details page in a stackview
This allow the swarm details page to be resizable.

Also adds the add members list into this view.
Presence and filtering for ContactPicker is also
fixed.

GitLab: #670
Change-Id: I4bf4369eba1d30dff3931575cd8ebd7eb2c7aee0
2022-03-23 13:45:32 -04:00

218 lines
7.5 KiB
QML

/*
* Copyright (C) 2020-2022 Savoir-faire Linux Inc.
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* Author: Trevor Tabah <trevor.tabah@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation
Rectangle {
id: root
property string headerUserAliasLabelText: ""
property string headerUserUserNameLabelText: ""
property bool allMessagesLoaded
signal needToHideConversationInCall
signal messagesCleared
signal messagesLoaded
function focusChatView() {
chatViewFooter.textInput.forceActiveFocus()
swarmDetailsPanel.visible = false
addMemberPanel.visible = false
}
color: JamiTheme.chatviewBgColor
ColumnLayout {
anchors.fill: root
spacing: 0
ChatViewHeader {
id: chatViewHeader
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.chatViewHeaderPreferredHeight
Layout.maximumHeight: JamiTheme.chatViewHeaderPreferredHeight
userAliasLabelText: headerUserAliasLabelText
userUserNameLabelText: headerUserUserNameLabelText
DropArea {
anchors.fill: parent
onDropped: chatViewFooter.setFilePathsToSend(drop.urls)
}
onBackClicked: {
mainView.showWelcomeView()
}
onNeedToHideConversationInCall: {
root.needToHideConversationInCall()
}
onShowDetailsClicked: {
addMemberPanel.visible = false
swarmDetailsPanel.visible = !swarmDetailsPanel.visible
}
Connections {
target: CurrentConversation
onUrisChanged: {
if (CurrentConversation.uris.length >= 8 && addMemberPanel.visible) {
swarmDetailsPanel.visible = false
addMemberPanel.visible = !addMemberPanel.visible
}
}
}
onAddToConversationClicked: {
swarmDetailsPanel.visible = false
addMemberPanel.visible = !addMemberPanel.visible
}
onPluginSelector: {
// Create plugin handler picker - PLUGINS
PluginHandlerPickerCreation.createPluginHandlerPickerObjects(
root, false)
PluginHandlerPickerCreation.calculateCurrentGeo(root.width / 2,
root.height / 2)
PluginHandlerPickerCreation.openPluginHandlerPicker()
}
}
SplitView {
id: chatViewMainRow
Layout.fillWidth: true
Layout.fillHeight: true
handle: Rectangle {
implicitWidth: JamiTheme.splitViewHandlePreferredWidth
implicitHeight: splitView.height
color: JamiTheme.primaryBackgroundColor
Rectangle {
implicitWidth: 1
implicitHeight: splitView.height
color: JamiTheme.tabbarBorderColor
}
}
ColumnLayout {
SplitView.maximumWidth: splitView.width
// Note, without JamiTheme.detailsPageMinWidth, sometimes the details page is hidden at the right
SplitView.preferredWidth: Math.max(0, 2 * splitView.width / 3 - JamiTheme.detailsPageMinWidth)
SplitView.fillHeight: true
StackLayout {
id: chatViewStack
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
Layout.topMargin: JamiTheme.chatViewHairLineSize
Layout.bottomMargin: JamiTheme.chatViewHairLineSize
currentIndex: CurrentConversation.isRequest ||
CurrentConversation.needsSyncing
Loader {
active: CurrentConversation.id !== ""
sourceComponent: MessageListView {
DropArea {
anchors.fill: parent
onDropped: chatViewFooter.setFilePathsToSend(drop.urls)
}
}
}
InvitationView {
id: invitationView
Layout.fillWidth: true
Layout.fillHeight: true
}
}
ReadOnlyFooter {
visible: CurrentConversation.readOnly
Layout.fillWidth: true
}
ChatViewFooter {
id: chatViewFooter
visible: {
if (CurrentConversation.needsSyncing || CurrentConversation.readOnly)
return false
else if (CurrentConversation.isSwarm && CurrentConversation.isRequest)
return false
return true
}
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Layout.maximumHeight: JamiTheme.chatViewFooterMaximumHeight
DropArea {
anchors.fill: parent
onDropped: chatViewFooter.setFilePathsToSend(drop.urls)
}
}
}
SwarmDetailsPanel {
id: swarmDetailsPanel
visible: false
SplitView.maximumWidth: splitView.width
SplitView.preferredWidth: Math.max(JamiTheme.detailsPageMinWidth, splitView.width / 3)
SplitView.minimumWidth: JamiTheme.detailsPageMinWidth
SplitView.fillHeight: true
Layout.fillHeight: true
Layout.fillWidth: true
}
AddMemberPanel {
id: addMemberPanel
visible: false
SplitView.maximumWidth: splitView.width
SplitView.preferredWidth: Math.max(JamiTheme.detailsPageMinWidth, splitView.width / 3)
SplitView.minimumWidth: JamiTheme.detailsPageMinWidth
SplitView.fillHeight: true
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
}