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
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import net.jami.Models 1.0
|
2020-12-05 14:05:57 +01:00
|
|
|
import net.jami.Constants 1.0
|
2021-01-22 11:53:08 -05:00
|
|
|
import net.jami.Adapters 1.0
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: messagingHeaderRect
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
property string userAliasLabelText
|
|
|
|
property string userUserNameLabelText
|
2020-08-03 13:27:42 -04:00
|
|
|
property string backToWelcomeViewButtonSource: "qrc:/images/icons/ic_arrow_back_24px.svg"
|
2020-09-28 18:59:40 -04:00
|
|
|
property alias sendContactRequestButtonVisible: sendContactRequestButton.visible
|
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
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-11-28 16:14:25 -05:00
|
|
|
color: JamiTheme.secondaryBackgroundColor
|
|
|
|
|
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
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.leftMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
source: backToWelcomeViewButtonSource
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2020-11-28 16:14:25 -05:00
|
|
|
normalColor: JamiTheme.secondaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
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-28 18:59:40 -04:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
2020-09-28 18:59:40 -04:00
|
|
|
Layout.preferredWidth: childrenRect.width + 18
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
2020-07-30 13:38:57 +02:00
|
|
|
Layout.rightMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
color: "transparent"
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
source: "qrc:/images/icons/ic_phone_24px.svg"
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2020-11-28 16:14:25 -05:00
|
|
|
normalColor: JamiTheme.secondaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: startAVideoCallButton
|
|
|
|
|
2021-01-22 11:53:08 -05:00
|
|
|
anchors.right: selectPluginButton.visible ? selectPluginButton.left :
|
|
|
|
sendContactRequestButton.visible ?
|
2020-09-28 18:59:40 -04:00
|
|
|
sendContactRequestButton.left :
|
|
|
|
buttonGroup.right
|
2020-07-30 13:38:57 +02:00
|
|
|
anchors.rightMargin: 16
|
2020-08-03 13:27:42 -04:00
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2020-09-24 14:15:33 +02:00
|
|
|
source: "qrc:/images/icons/videocam-24px.svg"
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2020-11-28 16:14:25 -05:00
|
|
|
normalColor: JamiTheme.secondaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-22 11:53:08 -05:00
|
|
|
PushButton {
|
|
|
|
id: selectPluginButton
|
|
|
|
|
|
|
|
visible: UtilsAdapter.checkShowPluginsButton(false)
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: PluginAdapter
|
|
|
|
function onPluginHandlersUpdateStatus() {
|
|
|
|
selectPluginButton.visible = UtilsAdapter.checkShowPluginsButton(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
anchors.right: sendContactRequestButton.visible ?
|
|
|
|
sendContactRequestButton.left :
|
|
|
|
buttonGroup.right
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
|
|
|
source: "qrc:/images/icons/extension_24dp.svg"
|
|
|
|
|
|
|
|
normalColor: JamiTheme.secondaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
|
|
|
|
|
|
|
onClicked: pluginSelector()
|
|
|
|
}
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
PushButton {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sendContactRequestButton
|
|
|
|
|
|
|
|
anchors.right: buttonGroup.right
|
|
|
|
anchors.rightMargin: 8
|
|
|
|
anchors.verticalCenter: buttonGroup.verticalCenter
|
|
|
|
|
2020-09-28 18:59:40 -04:00
|
|
|
width: sendContactRequestButton.visible ? preferredSize : 0
|
2020-07-30 13:38:57 +02:00
|
|
|
source: "qrc:/images/icons/person_add-24px.svg"
|
2020-09-28 18:59:40 -04:00
|
|
|
|
2020-11-28 16:14:25 -05:00
|
|
|
normalColor: JamiTheme.secondaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.chatviewButtonColor
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
onClicked: {
|
2020-09-28 10:06:20 +02:00
|
|
|
MessagesAdapter.sendContactRequest()
|
2020-09-28 18:59:40 -04:00
|
|
|
visible = false
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CustomBorder {
|
|
|
|
commonBorder: false
|
|
|
|
lBorderwidth: 0
|
|
|
|
rBorderwidth: 0
|
|
|
|
tBorderwidth: 0
|
|
|
|
bBorderwidth: 1
|
|
|
|
borderColor: JamiTheme.tabbarBorderColor
|
|
|
|
}
|
|
|
|
}
|