From f8072a2f4a275d2e4c5efa924e8560329c3aff51 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Mon, 30 Sep 2019 17:56:49 -0700 Subject: [PATCH] More per user color. --- .../Component/Timeline/FileDelegate.qml | 1 + .../Component/Timeline/ImageDelegate.qml | 1 + .../Component/Timeline/MessageDelegate.qml | 18 ++++++++++++------ .../Component/Timeline/StateDelegate.qml | 16 ++++++++++++++++ .../Component/Timeline/VideoDelegate.qml | 1 + imports/Spectral/Panel/RoomPanel.qml | 1 + 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/imports/Spectral/Component/Timeline/FileDelegate.qml b/imports/Spectral/Component/Timeline/FileDelegate.qml index 99af026cf..af41c75c4 100644 --- a/imports/Spectral/Component/Timeline/FileDelegate.qml +++ b/imports/Spectral/Component/Timeline/FileDelegate.qml @@ -37,6 +37,7 @@ RowLayout { visible: avatarVisible hint: author.displayName source: author.avatarMediaId + color: author.color Component { id: userDetailDialog diff --git a/imports/Spectral/Component/Timeline/ImageDelegate.qml b/imports/Spectral/Component/Timeline/ImageDelegate.qml index c5a3f31cd..78b8042cb 100644 --- a/imports/Spectral/Component/Timeline/ImageDelegate.qml +++ b/imports/Spectral/Component/Timeline/ImageDelegate.qml @@ -43,6 +43,7 @@ RowLayout { visible: avatarVisible hint: author.displayName source: author.avatarMediaId + color: author.color Component { id: userDetailDialog diff --git a/imports/Spectral/Component/Timeline/MessageDelegate.qml b/imports/Spectral/Component/Timeline/MessageDelegate.qml index 76acac3f8..5602314eb 100644 --- a/imports/Spectral/Component/Timeline/MessageDelegate.qml +++ b/imports/Spectral/Component/Timeline/MessageDelegate.qml @@ -17,6 +17,8 @@ ColumnLayout { readonly property bool darkBackground: !sentByMe readonly property bool replyVisible: reply || false readonly property bool failed: marks === EventStatus.SendingFailed + readonly property color authorColor: eventType === "notice" ? MPalette.primary : author.color + readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent signal saveFileAs() signal openExternally() @@ -42,6 +44,7 @@ ColumnLayout { visible: avatarVisible hint: author.displayName source: author.avatarMediaId + color: author.color Component { id: userDetailDialog @@ -76,7 +79,7 @@ ColumnLayout { id: bubbleBackground - color: sentByMe ? MPalette.background : eventType === "notice" ? MPalette.primary : author.color + color: sentByMe ? MPalette.background : authorColor radius: 18 topLeftVisible: !sentByMe && (bubbleShape == 3 || bubbleShape == 2) @@ -135,6 +138,8 @@ ColumnLayout { Layout.leftMargin: 8 Layout.rightMargin: 8 + id: replyControl + padding: 4 rightPadding: 12 @@ -148,6 +153,7 @@ ColumnLayout { source: replyVisible ? reply.author.avatarMediaId : "" hint: replyVisible ? reply.author.displayName : "H" + color: replyVisible ? reply.author.color : MPalette.accent RippleEffect { anchors.fill: parent @@ -168,14 +174,14 @@ ColumnLayout { selectByMouse: true readOnly: true wrapMode: Label.Wrap - selectedTextColor: darkBackground ? "white" : MPalette.accent - selectionColor: darkBackground ? MPalette.accent : "white" + selectedTextColor: darkBackground ? "white" : replyAuthorColor + selectionColor: darkBackground ? replyAuthorColor : "white" textFormat: Text.RichText } } background: Rectangle { - color: replyVisible && sentByMe ? reply.author.color : MPalette.background + color: sentByMe ? replyAuthorColor : MPalette.background radius: 18 AutoMouseArea { @@ -205,8 +211,8 @@ ColumnLayout { selectByMouse: true readOnly: true wrapMode: Label.Wrap - selectedTextColor: darkBackground ? MPalette.accent : "white" - selectionColor: darkBackground ? "white" : MPalette.accent + selectedTextColor: darkBackground ? authorColor : "white" + selectionColor: darkBackground ? "white" : authorColor textFormat: Text.RichText onLinkActivated: { diff --git a/imports/Spectral/Component/Timeline/StateDelegate.qml b/imports/Spectral/Component/Timeline/StateDelegate.qml index 6db382767..fae7383ae 100644 --- a/imports/Spectral/Component/Timeline/StateDelegate.qml +++ b/imports/Spectral/Component/Timeline/StateDelegate.qml @@ -4,6 +4,8 @@ import QtQuick.Layouts 1.12 import QtQuick.Controls.Material 2.12 import Spectral.Component 2.0 +import Spectral.Dialog 2.0 +import Spectral.Effect 2.0 import Spectral.Setting 0.1 Control { @@ -30,6 +32,20 @@ Control { hint: author.displayName source: author.avatarMediaId color: Qt.darker(author.color, 1.1) + + Component { + id: userDetailDialog + + UserDetailDialog {} + } + + RippleEffect { + anchors.fill: parent + + circular: true + + onClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": currentRoom, "user": author}).open() + } } Label { diff --git a/imports/Spectral/Component/Timeline/VideoDelegate.qml b/imports/Spectral/Component/Timeline/VideoDelegate.qml index 4e02475ff..6f190814f 100644 --- a/imports/Spectral/Component/Timeline/VideoDelegate.qml +++ b/imports/Spectral/Component/Timeline/VideoDelegate.qml @@ -48,6 +48,7 @@ RowLayout { visible: avatarVisible hint: author.displayName source: author.avatarMediaId + color: author.color Component { id: userDetailDialog diff --git a/imports/Spectral/Panel/RoomPanel.qml b/imports/Spectral/Panel/RoomPanel.qml index 745c8ce41..ac9b6d8b0 100644 --- a/imports/Spectral/Panel/RoomPanel.qml +++ b/imports/Spectral/Panel/RoomPanel.qml @@ -554,6 +554,7 @@ Item { source: modelData.avatarMediaId hint: modelData.displayName + color: modelData.color } } }