Reorganize Chat component files

- MessageList renamed to RoomEventList
- MessageDelegate renamed to RoomEventDelegate
- Banner and RoomEventList get their own folders
This commit is contained in:
miruka 2019-04-28 14:34:29 -04:00
parent 99ab6a817a
commit 7004b4ea3f
10 changed files with 26 additions and 24 deletions

View File

@ -39,7 +39,7 @@ QtObject {
property color background: colors.background1
}
readonly property QtObject messageList: QtObject {
readonly property QtObject roomEventList: QtObject {
property color background: "transparent"
}

View File

@ -1,7 +1,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../../Base" as Base
Base.HGlassRectangle {
id: banner

View File

@ -1,7 +1,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../../Base" as Base
Banner {
property var inviter: null

View File

@ -1,8 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "utils.js" as ChatJS
import "../../Base" as Base
import "../utils.js" as ChatJS
Banner {
property var leftEvent: null

View File

@ -1,6 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "Banners"
import "RoomEventList"
ColumnLayout {
property string userId: ""
@ -22,7 +24,7 @@ ColumnLayout {
topic: roomInfo.topic
}
MessageList {}
RoomEventList {}
TypingUsersBar {}

View File

@ -1,5 +1,5 @@
import QtQuick 2.7
import "../Base" as Base
import "../../Base" as Base
Base.HNoticeLabel {
text: dateTime.toLocaleDateString()
@ -7,5 +7,5 @@ Base.HNoticeLabel {
backgroundColor: Base.HStyle.chat.daybreak.background
radius: Base.HStyle.chat.daybreak.radius
width: messageDelegate.width
width: roomEventDelegate.width
}

View File

@ -1,8 +1,8 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../Base" as Base
import "utils.js" as ChatJS
import "../../Base" as Base
import "../utils.js" as ChatJS
RowLayout {
id: row
@ -48,7 +48,7 @@ RowLayout {
bottomPadding: verticalPadding
Layout.maximumWidth: Math.min(
600, messageListView.width - avatar.width - row.spacing
600, roomEventListView.width - avatar.width - row.spacing
)
}
}

View File

@ -1,7 +1,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../../Base" as Base
Row {
id: row
@ -57,7 +57,7 @@ Row {
Layout.minimumWidth: nameLabel.implicitWidth
Layout.maximumWidth: Math.min(
600, messageListView.width - avatar.width - row.spacing
600, roomEventListView.width - avatar.width - row.spacing
)
}
}

View File

@ -1,11 +1,11 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../Base" as Base
import "utils.js" as ChatJS
import "../../Base" as Base
import "../utils.js" as ChatJS
Column {
id: messageDelegate
id: roomEventDelegate
function minsBetween(date1, date2) {
return Math.round((((date2 - date1) % 86400000) % 3600000) / 60000)
@ -14,8 +14,8 @@ Column {
function getIsMessage(type_) { return type_.startsWith("RoomMessage") }
function getPreviousItem() {
return index < messageListView.model.count - 1 ?
messageListView.model.get(index + 1) : null
return index < roomEventListView.model.count - 1 ?
roomEventListView.model.get(index + 1) : null
}
property var previousItem: getPreviousItem()
@ -59,7 +59,7 @@ Column {
property int verticalPadding: 5
ListView.onAdd: {
var nextDelegate = messageListView.contentItem.children[index]
var nextDelegate = roomEventListView.contentItem.children[index]
if (nextDelegate) { nextDelegate.reloadPreviousItem() }
}

View File

@ -1,20 +1,20 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../../Base" as Base
Base.HGlassRectangle {
property bool canLoadPastEvents: true
property int space: 8
color: Base.HStyle.chat.messageList.background
color: Base.HStyle.chat.roomEventList.background
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
id: messageListView
delegate: MessageDelegate {}
id: roomEventListView
delegate: RoomEventDelegate {}
model: Backend.models.roomEvents.get(chatPage.roomId)
anchors.fill: parent
@ -43,7 +43,7 @@ Base.HGlassRectangle {
Base.HNoticeLabel {
text: qsTr("Nothing to show here yet...")
visible: messageListView.model.count < 1
visible: roomEventListView.model.count < 1
anchors.centerIn: parent
}
}