summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-09-03 19:51:50 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-09-16 23:49:17 +0200
commitb05c10102148a388a5abedc890db52abc70d71b5 (patch)
tree363429b6cd8613d7e9bb8deea1b4ff379b1b9c4a /resources
parentReenable top bar room settings menus on avatar or title clicks (diff)
downloadnheko-b05c10102148a388a5abedc890db52abc70d71b5.tar.xz
Fix null errors in qml
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/Avatar.qml2
-rw-r--r--resources/qml/TimelineView.qml13
-rw-r--r--resources/qml/delegates/MessageDelegate.qml2
-rw-r--r--resources/qml/delegates/Reply.qml2
4 files changed, 11 insertions, 8 deletions
diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml

index 0c4343c7..a3943806 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml
@@ -14,7 +14,7 @@ Rectangle { Label { anchors.fill: parent - text: chat.model.escapeEmoji(String.fromCodePoint(displayName.codePointAt(0))) + text: timelineManager.escapeEmoji(String.fromCodePoint(displayName.codePointAt(0))) textFormat: Text.RichText font.pixelSize: avatar.height/2 verticalAlignment: Text.AlignVCenter diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 49f523a5..e4643635 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -167,8 +167,9 @@ Page { width: avatarSize height: avatarSize - url: chat.model.roomAvatarUrl.replace("mxc://", "image://MxcImage/") - displayName: chat.model.roomName + + url: chat.model ? chat.model.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : "" + displayName: chat.model ? chat.model.roomName : qsTr("No room selected") MouseArea { anchors.fill: parent @@ -182,7 +183,8 @@ Page { Layout.row: 0 font.pointSize: fontMetrics.font.pointSize * 1.1 - text: chat.model.roomName + + text: chat.model ? chat.model.roomName : qsTr("No room selected") MouseArea { anchors.fill: parent @@ -193,9 +195,10 @@ Page { Layout.fillWidth: true Layout.column: 2 Layout.row: 1 - text: chat.model.roomTopic Layout.maximumHeight: fontMetrics.lineSpacing * 2 // show 2 lines clip: true + + text: chat.model ? chat.model.roomTopic : "" } ImageButton { @@ -387,7 +390,7 @@ Page { Label { id: userName - text: chat.model.escapeEmoji(modelData.userName) + text: timelineManager.escapeEmoji(modelData.userName) color: timelineManager.userColor(modelData.userId, colors.window) textFormat: Text.RichText diff --git a/resources/qml/delegates/MessageDelegate.qml b/resources/qml/delegates/MessageDelegate.qml
index 56b8040e..90e52442 100644 --- a/resources/qml/delegates/MessageDelegate.qml +++ b/resources/qml/delegates/MessageDelegate.qml
@@ -36,7 +36,7 @@ Item { DelegateChoice { roleValue: MtxEvent.EmoteMessage NoticeMessage { - formatted: chat.model.escapeEmoji(modelData.userName) + " " + model.data.formattedBody + formatted: timelineManager.escapeEmoji(modelData.userName) + " " + model.data.formattedBody color: timelineManager.userColor(modelData.userId, colors.window) } } diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index f9fd3f11..36a6d373 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml
@@ -37,7 +37,7 @@ Item { Text { id: userName - text: chat.model ? chat.model.escapeEmoji(reply.modelData.userName) : "" + text: timelineManager.escapeEmoji(reply.modelData.userName) color: replyComponent.userColor textFormat: Text.RichText