Warning, /network/neochat/src/qml/TypingPane.qml is written in an unsupported language. File is not indexed.
0001 /* SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.de> 0002 * SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com> 0003 * SPDX-FileCopyrightText: 2021 Srevin Saju <srevinsaju@sugarlabs.org> 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Layouts 0009 import QtQuick.Controls as QQC2 0010 import org.kde.kirigami as Kirigami 0011 import org.kde.neochat 0012 0013 Loader { 0014 id: root 0015 property string labelText: "" 0016 0017 active: visible 0018 sourceComponent: QQC2.Pane { 0019 id: typingPane 0020 0021 leftPadding: Kirigami.Units.largeSpacing 0022 rightPadding: Kirigami.Units.largeSpacing 0023 topPadding: Kirigami.Units.smallSpacing 0024 bottomPadding: Kirigami.Units.smallSpacing 0025 spacing: Kirigami.Units.largeSpacing 0026 0027 FontMetrics { 0028 id: fontMetrics 0029 } 0030 0031 Kirigami.Theme.colorSet: Kirigami.Theme.View 0032 Kirigami.Theme.inherit: false 0033 0034 contentItem: RowLayout { 0035 spacing: typingPane.spacing 0036 Row { 0037 id: dotRow 0038 property int duration: 400 0039 spacing: Kirigami.Units.smallSpacing 0040 Repeater { 0041 model: 3 0042 delegate: Rectangle { 0043 id: dot 0044 color: Kirigami.Theme.textColor 0045 radius: height/2 0046 implicitWidth: fontMetrics.xHeight 0047 implicitHeight: fontMetrics.xHeight 0048 // rotating 45 degrees makes the dots look a bit smoother when scaled up 0049 rotation: 45 0050 opacity: 0.5 0051 scale: 1 0052 // FIXME: Sometimes the animation timings for each 0053 // dot drift slightly reletative to each other. 0054 // Not everyone can see this, but I'm pretty sure it's there. 0055 SequentialAnimation { 0056 running: true 0057 PauseAnimation { duration: dotRow.duration * index / 2 } 0058 SequentialAnimation { 0059 loops: Animation.Infinite 0060 ParallelAnimation { 0061 // Animators unfortunately sync up instead of being 0062 // staggered, so I'm using NumberAnimations instead. 0063 NumberAnimation { 0064 target: dot; property: "scale"; 0065 from: 1; to: 1.33 0066 duration: dotRow.duration 0067 } 0068 NumberAnimation { 0069 target: dot; property: "opacity" 0070 from: 0.5; to: 1 0071 duration: dotRow.duration 0072 } 0073 } 0074 ParallelAnimation { 0075 NumberAnimation { 0076 target: dot; property: "scale" 0077 from: 1.33; to: 1 0078 duration: dotRow.duration 0079 } 0080 NumberAnimation { 0081 target: dot; property: "opacity" 0082 from: 1; to: 0.5 0083 duration: dotRow.duration 0084 } 0085 } 0086 PauseAnimation { duration: dotRow.duration } 0087 } 0088 } 0089 } 0090 } 0091 } 0092 QQC2.Label { 0093 id: typingLabel 0094 elide: Text.ElideRight 0095 text: root.labelText 0096 textFormat: Text.PlainText 0097 } 0098 } 0099 0100 leftInset: !mirrored ? 0 : -background.radius 0101 rightInset: mirrored ? 0 : -background.radius 0102 bottomInset: -background.radius 0103 background: Rectangle { 0104 radius: 3 0105 color: Kirigami.Theme.backgroundColor 0106 border.color: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.2) 0107 border.width: 1 0108 } 0109 } 0110 }