Warning, /utilities/francis/src/ui/PageHeader.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2022 Felipe Kinoshita <kinofhek@gmail.com>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick 2.15
0005 import QtQuick.Controls 2.15 as QQC2
0006 import QtQuick.Layouts 1.15
0007 import org.kde.kirigami 2.19 as Kirigami
0008 
0009 import org.kde.francis 1.0
0010 
0011 RowLayout {
0012     id: pageHeader
0013 
0014     Layout.fillWidth: true
0015     spacing: 0
0016 
0017     Shortcut {
0018         sequence: StandardKey.Cancel
0019         enabled: Controller.running
0020         onActivated: Controller.toggle()
0021     }
0022 
0023     QQC2.ToolButton {
0024         action: Kirigami.Action {
0025             text: Controller.running ? i18n("Pause") : (Controller.hasStarted ? i18n("Resume") : i18n("Start"))
0026             icon.name: Controller.running ? "chronometer-pause" : "chronometer-start"
0027             shortcut: "S"
0028             onTriggered: Controller.hasStarted ? Controller.toggle() : Controller.start()
0029         }
0030 
0031         QQC2.ToolTip.visible: hovered
0032         QQC2.ToolTip.text: i18nc("keyboard shortcut", "Toggle Timer (S)")
0033         QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0034     }
0035 
0036     QQC2.ToolButton {
0037         visible: Controller.hasStarted
0038 
0039         action: Kirigami.Action {
0040             text: i18n("Reset")
0041             icon.name: "chronometer-reset"
0042             shortcut: "R"
0043             enabled: Controller.hasStarted
0044             onTriggered: Controller.reset()
0045         }
0046 
0047         QQC2.ToolTip.visible: hovered
0048         QQC2.ToolTip.text: i18nc("keyboard shortcut", "Reset (R)")
0049         QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0050     }
0051 
0052     Item {
0053         Layout.fillWidth: true
0054     }
0055 
0056     QQC2.ToolButton {
0057         display: QQC2.AbstractButton.IconOnly
0058         action: Kirigami.Action {
0059             text: i18nc("keyboard shortcut", "About Francis (F1)")
0060             icon.name: "help-about"
0061             shortcut: StandardKey.HelpContents
0062             onTriggered: pageStack.pushDialogLayer(Qt.resolvedUrl("About.qml"), {}, {
0063                 maximumWidth: Kirigami.Units.gridUnit * 30
0064             })
0065         }
0066 
0067         QQC2.ToolTip.visible: hovered
0068         QQC2.ToolTip.text: text
0069         QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0070     }
0071 }