Reorganize backend files, show accounts in UI
This commit is contained in:
@@ -11,7 +11,7 @@ Column {
|
||||
}
|
||||
|
||||
readonly property string displayName:
|
||||
Backend.getUser(sender_id).display_name
|
||||
Backend.getUser(chatPage.room.room_id, sender_id).display_name
|
||||
|
||||
readonly property bool isOwn:
|
||||
chatPage.user.user_id === sender_id
|
||||
|
@@ -13,7 +13,7 @@ Rectangle {
|
||||
ListView {
|
||||
id: messageListView
|
||||
anchors.fill: parent
|
||||
model: Backend.messagesModel[chatPage.room.room_id]
|
||||
model: Backend.models.messages[chatPage.room.room_id]
|
||||
delegate: MessageDelegate {}
|
||||
//highlight: Rectangle {color: "lightsteelblue"; radius: 5}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ ColumnLayout {
|
||||
id: "roomList"
|
||||
visible: true
|
||||
interactive: false // no scrolling
|
||||
user: Backend.getUser(user_id)
|
||||
for_user_id: user_id
|
||||
|
||||
Layout.minimumHeight:
|
||||
roomList.visible ?
|
||||
|
@@ -5,7 +5,7 @@ import QtQuick.Layouts 1.4
|
||||
ListView {
|
||||
id: "accountList"
|
||||
spacing: 8
|
||||
model: Backend.accountsModel
|
||||
model: Backend.models.accounts
|
||||
delegate: AccountDelegate {}
|
||||
clip: true
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ MouseArea {
|
||||
height: Math.max(roomLabel.height + subtitleLabel.height, avatar.height)
|
||||
|
||||
onClicked: pageStack.show_room(
|
||||
roomList.user,
|
||||
roomList.user_id,
|
||||
roomList.model.get(index)
|
||||
)
|
||||
|
||||
@@ -38,22 +38,23 @@ MouseArea {
|
||||
}
|
||||
Base.HLabel {
|
||||
function get_text() {
|
||||
var msgs = Backend.messagesModel[room_id]
|
||||
var msgs = Backend.models.messages[room_id]
|
||||
if (msgs.count < 1) { return "" }
|
||||
|
||||
var msg = msgs.get(-1)
|
||||
var color_ = (msg.sender_id === roomList.user.user_id ?
|
||||
var color_ = (msg.sender_id === roomList.user_id ?
|
||||
"darkblue" : "purple")
|
||||
var client = Backend.clientManager.clients[RoomList.for_user_id]
|
||||
|
||||
return "<font color=\"" + color_ + "\">" +
|
||||
Backend.getUser(msg.sender_id).display_name +
|
||||
client.getUser(room_id, msg.sender_id).display_name +
|
||||
":</font> " +
|
||||
msg.content
|
||||
}
|
||||
|
||||
id: subtitleLabel
|
||||
visible: text !== ""
|
||||
text: Backend.messagesModel[room_id].reloadThis, get_text()
|
||||
text: Backend.models.messages[room_id].reloadThis, get_text()
|
||||
textFormat: Text.StyledText
|
||||
|
||||
font.pixelSize: smallSize
|
||||
|
@@ -4,7 +4,7 @@ import QtQuick.Layouts 1.4
|
||||
import "../base" as Base
|
||||
|
||||
ListView {
|
||||
property var user: null
|
||||
property var for_user_id: null
|
||||
|
||||
property int contentHeight: 0
|
||||
|
||||
@@ -21,6 +21,6 @@ ListView {
|
||||
|
||||
id: "roomList"
|
||||
spacing: 8
|
||||
model: Backend.roomsModel[user.user_id]
|
||||
model: Backend.models.rooms[for_user_id]
|
||||
delegate: RoomDelegate {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user