Warning, /utilities/kairo/src/CircuitControlPage.qml is written in an unsupported language. File is not indexed.

0001 /* This file is part of Kairo Timer
0002 
0003    SPDX-FileCopyrightText: 2016 (c) Kevin Ottens <ervin@kde.org>
0004 
0005    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 
0007 */
0008 
0009 import QtQuick 2.0
0010 import QtQuick.Controls 2.15 as Controls
0011 import QtQuick.Layouts 1.2
0012 import org.kde.kirigami 2.0 as Kirigami
0013 import Kairo 1.0
0014 
0015 Kirigami.Page {
0016     id: root
0017 
0018     title: model.name
0019     topPadding: 0
0020     leftPadding: 0
0021     rightPadding: 0
0022     bottomPadding: 0
0023 
0024     property SoundControl soundControl
0025     property alias model: circuitControl.model
0026     signal circuitFinished()
0027 
0028     function start()
0029     {
0030         timer.running = true
0031     }
0032 
0033     actions.main: Kirigami.Action {
0034         iconName: "go-next"
0035         onTriggered: circuitControl.nextTimer()
0036     }
0037 
0038     TimerNotificationControl {
0039         sound: root.soundControl
0040         timer: TimerControl {
0041             id: timer
0042             running: false
0043         }
0044     }
0045 
0046     CircuitControl {
0047         id: circuitControl
0048         timerControl: timer
0049         onCircuitFinished: {
0050             timer.running = false
0051             root.circuitFinished()
0052         }
0053     }
0054 
0055     Rectangle {
0056         height: parent.height
0057         width: timer.duration <= 0 ? 0 : parent.width * (timer.duration - timer.value) / timer.duration
0058         color: timer.value > 10000 ? "lightSteelBlue" : "crimson"
0059     }
0060 
0061     ColumnLayout {
0062         anchors {
0063             left: parent.left
0064             right: parent.right
0065             verticalCenter: parent.verticalCenter
0066         }
0067         spacing: Kirigami.Units.gridUnit
0068         Kirigami.Heading {
0069             Layout.fillWidth: true
0070             horizontalAlignment: Text.AlignHCenter
0071             font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 4
0072             text: timer.text
0073             wrapMode: Text.WordWrap
0074         }
0075         Controls.Label {
0076             Layout.fillWidth: true
0077             horizontalAlignment: Text.AlignHCenter
0078 
0079             font.pixelSize: Kirigami.Theme.defaultFont.pixelSize * 6
0080             text: timer.formattedValue
0081         }
0082     }
0083 }