summaryrefslogtreecommitdiff
path: root/package/contents/ui/IconUtils.qml
blob: 344d26f9f3cb28cae2010c9e50427779e09f4a0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 "";
        }
    }
}