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/>.
|
|
|
|
*/
|
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import net.jami.Models 1.0
|
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: messagingHeaderRect
|
|
|
|
|
|
|
|
property int buttonPreferredSize: 30
|
|
|
|
property string userAliasLabelText: ""
|
|
|
|
property string userUserNameLabelText: ""
|
|
|
|
property string backToWelcomeViewButtonSource: "qrc:/images/icons/ic_arrow_back_24px.svg"
|
|
|
|
property bool sendContactRequestButtonVisible: true
|
|
|
|
|
2020-09-21 11:50:29 +02:00
|
|
|
signal backClicked
|
2020-08-03 13:27:42 -04:00
|
|
|
signal needToHideConversationInCall
|
|
|
|
|
|
|
|
function resetBackToWelcomeViewButtonSource(reset) {
|
|
|
|
backToWelcomeViewButtonSource = reset ? "qrc:/images/icons/ic_arrow_back_24px.svg" : "qrc:/images/icons/round-close-24px.svg"
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleMessagingHeaderButtonsVisible(visible) {
|
|
|
|
startAAudioCallButton.visible = visible
|
|
|
|
startAVideoCallButton.visible = visible
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: messagingHeaderRectRowLayout
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
HoverableButton {
|
|
|
|
id: backToWelcomeViewButton
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.leftMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
Layout.preferredWidth: buttonPreferredSize
|
|
|
|
Layout.preferredHeight: buttonPreferredSize
|
|
|
|
|
|
|
|
radius: 30
|
|
|
|
source: backToWelcomeViewButtonSource
|
|
|
|
backgroundColor: "white"
|
|
|
|
onExitColor: "white"
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
if (backToWelcomeViewButtonSource === "qrc:/images/icons/ic_arrow_back_24px.svg")
|
2020-09-21 11:50:29 +02:00
|
|
|
messagingHeaderRect.backClicked()
|
2020-08-03 13:27:42 -04:00
|
|
|
else
|
|
|
|
messagingHeaderRect.needToHideConversationInCall()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: userNameOrIdRect
|
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
2020-09-03 21:19:10 -04:00
|
|
|
// Width + margin.
|
2020-08-03 13:27:42 -04:00
|
|
|
Layout.preferredWidth: messagingHeaderRect.width
|
|
|
|
- backToWelcomeViewButton.width - buttonGroup.width - 45
|
2020-09-16 11:44:18 -04:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.topMargin: 7
|
|
|
|
Layout.bottomMargin: 7
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.leftMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
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
|
|
|
|
2020-09-16 11:44:18 -04:00
|
|
|
visible: text !== ""
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: buttonGroup
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
|
|
Layout.preferredWidth: buttonPreferredSize * 3 + 18
|
|
|
|
Layout.preferredHeight: buttonPreferredSize
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.rightMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
color: "transparent"
|
|
|
|
|
|
|
|
HoverableButton {
|
|
|
|
id: startAAudioCallButton
|
|
|
|
|
|
|
|
anchors.right: startAVideoCallButton.left
|
2020-07-30 13:38:57 +02:00
|
|
|
anchors.rightMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
|
|
|
height: buttonPreferredSize
|
|
|
|
width: buttonPreferredSize
|
|
|
|
|
|
|
|
radius: 30
|
|
|
|
source: "qrc:/images/icons/ic_phone_24px.svg"
|
|
|
|
backgroundColor: "white"
|
|
|
|
onExitColor: "white"
|
|
|
|
|
|
|
|
onClicked: {
|
2020-09-28 10:06:20 +02:00
|
|
|
MessagesAdapter.sendContactRequest()
|
2020-08-03 13:27:42 -04:00
|
|
|
CallAdapter.placeAudioOnlyCall()
|
2020-09-14 16:15:28 +02:00
|
|
|
communicationPageMessageWebView.setSendContactRequestButtonVisible(false)
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HoverableButton {
|
|
|
|
id: startAVideoCallButton
|
|
|
|
|
2020-07-30 13:38:57 +02:00
|
|
|
anchors.right: sendContactRequestButton.visible ? sendContactRequestButton.left : buttonGroup.right
|
|
|
|
anchors.rightMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
|
|
|
height: buttonPreferredSize
|
|
|
|
width: buttonPreferredSize
|
|
|
|
|
|
|
|
radius: 30
|
2020-09-24 14:15:33 +02:00
|
|
|
source: "qrc:/images/icons/videocam-24px.svg"
|
2020-08-03 13:27:42 -04:00
|
|
|
backgroundColor: "white"
|
|
|
|
onExitColor: "white"
|
|
|
|
|
|
|
|
onClicked: {
|
2020-09-28 10:06:20 +02:00
|
|
|
MessagesAdapter.sendContactRequest()
|
2020-08-03 13:27:42 -04:00
|
|
|
CallAdapter.placeCall()
|
2020-09-14 16:15:28 +02:00
|
|
|
communicationPageMessageWebView.setSendContactRequestButtonVisible(false)
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HoverableButton {
|
|
|
|
id: sendContactRequestButton
|
|
|
|
|
|
|
|
anchors.right: buttonGroup.right
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
|
|
|
height: buttonPreferredSize
|
|
|
|
width: buttonPreferredSize
|
|
|
|
|
|
|
|
visible: sendContactRequestButtonVisible
|
|
|
|
radius: 30
|
2020-07-30 13:38:57 +02:00
|
|
|
source: "qrc:/images/icons/person_add-24px.svg"
|
2020-08-03 13:27:42 -04:00
|
|
|
backgroundColor: "white"
|
|
|
|
onExitColor: "white"
|
|
|
|
|
|
|
|
onClicked: {
|
2020-09-28 10:06:20 +02:00
|
|
|
MessagesAdapter.sendContactRequest()
|
2020-08-03 13:27:42 -04:00
|
|
|
sendContactRequestButtonVisible = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onVisibleChanged: {
|
|
|
|
if (sendContactRequestButton.visible) {
|
|
|
|
sendContactRequestButton.width = buttonPreferredSize
|
|
|
|
} else {
|
|
|
|
sendContactRequestButton.width = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomBorder {
|
|
|
|
commonBorder: false
|
|
|
|
lBorderwidth: 0
|
|
|
|
rBorderwidth: 0
|
|
|
|
tBorderwidth: 0
|
|
|
|
bBorderwidth: 1
|
|
|
|
borderColor: JamiTheme.tabbarBorderColor
|
|
|
|
}
|
|
|
|
}
|