Warning, /plasma/kdeplasma-addons/applets/binary-clock/package/contents/ui/BinaryClock.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Rewrite of the KDE4-Plasma Binary Clock for KF5/Plasma/QML 0003 * 0004 * SPDX-FileCopyrightText: 2014 Joseph Wenninger <jowenn@kde.org> 0005 * SPDX-FileCopyrightText: 2018 Piotr Kąkol <piotrkakol@protonmail.com> 0006 * SPDX-FileCopyrightText: 2023 Bharadwaj Raju <bharadwaj.raju777@protonmail.com> 0007 * 0008 * Original code (KDE4): 0009 * SPDX-FileCopyrightText: 2007 Riccardo Iaconelli <riccardo@kde.org> 0010 * SPDX-FileCopyrightText: 2007 Davide Bettio <davide.bettio@kdemail.net> 0011 * 0012 * Based on FuzzyClock.qml: 0013 * SPDX-FileCopyrightText: 2013 Heena Mahour <heena393@gmail.com> 0014 * SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org> 0015 * SPDX-FileCopyrightText: 2013 Martin Klapetek <mklapetek@kde.org> 0016 * SPDX-FileCopyrightText: 2014 David Edmundson <davidedmundson@kde.org> 0017 * SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de> 0018 * 0019 * SPDX-License-Identifier: GPL-2.0-or-later 0020 */ 0021 0022 import QtQuick 0023 import QtQuick.Layouts 0024 import org.kde.plasma.core as PlasmaCore 0025 import org.kde.kirigami as Kirigami 0026 0027 Item { 0028 id: main 0029 0030 readonly property real w1: (main.height-5*Kirigami.Units.smallSpacing)*dots/4 0031 0032 Layout.minimumWidth: w1 < 20 ? 20 : w1 0033 Layout.maximumWidth: Infinity 0034 Layout.preferredWidth: Layout.minimumWidth 0035 0036 Layout.minimumHeight: 16+(Kirigami.Units.smallSpacing*5) 0037 //Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity 0038 //Layout.preferredHeight: Layout.minimumHeight 0039 0040 readonly property int formFactor: plasmoid.formFactor 0041 0042 readonly property bool constrained: formFactor == PlasmaCore.Types.Vertical || formFactor == PlasmaCore.Types.Horizontal 0043 0044 readonly property bool showSeconds: root.showSeconds 0045 0046 readonly property int hours: root.hours 0047 readonly property int minutes: root.minutes 0048 readonly property int seconds: root.seconds 0049 0050 readonly property int base: 10 0051 0052 readonly property bool showOffLeds: plasmoid.configuration.showOffLeds 0053 0054 readonly property int dots: showSeconds ? 6 : 4 0055 0056 readonly property color onColor: plasmoid.configuration.useCustomColorForActive ? plasmoid.configuration.customColorForActive : Kirigami.Theme.textColor 0057 readonly property color offColor: plasmoid.configuration.useCustomColorForInactive ? plasmoid.configuration.customColorForInactive : Qt.rgba(onColor.r, onColor.g, onColor.b, 0.2) 0058 0059 readonly property int dotSize: Math.min((height-5*Kirigami.Units.smallSpacing)/4, (width-(dots+1)*Kirigami.Units.smallSpacing)/dots) 0060 0061 property bool wasExpanded: false 0062 0063 readonly property alias mouseArea: mouseArea 0064 0065 MouseArea { 0066 id: mouseArea 0067 anchors.fill: parent 0068 hoverEnabled: true 0069 onPressed: wasExpanded = root.expanded 0070 onClicked: root.expanded = !wasExpanded 0071 } 0072 0073 GridLayout { 0074 anchors.horizontalCenter: parent.horizontalCenter 0075 anchors.verticalCenter: parent.verticalCenter 0076 columns: main.showSeconds ? 6 : 4 0077 Repeater { 0078 model: [8, 4, 2, 1] 0079 Repeater { 0080 model: [hours/base, hours%base, minutes/base, minutes%base, seconds/base, seconds%base] 0081 property var bit: modelData 0082 Rectangle { 0083 property var timeVal: modelData 0084 visible: main.dotSize >= 0 && (main.showSeconds || index < 4) 0085 width: main.dotSize 0086 height: width 0087 radius: width/2 0088 color: (timeVal & bit) ? main.onColor : (main.showOffLeds ? main.offColor : "transparent") 0089 } 0090 } 0091 } 0092 } 0093 }