bar tooltips: format

This commit is contained in:
end-4
2025-08-11 21:17:53 +07:00
parent 6a8a9172b1
commit af111a4be9
4 changed files with 51 additions and 35 deletions
@@ -58,9 +58,7 @@ MouseArea {
iconSize: Appearance.font.pixelSize.normal iconSize: Appearance.font.pixelSize.normal
color: (isLow && !isCharging) ? batteryLowOnBackground : Appearance.m3colors.m3onSecondaryContainer color: (isLow && !isCharging) ? batteryLowOnBackground : Appearance.m3colors.m3onSecondaryContainer
} }
} }
} }
Loader { Loader {
@@ -72,7 +70,8 @@ MouseArea {
Connections { Connections {
target: root target: root
function onIsChargingChanged() { function onIsChargingChanged() {
if (isCharging) boltIconLoader.active = true if (isCharging)
boltIconLoader.active = true;
} }
} }
@@ -85,13 +84,13 @@ MouseArea {
visible: opacity > 0 // Only show when charging visible: opacity > 0 // Only show when charging
opacity: isCharging ? 1 : 0 // Keep opacity for visibility opacity: isCharging ? 1 : 0 // Keep opacity for visibility
onVisibleChanged: { onVisibleChanged: {
if (!visible) boltIconLoader.active = false if (!visible)
boltIconLoader.active = false;
} }
Behavior on opacity { Behavior on opacity {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
} }
} }
@@ -15,22 +15,24 @@ Item {
// Helper function to get upcoming todos // Helper function to get upcoming todos
function getUpcomingTodos() { function getUpcomingTodos() {
const unfinishedTodos = Todo.list.filter(function(item) { return !item.done; }) const unfinishedTodos = Todo.list.filter(function (item) {
return !item.done;
});
if (unfinishedTodos.length === 0) { if (unfinishedTodos.length === 0) {
return Translation.tr("No pending tasks") return Translation.tr("No pending tasks");
} }
// Limit to first 5 todos to keep popup manageable // Limit to first 5 todos to keep popup manageable
const limitedTodos = unfinishedTodos.slice(0, 5) const limitedTodos = unfinishedTodos.slice(0, 5);
let todoText = limitedTodos.map(function(item, index) { let todoText = limitedTodos.map(function (item, index) {
return `${index + 1}. ${item.content}` return `${index + 1}. ${item.content}`;
}).join('\n') }).join('\n');
if (unfinishedTodos.length > 5) { if (unfinishedTodos.length > 5) {
todoText += `\n${Translation.tr("... and %1 more").arg(unfinishedTodos.length - 5)}` todoText += `\n${Translation.tr("... and %1 more").arg(unfinishedTodos.length - 5)}`;
} }
return todoText return todoText;
} }
// Popup Data // Popup Data
@@ -63,7 +65,6 @@ Item {
color: Appearance.colors.colOnLayer1 color: Appearance.colors.colOnLayer1
text: DateTime.date text: DateTime.date
} }
} }
MouseArea { MouseArea {
@@ -104,8 +105,15 @@ Item {
RowLayout { RowLayout {
spacing: 5 spacing: 5
Layout.fillWidth: true Layout.fillWidth: true
MaterialSymbol { text: "timelapse"; color: Appearance.colors.colOnSurfaceVariant; font.pixelSize: Appearance.font.pixelSize.large } MaterialSymbol {
StyledText { text: Translation.tr("System uptime:"); color: Appearance.colors.colOnSurfaceVariant } text: "timelapse"
color: Appearance.colors.colOnSurfaceVariant
font.pixelSize: Appearance.font.pixelSize.large
}
StyledText {
text: Translation.tr("System uptime:")
color: Appearance.colors.colOnSurfaceVariant
}
StyledText { StyledText {
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
@@ -122,8 +130,15 @@ Item {
RowLayout { RowLayout {
spacing: 4 spacing: 4
Layout.fillWidth: true Layout.fillWidth: true
MaterialSymbol { text: "checklist"; color: Appearance.colors.colOnSurfaceVariant; font.pixelSize: Appearance.font.pixelSize.large } MaterialSymbol {
StyledText { text: Translation.tr("To Do:"); color: Appearance.colors.colOnSurfaceVariant } text: "checklist"
color: Appearance.colors.colOnSurfaceVariant
font.pixelSize: Appearance.font.pixelSize.large
}
StyledText {
text: Translation.tr("To Do:")
color: Appearance.colors.colOnSurfaceVariant
}
} }
StyledText { StyledText {
@@ -136,5 +151,4 @@ Item {
} }
} }
} }
} }
@@ -10,7 +10,13 @@ Item {
id: root id: root
required property string iconName required property string iconName
required property double percentage required property double percentage
property var tooltipData: [{ icon: "info", label: "System resource", value: "" }] property var tooltipData: [
{
icon: "info",
label: "System resource",
value: ""
}
]
property var tooltipHeaderIcon property var tooltipHeaderIcon
property var tooltipHeaderText property var tooltipHeaderText
property bool shown: true property bool shown: true
@@ -21,12 +27,12 @@ Item {
// Helper function to format KB to GB // Helper function to format KB to GB
function formatKB(kb) { function formatKB(kb) {
return (kb / (1024 * 1024)).toFixed(1) + " GB" return (kb / (1024 * 1024)).toFixed(1) + " GB";
} }
RowLayout { RowLayout {
spacing: 4
id: resourceRowLayout id: resourceRowLayout
spacing: 4
x: shown ? 0 : -resourceRowLayout.width x: shown ? 0 : -resourceRowLayout.width
CircularProgress { CircularProgress {
@@ -45,7 +51,6 @@ Item {
iconSize: Appearance.font.pixelSize.large iconSize: Appearance.font.pixelSize.large
color: Appearance.m3colors.m3onSecondaryContainer color: Appearance.m3colors.m3onSecondaryContainer
} }
} }
StyledText { StyledText {
@@ -57,7 +62,6 @@ Item {
Behavior on x { Behavior on x {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
} }
MouseArea { MouseArea {
@@ -124,7 +128,6 @@ Item {
} }
} }
} }
} }
} }