Warning, /utilities/kclock/src/plasmoid/KClock_1x2/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 HanY <hanyoung@protonmail.com>
0003     SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 import QtQml
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import org.kde.plasma.core as PlasmaCore
0011 import org.kde.plasma.plasmoid
0012 import org.kde.plasma.components as PlasmaComponents
0013 import org.kde.kirigami as Kirigami
0014 
0015 PlasmoidItem {
0016     Plasmoid.status: plasmoid.hasAlarm ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
0017     Plasmoid.backgroundHints: "ShadowBackground";
0018 
0019     fullRepresentation: Item {
0020         property int fontSize: Math.round(mainItem.width / 5)
0021 
0022         id: mainItem
0023         Layout.preferredHeight: Kirigami.Theme.defaultFont.pointSize * 10
0024         Layout.preferredWidth: Kirigami.Settings.isMobile ? Math.round(plasmoid.screenGeometry.width * 0.5) : Kirigami.Units.gridUnit * 12
0025         Layout.alignment: Qt.AlignHCenter
0026 
0027         property var layoutAlignment: plasmoid.configuration.textAlignment == "Left" ? Qt.AlignLeft :
0028                                         plasmoid.configuration.textAlignment == "Right" ? Qt.AlignRight : Qt.AlignHCenter
0029 
0030         MouseArea {
0031             anchors.fill: parent
0032             onClicked: plasmoid.openKClock()
0033         }
0034 
0035         ColumnLayout {
0036             id: mainDisplay
0037             anchors.centerIn: parent
0038             spacing: 0
0039 
0040             PlasmaComponents.Label {
0041                 text: Qt.formatTime(plasmoid.datetime, plasmoid.configuration.twelveHourTime ? "h:mm ap" : "h:mm")
0042                 font.pointSize: fontSize
0043                 font.weight: Font.ExtraLight
0044                 color: "white"
0045                 Layout.alignment: mainItem.layoutAlignment
0046             }
0047 
0048             PlasmaComponents.Label {
0049                 text: plasmoid.date
0050                 font.pointSize: Math.round(fontSize / 4)
0051                 color: "white"
0052                 Layout.alignment: mainItem.layoutAlignment
0053                 visible: plasmoid.configuration.showDate
0054             }
0055 
0056             RowLayout {
0057                 Layout.topMargin: Kirigami.Units.smallSpacing
0058                 Layout.alignment: mainItem.layoutAlignment
0059 
0060                 Kirigami.Icon {
0061                     visible: plasmoid.hasAlarm && plasmoid.configuration.showAlarms
0062                     source: "notifications"
0063                     Layout.preferredHeight: Math.round(alarmTime.height)
0064                     Layout.preferredWidth: Math.round(alarmTime.height)
0065                 }
0066                 PlasmaComponents.Label {
0067                     visible: plasmoid.hasAlarm && plasmoid.configuration.showAlarms
0068                     id: alarmTime
0069                     text: plasmoid.alarmTime
0070                     color: "white"
0071                     font.pointSize: Math.round(fontSize / 4)
0072                 }
0073             }
0074         }
0075     }
0076 }