Rework models hierarchy, room categories models

This commit is contained in:
miruka
2019-05-02 14:20:21 -04:00
parent ada44cf6f7
commit 047225fded
23 changed files with 325 additions and 293 deletions

View File

@@ -1,14 +1,17 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../Base"
import "Banners"
import "RoomEventList"
HColumnLayout {
property string userId: ""
property string category: ""
property string roomId: ""
readonly property var roomInfo:
Backend.models.rooms.get(userId).get(roomId)
Backend.models.accounts.get(userId)
.roomCategories.get(category).rooms.get(roomId)
property bool canLoadPastEvents: true
@@ -20,22 +23,25 @@ HColumnLayout {
topic: roomInfo.topic || ""
}
RoomEventList {}
RoomEventList {
Layout.fillWidth: true
Layout.fillHeight: true
}
TypingUsersBar {}
InviteBanner {
visible: roomInfo.category === "Invites"
visible: category === "Invites"
inviter: roomInfo.inviter
}
SendBox {
id: sendBox
visible: roomInfo.category === "Rooms"
visible: category === "Rooms"
}
LeftBanner {
visible: roomInfo.category === "Left"
visible: category === "Left"
leftEvent: roomInfo.leftEvent
}
}

View File

@@ -1,7 +1,7 @@
import QtQuick 2.7
import "../../Base"
HNoticeLabel {
HNoticePage {
text: dateTime.toLocaleDateString()
color: HStyle.chat.daybreak.foreground
backgroundColor: HStyle.chat.daybreak.background

View File

@@ -1,5 +1,4 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../../Base"
HGlassRectangle {
@@ -8,9 +7,6 @@ HGlassRectangle {
color: HStyle.chat.roomEventList.background
Layout.fillWidth: true
Layout.fillHeight: true
ListView {
id: roomEventListView
delegate: RoomEventDelegate {}
@@ -20,7 +16,6 @@ HGlassRectangle {
anchors.leftMargin: space
anchors.rightMargin: space
clip: true
topMargin: space
bottomMargin: space
verticalLayoutDirection: ListView.BottomToTop
@@ -39,10 +34,10 @@ HGlassRectangle {
}
}
HNoticeLabel {
HNoticePage {
text: qsTr("Nothing to show here yet...")
visible: roomEventListView.model.count < 1
anchors.centerIn: parent
anchors.fill: parent
}
}