2020-08-31 01:38:46 +00:00
|
|
|
/*
|
2022-02-17 05:52:34 +00:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
2024-06-26 02:57:42 +00:00
|
|
|
* SPDX-FileCopyrightText: 2020-2024 Devin Lin <devin@kde.org>
|
2022-02-17 05:52:34 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2020-08-31 01:38:46 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2021-12-24 15:51:21 +00:00
|
|
|
|
2026-03-07 03:08:07 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2025-11-12 20:29:19 +00:00
|
|
|
import org.kde.plasma.clock
|
2022-10-27 23:48:05 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2022-04-07 14:35:35 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
Item {
|
2022-02-17 05:52:34 +00:00
|
|
|
id: root
|
2022-10-27 23:48:05 +00:00
|
|
|
implicitHeight: clockColumn.implicitHeight
|
|
|
|
|
implicitWidth: clockColumn.implicitWidth
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-02-17 05:52:34 +00:00
|
|
|
property int layoutAlignment
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2025-11-12 20:29:19 +00:00
|
|
|
Clock {
|
|
|
|
|
id: clockSource
|
2022-10-27 23:48:05 +00:00
|
|
|
}
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: clockColumn
|
2024-07-30 02:53:33 +00:00
|
|
|
spacing: 0
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
PC3.Label {
|
2024-07-30 02:53:33 +00:00
|
|
|
text: {
|
2025-11-12 20:29:19 +00:00
|
|
|
let timeText = Qt.formatTime(clockSource.dateTime, MobileShell.ShellUtil.isSystem24HourFormat ? "h:mm" : "h:mm ap");
|
2024-07-30 02:53:33 +00:00
|
|
|
|
|
|
|
|
// Remove am/pm in 12-hour time to avoid excessive length
|
|
|
|
|
if (!MobileShell.ShellUtil.isSystem24HourFormat) {
|
|
|
|
|
timeText = timeText.substring(0, timeText.length - 3);
|
|
|
|
|
}
|
|
|
|
|
return timeText;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
color: "white"
|
2024-07-30 02:53:33 +00:00
|
|
|
opacity: 0.9
|
|
|
|
|
|
|
|
|
|
renderType: Text.NativeRendering
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
Layout.alignment: root.layoutAlignment
|
2024-07-30 02:53:33 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
|
font.pointSize: 64
|
2023-05-13 15:15:52 +00:00
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
|
layer.effect: MobileShell.TextDropShadow {
|
|
|
|
|
blurMax: 16
|
|
|
|
|
}
|
2022-10-27 23:48:05 +00:00
|
|
|
}
|
|
|
|
|
PC3.Label {
|
2025-11-12 20:29:19 +00:00
|
|
|
text: Qt.formatDate(clockSource.dateTime, "dddd, MMMM d")
|
2022-10-27 23:48:05 +00:00
|
|
|
color: "white"
|
2024-07-30 02:53:33 +00:00
|
|
|
opacity: 0.9
|
2024-06-26 02:57:42 +00:00
|
|
|
|
2022-10-27 23:48:05 +00:00
|
|
|
Layout.alignment: root.layoutAlignment
|
|
|
|
|
font.weight: Font.Bold
|
2024-07-30 02:53:33 +00:00
|
|
|
font.pointSize: 12
|
2023-05-13 15:15:52 +00:00
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
|
layer.effect: MobileShell.TextDropShadow {
|
|
|
|
|
blurMax: 16
|
|
|
|
|
}
|
2020-08-31 01:38:46 +00:00
|
|
|
}
|
2020-02-01 14:21:24 +00:00
|
|
|
}
|
|
|
|
|
}
|