summaryrefslogtreecommitdiff
path: root/bar/Resources.qml
blob: a4d2a2f2e1dde0087206f7b158eac3f6cb85b99b (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import QtQuick
import QtQuick.Layouts

import "components"
import qs.components
import qs.config as Config
import qs.services as Services

Item {
    implicitWidth: container.implicitWidth
    implicitHeight: container.implicitHeight

    IRect {
        id: container
        implicitWidth: layout.implicitWidth + Config.General.rectMargin * 2
        implicitHeight: Config.Bar.height - Config.General.rectMargin

        color: Config.Colors.accent
        radius: Config.Style.rounding.large

        Row {
            id: layout
            anchors.centerIn: parent
            SimpleResource {
                value: Math.round(Services.Resource.cpuUsage * 100)
                altValue: Math.round(Services.Resource.cpuFreq / 10) / 100
                suffix: "%"
                altSuffix: "GHz"
                icon: Config.Icons.resource.cpu
            }
            SimpleResource {
                icon: Config.Icons.resource.memory
                value: Math.round(Services.Resource.memoryUsedPercentage * 100)
                altValue: Math.round(Services.Resource.memoryUsed / 1024 / 1024)
                suffix: "%"
                altSuffix: "GB"
            }
            SimpleResource {
                icon: Config.Icons.resource.gpu
                value: Services.Resource.gpuUsage
                altValue: Services.Resource.gpuTemp
                suffix: "%"
                altSuffix: "°C"
                altIcon: Config.Icons.resource.temp
                thresholdL1: 60
                thresholdL2: 70
                thresholdL3: 80
            }
            SimpleResource {
                icon: Config.Icons.resource.temp
                value: Math.round(Services.Resource.cpuTemp * 100)
                suffix: "°C"
                thresholdL1: 60
                thresholdL2: 80
                thresholdL3: 90
            }
        }
    }
}