mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-05-30 17:28:55 +00:00
Calendar: events tooltip use fixed font with improved time formating
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user