Don't color usernames in state delegates

This starts to look quite messy when there are many state delegates visible
This commit is contained in:
Tobias Fella
2024-01-27 16:38:38 +01:00
parent fb3b1490a9
commit 173e507ebf
4 changed files with 10 additions and 6 deletions

View File

@@ -321,8 +321,7 @@ QString EventHandler::getBody(const Quotient::RoomEvent *event, Qt::TextFormat f
}
if (prettyPrint) {
subjectName = QStringLiteral("<a href=\"https://matrix.to/#/%1\" style=\"color: %2\">%3</a>")
.arg(e.userId(), Utils::getUserColor(m_room->user(e.userId())->hueF()).name(), subjectName);
subjectName = QStringLiteral("<a href=\"https://matrix.to/#/%1\">%2</a>").arg(e.userId(), subjectName);
}
// The below code assumes senderName output in AuthorRole

View File

@@ -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("<a href=\"https://matrix.to/#/%1\" style=\"color: %2\">%3</a> ")
: QStringLiteral("<a href=\"https://matrix.to/#/%1\">%3</a> ")
.arg(uniqueAuthors[0].toMap()[QStringLiteral("id")].toString(),
uniqueAuthors[0].toMap()[QStringLiteral("color")].toString(),
uniqueAuthors[0].toMap()[QStringLiteral("displayName")].toString().toHtmlEscaped());
QString chunksText;

View File

@@ -70,9 +70,12 @@ RowLayout {
id: label
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
text: `<style>a {text-decoration: none;}</style><a href="https://matrix.to/#/${root.author.id}" style="color: ${root.author.color}">${root.authorDisplayName}</a> ${root.text}`
text: `<style>a {text-decoration: none; color: ${Kirigami.Theme.textColor};}</style><a href="https://matrix.to/#/${root.author.id}">${root.authorDisplayName}</a> ${root.text}`
wrapMode: Text.WordWrap
textFormat: Text.RichText
onLinkActivated: link => RoomManager.resolveResource(link)
HoverHandler {
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.IBeamCursor
}
}
}

View File

@@ -153,11 +153,14 @@ TimelineDelegate {
Layout.fillWidth: true
visible: root.folded
text: root.aggregateDisplay
text: `<style>a {color: ${Kirigami.Theme.textColor}}</style>` + 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