2021-08-30 09:50:45 +00:00
|
|
|
import QtQuick 2.14
|
2020-07-15 21:04:14 +00:00
|
|
|
import "../../../../../shared"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
2021-01-25 20:01:00 +00:00
|
|
|
Column {
|
2020-07-15 21:04:14 +00:00
|
|
|
property string authorCurrentMsg: "authorCurrentMsg"
|
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
property string profileImage
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
id: channelIdentifier
|
2021-01-25 20:01:00 +00:00
|
|
|
spacing: Style.current.padding
|
2020-11-30 17:03:52 +00:00
|
|
|
visible: authorCurrentMsg === ""
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-08-30 09:50:45 +00:00
|
|
|
topPadding: visible ? Style.current.bigPadding : 0
|
|
|
|
bottomPadding: visible? 50 : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: circleId
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 120
|
|
|
|
height: 120
|
|
|
|
radius: 120
|
2021-06-17 22:09:00 +00:00
|
|
|
border.width: chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne ? 2 : 0
|
2020-07-22 20:16:06 +00:00
|
|
|
border.color: Style.current.border
|
2020-07-15 21:04:14 +00:00
|
|
|
color: {
|
2021-06-17 22:09:00 +00:00
|
|
|
if (chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne) {
|
2020-07-15 21:04:14 +00:00
|
|
|
return Style.current.transparent
|
|
|
|
}
|
2021-06-17 22:09:00 +00:00
|
|
|
if (chatsModel.channelView.activeChannel.color) {
|
|
|
|
return chatsModel.channelView.activeChannel.color
|
2021-03-02 20:43:32 +00:00
|
|
|
}
|
2021-06-17 22:09:00 +00:00
|
|
|
const color = chatsModel.channelView.getChannelColor(chatId)
|
2021-03-02 20:43:32 +00:00
|
|
|
if (!color) {
|
|
|
|
return Style.current.orange
|
|
|
|
}
|
|
|
|
return color
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
RoundedImage {
|
2021-06-17 22:09:00 +00:00
|
|
|
visible: chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 120
|
|
|
|
height: 120
|
2021-06-17 22:09:00 +00:00
|
|
|
source: channelIdentifier.profileImage || chatsModel.channelView.activeChannel.identicon
|
2020-07-15 21:04:14 +00:00
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-06-17 22:09:00 +00:00
|
|
|
visible: chatsModel.channelView.activeChannel.chatType !== Constants.chatTypeOneToOne
|
|
|
|
text: Utils.removeStatusEns((chatsModel.channelView.activeChannel.name.charAt(0) === "#" ? chatsModel.channelView.activeChannel.name.charAt(1) : chatsModel.channelView.activeChannel.name.charAt(0)).toUpperCase())
|
2020-07-15 21:04:14 +00:00
|
|
|
opacity: 0.7
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 51
|
|
|
|
color: Style.current.white
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: channelName
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
text: {
|
2021-06-17 22:09:00 +00:00
|
|
|
switch(chatsModel.channelView.activeChannel.chatType) {
|
|
|
|
case Constants.chatTypePublic: return "#" + chatsModel.channelView.activeChannel.name;
|
|
|
|
case Constants.chatTypeOneToOne: return Utils.removeStatusEns(chatsModel.userNameOrAlias(chatsModel.channelView.activeChannel.id))
|
|
|
|
default: return chatsModel.channelView.activeChannel.name
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
2020-08-07 19:26:51 +00:00
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 22
|
2020-07-17 11:36:36 +00:00
|
|
|
color: Style.current.textColor
|
2020-07-15 21:04:14 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
2021-04-28 17:33:10 +00:00
|
|
|
StyledText {
|
|
|
|
id: descText
|
|
|
|
wrapMode: Text.Wrap
|
2020-08-07 21:36:35 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-04-28 17:33:10 +00:00
|
|
|
width: 310
|
|
|
|
text: {
|
2021-06-17 22:09:00 +00:00
|
|
|
switch(chatsModel.channelView.activeChannel.chatType) {
|
2021-04-28 17:33:10 +00:00
|
|
|
//% "Welcome to the beginning of the <span style='color: %1'>%2</span> group!"
|
2021-06-17 22:09:00 +00:00
|
|
|
case Constants.chatTypePrivateGroupChat: return qsTrId("welcome-to-the-beginning-of-the--span-style--color---1---2--span--group-").arg(Style.current.textColor).arg(chatsModel.channelView.activeChannel.name);
|
2021-04-28 17:33:10 +00:00
|
|
|
//% "Any messages you send here are encrypted and can only be read by you and <span style='color: %1'>%2</span>"
|
|
|
|
case Constants.chatTypeOneToOne: return qsTrId("any-messages-you-send-here-are-encrypted-and-can-only-be-read-by-you-and--span-style--color---1---2--span-").arg(Style.current.textColor).arg(channelName.text)
|
|
|
|
default: return "";
|
2020-08-07 21:36:35 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-28 17:33:10 +00:00
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
textFormat: Text.RichText
|
2020-08-07 21:36:35 +00:00
|
|
|
}
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
Item {
|
2021-06-17 22:09:00 +00:00
|
|
|
visible: chatsModel.channelView.activeChannel.chatType === Constants.chatTypePrivateGroupChat && chatsModel.channelView.activeChannel.isMemberButNotJoined
|
2020-09-18 13:11:51 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-04-28 17:33:10 +00:00
|
|
|
width: visible ? joinChat.width : 0
|
|
|
|
height: visible ? 100 : 0
|
2020-07-15 21:04:14 +00:00
|
|
|
id: joinOrDecline
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: joinChat
|
|
|
|
//% "Join chat"
|
|
|
|
text: qsTrId("join-chat")
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: Style.current.blue
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2020-12-06 15:24:28 +00:00
|
|
|
chatsModel.groups.join()
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
//% "Decline invitation"
|
|
|
|
text: qsTrId("group-chat-decline-invitation")
|
|
|
|
font.pixelSize: 20
|
|
|
|
color: Style.current.blue
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: joinChat.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2021-06-17 22:09:00 +00:00
|
|
|
chatsModel.channelView.leaveActiveChat()
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|