2020-05-27 21:59:34 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Controls 2.12 as QQC2
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import Qt.labs.platform 1.1
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../imports"
|
2020-06-02 09:54:46 +00:00
|
|
|
import "../components"
|
2020-05-27 21:59:34 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2020-06-02 12:00:38 +00:00
|
|
|
property string channelNameStr: "#" + chatsModel.activeChannel.id
|
2020-05-27 21:59:34 +00:00
|
|
|
|
|
|
|
id: chatTopBarContent
|
|
|
|
color: "white"
|
|
|
|
height: 56
|
|
|
|
Layout.fillWidth: true
|
|
|
|
border.color: Theme.grey
|
|
|
|
border.width: 1
|
|
|
|
|
|
|
|
|
2020-06-02 09:54:46 +00:00
|
|
|
ChannelIcon {
|
|
|
|
id: channelIcon
|
2020-06-02 12:00:38 +00:00
|
|
|
channelName: chatsModel.activeChannel.id
|
|
|
|
channelType: chatsModel.activeChannel.chatType
|
|
|
|
channelIdenticon: chatsModel.activeChannel.identicon
|
2020-05-27 21:59:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: channelName
|
|
|
|
width: 80
|
|
|
|
height: 20
|
2020-06-09 15:48:17 +00:00
|
|
|
text: chatsModel.activeChannel.chatType != Constants.chatTypePublic ? chatsModel.activeChannel.name : channelNameStr
|
2020-05-27 21:59:34 +00:00
|
|
|
anchors.left: channelIcon.right
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Theme.smallPadding
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 15
|
|
|
|
selectByMouse: true
|
|
|
|
readOnly: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: channelIdentifier
|
|
|
|
color: Theme.darkGrey
|
|
|
|
// TODO change this in case of private message
|
2020-06-09 15:48:17 +00:00
|
|
|
text: {
|
|
|
|
switch(chatsModel.activeChannel.chatType){
|
|
|
|
case Constants.chatTypePublic: return qsTr("Public chat")
|
|
|
|
case Constants.chatTypeOneToOne: return qsTr("TODO: Contact/Not a contact")
|
|
|
|
case Constants.chatTypePrivateGroupChat: return qsTr("TODO: N members")
|
|
|
|
}
|
|
|
|
}
|
2020-05-27 21:59:34 +00:00
|
|
|
font.pixelSize: 12
|
|
|
|
anchors.left: channelIcon.right
|
|
|
|
anchors.leftMargin: Theme.smallPadding
|
|
|
|
anchors.top: channelName.bottom
|
|
|
|
anchors.topMargin: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: moreActionsBtn
|
|
|
|
text: "..."
|
|
|
|
font.letterSpacing: 0.5
|
|
|
|
font.bold: true
|
|
|
|
lineHeight: 1.4
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 20
|
|
|
|
font.pixelSize: 25
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
// The negative margins are for the mouse area to be a bit more wide around the button and have more space for the click
|
|
|
|
anchors.topMargin: -10
|
|
|
|
anchors.bottomMargin: -10
|
|
|
|
anchors.rightMargin: -15
|
|
|
|
anchors.leftMargin: -15
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
contextMenu.arrowX = contextMenu.width - 40
|
|
|
|
contextMenu.popup(moreActionsBtn.x, moreActionsBtn.height + 10)
|
|
|
|
}
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
|
|
|
|
|
|
PopupMenu {
|
|
|
|
id: contextMenu
|
|
|
|
QQC2.Action {
|
|
|
|
text: qsTr("Leave Chat")
|
|
|
|
onTriggered: chatsModel.leaveActiveChat()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-02 09:54:46 +00:00
|
|
|
}
|