-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
94 lines (82 loc) · 2.44 KB
/
main.qml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import QtQuick 2.6
import QtQuick.Controls 1.4 as QQC1
import no.crimson.bmon 1.0
QQC1.ApplicationWindow {
visible: true
width: 800
height: 600
ProcessModel {
id: processModel
}
QQC1.TableView {
id: tableView
model: SortFilterProxyModel {
id: sortFilterProxyModel
source: processModel
sortOrder: tableView.sortIndicatorOrder
sortCaseSensitivity: Qt.CaseInsensitive
sortRole: tableView.getColumn(tableView.sortIndicatorColumn).role
// filterString
// filterSyntax
// filterCaseSensitivity
}
sortIndicatorVisible: true
currentRow: 0
anchors.fill: parent
itemDelegate: Rectangle {
color: {
if (styleData.role == "activePulseStreams") {
if (styleData.value == 0) {
return "transparent"
}
return "red";
}
return "transparent"
}
Text {
anchors.verticalCenter: parent.verticalCenter
color: {
var row = sortFilterProxyModel.get(styleData.row);
var process = row.processInfoObject;
if (process && process.live) {
return styleData.textColor;
} else {
return "#666666";
}
}
elide: styleData.elideMode
text: {
if (styleData.role == "powerImpact") {
if (styleData.value) {
return styleData.value.toFixed(2)
} else {
return "0.00"
}
}
return styleData.value
}
width: parent.width
}
}
QQC1.TableViewColumn {
role: "pid"
title: "PID"
width: 100
}
QQC1.TableViewColumn {
role: "name"
title: "Name"
width: 200
}
QQC1.TableViewColumn {
role: "powerImpact"
title: "Power"
width: 100
}
QQC1.TableViewColumn {
role: "activePulseStreams"
title: "Audio streams"
width: 100
}
}
}