status-desktop/ui/app/AppLayouts/Chat/ChatColumn.qml

145 lines
3.9 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../shared"
import "../../../imports"
2020-06-25 16:27:46 +00:00
import "./components"
2020-05-27 21:59:34 +00:00
import "./ChatColumn"
StackLayout {
id: chatColumnLayout
property int chatGroupsListViewCount: 0
2020-07-09 17:47:36 +00:00
property bool isReply: false
property var appSettings
property bool isConnected: false
Layout.fillHeight: true
Layout.fillWidth: true
2020-05-28 12:56:43 +00:00
Layout.minimumWidth: 300
currentIndex: chatsModel.activeChannelIndex > -1 && chatGroupsListViewCount > 0 ? 0 : 1
ColumnLayout {
2020-07-09 17:47:36 +00:00
spacing: 0
RowLayout {
id: chatTopBar
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.fillWidth: true
z: 60
2020-07-09 17:47:36 +00:00
spacing: 0
TopBar {
id: topBar
}
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
z: 60
Rectangle {
id: connectedStatusRect
Layout.fillWidth: true
height: 40;
color: isConnected ? Style.current.green : Style.current.darkGrey
visible: false
Text {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: Style.current.white
id: connectedStatusLbl
text: isConnected ?
qsTr("Connected") :
qsTr("Disconnected")
}
}
Timer {
id: timer
}
Connections {
target: chatsModel
onOnlineStatusChanged: {
isConnected = connected
if(connected){
timer.setTimeout(function(){
connectedStatusRect.visible = false;
}, 5000);
} else {
connectedStatusRect.visible = true;
}
}
}
}
RowLayout {
id: chatContainer
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
2020-07-09 17:47:36 +00:00
spacing: 0
2020-05-28 17:34:54 +00:00
ChatMessages {
2020-07-09 17:47:36 +00:00
id: chatMessages
2020-05-28 17:34:54 +00:00
messageList: chatsModel.messageList
appSettings: chatColumnLayout.appSettings
2020-05-28 17:34:54 +00:00
}
}
2020-06-25 16:27:46 +00:00
ProfilePopup {
id: profilePopup
}
2020-07-09 17:47:36 +00:00
PopupMenu {
id: messageContextMenu
Action {
id: viewProfileAction
text: qsTr("View profile")
onTriggered: profilePopup.open()
}
Action {
text: qsTr("Reply to")
2020-07-10 22:22:39 +00:00
onTriggered: {
isReply = true;
replyAreaContainer.setup()
}
2020-07-09 17:47:36 +00:00
}
}
Rectangle {
2020-07-09 17:47:36 +00:00
id: inputArea
color: Style.current.background
2020-07-09 17:47:36 +00:00
border.width: 1
border.color: Style.current.border
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.fillWidth: true
Layout.preferredWidth: parent.width
2020-07-09 17:47:36 +00:00
height: !isReply ? 70 : 140
Layout.preferredHeight: height
2020-07-09 17:47:36 +00:00
ReplyArea {
2020-07-10 22:22:39 +00:00
id: replyAreaContainer
2020-07-09 17:47:36 +00:00
visible: isReply
}
ChatInput {
2020-07-09 17:47:36 +00:00
height: 40
2020-07-10 22:22:39 +00:00
anchors.top: !isReply ? inputArea.top : replyAreaContainer.bottom
2020-07-09 17:47:36 +00:00
anchors.topMargin: 4
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
}
}
}
2020-05-28 00:12:07 +00:00
EmptyChat {}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:770;width:800}
}
##^##*/