diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml
index c92d1d0..514ce67 100644
--- a/imports/Spectral/Component/Timeline/MessageDelegate.qml
+++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml
@@ -99,18 +99,32 @@ ColumnLayout {
visible: replyEventId || ""
- background: MouseArea {
- onClicked: goToEvent(replyEventId)
+ padding: 8
+
+ background: Item {
+ Rectangle {
+ anchors.leftMargin: 0
+ width: 2
+ height: parent.height
+
+ color: "white"
+ }
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: goToEvent(replyEventId)
+ }
}
contentItem: RowLayout {
- spacing: 4
+ spacing: 8
- Rectangle {
- Layout.preferredWidth: 2
- Layout.fillHeight: true
+ ImageItem {
+ Layout.preferredWidth: 36
+ Layout.preferredHeight: 36
+ Layout.alignment: Qt.AlignTop
- color: "white"
+ source: replyAuthor ? replyAuthor.paintable : null
}
ColumnLayout {
@@ -118,38 +132,21 @@ ColumnLayout {
spacing: 0
- Control {
- padding: 4
+ Label {
+ Layout.fillWidth: true
- contentItem: RowLayout {
- spacing: 4
+ color: "white"
+ text: replyAuthor ? replyAuthor.displayName : ""
- ImageItem {
- Layout.preferredWidth: 16
- Layout.preferredHeight: 16
-
- source: replyAuthor ? replyAuthor.paintable : null
- }
-
- Label {
- color: "white"
- text: replyAuthor ? replyAuthor.displayName : ""
- }
- }
-
- background: Rectangle {
- color: "black"
- opacity: 0.2
- radius: height / 2
- }
+ font.pixelSize: 13
+ font.weight: Font.Medium
}
Label {
Layout.fillWidth: true
- text: "" + (replyDisplay ? replyDisplay.replace(/.*<\/mx-reply>/g, "") : "")
-
color: "white"
+ text: replyDisplay || ""
wrapMode: Label.Wrap
textFormat: Label.RichText
diff --git a/src/controller.cpp b/src/controller.cpp
index c53df3b..7552083 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -10,6 +10,8 @@
#include "csapi/joining.h"
#include "csapi/logout.h"
+#include "utils.h"
+
#include
#include
#include
@@ -242,3 +244,7 @@ int Controller::dpi() {
void Controller::setDpi(int dpi) {
SettingsGroup("Interface").setValue("dpi", dpi);
}
+
+QString Controller::removeReply(const QString& text) {
+ return utils::removeReply(text);
+}
diff --git a/src/controller.h b/src/controller.h
index 46c526e..0300c78 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -76,6 +76,8 @@ class Controller : public QObject {
void loadSettings();
void saveSettings() const;
+ Q_INVOKABLE QString removeReply(const QString& text);
+
private slots:
void invokeLogin();
diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp
index 1c1956d..a41eafc 100644
--- a/src/messageeventmodel.cpp
+++ b/src/messageeventmodel.cpp
@@ -261,7 +261,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const {
const auto &evt = isPending ? **pendingIt : **timelineIt;
if (role == Qt::DisplayRole) {
- return utils::eventToString(evt, m_currentRoom, Qt::RichText);
+ return utils::removeReply(utils::eventToString(evt, m_currentRoom, Qt::RichText));
}
if (role == MessageRole) {
@@ -389,7 +389,7 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const {
case ReplyEventIdRole:
return replyEventId;
case ReplyDisplayRole:
- return utils::eventToString(replyEvt, m_currentRoom, Qt::RichText);
+ return utils::removeReply(utils::eventToString(replyEvt, m_currentRoom, Qt::RichText));
case ReplyAuthorRole:
return QVariant::fromValue(
m_currentRoom->user(replyEvt.senderId()));
diff --git a/src/utils.cpp b/src/utils.cpp
index b14e9be..3b87e44 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -2,5 +2,7 @@
QString utils::removeReply(const QString& text) {
QString result(text);
- return result.remove(utils::removeReplyRegex);
+ result.remove(utils::removeRichReplyRegex);
+ result.remove(utils::removeReplyRegex);
+ return result;
}
diff --git a/src/utils.h b/src/utils.h
index 6ffdb0a..f754760 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -15,6 +15,7 @@
namespace utils {
const QRegExp removeReplyRegex{"> <.*>.*\\n\\n"};
+const QRegExp removeRichReplyRegex{".*"};
QString removeReply(const QString& text);