2022-01-18 19:54:45 +00:00
|
|
|
import QtQuick 2.12
|
2022-01-19 22:33:29 +00:00
|
|
|
import QtQuick.Layouts 1.12
|
2022-01-18 19:54:45 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Layout 0.1
|
2021-12-16 10:17:03 +00:00
|
|
|
import StatusQ.Core 0.1
|
2022-01-18 19:54:45 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
import "data" 1.0
|
|
|
|
|
2022-09-02 07:25:43 +00:00
|
|
|
StatusSectionLayout {
|
2022-01-18 19:54:45 +00:00
|
|
|
id: root
|
2022-01-19 22:33:29 +00:00
|
|
|
property bool createChat: false
|
2022-01-18 19:54:45 +00:00
|
|
|
|
2022-09-02 07:25:43 +00:00
|
|
|
notificationCount: 1
|
|
|
|
onNotificationButtonClicked: { notificationCount = 0; }
|
|
|
|
showHeader: !root.createChat
|
|
|
|
|
|
|
|
headerContent: RowLayout {
|
|
|
|
id: chatHeader
|
|
|
|
|
|
|
|
signal chatInfoButtonClicked()
|
|
|
|
signal menuButtonClicked()
|
|
|
|
signal membersButtonClicked()
|
|
|
|
signal searchButtonClicked()
|
|
|
|
|
|
|
|
StatusChatInfoButton {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.leftMargin: padding
|
|
|
|
title: "Amazing Funny Squirrel"
|
|
|
|
subTitle: "Contact"
|
|
|
|
icon.color: Theme.palette.miscColor7
|
|
|
|
type: StatusChatInfoButton.Type.OneToOneChat
|
|
|
|
pinnedMessagesCount: 1
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: actionButtons
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
Layout.rightMargin: padding
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: menuButton
|
|
|
|
objectName: "chatToolbarMoreOptionsButton"
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
icon.name: "more"
|
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
|
|
|
|
|
|
|
// initializing the tooltip
|
|
|
|
tooltip.visible: !!tooltip.text && menuButton.hovered && !contextMenu.open
|
|
|
|
tooltip.text: qsTr("More")
|
|
|
|
tooltip.orientation: StatusToolTip.Orientation.Bottom
|
|
|
|
tooltip.y: parent.height + 12
|
|
|
|
|
|
|
|
property bool showMoreMenu: false
|
|
|
|
onClicked: {
|
|
|
|
menuButton.highlighted = true
|
|
|
|
|
|
|
|
let originalOpenHandler = contextMenu.openHandler
|
|
|
|
let originalCloseHandler = contextMenu.closeHandler
|
|
|
|
|
|
|
|
contextMenu.openHandler = function () {
|
|
|
|
if (!!originalOpenHandler) {
|
|
|
|
originalOpenHandler()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contextMenu.closeHandler = function () {
|
|
|
|
menuButton.highlighted = false
|
|
|
|
if (!!originalCloseHandler) {
|
|
|
|
originalCloseHandler()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contextMenu.openHandler = originalOpenHandler
|
|
|
|
contextMenu.popup(-contextMenu.width + menuButton.width, menuButton.height + 4)
|
|
|
|
}
|
|
|
|
StatusPopupMenu {
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Mute Chat"
|
|
|
|
icon.name: "notification"
|
|
|
|
}
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Mark as Read"
|
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
}
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Clear History"
|
|
|
|
icon.name: "close-circle"
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Leave Chat"
|
|
|
|
icon.name: "arrow-left"
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
width: 1
|
|
|
|
height: 24
|
|
|
|
color: Theme.palette.directColor7
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
visible: (notificationButton.visible && menuButton.visible)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-18 19:54:45 +00:00
|
|
|
leftPanel: Item {
|
|
|
|
anchors.fill: parent
|
2022-07-13 08:58:59 +00:00
|
|
|
anchors.margins: 16
|
2022-01-19 22:33:29 +00:00
|
|
|
RowLayout {
|
2022-01-18 19:54:45 +00:00
|
|
|
id: searchInputWrapper
|
2022-07-13 08:58:59 +00:00
|
|
|
width: parent.width
|
2022-01-18 19:54:45 +00:00
|
|
|
|
2022-07-13 08:58:59 +00:00
|
|
|
StatusNavigationPanelHeadline {
|
|
|
|
id: headline
|
2022-05-18 14:01:27 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2022-07-13 08:58:59 +00:00
|
|
|
text: "Chat"
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|
|
|
|
|
2022-07-13 08:58:59 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StatusRoundButton {
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2022-01-19 22:33:29 +00:00
|
|
|
icon.name: "public-chat"
|
2022-07-13 08:58:59 +00:00
|
|
|
icon.color: Theme.palette.directColor1
|
|
|
|
icon.height: editBtn.icon.height
|
|
|
|
icon.width: editBtn.icon.width
|
|
|
|
implicitWidth: editBtn.implicitWidth
|
|
|
|
implicitHeight: editBtn.implicitHeight
|
|
|
|
type: StatusRoundButton.Type.Tertiary
|
|
|
|
StatusToolTip {
|
|
|
|
text: qsTr("Join public chats")
|
|
|
|
visible: parent.hovered
|
|
|
|
orientation: StatusToolTip.Orientation.Bottom
|
|
|
|
y: parent.height + 12
|
|
|
|
}
|
2022-01-19 22:33:29 +00:00
|
|
|
}
|
2022-01-18 19:54:45 +00:00
|
|
|
|
2022-01-19 22:33:29 +00:00
|
|
|
StatusIconTabButton {
|
2022-07-13 08:58:59 +00:00
|
|
|
id: editBtn
|
2022-01-19 22:33:29 +00:00
|
|
|
icon.name: "edit"
|
2022-07-13 08:58:59 +00:00
|
|
|
icon.color: Theme.palette.directColor1
|
|
|
|
checked: root.createChat
|
|
|
|
highlighted: checked
|
2022-01-19 22:33:29 +00:00
|
|
|
onClicked: {
|
|
|
|
root.createChat = !root.createChat;
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|
2022-07-13 08:58:59 +00:00
|
|
|
StatusToolTip {
|
|
|
|
text: qsTr("Start chat")
|
|
|
|
visible: parent.hovered
|
|
|
|
orientation: StatusToolTip.Orientation.Bottom
|
|
|
|
y: parent.height + 12
|
|
|
|
}
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-25 10:19:26 +00:00
|
|
|
StatusInput {
|
2022-07-13 08:58:59 +00:00
|
|
|
id: searchInput
|
2022-01-18 19:54:45 +00:00
|
|
|
anchors.top: searchInputWrapper.bottom
|
|
|
|
anchors.topMargin: 16
|
2022-07-13 08:58:59 +00:00
|
|
|
width: parent.width
|
2022-07-25 10:19:26 +00:00
|
|
|
maximumHeight: 36
|
2022-07-13 08:58:59 +00:00
|
|
|
topPadding: 8
|
|
|
|
bottomPadding: 8
|
|
|
|
placeholderText: "Search"
|
2022-07-25 10:19:26 +00:00
|
|
|
input.icon.name: "search"
|
2022-07-13 08:58:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
width: parent.width
|
|
|
|
anchors.top: searchInput.bottom
|
|
|
|
anchors.topMargin: 16
|
2022-05-18 14:01:27 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-01-18 19:54:45 +00:00
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
StatusContactRequestsIndicatorListItem {
|
2022-07-13 08:58:59 +00:00
|
|
|
width: parent.width
|
2022-01-18 19:54:45 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
title: "Contact requests"
|
|
|
|
requestsCount: 3
|
2022-08-04 15:10:35 +00:00
|
|
|
onClicked: demoContactRequestsModal.open()
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusChatList {
|
2022-07-13 08:58:59 +00:00
|
|
|
width: parent.width
|
2022-02-01 15:20:57 +00:00
|
|
|
model: Models.demoChatListItems
|
2022-05-05 09:27:05 +00:00
|
|
|
highlightItem: !root.createChat
|
2022-01-18 19:54:45 +00:00
|
|
|
onChatItemUnmuted: {
|
|
|
|
for (var i = 0; i < Models.demoChatListItems.count; i++) {
|
|
|
|
let item = Models.demoChatListItems.get(i);
|
|
|
|
if (item.chatId === id) {
|
|
|
|
Models.demoChatListItems.setProperty(i, "muted", false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
popupMenu: StatusPopupMenu {
|
|
|
|
|
|
|
|
property string chatId
|
|
|
|
|
|
|
|
openHandler: function (id) {
|
|
|
|
chatId = id
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "View Profile"
|
|
|
|
icon.name: "group-chat"
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Mute chat"
|
|
|
|
icon.name: "notification"
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Mark as Read"
|
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Clear history"
|
|
|
|
icon.name: "close-circle"
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: "Delete chat"
|
|
|
|
icon.name: "delete"
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-19 22:33:29 +00:00
|
|
|
centerPanel: Loader {
|
|
|
|
anchors.fill: parent
|
|
|
|
sourceComponent: root.createChat ? createChatView : chatChannelView
|
2022-05-10 16:04:27 +00:00
|
|
|
Component {
|
|
|
|
id: createChatView
|
|
|
|
CreateChatView {
|
2022-05-19 09:02:36 +00:00
|
|
|
contactsModel: Models.membersListModel
|
2022-05-10 16:04:27 +00:00
|
|
|
}
|
2022-01-19 22:33:29 +00:00
|
|
|
}
|
|
|
|
|
2022-05-10 16:04:27 +00:00
|
|
|
Component {
|
|
|
|
id: chatChannelView
|
|
|
|
ChatChannelView {
|
|
|
|
model: Models.chatMessagesModel
|
|
|
|
}
|
2022-01-19 22:33:29 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|