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
|
|
|
|
|
2021-12-16 10:17:03 +00:00
|
|
|
StatusAppThreePanelLayout {
|
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
|
|
|
|
|
|
|
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
|
|
|
|
sensor.onClicked: demoContactRequestsModal.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
rightPanel: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
StatusChatToolBar {
|
|
|
|
width: parent.width
|
2022-05-31 09:21:32 +00:00
|
|
|
toolbarComponent: statusChatInfoButton
|
2022-01-18 19:54:45 +00:00
|
|
|
searchButton.visible: false
|
|
|
|
membersButton.visible: false
|
|
|
|
notificationCount: 1
|
|
|
|
|
|
|
|
onNotificationButtonClicked: notificationCount = 0
|
|
|
|
|
|
|
|
popupMenu: 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-right"
|
|
|
|
icon.width: 14
|
|
|
|
iconRotation: 180
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
}
|
|
|
|
}
|
2022-05-31 09:21:32 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: statusChatInfoButton
|
|
|
|
|
|
|
|
StatusChatInfoButton {
|
|
|
|
width: Math.min(implicitWidth, parent.width)
|
|
|
|
title: "Amazing Funny Squirrel"
|
|
|
|
subTitle: "Contact"
|
|
|
|
icon.color: Theme.palette.miscColor7
|
|
|
|
type: StatusChatInfoButton.Type.OneToOneChat
|
|
|
|
pinnedMessagesCount: 1
|
|
|
|
}
|
|
|
|
}
|
2022-01-18 19:54:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|