diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30e5885ab..d665794f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,8 @@ if (Qt5_POSITION_INDEPENDENT_CODE)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
+set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/qml ${CMAKE_BINARY_DIR}/imports CACHE string "" FORCE)
+
if(WIN32)
enable_language(RC)
include(CMakeDetermineRCCompiler)
diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml
index 597e46e77..2531ff9e6 100644
--- a/imports/Spectral/Component/Timeline/MessageDelegate.qml
+++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml
@@ -15,7 +15,7 @@ ColumnLayout {
readonly property bool avatarVisible: !sentByMe && showAuthor
readonly property bool sentByMe: author === currentRoom.localUser
readonly property bool darkBackground: !sentByMe
- readonly property bool replyVisible: replyEventId || false
+ readonly property bool replyVisible: reply || false
signal saveFileAs()
signal openExternally()
@@ -144,15 +144,15 @@ ColumnLayout {
Layout.preferredHeight: 28
Layout.alignment: Qt.AlignTop
- source: replyVisible ? replyAuthor.avatarMediaId : ""
- hint: replyVisible ? replyAuthor.displayName : "H"
+ source: replyVisible ? reply.author.avatarMediaId : ""
+ hint: replyVisible ? reply.author.displayName : "H"
RippleEffect {
anchors.fill: parent
circular: true
- onClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": currentRoom, "user": replyAuthor}).open()
+ onClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": currentRoom, "user": reply.author}).open()
}
}
@@ -160,7 +160,7 @@ ColumnLayout {
Layout.fillWidth: true
color: !sentByMe ? MPalette.foreground : "white"
- text: "" + (replyDisplay || "")
+ text: "" + (replyVisible ? reply.display : "")
wrapMode: Label.Wrap
textFormat: Label.RichText
@@ -168,13 +168,13 @@ ColumnLayout {
}
background: Rectangle {
- color: replyAuthor && sentByMe ? replyAuthor.color : MPalette.background
+ color: replyVisible && sentByMe ? reply.author.color : MPalette.background
radius: 18
AutoMouseArea {
anchors.fill: parent
- onClicked: goToEvent(replyEventId)
+ onClicked: goToEvent(reply.eventId)
}
}
}
diff --git a/include/libQuotient b/include/libQuotient
index 74caea266..2fb22758c 160000
--- a/include/libQuotient
+++ b/include/libQuotient
@@ -1 +1 @@
-Subproject commit 74caea2669b8f76ca76507bc40321fdcd23dc522
+Subproject commit 2fb22758c1668d65e9400fe7d35857ddc54fcc6a
diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp
index 59577f4a9..c1f5a54ae 100644
--- a/src/messageeventmodel.cpp
+++ b/src/messageeventmodel.cpp
@@ -30,9 +30,7 @@ QHash MessageEventModel::roleNames() const {
roles[LongOperationRole] = "progressInfo";
roles[AnnotationRole] = "annotation";
roles[EventResolvedTypeRole] = "eventResolvedType";
- roles[ReplyEventIdRole] = "replyEventId";
- roles[ReplyAuthorRole] = "replyAuthor";
- roles[ReplyDisplayRole] = "replyDisplay";
+ roles[ReplyRole] = "reply";
roles[UserMarkerRole] = "userMarker";
roles[ShowAuthorRole] = "showAuthor";
roles[ShowSectionRole] = "showSection";
@@ -404,8 +402,7 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
return variantList;
}
- if (role == ReplyEventIdRole || role == ReplyDisplayRole ||
- role == ReplyAuthorRole) {
+ if (role == ReplyRole) {
const QString& replyEventId = evt.contentJson()["m.relates_to"]
.toObject()["m.in_reply_to"]
.toObject()["event_id"]
@@ -416,16 +413,13 @@ QVariant MessageEventModel::data(const QModelIndex& idx, int role) const {
if (replyIt == m_currentRoom->timelineEdge())
return {};
const auto& replyEvt = **replyIt;
- switch (role) {
- case ReplyEventIdRole:
- return replyEventId;
- case ReplyDisplayRole:
- return utils::cleanHTML(utils::removeReply(
- m_currentRoom->eventToString(replyEvt, Qt::RichText)));
- case ReplyAuthorRole:
- return QVariant::fromValue(m_currentRoom->user(replyEvt.senderId()));
- }
- return {};
+
+ return QVariantMap{
+ {"eventId", replyEventId},
+ {"display", utils::cleanHTML(utils::removeReply(
+ m_currentRoom->eventToString(replyEvt, Qt::RichText)))},
+ {"author", QVariant::fromValue(m_currentRoom->user(replyEvt.senderId()))}
+ };
}
if (role == ShowAuthorRole) {
diff --git a/src/messageeventmodel.h b/src/messageeventmodel.h
index 3def157f9..7933b4ea6 100644
--- a/src/messageeventmodel.h
+++ b/src/messageeventmodel.h
@@ -26,14 +26,14 @@ class MessageEventModel : public QAbstractListModel {
LongOperationRole,
AnnotationRole,
UserMarkerRole,
- // For reply
- ReplyEventIdRole,
- ReplyAuthorRole,
- ReplyDisplayRole,
+
+ ReplyRole,
ShowAuthorRole,
ShowSectionRole,
+
BubbleShapeRole,
+
// For debugging
EventResolvedTypeRole,
};