2020-08-03 13:27:42 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 by Savoir-faire Linux
|
|
|
|
* Author: Mingrui Zhang <mingrui.zhang@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/>.
|
|
|
|
*/
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2021-08-23 19:05:06 -04:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2021-03-17 14:23:21 -04:00
|
|
|
|
2021-08-23 13:24:08 -04:00
|
|
|
import net.jami.Models 1.1
|
|
|
|
import net.jami.Constants 1.1
|
|
|
|
import net.jami.Adapters 1.1
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
|
|
|
Rectangle {
|
2021-07-29 16:59:18 -04:00
|
|
|
id: root
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
property string userAliasLabelText
|
|
|
|
property string userUserNameLabelText
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-21 11:50:29 +02:00
|
|
|
signal backClicked
|
2020-08-03 13:27:42 -04:00
|
|
|
signal needToHideConversationInCall
|
2021-01-22 11:53:08 -05:00
|
|
|
signal pluginSelector
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-16 13:17:53 -04:00
|
|
|
property bool interactionButtonsVisibility: {
|
2021-08-03 11:35:34 -04:00
|
|
|
if (CurrentConversation.inCall)
|
|
|
|
return false
|
|
|
|
if (CurrentConversation.isSwarm &&
|
|
|
|
CurrentConversation.readOnly)
|
|
|
|
return false
|
|
|
|
if (CurrentConversation.isSwarm &&
|
|
|
|
(CurrentConversation.isRequest ||
|
|
|
|
CurrentConversation.needsSyncing))
|
|
|
|
return false
|
|
|
|
return true
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
color: JamiTheme.chatviewBgColor
|
2020-11-28 16:14:25 -05:00
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
RowLayout {
|
|
|
|
id: messagingHeaderRectRowLayout
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: backToWelcomeViewButton
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2021-01-18 15:44:36 +01:00
|
|
|
Layout.leftMargin: 8
|
|
|
|
|
|
|
|
preferredSize: 24
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
source: CurrentConversation.inCall ?
|
|
|
|
JamiResources.round_close_24dp_svg :
|
|
|
|
JamiResources.back_24dp_svg
|
2021-01-18 15:44:36 +01:00
|
|
|
toolTipText: JamiStrings.hideChatView
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
normalColor: JamiTheme.chatviewBgColor
|
2020-11-28 16:14:25 -05:00
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
onClicked: CurrentConversation.inCall ?
|
|
|
|
root.needToHideConversationInCall() :
|
|
|
|
root.backClicked()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: userNameOrIdRect
|
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2020-09-03 21:19:10 -04:00
|
|
|
// Width + margin.
|
2021-07-29 16:59:18 -04:00
|
|
|
Layout.preferredWidth: root.width
|
2020-08-03 13:27:42 -04:00
|
|
|
- backToWelcomeViewButton.width - buttonGroup.width - 45
|
2020-09-16 11:44:18 -04:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.topMargin: 7
|
|
|
|
Layout.bottomMargin: 7
|
2021-01-18 15:44:36 +01:00
|
|
|
Layout.leftMargin: 8
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
color: JamiTheme.transparentColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: userNameOrIdColumnLayout
|
2020-09-16 11:44:18 -04:00
|
|
|
|
2020-07-30 13:38:57 +02:00
|
|
|
anchors.fill: parent
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
ElidedTextLabel {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: userAliasLabel
|
|
|
|
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize + 2
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
2020-09-18 09:35:26 -04:00
|
|
|
eText: userAliasLabelText
|
2020-09-16 11:44:18 -04:00
|
|
|
maxWidth: userNameOrIdRect.width
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
ElidedTextLabel {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: userUserNameLabel
|
2020-09-16 11:44:18 -04:00
|
|
|
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-02 13:36:23 -04:00
|
|
|
visible: text.length &&
|
|
|
|
userAliasLabelText != userUserNameLabelText
|
2020-07-30 13:38:57 +02:00
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
color: JamiTheme.faddedLastInteractionFontColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2020-09-18 09:35:26 -04:00
|
|
|
eText: userUserNameLabelText
|
2020-09-16 11:44:18 -04:00
|
|
|
maxWidth: userNameOrIdRect.width
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
Item {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: buttonGroup
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
2020-09-28 18:59:40 -04:00
|
|
|
Layout.preferredWidth: childrenRect.width + 18
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
2021-01-18 15:44:36 +01:00
|
|
|
Layout.rightMargin: 8
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: startAAudioCallButton
|
|
|
|
|
2021-08-16 13:17:53 -04:00
|
|
|
visible: interactionButtonsVisibility
|
2021-08-03 11:35:34 -04:00
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.right: startAVideoCallButton.left
|
2021-01-18 15:44:36 +01:00
|
|
|
anchors.rightMargin: 8
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.place_audiocall_24dp_svg
|
2021-01-18 15:44:36 +01:00
|
|
|
toolTipText: JamiStrings.placeAudioCall
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
normalColor: JamiTheme.chatviewBgColor
|
2020-11-28 16:14:25 -05:00
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
onClicked: CallAdapter.placeAudioOnlyCall()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: startAVideoCallButton
|
|
|
|
|
2021-08-16 13:17:53 -04:00
|
|
|
visible: interactionButtonsVisibility
|
2021-08-03 11:35:34 -04:00
|
|
|
|
|
|
|
anchors.right: selectPluginButton.visible ? selectPluginButton.left :
|
2021-01-22 11:53:08 -05:00
|
|
|
sendContactRequestButton.visible ?
|
2020-09-28 18:59:40 -04:00
|
|
|
sendContactRequestButton.left :
|
|
|
|
buttonGroup.right
|
2021-01-18 15:44:36 +01:00
|
|
|
anchors.rightMargin: 8
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.videocam_24dp_svg
|
2021-01-18 15:44:36 +01:00
|
|
|
toolTipText: JamiStrings.placeVideoCall
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
normalColor: JamiTheme.chatviewBgColor
|
2020-11-28 16:14:25 -05:00
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
onClicked: CallAdapter.placeCall()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2021-01-22 11:53:08 -05:00
|
|
|
PushButton {
|
|
|
|
id: selectPluginButton
|
|
|
|
|
2021-08-16 13:17:53 -04:00
|
|
|
visible: PluginAdapter.chatHandlersListCount &&
|
|
|
|
interactionButtonsVisibility
|
2021-01-22 11:53:08 -05:00
|
|
|
|
|
|
|
anchors.right: sendContactRequestButton.visible ?
|
|
|
|
sendContactRequestButton.left :
|
|
|
|
buttonGroup.right
|
2021-01-18 15:44:36 +01:00
|
|
|
anchors.rightMargin: sendContactRequestButton.visible ? 8 : 16
|
2021-01-22 11:53:08 -05:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.plugins_24dp_svg
|
2021-01-18 15:44:36 +01:00
|
|
|
toolTipText: JamiStrings.showPlugins
|
2021-01-22 11:53:08 -05:00
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
normalColor: JamiTheme.chatviewBgColor
|
2021-01-22 11:53:08 -05:00
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
|
|
|
|
|
|
|
onClicked: pluginSelector()
|
|
|
|
}
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sendContactRequestButton
|
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
visible: CurrentConversation.isTemporary
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.right: buttonGroup.right
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.add_people_24dp_svg
|
2021-01-18 15:44:36 +01:00
|
|
|
toolTipText: JamiStrings.addToConversations
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2021-01-18 15:44:36 +01:00
|
|
|
normalColor: JamiTheme.chatviewBgColor
|
2020-11-28 16:14:25 -05:00
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-08-03 11:35:34 -04:00
|
|
|
onClicked: MessagesAdapter.sendConversationRequest()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomBorder {
|
|
|
|
commonBorder: false
|
|
|
|
lBorderwidth: 0
|
|
|
|
rBorderwidth: 0
|
|
|
|
tBorderwidth: 0
|
2021-07-06 10:20:46 -04:00
|
|
|
bBorderwidth: JamiTheme.chatViewHairLineSize
|
2020-08-03 13:27:42 -04:00
|
|
|
borderColor: JamiTheme.tabbarBorderColor
|
|
|
|
}
|
|
|
|
}
|