Warning, /network/neochat/src/qml/ReadMarkerDelegate.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: GPL-3.0-only
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 
0008 import Qt.labs.qmlmodels
0009 import org.kde.kirigami as Kirigami
0010 
0011 import org.kde.neochat
0012 
0013 TimelineDelegate {
0014     id: root
0015     contentItem: QQC2.ItemDelegate {
0016         padding: Kirigami.Units.largeSpacing
0017         topInset: Kirigami.Units.largeSpacing
0018         topPadding: Kirigami.Units.largeSpacing * 2
0019 
0020         property bool isTemporaryHighlighted: false
0021 
0022         onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) {
0023             temporaryHighlightTimer.start();
0024         }
0025 
0026         Timer {
0027             id: temporaryHighlightTimer
0028 
0029             interval: 1500
0030             onTriggered: isTemporaryHighlighted = false
0031         }
0032 
0033         contentItem: QQC2.Label {
0034             text: i18nc("Relative time since the room was last read", "Last read: %1", time)
0035         }
0036 
0037         background: Kirigami.ShadowedRectangle {
0038             id: readMarkerBackground
0039             color: {
0040                 if (root.isTemporaryHighlighted) {
0041                     return Kirigami.Theme.positiveBackgroundColor;
0042                 } else {
0043                     return Kirigami.Theme.backgroundColor;
0044                 }
0045             }
0046             Kirigami.Theme.inherit: false
0047             Kirigami.Theme.colorSet: Kirigami.Theme.View
0048             opacity: root.isTemporaryHighlighted ? 1 : 0.6
0049             radius: Kirigami.Units.smallSpacing
0050             shadow.size: Kirigami.Units.smallSpacing
0051             shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10)
0052             border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
0053             border.width: 1
0054 
0055             Behavior on color {
0056                 ColorAnimation {
0057                     target: readMarkerBackground
0058                     duration: Kirigami.Units.veryLongDuration
0059                     easing.type: Easing.InOutCubic
0060                 }
0061             }
0062         }
0063     }
0064 }