From 1cddc5a3980d00dba1cf2b115edd3dea861ee8c1 Mon Sep 17 00:00:00 2001 From: Armored Dragon Date: Wed, 22 May 2024 21:18:08 -0500 Subject: [PATCH] Added message padding. Resolved "listview" rendering warnings. Prevent sending empty messages. Signed-off-by: Armored Dragon --- .../communityScripts/armored-chat/armored_chat.js | 2 ++ .../communityScripts/armored-chat/armored_chat.qml | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/communityScripts/armored-chat/armored_chat.js b/scripts/communityScripts/armored-chat/armored_chat.js index 6674a74538..49c4ba0790 100644 --- a/scripts/communityScripts/armored-chat/armored_chat.js +++ b/scripts/communityScripts/armored-chat/armored_chat.js @@ -186,6 +186,8 @@ } } function _sendMessage(message, channel) { + if (message.length == 0) return; + Messages.sendMessage( "chat", JSON.stringify({ diff --git a/scripts/communityScripts/armored-chat/armored_chat.qml b/scripts/communityScripts/armored-chat/armored_chat.qml index 826e848370..b34d941fc5 100644 --- a/scripts/communityScripts/armored-chat/armored_chat.qml +++ b/scripts/communityScripts/armored-chat/armored_chat.qml @@ -11,7 +11,6 @@ Rectangle { property string last_message_user: "" property date last_message_time: new Date() - // TODO: Find a better way to do this // When the window is created on the script side, the window starts open. // Once the QML window is created wait, then send the initialized signal. // This signal is mostly used to close the "Desktop overlay window" script side @@ -154,7 +153,7 @@ Rectangle { property string delegateText: model.text property string delegateUsername: model.username property string delegateDate: model.date - width: parent.width // FIXME: Causes warning, but required for style? + width: listview.width sourceComponent: { if (model.type === "chat") { @@ -339,12 +338,12 @@ Rectangle { property string username: delegateUsername property string date: delegateDate - width: parent.width height: Math.max(65, children[1].height + 30) color: index % 2 === 0 ? "transparent" : Qt.rgba(0.15,0.15,0.15,1) Item { - width: parent.width + width: parent.width - 10 + anchors.horizontalCenter: parent.horizontalCenter height: 22 Text{ @@ -361,6 +360,7 @@ Rectangle { TextEdit{ anchors.top: parent.children[0].bottom + x: 5 text: texttest color:"white" font.pointSize: 12 @@ -368,7 +368,7 @@ Rectangle { selectByMouse: true selectByKeyboard: true width: parent.width * 0.8 - height: contentHeight // Adjust height to fit content + height: contentHeight wrapMode: Text.Wrap textFormat: TextEdit.RichText @@ -382,8 +382,6 @@ Rectangle { Component { id: template_notification - // width: (Math.min(parent.width * 0.8, Math.max(contentWidth, parent.width))) - parent.children[0].width - Rectangle{ property int index: delegateIndex property string texttest: delegateText