bartab-overhaul: initial commit
This commit is contained in:
parent
835f88d71e
commit
57448f100c
16 changed files with 905 additions and 76 deletions
|
|
@ -27,6 +27,11 @@ RowLayout {
|
|||
visible: root.label !== "" || root.description !== ""
|
||||
}
|
||||
|
||||
// Spacer to push the checkbox to the far right
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: box
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,32 @@ Rectangle {
|
|||
signal exited
|
||||
signal clicked
|
||||
|
||||
// Per-instance overrides (default to global settings if not provided by parent)
|
||||
// Parent widgets like Bar `Clock.qml` can bind these
|
||||
property bool showDate: Settings.data.location.showDateWithClock
|
||||
property bool use12h: Settings.data.location.use12HourClock
|
||||
property bool showSeconds: false
|
||||
|
||||
width: textItem.paintedWidth
|
||||
height: textItem.paintedHeight
|
||||
color: Color.transparent
|
||||
|
||||
NText {
|
||||
id: textItem
|
||||
text: Time.time
|
||||
text: {
|
||||
const now = Time.date
|
||||
const timeFormat = use12h ? (showSeconds ? "h:mm:ss AP" : "h:mm AP") : (showSeconds ? "HH:mm:ss" : "HH:mm")
|
||||
const timeString = Qt.formatDateTime(now, timeFormat)
|
||||
|
||||
if (showDate) {
|
||||
let dayName = now.toLocaleDateString(Qt.locale(), "ddd")
|
||||
dayName = dayName.charAt(0).toUpperCase() + dayName.slice(1)
|
||||
let day = now.getDate()
|
||||
let month = now.toLocaleDateString(Qt.locale(), "MMM")
|
||||
return timeString + " - " + (Settings.data.location.reverseDayMonth ? `${dayName}, ${month} ${day}` : `${dayName}, ${day} ${month}`)
|
||||
}
|
||||
return timeString
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue