Warning, /plasma/kdeplasma-addons/applets/timer/package/contents/ui/TimerView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2008, 2014 Davide Bettio <davide.bettio@kdemail.net> 0003 * SPDX-FileCopyrightText: 2015 Bernhard Friedreich <friesoft@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Layouts 1.15 0010 0011 import org.kde.plasma.plasmoid 2.0 0012 import org.kde.kirigami 2.20 as Kirigami 0013 import org.kde.plasma.components 3.0 as PlasmaComponents3 0014 import org.kde.plasma.extras 2.0 as PlasmaExtras 0015 import org.kde.kquickcontrolsaddons 2.0 as QtExtra 0016 0017 MouseArea { 0018 Layout.preferredWidth: Math.max(Plasmoid.compactRepresentationItem.width, Kirigami.Units.gridUnit * 10) 0019 Layout.preferredHeight: main.implicitHeight 0020 0021 onClicked: root.toggleTimer() 0022 0023 Component { 0024 id: popupHeadingComponent 0025 0026 PlasmaExtras.PlasmoidHeading { 0027 leftPadding: Kirigami.Units.smallSpacing * 2 0028 rightPadding: Kirigami.Units.smallSpacing * 2 0029 0030 contentItem: Kirigami.Heading { 0031 level: 3 0032 elide: Text.ElideRight 0033 horizontalAlignment: Text.AlignHCenter 0034 text: root.title 0035 textFormat: Text.PlainText 0036 } 0037 } 0038 } 0039 0040 Component { 0041 id: desktopHeadingComponent 0042 0043 PlasmaComponents3.Label { 0044 elide: Text.ElideRight 0045 font.pixelSize: 0.3 * timerDigits.height 0046 text: root.title 0047 textFormat: Text.PlainText 0048 } 0049 } 0050 0051 ColumnLayout { 0052 id: main 0053 0054 width: parent.width 0055 0056 Loader { 0057 Layout.fillWidth: true 0058 0059 active: root.showTitle 0060 0061 sourceComponent: root.inPanel ? popupHeadingComponent : desktopHeadingComponent 0062 } 0063 0064 TimerEdit { 0065 id: timerDigits 0066 0067 Layout.fillWidth: true 0068 visible: root.showRemainingTime 0069 0070 value: root.seconds 0071 editable: !root.running 0072 alertMode: root.alertMode 0073 onDigitModified: valueDelta => root.seconds += valueDelta 0074 SequentialAnimation on opacity { 0075 running: root.suspended; 0076 loops: Animation.Infinite; 0077 NumberAnimation { 0078 duration: Kirigami.Units.veryLongDuration * 2; 0079 from: 1.0; 0080 to: 0.2; 0081 easing.type: Easing.InOutQuad; 0082 } 0083 PauseAnimation { 0084 duration: Kirigami.Units.veryLongDuration; 0085 } 0086 NumberAnimation { 0087 duration: Kirigami.Units.veryLongDuration * 2; 0088 from: 0.2; 0089 to: 1.0; 0090 easing.type: Easing.InOutQuad; 0091 } 0092 PauseAnimation { 0093 duration: Kirigami.Units.veryLongDuration; 0094 } 0095 } 0096 } 0097 0098 PlasmaComponents3.ProgressBar { 0099 id: remainingTimeProgressBar 0100 0101 Layout.fillWidth: true 0102 Layout.fillHeight: true 0103 visible: root.showProgressBar 0104 0105 from: plasmoid.configuration.seconds 0106 to: 0 0107 value: root.seconds 0108 } 0109 0110 function resetOpacity() { 0111 timerDigits.opacity = 1.0; 0112 } 0113 0114 Component.onCompleted: { 0115 root.opacityNeedsReset.connect(resetOpacity); 0116 } 0117 } 0118 } 0119