2021-06-30 09:53:06 -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.Adapters 1.0
|
2021-07-06 15:16:08 -04:00
|
|
|
import net.jami.Models 1.0
|
2021-06-30 09:53:06 -04:00
|
|
|
import net.jami.Constants 1.0
|
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
ColumnLayout {
|
2021-06-30 09:53:06 -04:00
|
|
|
id: root
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
property alias text: textArea.text
|
2021-06-30 09:53:06 -04:00
|
|
|
property var textAreaObj: textArea
|
|
|
|
property real marginSize: 10
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
signal sendMessageButtonClicked
|
2021-06-30 09:53:06 -04:00
|
|
|
signal sendFileButtonClicked
|
|
|
|
signal audioRecordMessageButtonClicked
|
|
|
|
signal videoRecordMessageButtonClicked
|
|
|
|
signal emojiButtonClicked
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
function showSendMessageButton() {
|
|
|
|
sendMessageButton.visible = true
|
|
|
|
sendMessageButton.state = "buttonFadeOut"
|
|
|
|
}
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
function hideSendMessageButton() {
|
|
|
|
sendMessageButton.state = "buttonFadeIn"
|
|
|
|
}
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
implicitHeight: messageBarRowLayout.height
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
spacing: 0
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Rectangle {
|
|
|
|
id: messageBarHairLine
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewHairLineSize
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumWidth: JamiTheme.messageWebViewFooterContentMaximumWidth
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
color: JamiTheme.tabbarBorderColor
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
RowLayout {
|
|
|
|
id: messageBarRowLayout
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumWidth: JamiTheme.messageWebViewFooterContentMaximumWidth
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
spacing: JamiTheme.messageWebViewFooterRowSpacing
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
PushButton {
|
|
|
|
id: sendFileButton
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.leftMargin: marginSize
|
|
|
|
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
radius: JamiTheme.messageWebViewFooterButtonRadius
|
|
|
|
preferredSize: JamiTheme.messageWebViewFooterButtonIconSize - 6
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
toolTipText: JamiStrings.sendFile
|
|
|
|
|
|
|
|
source: "qrc:/images/icons/link_black-24dp.svg"
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
normalColor: JamiTheme.primaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.messageWebViewFooterButtonImageColor
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
onClicked: root.sendFileButtonClicked()
|
|
|
|
}
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
PushButton {
|
|
|
|
id: audioRecordMessageButton
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
radius: JamiTheme.messageWebViewFooterButtonRadius
|
|
|
|
preferredSize: JamiTheme.messageWebViewFooterButtonIconSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
toolTipText: JamiStrings.leaveAudioMessage
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
source: "qrc:/images/icons/message_audio_black-24dp.svg"
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
normalColor: JamiTheme.primaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.messageWebViewFooterButtonImageColor
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
onClicked: root.audioRecordMessageButtonClicked()
|
|
|
|
|
|
|
|
Component.onCompleted: JamiQmlUtils.audioRecordMessageButtonObj = audioRecordMessageButton
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
PushButton {
|
|
|
|
id: videoRecordMessageButton
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
radius: JamiTheme.messageWebViewFooterButtonRadius
|
|
|
|
preferredSize: JamiTheme.messageWebViewFooterButtonIconSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
toolTipText: JamiStrings.leaveVideoMessage
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
source: "qrc:/images/icons/message_video_black-24dp.svg"
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
normalColor: JamiTheme.primaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.messageWebViewFooterButtonImageColor
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
onClicked: root.videoRecordMessageButtonClicked()
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Component.onCompleted: JamiQmlUtils.videoRecordMessageButtonObj = videoRecordMessageButton
|
|
|
|
}
|
|
|
|
|
|
|
|
MessageBarTextArea {
|
|
|
|
id: textArea
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.margins: marginSize / 2
|
|
|
|
Layout.preferredHeight: {
|
|
|
|
return JamiTheme.messageWebViewFooterPreferredHeight
|
|
|
|
> contentHeight ? JamiTheme.messageWebViewFooterPreferredHeight : contentHeight
|
|
|
|
}
|
|
|
|
Layout.maximumHeight: JamiTheme.messageWebViewFooterTextAreaMaximumHeight
|
|
|
|
- marginSize / 2
|
|
|
|
|
|
|
|
onSendMessagesRequired: root.sendMessageButtonClicked()
|
|
|
|
}
|
|
|
|
|
|
|
|
PushButton {
|
|
|
|
id: emojiButton
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.rightMargin: sendMessageButton.visible ? 0 : marginSize
|
|
|
|
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
radius: JamiTheme.messageWebViewFooterButtonRadius
|
|
|
|
preferredSize: JamiTheme.messageWebViewFooterButtonIconSize
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
toolTipText: JamiStrings.addEmoji
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
source: "qrc:/images/icons/emoji_black-24dp.svg"
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
normalColor: JamiTheme.primaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.messageWebViewFooterButtonImageColor
|
2021-06-30 09:53:06 -04:00
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
onClicked: root.emojiButtonClicked()
|
|
|
|
|
|
|
|
Component.onCompleted: JamiQmlUtils.emojiPickerButtonObj = emojiButton
|
|
|
|
}
|
|
|
|
|
|
|
|
PushButton {
|
|
|
|
id: sendMessageButton
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
Layout.rightMargin: visible ? marginSize : 0
|
|
|
|
Layout.preferredWidth: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
Layout.preferredHeight: JamiTheme.messageWebViewFooterButtonSize
|
|
|
|
|
|
|
|
radius: JamiTheme.messageWebViewFooterButtonRadius
|
|
|
|
preferredSize: JamiTheme.messageWebViewFooterButtonIconSize - 6
|
|
|
|
|
|
|
|
toolTipText: JamiStrings.send
|
|
|
|
|
|
|
|
source: "qrc:/images/icons/send_black-24dp.svg"
|
|
|
|
|
|
|
|
normalColor: JamiTheme.primaryBackgroundColor
|
|
|
|
imageColor: JamiTheme.messageWebViewFooterButtonImageColor
|
|
|
|
|
|
|
|
opacity: 0
|
|
|
|
visible: false
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "buttonFadeIn"
|
|
|
|
PropertyChanges {
|
|
|
|
target: sendMessageButton
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "buttonFadeOut"
|
|
|
|
PropertyChanges {
|
|
|
|
target: sendMessageButton
|
|
|
|
opacity: 1
|
|
|
|
}
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
2021-07-06 15:16:08 -04:00
|
|
|
]
|
|
|
|
transitions: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity"
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
duration: 300
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
}
|
2021-07-06 15:16:08 -04:00
|
|
|
|
|
|
|
onOpacityChanged: {
|
|
|
|
if (opacity === 0)
|
|
|
|
visible = false
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
onClicked: root.sendMessageButtonClicked()
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
|
2021-07-06 15:16:08 -04:00
|
|
|
Component.onCompleted: JamiQmlUtils.messageBarButtonsRowObj = messageBarRowLayout
|
2021-06-30 09:53:06 -04:00
|
|
|
}
|
|
|
|
}
|