/usr/share/plasma/plasmoids/org.kde.plasma.timer/contents/ui/TimerView.qml is in plasma-widgets-addons 4:5.12.4-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /***************************************************************************
* Copyright 2008,2014 by Davide Bettio <davide.bettio@kdemail.net> *
* Copyright 2015 by Bernhard Friedreich <friesoft@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 2.2
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0 as QtExtra
import org.kde.plasma.private.timer 0.1 as TimerPlasmoid
Item {
id: main
property date savedAt: plasmoid.configuration.savedAt;
// display seconds in addition to hours and minutes (default: enabled)
property bool showSeconds: plasmoid.configuration.showSeconds;
// show notification on timer completion (default: enabled)
property bool showNotification: plasmoid.configuration.showNotification;
// run custom command on timer completion (default: disabled)
property bool runCommand: plasmoid.configuration.runCommand;
property string command: plasmoid.configuration.command;
property real digits: (showSeconds) ? 7 : 4.5;
property int digitH: ((height / 2) * digits < width ? height : ((width - (digits - 1)) / digits) * 2);
property int digitW: digitH / 2;
PlasmaCore.Svg {
id: timerSvg
imagePath: "widgets/timer"
}
Timer {
id: t;
interval: 1000;
onTriggered: {
if (root.seconds != 0) {
root.seconds--;
}
if (root.seconds == 0) {
root.running = false;
if (showNotification) {
root.createNotification();
}
if (runCommand) {
TimerPlasmoid.Timer.runCommand(command);
}
saveTimer();
}
}
repeat: true;
running: root.running;
}
Timer {
id: delayedSaveTimer;
interval: 3000;
onTriggered: saveTimer();
}
Column {
anchors.centerIn: parent;
Text {
id: titleLabel;
text: root.title;
visible: root.showTitle;
horizontalAlignment: Text.AlignHCenter
font.pixelSize: parent.parent.height - digitH;
}
Row {
id: timerDigits;
SequentialAnimation on opacity {
running: root.suspended;
loops: Animation.Infinite;
NumberAnimation {
duration: 800;
from: 1.0;
to: 0.2;
easing.type: Easing.InOutQuad;
}
PauseAnimation {
duration: 400;
}
NumberAnimation {
duration: 800;
from: 0.2;
to: 1.0;
easing.type: Easing.InOutQuad;
}
PauseAnimation {
duration: 400;
}
}
TimerDigit {
meaning: 60*60*10;
num: ~~((root.seconds / (60*60)) / 10);
suffix: (root.running && root.seconds < 60) ? "_1" : "";
}
TimerDigit {
meaning: 60*60;
num: ~~(~~(root.seconds / (60*60))) % 10;
suffix: (root.running && root.seconds < 60) ? "_1" : "";
}
PlasmaCore.SvgItem {
svg: timerSvg;
width: digitW / 2;
height: digitH;
elementId: "separator" + ((root.running && root.seconds < 60) ? "_1" : "");
}
TimerDigit {
meaning: 600;
num: ~~(~~((root.seconds % (60*60)) / 60) / 10);
suffix: (root.running && root.seconds < 60) ? "_1" : "";
}
TimerDigit {
meaning: 60;
num: ~~((root.seconds % (60*60)) / 60) % 10;
suffix: (root.running && root.seconds < 60) ? "_1" : "";
}
PlasmaCore.SvgItem {
svg: timerSvg;
width: digitW / 2;
height: digitH;
elementId: "separator" + ((root.running && root.seconds < 60) ? "_1" : "");
visible: showSeconds;
}
TimerDigit {
meaning: 10;
num: ~~((root.seconds % 60) / 10);
suffix: (root.running && root.seconds < 60) ? "_1" : "";
visible: showSeconds;
}
TimerDigit {
meaning: 1;
num: (root.seconds % 60) % 10;
suffix: (root.running && root.seconds < 60) ? "_1" : "";
visible: showSeconds;
}
}
}
MouseArea {
anchors.fill: parent;
onClicked: {
if (root.running) {
root.stopTimer();
} else {
root.startTimer();
}
}
PlasmaCore.ToolTipArea {
anchors.fill: parent
subText: root.running ? i18n("Timer is running") : i18n("Use mouse wheel to change digits or choose from predefined timers in the context menu");
}
}
function digitChanged() {
delayedSaveTimer.stop();
delayedSaveTimer.start();
}
function resetOpacity() {
timerDigits.opacity = 1.0;
}
Component.onCompleted: {
root.opacityNeedsReset.connect(resetOpacity);
root.digitHasChanged.connect(digitChanged);
}
}
|