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) temporaryHighlightTimer.start()
0023 
0024         Timer {
0025             id: temporaryHighlightTimer
0026 
0027             interval: 1500
0028             onTriggered: isTemporaryHighlighted = false
0029         }
0030 
0031         contentItem: QQC2.Label {
0032             text: i18nc("Relative time since the room was last read", "Last read: %1", time)
0033         }
0034 
0035         background: Kirigami.ShadowedRectangle {
0036             id: readMarkerBackground
0037             color: {
0038                 if (root.isTemporaryHighlighted) {
0039                     return Kirigami.Theme.positiveBackgroundColor
0040                 } else {
0041                     return Kirigami.Theme.backgroundColor
0042                 }
0043             }
0044             Kirigami.Theme.inherit: false
0045             Kirigami.Theme.colorSet: Kirigami.Theme.View
0046             opacity: root.isTemporaryHighlighted ? 1 : 0.6
0047             radius: Kirigami.Units.smallSpacing
0048             shadow.size: Kirigami.Units.smallSpacing
0049             shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10)
0050             border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
0051             border.width: 1
0052 
0053             Behavior on color {
0054                 ColorAnimation {target: readMarkerBackground; duration: Kirigami.Units.veryLongDuration; easing.type: Easing.InOutCubic}
0055             }
0056         }
0057     }
0058 }