Skip to content
Snippets Groups Projects
Commit 1403e8dd authored by Sébastien Blin's avatar Sébastien Blin
Browse files

chatview: implement ContactMessageDelegate

GitLab: #670
Change-Id: Iab928c87f409713f867d47a2f87e53537af444b5
parent 48f1bd0d
No related branches found
No related tags found
No related merge requests found
...@@ -174,6 +174,7 @@ ...@@ -174,6 +174,7 @@
<file>src/commoncomponents/ReadStatus.qml</file> <file>src/commoncomponents/ReadStatus.qml</file>
<file>src/commoncomponents/GeneratedMessageDelegate.qml</file> <file>src/commoncomponents/GeneratedMessageDelegate.qml</file>
<file>src/commoncomponents/DataTransferMessageDelegate.qml</file> <file>src/commoncomponents/DataTransferMessageDelegate.qml</file>
<file>src/commoncomponents/ContactMessageDelegate.qml</file>
<file>src/mainview/components/ScrollToBottomButton.qml</file> <file>src/mainview/components/ScrollToBottomButton.qml</file>
<file>src/commoncomponents/TypingDots.qml</file> <file>src/commoncomponents/TypingDots.qml</file>
<file>src/commoncomponents/JamiScrollBar.qml</file> <file>src/commoncomponents/JamiScrollBar.qml</file>
......
/*
* Copyright (C) 2022 Savoir-faire Linux Inc.
* Author: Sébastien Blin <sebastien.blin@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
Column {
id: root
property bool showTime: false
property int seq: MsgSeq.single
property alias font: textLabel.font
width: ListView.view ? ListView.view.width : 0
spacing: 2
topPadding: 12
bottomPadding: 12
Rectangle {
id: msg
anchors.horizontalCenter: parent.horizontalCenter
width: childrenRect.width + 12
height: JamiTheme.contactMessageAvatarSize + 12
radius: JamiTheme.contactMessageAvatarSize / 2 + 6
color: "transparent"
border.width: 1
border.color: CurrentConversation.isCoreDialog ? JamiTheme.messageInBgColor : CurrentConversation.color
RowLayout {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
Avatar {
width: JamiTheme.contactMessageAvatarSize
height: JamiTheme.contactMessageAvatarSize
visible: ActionUri !== ""
imageId: ActionUri !== CurrentAccount.uri ? ActionUri : CurrentAccount.id
showPresenceIndicator: false
mode: ActionUri !== CurrentAccount.uri ? Avatar.Mode.Contact : Avatar.Mode.Account
}
Label {
id: textLabel
width: parent.width
text: Body
horizontalAlignment: Qt.AlignHCenter
font.pointSize: JamiTheme.contactEventPointSize
font.bold: true
color: JamiTheme.chatviewTextColor
}
}
}
Item {
id: infoCell
width: parent.width
height: childrenRect.height
Label {
text: MessagesAdapter.getFormattedTime(Timestamp)
color: JamiTheme.timestampColor
visible: showTime || seq === MsgSeq.last
height: visible * implicitHeight
font.pointSize: 9
anchors.horizontalCenter: parent.horizontalCenter
}
}
opacity: 0
Behavior on opacity { NumberAnimation { duration: 100 } }
Component.onCompleted: opacity = 1
}
...@@ -99,7 +99,7 @@ Control { ...@@ -99,7 +99,7 @@ Control {
type: seq type: seq
color: isOutgoing ? color: isOutgoing ?
JamiTheme.messageOutBgColor : JamiTheme.messageOutBgColor :
JamiTheme.messageInBgColor CurrentConversation.isCoreDialog ? JamiTheme.messageInBgColor : Qt.lighter(CurrentConversation.color, 1.5)
radius: msgRadius radius: msgRadius
anchors.right: isOutgoing ? parent.right : undefined anchors.right: isOutgoing ? parent.right : undefined
width: innerContent.childrenRect.width width: innerContent.childrenRect.width
......
...@@ -61,9 +61,14 @@ SBSMessageBase { ...@@ -61,9 +61,14 @@ SBSMessageBase {
onLinkHovered: root.hoveredLink = hoveredLink onLinkHovered: root.hoveredLink = hoveredLink
onLinkActivated: Qt.openUrlExternally(hoveredLink) onLinkActivated: Qt.openUrlExternally(hoveredLink)
readOnly: true readOnly: true
color: isOutgoing ? color: {
JamiTheme.messageOutTxtColor : var luma = 0.2126 * bubble.color.r + 0.7152 * bubble.color.g + 0.0722 * bubble.color.b // ITU-R BT.709
JamiTheme.messageInTxtColor
return luma < 0.60 ?
JamiTheme.chatviewTextColorLight :
JamiTheme.chatviewTextColorDark
}
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
......
...@@ -156,10 +156,12 @@ Item { ...@@ -156,10 +156,12 @@ Item {
property color jamiLightBlue: darkTheme ? "#003b4e" : Qt.rgba(59, 193, 211, 0.3) property color jamiLightBlue: darkTheme ? "#003b4e" : Qt.rgba(59, 193, 211, 0.3)
property color jamiDarkBlue: darkTheme ? "#28b1ed" : "#003b4e" property color jamiDarkBlue: darkTheme ? "#28b1ed" : "#003b4e"
property color chatviewTextColor: darkTheme ? "#f0f0f0" : "#353637" property color chatviewTextColor: darkTheme ? "#f0f0f0" : "#353637"
property color chatviewTextColorLight: "#f0f0f0"
property color chatviewTextColorDark: "#353637"
property color timestampColor: darkTheme ? "#bbb" : "#777" property color timestampColor: darkTheme ? "#bbb" : "#777"
property color messageOutBgColor: darkTheme ? "#28b1ed" : "#cfd8dc"
property color messageOutTxtColor: chatviewTextColor property color messageOutTxtColor: chatviewTextColor
property color messageInBgColor: darkTheme? "#616161" : "#cfebf5" property color messageInBgColor: darkTheme ? "#28b1ed" : "#cfd8dc"
property color messageOutBgColor: darkTheme? "#616161" : "#cfebf5"
property color messageInTxtColor: chatviewTextColor property color messageInTxtColor: chatviewTextColor
property color fileOutTimestampColor: darkTheme ? "#eee" : "#555" property color fileOutTimestampColor: darkTheme ? "#eee" : "#555"
property color fileInTimestampColor: darkTheme ? "#999" : "#555" property color fileInTimestampColor: darkTheme ? "#999" : "#555"
...@@ -371,6 +373,11 @@ Item { ...@@ -371,6 +373,11 @@ Item {
// Details page // Details page
property real detailsPageMinWidth: 300 property real detailsPageMinWidth: 300
// Messages point size
property real contactEventPointSize: 10 + fontSizeOffset
property int contactMessageAvatarSize: 24
function setTheme(dark) { function setTheme(dark) {
darkTheme = dark darkTheme = dark
} }
......
...@@ -59,6 +59,7 @@ CurrentConversation::updateData() ...@@ -59,6 +59,7 @@ CurrentConversation::updateData()
set_isRequest(convInfo.isRequest); set_isRequest(convInfo.isRequest);
set_readOnly(convInfo.readOnly); set_readOnly(convInfo.readOnly);
set_needsSyncing(convInfo.needsSyncing); set_needsSyncing(convInfo.needsSyncing);
set_color(Utils::getAvatarColor(convId).name());
set_isSip(accInfo.profileInfo.type == profile::Type::SIP); set_isSip(accInfo.profileInfo.type == profile::Type::SIP);
set_callId(convInfo.getCallId()); set_callId(convInfo.getCallId());
set_allMessagesLoaded(convInfo.allMessagesLoaded); set_allMessagesLoaded(convInfo.allMessagesLoaded);
......
...@@ -41,6 +41,7 @@ class CurrentConversation final : public QObject ...@@ -41,6 +41,7 @@ class CurrentConversation final : public QObject
QML_PROPERTY(bool, needsSyncing) QML_PROPERTY(bool, needsSyncing)
QML_PROPERTY(bool, isSip) QML_PROPERTY(bool, isSip)
QML_PROPERTY(QString, callId) QML_PROPERTY(QString, callId)
QML_PROPERTY(QString, color)
QML_PROPERTY(call::Status, callState) QML_PROPERTY(call::Status, callState)
QML_PROPERTY(bool, inCall) QML_PROPERTY(bool, inCall)
QML_PROPERTY(bool, isTemporary) QML_PROPERTY(bool, isTemporary)
......
...@@ -34,7 +34,7 @@ Rectangle { ...@@ -34,7 +34,7 @@ Rectangle {
radius: JamiTheme.filesToSendDelegateRadius radius: JamiTheme.filesToSendDelegateRadius
color: JamiTheme.messageInBgColor color: CurrentConversation.color
ColumnLayout { ColumnLayout {
id: delegateFileWrapperColumnLayout id: delegateFileWrapperColumnLayout
......
...@@ -214,7 +214,7 @@ JamiListView { ...@@ -214,7 +214,7 @@ JamiListView {
} }
DelegateChoice { DelegateChoice {
roleValue: Interaction.Type.CONTACT roleValue: Interaction.Type.CONTACT
GeneratedMessageDelegate { ContactMessageDelegate {
Component.onCompleted: { Component.onCompleted: {
if (index) if (index)
computeTimestampVisibility(this, index) computeTimestampVisibility(this, index)
......
...@@ -29,7 +29,7 @@ import "../../commoncomponents" ...@@ -29,7 +29,7 @@ import "../../commoncomponents"
Rectangle { Rectangle {
id: root id: root
color: JamiTheme.buttonTintedBlue color: CurrentConversation.color
ColumnLayout { ColumnLayout {
id: swarmProfileDetails id: swarmProfileDetails
...@@ -108,8 +108,8 @@ Rectangle { ...@@ -108,8 +108,8 @@ Rectangle {
/*FilterTabButton { /*FilterTabButton {
id: aboutTabButton id: aboutTabButton
backgroundColor: JamiTheme.buttonTintedBlue backgroundColor: CurrentConversation.color
hoverColor: JamiTheme.buttonTintedBlue hoverColor: CurrentConversation.color
borderWidth: 4 borderWidth: 4
bottomMargin: JamiTheme.settingsMarginSize bottomMargin: JamiTheme.settingsMarginSize
fontSize: JamiTheme.menuFontSize fontSize: JamiTheme.menuFontSize
...@@ -121,8 +121,8 @@ Rectangle { ...@@ -121,8 +121,8 @@ Rectangle {
FilterTabButton { FilterTabButton {
id: membersTabButton id: membersTabButton
backgroundColor: JamiTheme.buttonTintedBlue backgroundColor: CurrentConversation.color
hoverColor: JamiTheme.buttonTintedBlue hoverColor: CurrentConversation.color
borderWidth: 4 borderWidth: 4
bottomMargin: JamiTheme.settingsMarginSize bottomMargin: JamiTheme.settingsMarginSize
fontSize: JamiTheme.menuFontSize fontSize: JamiTheme.menuFontSize
...@@ -139,8 +139,8 @@ Rectangle { ...@@ -139,8 +139,8 @@ Rectangle {
/*FilterTabButton { /*FilterTabButton {
id: documentsTabButton id: documentsTabButton
backgroundColor: JamiTheme.buttonTintedBlue backgroundColor: CurrentConversation.color
hoverColor: JamiTheme.buttonTintedBlue hoverColor: CurrentConversation.color
borderWidth: 4 borderWidth: 4
bottomMargin: JamiTheme.settingsMarginSize bottomMargin: JamiTheme.settingsMarginSize
fontSize: JamiTheme.menuFontSize fontSize: JamiTheme.menuFontSize
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment