From 173e507ebf56465f1128e126e34371c8b637379b Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 27 Jan 2024 16:38:38 +0100 Subject: [PATCH] Don't color usernames in state delegates This starts to look quite messy when there are many state delegates visible --- src/eventhandler.cpp | 3 +-- src/models/messagefiltermodel.cpp | 3 +-- src/qml/StateComponent.qml | 5 ++++- src/qml/StateDelegate.qml | 5 ++++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/eventhandler.cpp b/src/eventhandler.cpp index b4782f79f..4423a38a0 100644 --- a/src/eventhandler.cpp +++ b/src/eventhandler.cpp @@ -321,8 +321,7 @@ QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat f } if (prettyPrint) { - subjectName = QStringLiteral("%3") - .arg(e.userId(), Utils::getUserColor(m_room->user(e.userId())->hueF()).name(), subjectName); + subjectName = QStringLiteral("%2").arg(e.userId(), subjectName); } // The below code assumes senderName output in AuthorRole diff --git a/src/models/messagefiltermodel.cpp b/src/models/messagefiltermodel.cpp index 9d84235ee..20abe8853 100644 --- a/src/models/messagefiltermodel.cpp +++ b/src/models/messagefiltermodel.cpp @@ -127,9 +127,8 @@ QString MessageFilterModel::aggregateEventToString(int sourceRow) const chunks.removeDuplicates(); // The author text is either "n users" if > 1 user or the matrix.to link to a single user. QString userText = uniqueAuthors.length() > 1 ? i18ncp("n users", " %1 user ", " %1 users ", uniqueAuthors.length()) - : QStringLiteral("%3 ") + : QStringLiteral("%3 ") .arg(uniqueAuthors[0].toMap()[QStringLiteral("id")].toString(), - uniqueAuthors[0].toMap()[QStringLiteral("color")].toString(), uniqueAuthors[0].toMap()[QStringLiteral("displayName")].toString().toHtmlEscaped()); QString chunksText; diff --git a/src/qml/StateComponent.qml b/src/qml/StateComponent.qml index acd62e17b..ccc433b7c 100644 --- a/src/qml/StateComponent.qml +++ b/src/qml/StateComponent.qml @@ -70,9 +70,12 @@ RowLayout { id: label Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true - text: `${root.authorDisplayName} ${root.text}` + text: `${root.authorDisplayName} ${root.text}` wrapMode: Text.WordWrap textFormat: Text.RichText onLinkActivated: link => RoomManager.resolveResource(link) + HoverHandler { + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor + } } } diff --git a/src/qml/StateDelegate.qml b/src/qml/StateDelegate.qml index 2ff957824..c9683b236 100644 --- a/src/qml/StateDelegate.qml +++ b/src/qml/StateDelegate.qml @@ -153,11 +153,14 @@ TimelineDelegate { Layout.fillWidth: true visible: root.folded - text: root.aggregateDisplay + text: `` + root.aggregateDisplay elide: Qt.ElideRight textFormat: Text.RichText wrapMode: Text.WordWrap onLinkActivated: RoomManager.resolveResource(link) + HoverHandler { + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor + } } Item { Layout.fillWidth: true