mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
ClockSettings: add tooltip format option
Clock: use new tooltip logic i18n: replace "Clock" with "Calendar" as default
This commit is contained in:
@@ -94,6 +94,10 @@
|
||||
"label": "Horizontale Statusleiste"
|
||||
},
|
||||
"preview": "Vorschau",
|
||||
"tooltip-format": {
|
||||
"description": "Formatzeichenfolge für den Tooltip, der beim Überfahren der Uhr angezeigt wird. Leer lassen, um den Standard-Tooltip zu verwenden.",
|
||||
"label": "Tooltip-Format"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Überschreibt die Standard-Schriftart mit einer benutzerdefinierten Schriftart für die Uhr.",
|
||||
"label": "Benutzerdefinierte Schriftart verwenden"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Uhr"
|
||||
"tooltip": "Kalender"
|
||||
},
|
||||
"common": {
|
||||
"add": "Hinzufügen",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Horizontal bar"
|
||||
},
|
||||
"preview": "Preview",
|
||||
"tooltip-format": {
|
||||
"description": "Format string for the tooltip shown when hovering over the clock. Leave empty to use the default tooltip.",
|
||||
"label": "Tooltip format"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Override the default font selection with a custom font for the clock.",
|
||||
"label": "Use custom font"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Clock"
|
||||
"tooltip": "Calendar"
|
||||
},
|
||||
"common": {
|
||||
"add": "Add",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Barra horizontal"
|
||||
},
|
||||
"preview": "Vista previa",
|
||||
"tooltip-format": {
|
||||
"description": "Cadena de formato para la información sobre herramientas que se muestra al pasar el cursor sobre el reloj. Déjelo vacío para usar la información sobre herramientas predeterminada.",
|
||||
"label": "Formato de información sobre herramientas"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Anular la selección de fuente predeterminada con una fuente personalizada para el reloj.",
|
||||
"label": "Usar fuente personalizada"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Reloj"
|
||||
"tooltip": "Calendario"
|
||||
},
|
||||
"common": {
|
||||
"add": "Añadir",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Barre horizontale"
|
||||
},
|
||||
"preview": "Aperçu",
|
||||
"tooltip-format": {
|
||||
"description": "Chaîne de format pour l'info-bulle affichée lors du survol de l'horloge. Laissez vide pour utiliser l'info-bulle par défaut.",
|
||||
"label": "Format de l'info-bulle"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Remplacez la police par défaut par une police personnalisée pour l'horloge.",
|
||||
"label": "Utiliser une police personnalisée."
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Horloge"
|
||||
"tooltip": "Calendrier"
|
||||
},
|
||||
"common": {
|
||||
"add": "Ajouter",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Vízszintes sáv"
|
||||
},
|
||||
"preview": "Előnézet",
|
||||
"tooltip-format": {
|
||||
"description": "Formátumsztring az óra fölé húzva megjelenő eszköztipphez. Hagyja üresen az alapértelmezett eszköztipp használatához.",
|
||||
"label": "Eszköztipp formátum"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Felülbírálja az alapértelmezett betűtípus kiválasztását egy egyéni betűtípussal az órához.",
|
||||
"label": "Egyéni betűtípus használata"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Óra"
|
||||
"tooltip": "Naptár"
|
||||
},
|
||||
"common": {
|
||||
"add": "Hozzáadás",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "水平バー"
|
||||
},
|
||||
"preview": "プレビュー",
|
||||
"tooltip-format": {
|
||||
"description": "時計にマウスを合わせたときに表示されるツールチップのフォーマット文字列。デフォルトのツールチップを使用するには空のままにします。",
|
||||
"label": "ツールチップ形式"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "デフォルトのフォント設定を上書きし、時計にカスタムフォントを使用します。",
|
||||
"label": "カスタムフォントを使用"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "時計"
|
||||
"tooltip": "カレンダー"
|
||||
},
|
||||
"common": {
|
||||
"add": "追加",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Horizontale balk"
|
||||
},
|
||||
"preview": "Voorbeeld",
|
||||
"tooltip-format": {
|
||||
"description": "Opmaakreeks voor de tooltip die wordt weergegeven bij het zweven over de klok. Laat leeg om de standaard tooltip te gebruiken.",
|
||||
"label": "Tooltip-opmaak"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Overschrijf het standaardlettertype met een aangepast lettertype voor de klok.",
|
||||
"label": "Aangepast lettertype gebruiken"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Klok"
|
||||
"tooltip": "Kalender"
|
||||
},
|
||||
"common": {
|
||||
"add": "Toevoegen",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Pasek poziomy"
|
||||
},
|
||||
"preview": "Podgląd",
|
||||
"tooltip-format": {
|
||||
"description": "Ciąg formatujący dla etykietki wyświetlanej po najechaniu na zegar. Pozostaw puste, aby użyć domyślnej etykietki.",
|
||||
"label": "Format etykietki"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Zastąp domyślną czcionkę zegara czcionką niestandardową.",
|
||||
"label": "Użyj niestandardowej czcionki"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Zegar"
|
||||
"tooltip": "Kalendarz"
|
||||
},
|
||||
"common": {
|
||||
"add": "Dodaj",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Barra horizontal"
|
||||
},
|
||||
"preview": "Pré-visualização",
|
||||
"tooltip-format": {
|
||||
"description": "String de formato para a dica de ferramenta exibida ao passar o mouse sobre o relógio. Deixe vazio para usar a dica de ferramenta padrão.",
|
||||
"label": "Formato da dica de ferramenta"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Substitua a fonte padrão por uma fonte personalizada para o relógio.",
|
||||
"label": "Usar fonte personalizada"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Relógio"
|
||||
"tooltip": "Calendário"
|
||||
},
|
||||
"common": {
|
||||
"add": "Adicionar",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Горизонтальная панель"
|
||||
},
|
||||
"preview": "Предварительный просмотр",
|
||||
"tooltip-format": {
|
||||
"description": "Строка формата для подсказки, отображаемой при наведении на часы. Оставьте пустым, чтобы использовать подсказку по умолчанию.",
|
||||
"label": "Формат подсказки"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Переопределить выбор шрифта по умолчанию пользовательским шрифтом для часов.",
|
||||
"label": "Использовать пользовательский шрифт"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Часы"
|
||||
"tooltip": "Календарь"
|
||||
},
|
||||
"common": {
|
||||
"add": "Добавить",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Yatay çubuk"
|
||||
},
|
||||
"preview": "Önizleme",
|
||||
"tooltip-format": {
|
||||
"description": "Saat üzerine geldiğinizde gösterilen ipucu için format dizesi. Varsayılan ipucunu kullanmak için boş bırakın.",
|
||||
"label": "İpucu formatı"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Saat için varsayılan yazı tipi seçimini özel bir yazı tipiyle geçersiz kılın.",
|
||||
"label": "Özel yazı tipi kullan"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Saat"
|
||||
"tooltip": "Takvim"
|
||||
},
|
||||
"common": {
|
||||
"add": "Ekle",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "Горизонтальна панель"
|
||||
},
|
||||
"preview": "Попередній перегляд",
|
||||
"tooltip-format": {
|
||||
"description": "Рядок формату для підказки, що відображається при наведенні на годинник. Залиште порожнім, щоб використовувати стандартну підказку.",
|
||||
"label": "Формат підказки"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "Замінити стандартний вибір шрифту власним шрифтом для годинника.",
|
||||
"label": "Використовувати власний шрифт"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "Годинник"
|
||||
"tooltip": "Календар"
|
||||
},
|
||||
"common": {
|
||||
"add": "Додати",
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"label": "水平栏"
|
||||
},
|
||||
"preview": "预览",
|
||||
"tooltip-format": {
|
||||
"description": "悬停在时钟上时显示的工具提示的格式字符串。留空以使用默认工具提示。",
|
||||
"label": "工具提示格式"
|
||||
},
|
||||
"use-custom-font": {
|
||||
"description": "使用自定义字体覆盖时钟的默认字体选择。",
|
||||
"label": "使用自定义字体"
|
||||
@@ -536,7 +540,7 @@
|
||||
}
|
||||
},
|
||||
"clock": {
|
||||
"tooltip": "时钟"
|
||||
"tooltip": "日历"
|
||||
},
|
||||
"common": {
|
||||
"add": "添加",
|
||||
|
||||
@@ -42,6 +42,7 @@ Rectangle {
|
||||
readonly property string customFont: widgetSettings.customFont !== undefined ? widgetSettings.customFont : widgetMetadata.customFont
|
||||
readonly property string formatHorizontal: widgetSettings.formatHorizontal !== undefined ? widgetSettings.formatHorizontal : widgetMetadata.formatHorizontal
|
||||
readonly property string formatVertical: widgetSettings.formatVertical !== undefined ? widgetSettings.formatVertical : widgetMetadata.formatVertical
|
||||
readonly property string tooltipFormat: widgetSettings.tooltipFormat !== undefined ? widgetSettings.tooltipFormat : widgetMetadata.tooltipFormat
|
||||
|
||||
implicitWidth: isBarVertical ? Style.capsuleHeight : Math.round((isBarVertical ? verticalLoader.implicitWidth : horizontalLoader.implicitWidth) + Style.marginM * 2)
|
||||
|
||||
@@ -149,6 +150,15 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Build tooltip text with formatted time/date
|
||||
function buildTooltipText() {
|
||||
if (tooltipFormat && tooltipFormat.trim() !== "") {
|
||||
return I18n.locale.toString(now, tooltipFormat.trim());
|
||||
}
|
||||
// Fallback to default if no format is set
|
||||
return I18n.tr("clock.tooltip"); // Defaults to "Calendar"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: clockMouseArea
|
||||
anchors.fill: parent
|
||||
@@ -157,10 +167,12 @@ Rectangle {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onEntered: {
|
||||
if (!PanelService.getPanel("clockPanel", screen)?.active) {
|
||||
TooltipService.show(root, I18n.tr("clock.tooltip"), BarService.getTooltipDirection());
|
||||
TooltipService.show(root, buildTooltipText(), BarService.getTooltipDirection());
|
||||
tooltipRefreshTimer.start();
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
tooltipRefreshTimer.stop();
|
||||
TooltipService.hide();
|
||||
}
|
||||
onClicked: mouse => {
|
||||
@@ -176,4 +188,15 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: tooltipRefreshTimer
|
||||
interval: 1000
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (clockMouseArea.containsMouse && !PanelService.getPanel("clockPanel", screen)?.active) {
|
||||
TooltipService.updateText(buildTooltipText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ ColumnLayout {
|
||||
property string valueCustomFont: widgetData.customFont !== undefined ? widgetData.customFont : widgetMetadata.customFont
|
||||
property string valueFormatHorizontal: widgetData.formatHorizontal !== undefined ? widgetData.formatHorizontal : widgetMetadata.formatHorizontal
|
||||
property string valueFormatVertical: widgetData.formatVertical !== undefined ? widgetData.formatVertical : widgetMetadata.formatVertical
|
||||
property string valueTooltipFormat: widgetData.tooltipFormat !== undefined ? widgetData.tooltipFormat : widgetMetadata.tooltipFormat
|
||||
|
||||
// Track the currently focused input field
|
||||
property var focusedInput: null
|
||||
@@ -34,6 +35,7 @@ ColumnLayout {
|
||||
settings.customFont = valueCustomFont;
|
||||
settings.formatHorizontal = valueFormatHorizontal.trim();
|
||||
settings.formatVertical = valueFormatVertical.trim();
|
||||
settings.tooltipFormat = valueTooltipFormat.trim();
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -161,6 +163,25 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: inputTooltip
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.clock.tooltip-format.label")
|
||||
description: I18n.tr("bar.widget-settings.clock.tooltip-format.description")
|
||||
placeholderText: "HH:mm, ddd MMM dd"
|
||||
text: valueTooltipFormat
|
||||
onTextChanged: valueTooltipFormat = text
|
||||
Component.onCompleted: {
|
||||
if (inputItem) {
|
||||
inputItem.onActiveFocusChanged.connect(function () {
|
||||
if (inputItem.activeFocus) {
|
||||
root.focusedInput = inputTooltip;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------
|
||||
|
||||
Reference in New Issue
Block a user