2019-09-03 00:28:05 +03:00
|
|
|
import QtQuick 2.6
|
2019-09-01 15:17:33 +03:00
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import QtQuick.Layouts 1.5
|
2019-09-07 02:33:46 +03:00
|
|
|
import QtGraphicalEffects 1.0
|
2019-08-30 20:29:25 +03:00
|
|
|
|
2019-09-03 00:28:05 +03:00
|
|
|
import com.github.nheko 1.0
|
|
|
|
|
2019-08-30 20:29:25 +03:00
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-09-07 02:33:46 +03:00
|
|
|
SystemPalette { id: colors; colorGroup: SystemPalette.Active }
|
|
|
|
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Disabled }
|
|
|
|
color: colors.window
|
|
|
|
|
2019-08-30 20:29:25 +03:00
|
|
|
Text {
|
2019-08-31 23:43:31 +03:00
|
|
|
visible: !timelineManager.timeline
|
2019-08-30 20:29:25 +03:00
|
|
|
anchors.centerIn: parent
|
|
|
|
text: qsTr("No room open")
|
|
|
|
font.pointSize: 24
|
2019-09-07 02:33:46 +03:00
|
|
|
color: colors.windowText
|
2019-08-30 20:29:25 +03:00
|
|
|
}
|
2019-08-31 00:20:53 +03:00
|
|
|
|
|
|
|
ListView {
|
2019-09-01 23:34:36 +03:00
|
|
|
id: chat
|
|
|
|
|
2019-08-31 23:43:31 +03:00
|
|
|
visible: timelineManager.timeline != null
|
2019-08-31 00:20:53 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-09-01 23:34:36 +03:00
|
|
|
ScrollBar.vertical: ScrollBar {
|
|
|
|
id: scrollbar
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
}
|
2019-08-31 23:43:31 +03:00
|
|
|
|
|
|
|
model: timelineManager.timeline
|
2019-09-03 00:28:05 +03:00
|
|
|
spacing: 4
|
2019-09-01 15:17:33 +03:00
|
|
|
delegate: RowLayout {
|
2019-09-01 23:34:36 +03:00
|
|
|
anchors.leftMargin: 52
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: scrollbar.width
|
|
|
|
|
2019-09-03 00:28:05 +03:00
|
|
|
Loader {
|
|
|
|
id: loader
|
2019-09-01 15:17:33 +03:00
|
|
|
Layout.fillWidth: true
|
2019-09-03 00:28:05 +03:00
|
|
|
height: item.height
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
|
|
|
source: switch(model.type) {
|
|
|
|
case MtxEvent.Aliases: return "delegates/Aliases.qml"
|
|
|
|
case MtxEvent.Avatar: return "delegates/Avatar.qml"
|
|
|
|
case MtxEvent.CanonicalAlias: return "delegates/CanonicalAlias.qml"
|
|
|
|
case MtxEvent.Create: return "delegates/Create.qml"
|
|
|
|
case MtxEvent.GuestAccess: return "delegates/GuestAccess.qml"
|
|
|
|
case MtxEvent.HistoryVisibility: return "delegates/HistoryVisibility.qml"
|
|
|
|
case MtxEvent.JoinRules: return "delegates/JoinRules.qml"
|
|
|
|
case MtxEvent.Member: return "delegates/Member.qml"
|
|
|
|
case MtxEvent.Name: return "delegates/Name.qml"
|
|
|
|
case MtxEvent.PowerLevels: return "delegates/PowerLevels.qml"
|
|
|
|
case MtxEvent.Topic: return "delegates/Topic.qml"
|
|
|
|
case MtxEvent.NoticeMessage: return "delegates/NoticeMessage.qml"
|
|
|
|
case MtxEvent.TextMessage: return "delegates/TextMessage.qml"
|
|
|
|
case MtxEvent.ImageMessage: return "delegates/ImageMessage.qml"
|
|
|
|
case MtxEvent.VideoMessage: return "delegates/VideoMessage.qml"
|
|
|
|
default: return "delegates/placeholder.qml"
|
|
|
|
}
|
|
|
|
property variant eventData: model
|
2019-09-01 15:17:33 +03:00
|
|
|
}
|
|
|
|
|
2019-09-03 00:28:05 +03:00
|
|
|
|
2019-09-01 15:17:33 +03:00
|
|
|
Button {
|
2019-09-03 00:28:05 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
2019-09-01 15:17:33 +03:00
|
|
|
id: replyButton
|
|
|
|
flat: true
|
2019-09-07 02:33:46 +03:00
|
|
|
height: 32
|
|
|
|
width: 32
|
2019-09-01 15:17:33 +03:00
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Reply")
|
2019-09-07 02:33:46 +03:00
|
|
|
|
2019-09-01 15:17:33 +03:00
|
|
|
Image {
|
|
|
|
id: replyButtonImg
|
|
|
|
// Workaround, can't get icon.source working for now...
|
|
|
|
anchors.fill: parent
|
|
|
|
source: "qrc:/icons/icons/ui/mail-reply.png"
|
|
|
|
}
|
2019-09-07 02:33:46 +03:00
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: replyButtonImg
|
|
|
|
source: replyButtonImg
|
|
|
|
color: colors.buttonText
|
|
|
|
}
|
2019-09-01 15:17:33 +03:00
|
|
|
}
|
|
|
|
Button {
|
2019-09-03 00:28:05 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
2019-09-01 15:17:33 +03:00
|
|
|
id: optionsButton
|
|
|
|
flat: true
|
|
|
|
height: optionsButtonImg.contentHeight
|
|
|
|
width: optionsButtonImg.contentWidth
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Options")
|
|
|
|
Image {
|
|
|
|
id: optionsButtonImg
|
|
|
|
// Workaround, can't get icon.source working for now...
|
|
|
|
anchors.fill: parent
|
|
|
|
source: "qrc:/icons/icons/ui/vertical-ellipsis.png"
|
|
|
|
}
|
2019-09-07 02:33:46 +03:00
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: optionsButtonImg
|
|
|
|
source: optionsButtonImg
|
|
|
|
color: colors.buttonText
|
|
|
|
}
|
2019-09-01 15:17:33 +03:00
|
|
|
|
|
|
|
onClicked: contextMenu.open()
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
y: optionsButton.height
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: "Read receipts"
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: "Mark as read"
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: "View raw message"
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: "Redact message"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
2019-09-03 00:28:05 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
2019-09-01 15:17:33 +03:00
|
|
|
text: model.timestamp.toLocaleTimeString("HH:mm")
|
2019-09-07 02:33:46 +03:00
|
|
|
color: inactiveColors.text
|
2019-09-01 15:17:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
section {
|
|
|
|
property: "section"
|
|
|
|
delegate: Column {
|
2019-09-03 00:28:05 +03:00
|
|
|
topPadding: 4
|
|
|
|
bottomPadding: 4
|
|
|
|
spacing: 8
|
|
|
|
|
2019-09-01 15:17:33 +03:00
|
|
|
width: parent.width
|
2019-09-03 00:28:05 +03:00
|
|
|
|
2019-09-01 15:17:33 +03:00
|
|
|
Label {
|
2019-09-01 23:34:36 +03:00
|
|
|
id: dateBubble
|
2019-09-01 15:17:33 +03:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
visible: section.includes(" ")
|
2019-09-01 23:58:26 +03:00
|
|
|
text: chat.model.formatDateSeparator(new Date(Number(section.split(" ")[1])))
|
2019-09-07 02:33:46 +03:00
|
|
|
color: colors.windowText
|
2019-09-03 00:28:05 +03:00
|
|
|
|
2019-09-01 15:17:33 +03:00
|
|
|
height: contentHeight * 1.2
|
|
|
|
width: contentWidth * 1.2
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
background: Rectangle {
|
|
|
|
radius: parent.height / 2
|
2019-09-07 02:33:46 +03:00
|
|
|
color: colors.dark
|
2019-09-01 15:17:33 +03:00
|
|
|
}
|
|
|
|
}
|
2019-09-01 23:34:36 +03:00
|
|
|
Row {
|
2019-09-03 00:28:05 +03:00
|
|
|
height: userName.height
|
2019-09-01 23:34:36 +03:00
|
|
|
spacing: 4
|
|
|
|
Rectangle {
|
|
|
|
width: 48
|
|
|
|
height: 48
|
|
|
|
color: "green"
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: userName
|
|
|
|
text: chat.model.displayName(section.split(" ")[0])
|
2019-09-07 02:33:46 +03:00
|
|
|
color: chat.model.userColor(section.split(" ")[0], colors.window)
|
2019-09-01 23:34:36 +03:00
|
|
|
}
|
|
|
|
}
|
2019-09-01 15:17:33 +03:00
|
|
|
}
|
2019-08-31 00:20:53 +03:00
|
|
|
}
|
2019-08-31 23:43:31 +03:00
|
|
|
}
|
2019-08-30 20:29:25 +03:00
|
|
|
}
|