2020-07-15 21:04:14 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import "../../../../../shared"
|
|
|
|
import "../../../../../imports"
|
|
|
|
|
2021-01-25 20:01:00 +00:00
|
|
|
Column {
|
2020-07-15 21:04:14 +00:00
|
|
|
property string authorCurrentMsg: "authorCurrentMsg"
|
|
|
|
property int verticalMargin: 50
|
|
|
|
|
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
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: this.visible ? verticalMargin : 0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: circleId
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 120
|
|
|
|
height: 120
|
|
|
|
radius: 120
|
|
|
|
border.width: chatsModel.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: {
|
|
|
|
if (chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne) {
|
|
|
|
return Style.current.transparent
|
|
|
|
}
|
|
|
|
return chatsModel.activeChannel.color
|
|
|
|
}
|
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
RoundedImage {
|
2020-07-15 21:04:14 +00:00
|
|
|
visible: chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 120
|
|
|
|
height: 120
|
2020-11-30 17:03:52 +00:00
|
|
|
source: channelIdentifier.profileImage || chatsModel.activeChannel.identicon
|
2020-07-15 21:04:14 +00:00
|
|
|
smooth: false
|
|
|
|
antialiasing: true
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
visible: chatsModel.activeChannel.chatType !== Constants.chatTypeOneToOne
|
2020-08-07 19:26:51 +00:00
|
|
|
text: Utils.removeStatusEns((chatsModel.activeChannel.name.charAt(0) === "#" ? chatsModel.activeChannel.name.charAt(1) : chatsModel.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: {
|
2020-08-07 19:26:51 +00:00
|
|
|
switch(chatsModel.activeChannel.chatType) {
|
|
|
|
case Constants.chatTypePublic: return "#" + chatsModel.activeChannel.name;
|
|
|
|
case Constants.chatTypeOneToOne: return Utils.removeStatusEns(chatsModel.activeChannel.name)
|
|
|
|
default: return chatsModel.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
|
|
|
|
}
|
|
|
|
|
2020-11-30 17:03:52 +00:00
|
|
|
Item {
|
2020-08-07 21:36:35 +00:00
|
|
|
id: channelDescription
|
2020-09-22 14:47:25 +00:00
|
|
|
visible: descText.visible
|
|
|
|
width: visible ? 330 : 0
|
|
|
|
height: visible ? childrenRect.height : 0
|
2020-08-07 21:36:35 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-22 14:47:25 +00:00
|
|
|
id: descText
|
2020-08-07 21:36:35 +00:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
text: {
|
|
|
|
switch(chatsModel.activeChannel.chatType) {
|
|
|
|
case Constants.chatTypePrivateGroupChat: return qsTr(`Welcome to the beginning of the <span style="color: ${Style.current.textColor}">%1</span> group!`).arg(chatsModel.activeChannel.name);
|
|
|
|
case Constants.chatTypeOneToOne: return qsTr(`Any messages you send here are encrypted and can only be read by you and <span style="color: ${Style.current.textColor}">%1</span>`).arg(Utils.removeStatusEns(chatsModel.activeChannel.name))
|
|
|
|
default: return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
font.pixelSize: 14
|
|
|
|
color: Style.current.darkGrey
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
textFormat: Text.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-15 21:04:14 +00:00
|
|
|
Item {
|
2020-09-21 15:47:15 +00:00
|
|
|
visible: chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat && !chatsModel.activeChannel.isMember
|
2020-09-18 13:11:51 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-01-25 20:01:00 +00:00
|
|
|
width: joinChat.width
|
2020-09-18 13:11:51 +00:00
|
|
|
height: visible ? 100 : 10
|
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-09-18 13:11:51 +00:00
|
|
|
joinOrDecline.visible = false;
|
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: {
|
|
|
|
chatsModel.leaveActiveChat()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-01-25 20:01:00 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: spacer
|
|
|
|
visible: chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat && chatsModel.activeChannel.isMember
|
|
|
|
width: parent.width
|
|
|
|
height: Style.current.bigPadding
|
|
|
|
|
|
|
|
}
|
2020-07-15 21:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;formeditorZoom:0.5;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|