summary refs log tree commit diff
path: root/resources/qml/RoomList.qml
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/RoomList.qml')
-rw-r--r--resources/qml/RoomList.qml171
1 files changed, 136 insertions, 35 deletions
diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml

index 25abb4d1..87a27517 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml
@@ -8,6 +8,132 @@ import QtQuick.Layouts 1.3 import im.nheko 1.0 Page { + ListView { + anchors.left: parent.left + anchors.right: parent.right + height: parent.height + model: Rooms + + ScrollHelper { + flickable: parent + anchors.fill: parent + enabled: !Settings.mobileMode + } + + delegate: Rectangle { + color: Nheko.colors.window + height: fontMetrics.lineSpacing * 2.5 + Nheko.paddingMedium * 2 + width: ListView.view.width + + RowLayout { + //id: userInfoGrid + + spacing: Nheko.paddingMedium + anchors.fill: parent + anchors.margins: Nheko.paddingMedium + + Avatar { + //userid: Nheko.currentUser.userid + + id: avatar + + Layout.alignment: Qt.AlignVCenter + Layout.preferredWidth: fontMetrics.lineSpacing * 2.5 + Layout.preferredHeight: fontMetrics.lineSpacing * 2.5 + url: model.avatarUrl.replace("mxc://", "image://MxcImage/") + displayName: model.roomName + } + + ColumnLayout { + id: textContent + + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + Layout.minimumWidth: 100 + width: parent.width - avatar.width + Layout.preferredWidth: parent.width - avatar.width + spacing: 0 + + RowLayout { + Layout.fillWidth: true + spacing: 0 + + ElidedLabel { + Layout.alignment: Qt.AlignBottom + color: Nheko.colors.text + elideWidth: textContent.width - timestamp.width - Nheko.paddingMedium + fullText: model.roomName + ": " + model.notificationCount + } + + Item { + Layout.fillWidth: true + } + + Label { + id: timestamp + + Layout.alignment: Qt.AlignRight | Qt.AlignBottom + font.pixelSize: fontMetrics.font.pixelSize * 0.9 + color: Nheko.colors.buttonText + text: "14:32" + } + + } + + RowLayout { + Layout.fillWidth: true + spacing: 0 + + ElidedLabel { + color: Nheko.colors.buttonText + font.weight: Font.Thin + font.pixelSize: fontMetrics.font.pixelSize * 0.9 + elideWidth: textContent.width - notificationBubble.width + fullText: model.lastMessage + } + + Item { + Layout.fillWidth: true + } + + Rectangle { + id: notificationBubble + + Layout.alignment: Qt.AlignRight + height: fontMetrics.font.pixelSize * 1.3 + width: height + radius: height / 2 + color: Nheko.colors.highlight + + Label { + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + fontSizeMode: Text.Fit + color: Nheko.colors.highlightedText + text: model.notificationCount + } + + } + + } + + } + + } + + Rectangle { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + height: parent.height - Nheko.paddingSmall * 2 + width: 3 + color: Nheko.colors.highlight + visible: model.hasUnreadMessages + } + + } + + } background: Rectangle { color: Nheko.theme.sidebarBackground @@ -34,8 +160,8 @@ Page { id: avatar Layout.alignment: Qt.AlignVCenter - Layout.preferredWidth: Nheko.avatarSize - Layout.preferredHeight: Nheko.avatarSize + Layout.preferredWidth: fontMetrics.lineSpacing * 2 + Layout.preferredHeight: fontMetrics.lineSpacing * 2 url: Nheko.currentUser.avatarUrl.replace("mxc://", "image://MxcImage/") displayName: Nheko.currentUser.displayName userid: Nheko.currentUser.userid @@ -46,50 +172,25 @@ Page { Layout.alignment: Qt.AlignLeft Layout.fillWidth: true - Layout.minimumWidth: 100 - width: parent.width - avatar.width - logoutButton.width - Layout.preferredWidth: parent.width - avatar.width - logoutButton.width + width: parent.width - avatar.width - logoutButton.width - Nheko.paddingMedium * 2 + Layout.preferredWidth: parent.width - avatar.width - logoutButton.width - Nheko.paddingMedium * 2 spacing: 0 - Label { + ElidedLabel { Layout.alignment: Qt.AlignBottom - color: Nheko.colors.text font.pointSize: fontMetrics.font.pointSize * 1.1 font.weight: Font.DemiBold - text: userNameText.elidedText - maximumLineCount: 1 - elide: Text.ElideRight - textFormat: Text.PlainText - - TextMetrics { - id: userNameText - - font.pointSize: fontMetrics.font.pointSize * 1.1 - elide: Text.ElideRight - elideWidth: col.width - text: Nheko.currentUser.displayName - } - + fullText: Nheko.currentUser.displayName + elideWidth: col.width } - Label { + ElidedLabel { Layout.alignment: Qt.AlignTop color: Nheko.colors.buttonText font.weight: Font.Thin - text: userIdText.elidedText - maximumLineCount: 1 - textFormat: Text.PlainText font.pointSize: fontMetrics.font.pointSize * 0.9 - - TextMetrics { - id: userIdText - - font.pointSize: fontMetrics.font.pointSize * 0.9 - elide: Text.ElideRight - elideWidth: col.width - text: Nheko.currentUser.userid - } - + elideWidth: col.width + fullText: Nheko.currentUser.userid } }