From 9bccf4ff56e691a1377c81fd6612f94c22e9739d Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Tue, 11 Nov 2025 06:54:13 -0500 Subject: [PATCH] Calendar: events tooltip use fixed font with improved time formating --- Modules/Panels/Calendar/CalendarPanel.qml | 25 ++++++++++++----------- Modules/Tooltip/Tooltip.qml | 5 ++++- Services/UI/TooltipService.qml | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Modules/Panels/Calendar/CalendarPanel.qml b/Modules/Panels/Calendar/CalendarPanel.qml index 882775366..53d7de723 100644 --- a/Modules/Panels/Calendar/CalendarPanel.qml +++ b/Modules/Panels/Calendar/CalendarPanel.qml @@ -604,18 +604,19 @@ SmartPanel { const events = parent.parent.parent.parent.getEventsForDate(modelData.year, modelData.month, modelData.day) if (events.length > 0) { const summaries = events.map(event => { - if (isAllDayEvent(event)) { - return event.summary - } else { - const start = new Date(event.start * 1000) - const startFormatted = start.toLocaleTimeString(I18n.locale, Locale.ShortFormat) - const end = new Date(event.end * 1000) - const endFormatted = end.toLocaleTimeString(I18n.locale, Locale.ShortFormat) - return `${startFormatted}-${endFormatted} ${event.summary}` - } - }).join('\n') - TooltipService.show(Screen, parent, summaries) - TooltipService.updateText(summaries) + if (isAllDayEvent(event)) { + return event.summary + } else { + // Always format with '0' padding to ensure proper horizontal alignment + const timeFormat = Settings.data.location.use12hourFormat ? "hh:mm AP" : "HH:mm" + const start = new Date(event.start * 1000) + const startFormatted = I18n.locale.toString(start, timeFormat) + const end = new Date(event.end * 1000) + const endFormatted = I18n.locale.toString(end, timeFormat) + return `${startFormatted}-${endFormatted} ${event.summary}` + } + }).join('\n') + TooltipService.show(screen, parent, summaries, "auto", Style.tooltipDelay, Settings.data.ui.fontFixed) } } diff --git a/Modules/Tooltip/Tooltip.qml b/Modules/Tooltip/Tooltip.qml index 584c15290..e99ecff07 100644 --- a/Modules/Tooltip/Tooltip.qml +++ b/Modules/Tooltip/Tooltip.qml @@ -108,7 +108,7 @@ PopupWindow { } // Function to show tooltip - function show(screen, target, tipText, customDirection, showDelay) { + function show(screen, target, tipText, customDirection, showDelay, fontFamily) { if (!screen || !target || !tipText || tipText === "") return @@ -139,6 +139,8 @@ PopupWindow { direction = "auto" } + tooltipText.family = fontFamily ? fontFamily : Settings.data.ui.fontDefault + // Start show timer showTimer.start() } @@ -404,6 +406,7 @@ PopupWindow { anchors.margins: root.padding text: root.text pointSize: Style.fontSizeS + family: Settings.data.ui.fontFixed color: Color.mOnSurfaceVariant horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter diff --git a/Services/UI/TooltipService.qml b/Services/UI/TooltipService.qml index 606e2c39c..4e2b98b42 100644 --- a/Services/UI/TooltipService.qml +++ b/Services/UI/TooltipService.qml @@ -15,7 +15,7 @@ Singleton { Tooltip {} } - function show(screen, target, text, direction, delay) { + function show(screen, target, text, direction, delay, fontFamily) { if (!Settings.data.ui.tooltipsEnabled) { return } @@ -78,7 +78,7 @@ Singleton { }) // Show the tooltip - newTooltip.show(screen, target, text, direction || "auto", delay || Style.tooltipDelay) + newTooltip.show(screen, target, text, direction || "auto", delay || Style.tooltipDelay, fontFamily) return newTooltip } else {