summaryrefslogtreecommitdiff
path: root/package/contents/ui/IconUtils.qml
diff options
context:
space:
mode:
Diffstat (limited to 'package/contents/ui/IconUtils.qml')
-rw-r--r--package/contents/ui/IconUtils.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/package/contents/ui/IconUtils.qml b/package/contents/ui/IconUtils.qml
new file mode 100644
index 0000000..344d26f
--- /dev/null
+++ b/package/contents/ui/IconUtils.qml
@@ -0,0 +1,31 @@
+import QtQuick 6.0
+
+QtObject {
+ function getBatteryIcon(soc) {
+ if (soc === undefined || soc === null || soc < 0) {
+ return "\uf244"; // 
+ }
+ var socNum = Math.floor(soc);
+ if (socNum <= 20) return "\uf244"; // 
+ if (socNum <= 40) return "\uf243"; // 
+ if (socNum <= 60) return "\uf242"; // 
+ if (socNum <= 80) return "\uf241"; // 
+ return "\uf240"; // 
+ }
+
+ function getDirectionIcon(direction) {
+ if (!direction) return "";
+ switch (direction) {
+ case "charge":
+ return "\uf185"; // 
+ case "discharge":
+ return "\uf0e7"; // 
+ case "idle":
+ return "\uf186"; // 
+ default:
+ return "";
+ }
+ }
+}
+
+