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
color: (isLow && !isCharging) ? batteryLowOnBackground : Appearance.m3colors.m3onSecondaryContainer
}
}
}
Loader {
@@ -72,7 +70,8 @@ MouseArea {
Connections {
target: root
function onIsChargingChanged() {
if (isCharging) boltIconLoader.active = true
if (isCharging)
boltIconLoader.active = true;
}
}
@@ -85,19 +84,19 @@ MouseArea {
visible: opacity > 0 // Only show when charging
opacity: isCharging ? 1 : 0 // Keep opacity for visibility
onVisibleChanged: {
if (!visible) boltIconLoader.active = false
if (!visible)
boltIconLoader.active = false;
}
Behavior on opacity {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
}
}
StyledPopup {
hoverTarget: root
BatteryPopup {
id: batteryPopup
anchors.centerIn: parent
@@ -15,22 +15,24 @@ Item {
// Helper function to get upcoming todos
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) {
return Translation.tr("No pending tasks")
return Translation.tr("No pending tasks");
}
// Limit to first 5 todos to keep popup manageable
const limitedTodos = unfinishedTodos.slice(0, 5)
let todoText = limitedTodos.map(function(item, index) {
return `${index + 1}. ${item.content}`
}).join('\n')
const limitedTodos = unfinishedTodos.slice(0, 5);
let todoText = limitedTodos.map(function (item, index) {
return `${index + 1}. ${item.content}`;
}).join('\n');
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
@@ -63,7 +65,6 @@ Item {
color: Appearance.colors.colOnLayer1
text: DateTime.date
}
}
MouseArea {
@@ -75,7 +76,7 @@ Item {
StyledPopup {
hoverTarget: mouseArea
ColumnLayout {
id: columnLayout
anchors.centerIn: parent
@@ -104,8 +105,15 @@ Item {
RowLayout {
spacing: 5
Layout.fillWidth: true
MaterialSymbol { text: "timelapse"; color: Appearance.colors.colOnSurfaceVariant; font.pixelSize: Appearance.font.pixelSize.large }
StyledText { text: Translation.tr("System uptime:"); color: Appearance.colors.colOnSurfaceVariant }
MaterialSymbol {
text: "timelapse"
color: Appearance.colors.colOnSurfaceVariant
font.pixelSize: Appearance.font.pixelSize.large
}
StyledText {
text: Translation.tr("System uptime:")
color: Appearance.colors.colOnSurfaceVariant
}
StyledText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
@@ -122,8 +130,15 @@ Item {
RowLayout {
spacing: 4
Layout.fillWidth: true
MaterialSymbol { text: "checklist"; color: Appearance.colors.colOnSurfaceVariant; font.pixelSize: Appearance.font.pixelSize.large }
StyledText { text: Translation.tr("To Do:"); color: Appearance.colors.colOnSurfaceVariant }
MaterialSymbol {
text: "checklist"
color: Appearance.colors.colOnSurfaceVariant
font.pixelSize: Appearance.font.pixelSize.large
}
StyledText {
text: Translation.tr("To Do:")
color: Appearance.colors.colOnSurfaceVariant
}
}
StyledText {
@@ -136,5 +151,4 @@ Item {
}
}
}
}
+12 -9
View File
@@ -10,7 +10,13 @@ Item {
id: root
required property string iconName
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 tooltipHeaderText
property bool shown: true
@@ -19,14 +25,14 @@ Item {
implicitWidth: resourceRowLayout.x < 0 ? 0 : resourceRowLayout.implicitWidth
implicitHeight: resourceRowLayout.implicitHeight
// Helper function to format KB to GB
// Helper function to format KB to GB
function formatKB(kb) {
return (kb / (1024 * 1024)).toFixed(1) + " GB"
return (kb / (1024 * 1024)).toFixed(1) + " GB";
}
RowLayout {
spacing: 4
id: resourceRowLayout
spacing: 4
x: shown ? 0 : -resourceRowLayout.width
CircularProgress {
@@ -45,7 +51,6 @@ Item {
iconSize: Appearance.font.pixelSize.large
color: Appearance.m3colors.m3onSecondaryContainer
}
}
StyledText {
@@ -57,7 +62,6 @@ Item {
Behavior on x {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
}
MouseArea {
@@ -70,7 +74,7 @@ Item {
StyledPopup {
hoverTarget: mouseArea
ColumnLayout {
id: columnLayout
anchors.centerIn: parent
@@ -124,7 +128,6 @@ Item {
}
}
}
}
}
@@ -135,4 +138,4 @@ Item {
easing.bezierCurve: Appearance.animation.elementMove.bezierCurve
}
}
}
}
@@ -18,7 +18,7 @@ MouseArea {
RowLayout {
id: rowLayout
anchors.centerIn: parent
MaterialSymbol {
fill: 0
text: WeatherIcons.codeToName[Weather.data.wCode]
@@ -38,7 +38,7 @@ MouseArea {
StyledPopup {
hoverTarget: root
WeatherPopup {
id: weatherPopup
anchors.centerIn: parent