summaryrefslogtreecommitdiff
path: root/tests/manual
diff options
context:
space:
mode:
authorDaniel d'Andrada <daniel.dandrada@luxoft.com>2018-12-03 11:25:34 +0100
committerRobert Griebl <robert.griebl@pelagicore.com>2018-12-07 15:04:24 +0000
commit05a3bb55ce78d785a77bc8c8aaab2fd82b0bc0b5 (patch)
treeea33f8f0b2288af890d666ad74509b8fba33b181 /tests/manual
parentadb57812ee1cf89f3311f8a27ef97abf5d424bde (diff)
downloadqtapplicationmanager-05a3bb55ce78d785a77bc8c8aaab2fd82b0bc0b5.tar.gz
Introduce MonitorModel & friends
A better, more flexible, API for monitor-lib. Fixes: AUTOSUITE-692 Fixes: AUTOSUITE-250 Fixes: AUTOSUITE-686 Change-Id: Ib672e6a19beca4e83a51bcdca530c50be1bf00b7 Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/monitormodel/PropertyField.qml (renamed from tests/manual/systemmonitor/PropertyField.qml)0
-rw-r--r--tests/manual/monitormodel/README (renamed from tests/manual/systemmonitor/README)2
-rw-r--r--tests/manual/monitormodel/SystemMonitorChart.qml (renamed from tests/manual/systemmonitor/SystemMonitorChart.qml)0
-rw-r--r--tests/manual/monitormodel/main.qml (renamed from tests/manual/systemmonitor/main.qml)107
4 files changed, 69 insertions, 40 deletions
diff --git a/tests/manual/systemmonitor/PropertyField.qml b/tests/manual/monitormodel/PropertyField.qml
index cf1511f6..cf1511f6 100644
--- a/tests/manual/systemmonitor/PropertyField.qml
+++ b/tests/manual/monitormodel/PropertyField.qml
diff --git a/tests/manual/systemmonitor/README b/tests/manual/monitormodel/README
index 869b9538..8bc137f7 100644
--- a/tests/manual/systemmonitor/README
+++ b/tests/manual/monitormodel/README
@@ -1,4 +1,4 @@
-This is a playground for manually experimenting with the SystemMonitor component and seeing how it behaves.
+This is a playground for manually experimenting with the MonitorModel component and seeing how it behaves.
A good way to find bugs and doing some sanity checking.
TODO: It could probably later be used by qmlauto tests as a way to ensure it's always kept in a healthy state
diff --git a/tests/manual/systemmonitor/SystemMonitorChart.qml b/tests/manual/monitormodel/SystemMonitorChart.qml
index 59f7da5a..59f7da5a 100644
--- a/tests/manual/systemmonitor/SystemMonitorChart.qml
+++ b/tests/manual/monitormodel/SystemMonitorChart.qml
diff --git a/tests/manual/systemmonitor/main.qml b/tests/manual/monitormodel/main.qml
index 59af386d..50fedbb3 100644
--- a/tests/manual/systemmonitor/main.qml
+++ b/tests/manual/monitormodel/main.qml
@@ -53,12 +53,60 @@ Window {
Pane {
anchors.fill: parent
- SystemMonitor {
- id: systemMonitor
- cpuLoadReportingEnabled: cpuLoadReportingSwitch.checked
- memoryReportingEnabled: memoryReportingSwitch.checked
- gpuLoadReportingEnabled: gpuLoadReportingSwitch.checked
- fpsReportingEnabled: fpsReportingSwitch.checked
+ MonitorModel {
+ id: monitorModel
+
+ running: runningSwitch.checked
+
+ // Data sources from QtApplicationManager
+ CpuStatus { id: cpuStatus }
+ MemoryStatus { id: memoryStatus }
+ IoStatus {
+ id: ioStatus
+ deviceNames: "sda"
+ }
+
+ // A custom data source, with two roles
+ QtObject {
+ id: fooBarStatus
+ property var roleNames: ["foo", "bar"]
+
+ function update() {
+ foo += 1;
+
+ if (_up) {
+ bar += 1;
+ if (bar == 10)
+ _up = false;
+ } else {
+ bar -= 1;
+ if (bar == 0)
+ _up = true;
+ }
+ }
+ property int foo: 0
+ property int bar: 10
+ property bool _up: false
+ }
+
+ // Yet another custom data source
+ QtObject {
+ id: alphaStatus
+ property var roleNames: ["alpha"]
+ function update() {
+ if (_up) {
+ alpha *= 2;
+ if (alpha == 1024)
+ _up = false;
+ } else {
+ alpha /= 2;
+ if (alpha == 2)
+ _up = true;
+ }
+ }
+ property real alpha: 2
+ property bool _up: true
+ }
}
ScrollView {
@@ -69,17 +117,14 @@ Window {
anchors.left: parent.left
ColumnLayout {
- PropertyField { name: "count"; object: systemMonitor }
- PropertyField { name: "reportingInterval"; object: systemMonitor }
- PropertyField { name: "idleLoadThreshold"; object: systemMonitor }
+ PropertyField { name: "maximumCount"; object: monitorModel }
+ PropertyField { name: "interval"; object: monitorModel }
RowLayout {
ComboBox {
id: rolesCombo
- // TODO: ioLoad
Layout.fillWidth: true
- model: [ "cpuLoad", "gpuLoad", "memoryUsed", "averageFps", "minimumFps",
- "maximumFps", "fpsJitter" ]
+ model: [ "cpuLoad", "memoryUsed", "foo", "bar", "alpha" ]
}
Button {
@@ -91,36 +136,20 @@ Window {
}
Switch {
- id: cpuLoadReportingSwitch
- text: "cpuLoadReportingEnabled"
+ id: runningSwitch
+ text: "running"
checked: false
}
- Switch {
- id: memoryReportingSwitch
- text: "memoryReportingEnabled"
- checked: false
- }
-
- Switch {
- id: gpuLoadReportingSwitch
- text: "gpuLoadReportingEnabled"
- checked: false
- }
-
- Switch {
- id: fpsReportingSwitch
- text: "fpsReportingEnabled"
- checked: false
- }
+ Button { text: "Clear"; onClicked: monitorModel.clear() }
- Label { text: "cpuLoad: " + systemMonitor.cpuLoad }
- Label { text: "totalMemory: " + systemMonitor.totalMemory }
- Label { text: "memoryUsed: " + systemMonitor.memoryUsed }
- Label { text: "cpuCores: " + systemMonitor.cpuCores }
- Label { text: "cpuLoad: " + systemMonitor.cpuLoad }
- Label { text: "gpuLoad: " + systemMonitor.gpuLoad }
- Label { text: "idle: " + systemMonitor.idle }
+ Label { text: "cpuLoad: " + cpuStatus.cpuLoad }
+ Label { text: "totalMemory: " + memoryStatus.totalMemory }
+ Label { text: "memoryUsed: " + memoryStatus.memoryUsed }
+ Label { text: "ioLoad.sda: " + ioStatus.ioLoad.sda }
+ Label { text: "foo: " + fooBarStatus.foo }
+ Label { text: "bar: " + fooBarStatus.bar }
+ Label { text: "alpha: " + alphaStatus.alpha }
}
}
@@ -135,7 +164,7 @@ Window {
delegate: SystemMonitorChart {
Layout.fillWidth: true
Layout.fillHeight: true
- sourceModel: systemMonitor
+ sourceModel: monitorModel
role: model.role
onRemoveClicked: chartsModel.remove(model.index)
}