Reorganize Chat component files
- MessageList renamed to RoomEventList - MessageDelegate renamed to RoomEventDelegate - Banner and RoomEventList get their own folders
This commit is contained in:
parent
99ab6a817a
commit
7004b4ea3f
@ -39,7 +39,7 @@ QtObject {
|
|||||||
property color background: colors.background1
|
property color background: colors.background1
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject messageList: QtObject {
|
readonly property QtObject roomEventList: QtObject {
|
||||||
property color background: "transparent"
|
property color background: "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
|
|
||||||
Base.HGlassRectangle {
|
Base.HGlassRectangle {
|
||||||
id: banner
|
id: banner
|
@ -1,7 +1,7 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
|
|
||||||
Banner {
|
Banner {
|
||||||
property var inviter: null
|
property var inviter: null
|
@ -1,8 +1,8 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
import "utils.js" as ChatJS
|
import "../utils.js" as ChatJS
|
||||||
|
|
||||||
Banner {
|
Banner {
|
||||||
property var leftEvent: null
|
property var leftEvent: null
|
@ -1,6 +1,8 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
|
import "Banners"
|
||||||
|
import "RoomEventList"
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
property string userId: ""
|
property string userId: ""
|
||||||
@ -22,7 +24,7 @@ ColumnLayout {
|
|||||||
topic: roomInfo.topic
|
topic: roomInfo.topic
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageList {}
|
RoomEventList {}
|
||||||
|
|
||||||
TypingUsersBar {}
|
TypingUsersBar {}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
|
|
||||||
Base.HNoticeLabel {
|
Base.HNoticeLabel {
|
||||||
text: dateTime.toLocaleDateString()
|
text: dateTime.toLocaleDateString()
|
||||||
@ -7,5 +7,5 @@ Base.HNoticeLabel {
|
|||||||
backgroundColor: Base.HStyle.chat.daybreak.background
|
backgroundColor: Base.HStyle.chat.daybreak.background
|
||||||
radius: Base.HStyle.chat.daybreak.radius
|
radius: Base.HStyle.chat.daybreak.radius
|
||||||
|
|
||||||
width: messageDelegate.width
|
width: roomEventDelegate.width
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
import "utils.js" as ChatJS
|
import "../utils.js" as ChatJS
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: row
|
||||||
@ -48,7 +48,7 @@ RowLayout {
|
|||||||
bottomPadding: verticalPadding
|
bottomPadding: verticalPadding
|
||||||
|
|
||||||
Layout.maximumWidth: Math.min(
|
Layout.maximumWidth: Math.min(
|
||||||
600, messageListView.width - avatar.width - row.spacing
|
600, roomEventListView.width - avatar.width - row.spacing
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: row
|
id: row
|
||||||
@ -57,7 +57,7 @@ Row {
|
|||||||
|
|
||||||
Layout.minimumWidth: nameLabel.implicitWidth
|
Layout.minimumWidth: nameLabel.implicitWidth
|
||||||
Layout.maximumWidth: Math.min(
|
Layout.maximumWidth: Math.min(
|
||||||
600, messageListView.width - avatar.width - row.spacing
|
600, roomEventListView.width - avatar.width - row.spacing
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
import "utils.js" as ChatJS
|
import "../utils.js" as ChatJS
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: messageDelegate
|
id: roomEventDelegate
|
||||||
|
|
||||||
function minsBetween(date1, date2) {
|
function minsBetween(date1, date2) {
|
||||||
return Math.round((((date2 - date1) % 86400000) % 3600000) / 60000)
|
return Math.round((((date2 - date1) % 86400000) % 3600000) / 60000)
|
||||||
@ -14,8 +14,8 @@ Column {
|
|||||||
function getIsMessage(type_) { return type_.startsWith("RoomMessage") }
|
function getIsMessage(type_) { return type_.startsWith("RoomMessage") }
|
||||||
|
|
||||||
function getPreviousItem() {
|
function getPreviousItem() {
|
||||||
return index < messageListView.model.count - 1 ?
|
return index < roomEventListView.model.count - 1 ?
|
||||||
messageListView.model.get(index + 1) : null
|
roomEventListView.model.get(index + 1) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
property var previousItem: getPreviousItem()
|
property var previousItem: getPreviousItem()
|
||||||
@ -59,7 +59,7 @@ Column {
|
|||||||
property int verticalPadding: 5
|
property int verticalPadding: 5
|
||||||
|
|
||||||
ListView.onAdd: {
|
ListView.onAdd: {
|
||||||
var nextDelegate = messageListView.contentItem.children[index]
|
var nextDelegate = roomEventListView.contentItem.children[index]
|
||||||
if (nextDelegate) { nextDelegate.reloadPreviousItem() }
|
if (nextDelegate) { nextDelegate.reloadPreviousItem() }
|
||||||
}
|
}
|
||||||
|
|
@ -1,20 +1,20 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.4
|
||||||
import "../Base" as Base
|
import "../../Base" as Base
|
||||||
|
|
||||||
Base.HGlassRectangle {
|
Base.HGlassRectangle {
|
||||||
property bool canLoadPastEvents: true
|
property bool canLoadPastEvents: true
|
||||||
property int space: 8
|
property int space: 8
|
||||||
|
|
||||||
color: Base.HStyle.chat.messageList.background
|
color: Base.HStyle.chat.roomEventList.background
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: messageListView
|
id: roomEventListView
|
||||||
delegate: MessageDelegate {}
|
delegate: RoomEventDelegate {}
|
||||||
model: Backend.models.roomEvents.get(chatPage.roomId)
|
model: Backend.models.roomEvents.get(chatPage.roomId)
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -43,7 +43,7 @@ Base.HGlassRectangle {
|
|||||||
Base.HNoticeLabel {
|
Base.HNoticeLabel {
|
||||||
text: qsTr("Nothing to show here yet...")
|
text: qsTr("Nothing to show here yet...")
|
||||||
|
|
||||||
visible: messageListView.model.count < 1
|
visible: roomEventListView.model.count < 1
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user