mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2025-12-06 06:36:15 +00:00
Location/Clock: Moved use12hourformat and reverseDaymonth from the clock widget settings to the main settings, location tab
- Fix #303
This commit is contained in:
@@ -101,7 +101,7 @@ Singleton {
|
||||
"settings-display": "device-desktop",
|
||||
"settings-network": "sitemap",
|
||||
"settings-brightness": "brightness-up",
|
||||
"settings-weather": "cloud-sun",
|
||||
"settings-location": "world-pin",
|
||||
"settings-color-scheme": "palette",
|
||||
"settings-wallpaper": "paint",
|
||||
"settings-wallpaper-selector": "library-photo",
|
||||
|
||||
@@ -134,37 +134,17 @@ Singleton {
|
||||
// Backup the widget definition before altering
|
||||
const widgetBefore = JSON.stringify(widget)
|
||||
|
||||
// Migrate old bar settings to proper per widget settings
|
||||
switch (widget.id) {
|
||||
case "ActiveWindow":
|
||||
widget.showIcon = widget.showIcon !== undefined ? widget.showIcon : adapter.bar.showActiveWindowIcon
|
||||
break
|
||||
case "Battery":
|
||||
widget.alwaysShowPercentage = widget.alwaysShowPercentage !== undefined ? widget.alwaysShowPercentage : adapter.bar.alwaysShowBatteryPercentage
|
||||
break
|
||||
// Get back to global settings for these two clock settings
|
||||
case "Clock":
|
||||
widget.use12HourClock = widget.use12HourClock !== undefined ? widget.use12HourClock : adapter.location.use12HourClock
|
||||
widget.reverseDayMonth = widget.reverseDayMonth !== undefined ? widget.reverseDayMonth : adapter.location.reverseDayMonth
|
||||
if (widget.showDate !== undefined) {
|
||||
widget.displayFormat = "time-date"
|
||||
} else if (widget.showSeconds) {
|
||||
widget.displayFormat = "time-seconds"
|
||||
if (widget.use12HourClock !== undefined) {
|
||||
adapter.location.use12hourFormat = widget.use12HourClock
|
||||
delete widget.use12HourClock
|
||||
}
|
||||
if (widget.reverseDayMonth !== undefined) {
|
||||
adapter.location.monthBeforeDay = widget.reverseDayMonth
|
||||
delete widget.reverseDayMonth
|
||||
}
|
||||
delete widget.showDate
|
||||
delete widget.showSeconds
|
||||
break
|
||||
case "MediaMini":
|
||||
widget.showAlbumArt = widget.showAlbumArt !== undefined ? widget.showAlbumArt : adapter.audio.showMiniplayerAlbumArt
|
||||
widget.showVisualizer = widget.showVisualizer !== undefined ? widget.showVisualizer : adapter.audio.showMiniplayerCava
|
||||
break
|
||||
case "SidePanelToggle":
|
||||
widget.useDistroLogo = widget.useDistroLogo !== undefined ? widget.useDistroLogo : adapter.bar.useDistroLogo
|
||||
break
|
||||
case "SystemMonitor":
|
||||
widget.showNetworkStats = widget.showNetworkStats !== undefined ? widget.showNetworkStats : adapter.bar.showNetworkStats
|
||||
break
|
||||
case "Workspace":
|
||||
widget.labelMode = widget.labelMode !== undefined ? widget.labelMode : adapter.bar.showWorkspaceLabel
|
||||
break
|
||||
}
|
||||
|
||||
@@ -280,12 +260,6 @@ Singleton {
|
||||
property real marginVertical: 0.25
|
||||
property real marginHorizontal: 0.25
|
||||
|
||||
property bool showActiveWindowIcon: true // TODO: delete
|
||||
property bool alwaysShowBatteryPercentage: false // TODO: delete
|
||||
property bool showNetworkStats: false // TODO: delete
|
||||
property bool useDistroLogo: false // TODO: delete
|
||||
property string showWorkspaceLabel: "none" // TODO: delete
|
||||
|
||||
// Widget configuration for modular bar system
|
||||
property JsonObject widgets
|
||||
widgets: JsonObject {
|
||||
@@ -333,7 +307,6 @@ Singleton {
|
||||
property bool forceBlackScreenCorners: false
|
||||
property real radiusRatio: 1.0
|
||||
property real screenRadiusRatio: 1.0
|
||||
// Animation speed multiplier (0.1x - 2.0x)
|
||||
property real animationSpeed: 1.0
|
||||
}
|
||||
|
||||
@@ -341,10 +314,8 @@ Singleton {
|
||||
property JsonObject location: JsonObject {
|
||||
property string name: defaultLocation
|
||||
property bool useFahrenheit: false
|
||||
|
||||
property bool reverseDayMonth: false // TODO: delete
|
||||
property bool use12HourClock: false // TODO: delete
|
||||
property bool showDateWithClock: false // TODO: delete
|
||||
property bool use12hourFormat: false
|
||||
property bool monthBeforeDay: false
|
||||
}
|
||||
|
||||
// screen recorder
|
||||
@@ -378,7 +349,6 @@ Singleton {
|
||||
|
||||
// applauncher
|
||||
property JsonObject appLauncher: JsonObject {
|
||||
// When disabled, Launcher hides clipboard command and ignores cliphist
|
||||
property bool enableClipboardHistory: false
|
||||
// Position: center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center
|
||||
property string position: "center"
|
||||
@@ -406,7 +376,7 @@ Singleton {
|
||||
property JsonObject notifications: JsonObject {
|
||||
property bool doNotDisturb: false
|
||||
property list<string> monitors: []
|
||||
// Last time the user opened the notification history (ms since epoch)
|
||||
// Last time the user opened the notification history (ms since e899999999999998poch)
|
||||
property real lastSeenTs: 0
|
||||
// Duration settings for different urgency levels (in seconds)
|
||||
property int lowUrgencyDuration: 3
|
||||
@@ -421,9 +391,6 @@ Singleton {
|
||||
property string visualizerType: "linear"
|
||||
property list<string> mprisBlacklist: []
|
||||
property string preferredPlayer: ""
|
||||
|
||||
property bool showMiniplayerAlbumArt: false // TODO: delete
|
||||
property bool showMiniplayerCava: false // TODO: delete
|
||||
}
|
||||
|
||||
// ui
|
||||
|
||||
@@ -15,7 +15,7 @@ Singleton {
|
||||
return Math.floor(date / 1000)
|
||||
}
|
||||
|
||||
function formatDate(reverseDayMonth = true) {
|
||||
function formatDate(monthBeforeDay = true) {
|
||||
let now = date
|
||||
let dayName = now.toLocaleDateString(Qt.locale(), "ddd")
|
||||
dayName = dayName.charAt(0).toUpperCase() + dayName.slice(1)
|
||||
@@ -40,7 +40,7 @@ Singleton {
|
||||
let month = now.toLocaleDateString(Qt.locale(), "MMMM")
|
||||
let year = now.toLocaleDateString(Qt.locale(), "yyyy")
|
||||
|
||||
return `${dayName}, ` + (reverseDayMonth ? `${month} ${day}${suffix} ${year}` : `${day}${suffix} ${month} ${year}`)
|
||||
return `${dayName}, ` + (monthBeforeDay ? `${month} ${day}${suffix} ${year}` : `${day}${suffix} ${month} ${year}`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ Rectangle {
|
||||
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
readonly property bool compact: (Settings.data.bar.density === "compact")
|
||||
readonly property bool use12h: Settings.data.location.use12hourFormat
|
||||
readonly property bool monthBeforeDay: Settings.data.location.monthBeforeDay
|
||||
|
||||
// Resolve settings: try user settings or defaults from BarWidgetRegistry
|
||||
readonly property bool use12h: widgetSettings.use12HourClock !== undefined ? widgetSettings.use12HourClock : widgetMetadata.use12HourClock
|
||||
readonly property bool reverseDayMonth: widgetSettings.reverseDayMonth !== undefined ? widgetSettings.reverseDayMonth : widgetMetadata.reverseDayMonth
|
||||
readonly property string displayFormat: widgetSettings.displayFormat !== undefined ? widgetSettings.displayFormat : widgetMetadata.displayFormat
|
||||
|
||||
// Use compact mode for vertical bars
|
||||
@@ -119,7 +119,7 @@ Rectangle {
|
||||
dayName = dayName.charAt(0).toUpperCase() + dayName.slice(1)
|
||||
const day = now.getDate().toString().padStart(2, '0')
|
||||
let month = now.toLocaleDateString(Qt.locale(), "MMM")
|
||||
timeStr += " - " + (reverseDayMonth ? `${dayName}, ${month} ${day}` : `${dayName}, ${day} ${month}`)
|
||||
timeStr += " - " + (monthBeforeDay ? `${dayName}, ${month} ${day}` : `${dayName}, ${day} ${month}`)
|
||||
}
|
||||
|
||||
return timeStr
|
||||
@@ -184,7 +184,7 @@ Rectangle {
|
||||
const now = Time.date
|
||||
const day = now.getDate().toString().padStart(2, '0')
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, '0')
|
||||
return reverseDayMonth ? `${month}/${day}` : `${day}/${month}`
|
||||
return monthBeforeDay ? `${month}/${day}` : `${day}/${month}`
|
||||
}
|
||||
|
||||
// Enable fixed-width font for consistent spacing
|
||||
@@ -199,7 +199,7 @@ Rectangle {
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
text: `${Time.formatDate(reverseDayMonth)}.`
|
||||
text: `${Time.formatDate(monthBeforeDay)}.`
|
||||
target: clockContainer
|
||||
positionAbove: Settings.data.bar.position === "bottom"
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ Loader {
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime() {
|
||||
return Settings.data.location.use12hourFormat ? Qt.formatDateTime(new Date(), "h:mm A") : Qt.formatDateTime(new Date(), "HH:mm")
|
||||
}
|
||||
|
||||
function formatDate() {
|
||||
// For full text date, day is always before month, so we use this format for everybody: Wednesday, September 17.
|
||||
return Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
||||
}
|
||||
|
||||
function scheduleUnloadAfterUnlock() {
|
||||
unloadAfterUnlockTimer.start()
|
||||
}
|
||||
@@ -137,9 +146,10 @@ Loader {
|
||||
|
||||
NText {
|
||||
id: timeText
|
||||
text: Qt.formatDateTime(new Date(), "HH:mm")
|
||||
text: formatTime()
|
||||
font.family: Settings.data.ui.fontBillboard
|
||||
font.pointSize: Style.fontSizeXXXL * 6 * scaling
|
||||
// Smaller time display when using longer 12 hour format
|
||||
font.pointSize: Settings.data.location.use12hourFormat ? Style.fontSizeXXXL * 4 * scaling : Style.fontSizeXXXL * 5 * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
font.letterSpacing: -2 * scaling
|
||||
color: Color.mOnSurface
|
||||
@@ -163,7 +173,7 @@ Loader {
|
||||
|
||||
NText {
|
||||
id: dateText
|
||||
text: Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
||||
text: formatDate()
|
||||
font.family: Settings.data.ui.fontBillboard
|
||||
font.pointSize: Style.fontSizeXXL * scaling
|
||||
font.weight: Font.Light
|
||||
@@ -877,8 +887,8 @@ Loader {
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
timeText.text = Qt.formatDateTime(new Date(), "HH:mm")
|
||||
dateText.text = Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
||||
timeText.text = formatTime()
|
||||
dateText.text = formatDate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,10 @@ ColumnLayout {
|
||||
|
||||
// Local state
|
||||
property string valueDisplayFormat: widgetData.displayFormat !== undefined ? widgetData.displayFormat : widgetMetadata.displayFormat
|
||||
property bool valueUse12h: widgetData.use12HourClock !== undefined ? widgetData.use12HourClock : widgetMetadata.use12HourClock
|
||||
property bool valueReverseDayMonth: widgetData.reverseDayMonth !== undefined ? widgetData.reverseDayMonth : widgetMetadata.reverseDayMonth
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.displayFormat = valueDisplayFormat
|
||||
settings.use12HourClock = valueUse12h
|
||||
settings.reverseDayMonth = valueReverseDayMonth
|
||||
return settings
|
||||
}
|
||||
|
||||
@@ -50,16 +46,4 @@ ColumnLayout {
|
||||
onSelected: key => valueDisplayFormat = key
|
||||
minimumWidth: 230 * scaling
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Use 12-hour clock"
|
||||
checked: valueUse12h
|
||||
onToggled: checked => valueUse12h = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Reverse day and month"
|
||||
checked: valueReverseDayMonth
|
||||
onToggled: checked => valueReverseDayMonth = checked
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@ NPanel {
|
||||
About,
|
||||
Audio,
|
||||
Bar,
|
||||
Dock,
|
||||
Hooks,
|
||||
Launcher,
|
||||
ColorScheme,
|
||||
Display,
|
||||
Dock,
|
||||
General,
|
||||
Hooks,
|
||||
Launcher,
|
||||
Location,
|
||||
Network,
|
||||
Notification,
|
||||
ScreenRecorder,
|
||||
Weather,
|
||||
Wallpaper,
|
||||
WallpaperSelector
|
||||
}
|
||||
@@ -81,8 +81,8 @@ NPanel {
|
||||
Tabs.NetworkTab {}
|
||||
}
|
||||
Component {
|
||||
id: weatherTab
|
||||
Tabs.WeatherTab {}
|
||||
id: locationTab
|
||||
Tabs.LocationTab {}
|
||||
}
|
||||
Component {
|
||||
id: colorSchemeTab
|
||||
@@ -160,10 +160,10 @@ NPanel {
|
||||
"icon": "settings-network",
|
||||
"source": networkTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.Weather,
|
||||
"label": "Weather",
|
||||
"icon": "settings-weather",
|
||||
"source": weatherTab
|
||||
"id": SettingsPanel.Tab.Location,
|
||||
"label": "Location",
|
||||
"icon": "settings-location",
|
||||
"source": locationTab
|
||||
}, {
|
||||
"id": SettingsPanel.Tab.ColorScheme,
|
||||
"label": "Color Scheme",
|
||||
|
||||
@@ -65,7 +65,7 @@ ColumnLayout {
|
||||
|
||||
NHeader {
|
||||
label: "Weather"
|
||||
description: "Configure weather display preferences and temperature units."
|
||||
description: "Configure temperature units."
|
||||
}
|
||||
|
||||
NToggle {
|
||||
@@ -81,4 +81,35 @@ ColumnLayout {
|
||||
Layout.topMargin: Style.marginXL * scaling
|
||||
Layout.bottomMargin: Style.marginXL * scaling
|
||||
}
|
||||
|
||||
// Weather section
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
Layout.fillWidth: true
|
||||
|
||||
NHeader {
|
||||
label: "Time & Date"
|
||||
description: "Configure time and date formats."
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Use 12-hour time format"
|
||||
description: "Classic AM/PM or modern 24-hour."
|
||||
checked: Settings.data.location.use12hourFormat
|
||||
onToggled: checked => Settings.data.location.use12hourFormat = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: "Show Month Before Day"
|
||||
description: "Organize your dates. On for 09/17/2025, off for 17/09/2025."
|
||||
checked: Settings.data.location.monthBeforeDay
|
||||
onToggled: checked => Settings.data.location.monthBeforeDay = checked
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginXL * scaling
|
||||
Layout.bottomMargin: Style.marginXL * scaling
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,7 @@ Singleton {
|
||||
},
|
||||
"Clock": {
|
||||
"allowUserSettings": true,
|
||||
"displayFormat": "time-date-short",
|
||||
"use12HourClock": false,
|
||||
"reverseDayMonth": true
|
||||
"displayFormat": "time-date-short"
|
||||
},
|
||||
"CustomButton": {
|
||||
"allowUserSettings": true,
|
||||
|
||||
Reference in New Issue
Block a user