diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-12-03 11:25:34 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2018-12-07 15:04:24 +0000 |
commit | 05a3bb55ce78d785a77bc8c8aaab2fd82b0bc0b5 (patch) | |
tree | ea33f8f0b2288af890d666ad74509b8fba33b181 /examples | |
parent | adb57812ee1cf89f3311f8a27ef97abf5d424bde (diff) | |
download | qtapplicationmanager-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 'examples')
39 files changed, 1180 insertions, 692 deletions
diff --git a/examples/applicationmanager/applicationmanager.pro b/examples/applicationmanager/applicationmanager.pro index 6b7b8034..8231c457 100644 --- a/examples/applicationmanager/applicationmanager.pro +++ b/examples/applicationmanager/applicationmanager.pro @@ -2,10 +2,11 @@ TEMPLATE = subdirs SUBDIRS = \ animated-windows \ + frame-timer \ hello-world \ minidesk \ - monitor \ multi-views \ + process-status \ startup-plugin \ intents \ diff --git a/examples/applicationmanager/monitor/am-config.yaml b/examples/applicationmanager/frame-timer/am-config.yaml index dc5216c5..5db21e36 100644 --- a/examples/applicationmanager/monitor/am-config.yaml +++ b/examples/applicationmanager/frame-timer/am-config.yaml @@ -1,13 +1,8 @@ formatVersion: 1 formatType: am-configuration --- - applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" ui: mainQml: "${CONFIG_PWD}/system-ui/main.qml" - -# development setup: -flags: - noUiWatchdog: yes diff --git a/examples/applicationmanager/monitor/apps/tld.monitor.app/app.qml b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/fish.qml index a199d467..d6ae4bc3 100644 --- a/examples/applicationmanager/monitor/apps/tld.monitor.app/app.qml +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/fish.qml @@ -50,34 +50,36 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.4 import QtApplicationManager.Application 1.0 -ApplicationWindow { - title: "Primary Window" - windowType: "primary" +ApplicationManagerWindow { + id: root + color: mouseArea.pressed ? "red" : "darkblue" - ApplicationWindow { - title: "Secondary Window" - windowType: "secondary" - visible: true - idle: 500 - } + Rectangle { + id: rectangle + anchors.centerIn: parent + width: 180; height: 180; radius: width/4 + color: "aqua" + + Image { + source: ApplicationInterface.icon + anchors.centerIn: parent + } - Timer { - property int count: 0 - running: true - repeat: true - onTriggered: { - if (count < 100) { - var arr = []; - var idx = 200000; - while (idx > 0) - arr[idx] = idx--; - count++; - } else { - repeat = false; + Timer { + running: true + repeat: true + interval: 1000 / 25 // 25 frames per second + onTriggered: { + rectangle.rotation = (rectangle.rotation + 5) % 360; } } } + + MouseArea { + id: mouseArea + anchors.fill: parent + } } diff --git a/examples/applicationmanager/frame-timer/apps/frame-timer.fish/fish.svg b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/fish.svg new file mode 100644 index 00000000..69a95ea7 --- /dev/null +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/fish.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + id="svg8" + version="1.1" + viewBox="0 0 51.879999 51.880002" + height="51.880001mm" + width="51.880001mm"> + <title + id="title4518">U+144A5 ANATOLIAN HIEROGLYPH A138</title> + <defs + id="defs2" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>U+144A5 ANATOLIAN HIEROGLYPH A138 from Noto Sans font</dc:title> + <cc:license + rdf:resource="http://scripts.sil.org/OFL" /> + </cc:Work> + <cc:License + rdf:about="http://scripts.sil.org/OFL"> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Reproduction" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Distribution" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Embedding" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/DerivativeWorks" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/Notice" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/Attribution" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/ShareAlike" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/DerivativeRenaming" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/BundlingWhenSelling" /> + </cc:License> + </rdf:RDF> + </metadata> + <g + transform="translate(-47.560265,-26.871213)" + id="layer1"> + <g + id="text4538" + style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332;image-rendering:auto"> + <path + id="path814" + style="font-size:42.33333206px;stroke-width:0.26458332" + d="m 71.320099,66.590713 q -2.032,0 -3.852334,-0.804334 -1.777999,-0.762 -3.217333,-2.032 -1.439333,-1.227666 -2.413,-2.667 -3.090333,-0.973666 -6.095999,-3.090333 -3.005667,-2.116666 -6.180667,-4.699 V 52.32438 q 3.175,-2.582334 6.180667,-4.699 3.005666,-2.116667 6.095999,-3.090333 0.973667,-1.439334 2.413,-2.667 1.439334,-1.27 3.217333,-2.032 1.820334,-0.804334 3.852334,-0.804334 0.677333,0 1.058333,0.169334 0.423333,0.127 0.423333,0.592666 0,0.592667 -0.465666,1.058334 -0.465667,0.423333 -1.143,0.846666 -0.677334,0.423334 -1.312334,0.973667 -0.635,0.508 -0.973666,1.312333 l 1.820333,0.254 q 1.439333,-1.27 3.259667,-2.074333 1.862666,-0.846667 3.937,-0.846667 0.677333,0 1.058333,0.169334 0.423333,0.127 0.423333,0.592666 0,0.677334 -0.635,1.227667 -0.592666,0.550333 -1.397,1.100667 -0.804333,0.508 -1.439333,1.227666 0.465667,0.127 0.889,0.296334 0.423333,0.127 0.846667,0.254 1.269999,-0.846667 2.751666,-1.439334 1.524,-0.592666 3.090333,-0.592666 0.677334,0 1.058334,0.169333 0.423333,0.169333 0.423333,0.592667 0,0.889 -0.931333,1.439333 -0.931334,0.550333 -1.862667,1.312333 1.143,0.296333 2.201333,0.508 1.100667,0.211667 2.116667,0.211667 1.354667,0 2.582333,-0.635 1.227667,-0.677334 2.243667,-1.481667 1.058333,-0.846666 1.778,-1.397 0.296333,-0.211666 0.846666,-0.719666 0.550334,-0.550334 1.143,-1.016 0.592667,-0.465667 0.973667,-0.465667 0.635,0 0.973667,0.719667 0.381,0.677333 0.381,1.227666 0,0.973667 -0.550334,2.074333 -0.550333,1.100667 -1.312333,2.201334 -0.719667,1.058333 -1.27,2.032 -0.550333,0.931333 -0.550333,1.608666 v 0.550334 q 0,0.677333 0.550333,1.651 0.550333,0.931333 1.27,2.032 0.762,1.058333 1.312333,2.158999 0.550334,1.100667 0.550334,2.074334 0,0.592666 -0.381,1.27 -0.338667,0.677333 -0.973667,0.677333 -0.381,0 -0.973667,-0.465667 -0.592666,-0.465666 -1.143,-0.973666 -0.550333,-0.550334 -0.846666,-0.762 -0.719667,-0.550334 -1.778,-1.354667 -1.016,-0.846667 -2.243667,-1.481667 -1.227666,-0.677333 -2.582333,-0.677333 -1.016,0 -2.116667,0.211667 -1.058333,0.169333 -2.201333,0.508 0.931333,0.762 1.862667,1.312333 0.931333,0.550333 0.931333,1.439333 0,0.465667 -0.423333,0.635 -0.381,0.127 -1.058334,0.127 -1.566333,0 -3.090333,-0.592666 -1.481667,-0.635 -2.751666,-1.439334 -0.423334,0.127 -0.846667,0.296334 -0.423333,0.127 -0.889,0.254 0.635,0.677333 1.439333,1.227666 0.804334,0.550334 1.397,1.100667 0.635,0.550333 0.635,1.227667 0,0.423333 -0.423333,0.592666 -0.381,0.169334 -1.058333,0.169334 -2.074334,0 -3.937,-0.846667 -1.820334,-0.804333 -3.259667,-2.074333 l -1.820333,0.254 q 0.338666,0.804333 0.973666,1.312333 0.635,0.550333 1.312334,0.973667 0.677333,0.423333 1.143,0.846666 0.465666,0.465667 0.465666,1.058334 0,0.423333 -0.423333,0.592666 -0.381,0.169334 -1.058333,0.169334 z m -7.493,-22.563666 q 0.550333,-0.08467 1.143,-0.127 0.592667,-0.08467 1.185333,-0.08467 0.423334,0 0.804334,0 0.380999,0 0.804333,0.04233 0.508,-1.439333 1.524,-2.159 1.016,-0.762 1.947333,-1.566333 -0.127,-0.04233 -0.381,-0.04233 -1.735667,0 -3.640667,1.100666 -1.904999,1.100667 -3.386666,2.836334 z m 11.006666,1.227666 q 0.592667,-0.846666 1.439334,-1.524 0.846666,-0.719666 1.566333,-1.312333 -0.127,-0.04233 -0.381,-0.04233 -1.227667,0 -2.624667,0.635 -1.397,0.592666 -2.624666,1.566333 0.677333,0.169333 1.312333,0.338667 0.677333,0.169333 1.312333,0.338666 z m 21.209,16.298333 q 0.127,-0.254 0.127,-0.508 0,-0.804333 -0.592667,-1.820333 -0.550333,-1.058334 -1.354667,-2.159 -0.762,-1.143 -1.354666,-2.159 -0.550334,-1.058333 -0.550334,-1.820333 v -0.550334 q 0,-0.762 0.550334,-1.778 0.592666,-1.058333 1.354666,-2.159 0.804334,-1.143 1.354667,-2.159 0.592667,-1.058333 0.592667,-1.862666 0,-0.254 -0.127,-0.508 -1.100667,1.100667 -2.497667,2.370666 -1.397,1.227667 -3.090333,2.201334 -1.651,0.931333 -3.513667,1.016 v 6.307666 q 1.862667,0.127 3.513667,1.058334 1.693333,0.931333 3.090333,2.201333 1.397,1.27 2.497667,2.328333 z m -29.844999,-1.016 q 3.174999,0 5.799666,-0.635 2.667,-0.635 4.953,-1.481667 2.328333,-0.846666 4.445,-1.523999 2.159,-0.719667 4.275666,-0.889 v -6.392334 q -2.116666,-0.169333 -4.275666,-0.846666 -2.116667,-0.719667 -4.445,-1.566334 -2.286,-0.846666 -4.953,-1.481666 -2.624667,-0.635 -5.799666,-0.635 -2.878667,0 -5.418667,1.100667 -2.54,1.100666 -4.953,2.878666 -2.413,1.778 -4.868333,3.767667 2.413,1.989666 4.826,3.767666 2.413,1.735667 4.953,2.836333 2.582333,1.100667 5.461,1.100667 z M 80.972098,47.286713 q 0.592667,-0.592667 1.227667,-1.058333 0.635,-0.465667 1.227667,-0.973667 -0.127,-0.04233 -0.381,-0.04233 -0.973667,0 -2.032,0.381 -1.058334,0.381 -2.116667,1.016 0.550333,0.169333 1.058333,0.338666 0.508,0.169334 1.016,0.338667 z m -17.017999,9.440333 q 0.08467,-0.804333 0.635,-1.439333 0.550333,-0.635 0.550333,-1.354667 0,-0.550333 -0.423333,-0.973666 -0.423333,-0.423334 -0.846667,-0.931334 -0.381,-0.508 -0.381,-1.354666 0,-0.846667 0.423334,-1.481667 0.465666,-0.677333 0.550333,-1.439333 l 1.227667,0.127 q -0.08467,0.592666 -0.508,1.312333 -0.423334,0.719667 -0.423334,1.354667 0,0.635 0.381,1.143 0.423334,0.465666 0.846667,1.016 0.423333,0.508 0.423333,1.227666 0,0.550334 -0.296333,0.973667 -0.296333,0.423333 -0.592667,0.846667 -0.296333,0.423333 -0.296333,0.889 z m 8.466666,0 q 0.08467,-0.804333 0.635,-1.439333 0.550334,-0.635 0.550334,-1.354667 0,-0.550333 -0.423334,-0.973666 -0.423333,-0.423334 -0.846666,-0.931334 -0.381,-0.508 -0.381,-1.354666 0,-0.846667 0.423333,-1.481667 0.465667,-0.677333 0.550333,-1.439333 l 1.227667,0.127 q -0.08467,0.592666 -0.508,1.312333 -0.423333,0.719667 -0.423333,1.354667 0,0.635 0.381,1.143 0.423333,0.465666 0.846666,1.016 0.423334,0.508 0.423334,1.227666 0,0.550334 -0.296334,0.973667 -0.296333,0.423333 -0.592666,0.846667 -0.296334,0.423333 -0.296334,0.889 z m -4.233333,0 q 0.08467,-0.804333 0.635,-1.439333 0.550333,-0.635 0.550333,-1.354667 0,-0.550333 -0.423333,-0.973666 -0.423333,-0.423334 -0.846667,-0.931334 -0.381,-0.508 -0.381,-1.354666 0,-0.846667 0.423334,-1.481667 0.465666,-0.677333 0.550333,-1.439333 l 1.227667,0.127 q -0.08467,0.592666 -0.508,1.312333 -0.423334,0.719667 -0.423334,1.354667 0,0.635 0.381,1.143 0.423334,0.465666 0.846667,1.016 0.423333,0.508 0.423333,1.227666 0,0.550334 -0.296333,0.973667 -0.296333,0.423333 -0.592667,0.846667 -0.296333,0.423333 -0.296333,0.889 z m -10.879666,-3.429 q -0.804334,0 -1.354667,-0.508 -0.508,-0.550333 -0.508,-1.354666 0,-0.762 0.508,-1.312334 0.550333,-0.592666 1.354667,-0.592666 0.762,0 1.312333,0.592666 0.592667,0.550334 0.592667,1.312334 0,0.804333 -0.592667,1.354666 -0.550333,0.508 -1.312333,0.508 z m 25.738666,7.112 q 0.254,0 0.381,-0.04233 -0.592667,-0.508 -1.227667,-0.973667 -0.635,-0.465667 -1.227667,-1.058333 -0.508,0.169333 -1.016,0.338666 -0.508,0.127 -1.058333,0.338667 1.058333,0.635 2.116667,1.016 1.058333,0.381 2.032,0.381 z m -5.588,2.836333 q 0.254,0 0.381,-0.04233 -0.719667,-0.592667 -1.566333,-1.312333 -0.846667,-0.719667 -1.439334,-1.524 -0.635,0.211666 -1.312333,0.381 -0.635,0.127 -1.312333,0.296333 1.227666,0.973667 2.624666,1.608667 1.397,0.592666 2.624667,0.592666 z m -6.604,2.286 q 0.254,0 0.381,-0.04233 -0.931333,-0.804333 -1.947333,-1.566333 -1.016,-0.719667 -1.524,-2.159 -0.423334,0.04233 -0.804333,0.04233 -0.381,0 -0.804334,0 -0.592666,0 -1.185333,-0.04233 -0.592667,-0.08467 -1.143,-0.169334 1.481667,1.693334 3.386666,2.794 1.905,1.143 3.640667,1.143 z" /> + </g> + </g> +</svg> diff --git a/examples/applicationmanager/frame-timer/apps/frame-timer.fish/info.yaml b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/info.yaml new file mode 100644 index 00000000..2178b68e --- /dev/null +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.fish/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'frame-timer.fish' +icon: 'fish.svg' +code: 'fish.qml' +runtime: 'qml' +name: + en: 'Fish' diff --git a/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/info.yaml b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/info.yaml new file mode 100644 index 00000000..a50f99ad --- /dev/null +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'frame-timer.rabbit' +icon: 'rabbit.svg' +code: 'rabbit.qml' +runtime: 'qml' +name: + en: 'Rabbit' diff --git a/examples/applicationmanager/monitor/system-ui/Switch.qml b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.qml index 6ed638fb..4e38ce61 100644 --- a/examples/applicationmanager/monitor/system-ui/Switch.qml +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.qml @@ -50,23 +50,30 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.4 +import QtApplicationManager.Application 1.0 -Rectangle { - signal toggle() +ApplicationManagerWindow { + id: root + color: mouseArea.pressed ? "red" : "forestgreen" - width: 180; height: 30; radius: 4 - color: 'white' - - MonitorText { + Rectangle { anchors.centerIn: parent - text: 'Switch Process' - font.bold: true - color: 'black' + width: 180; height: 180; radius: width/4 + color: "palegreen" + + Image { + source: ApplicationInterface.icon + anchors.centerIn: parent + } + + RotationAnimation on rotation { + from: 0; to: 360; loops: Animation.Infinite; duration: 4000 + } } MouseArea { + id: mouseArea anchors.fill: parent - onClicked: toggle(); } } diff --git a/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.svg b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.svg new file mode 100644 index 00000000..639841df --- /dev/null +++ b/examples/applicationmanager/frame-timer/apps/frame-timer.rabbit/rabbit.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + width="51.880001mm" + height="51.880001mm" + viewBox="0 0 51.879999 51.879998" + version="1.1" + id="svg4565"> + <title + id="title815">U+1448C ANATOLIAN HIEROGLYPH A115A from Noto Sans font</title> + <defs + id="defs4559" /> + <metadata + id="metadata4562"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>U+1448C ANATOLIAN HIEROGLYPH A115A from Noto Sans font</dc:title> + <cc:license + rdf:resource="http://scripts.sil.org/OFL" /> + </cc:Work> + <cc:License + rdf:about="http://scripts.sil.org/OFL"> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Reproduction" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Distribution" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/Embedding" /> + <cc:permits + rdf:resource="http://scripts.sil.org/pub/OFL/DerivativeWorks" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/Notice" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/Attribution" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/ShareAlike" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/DerivativeRenaming" /> + <cc:requires + rdf:resource="http://scripts.sil.org/pub/OFL/BundlingWhenSelling" /> + </cc:License> + </rdf:RDF> + </metadata> + <g + id="layer1" + transform="matrix(1.1970749,0,0,1.1970749,-89.370004,-96.553259)"> + <g + id="text5112" + style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"> + <path + id="path815" + style="font-size:42.33333206px;stroke-width:0.26458332" + d="m 109.57681,120.95381 q -1.43934,0 -1.905,-0.508 -0.46567,-0.508 -0.46567,-1.18533 0,-0.254 0.254,-0.67733 0.29633,-0.46567 0.55033,-0.93134 0.29634,-0.508 0.29634,-0.889 0,-0.59266 -0.93134,-0.59266 -0.635,0 -1.56633,0.16933 -0.889,0.127 -1.69333,0.127 -1.10067,0 -1.905,-0.97367 -0.762,-0.97366 -1.10067,-2.49766 -1.05833,0.42333 -3.217334,0.84666 -2.159,0.42334 -4.487334,0.42334 -0.635,0 -1.524,-0.127 -0.846666,-0.16934 -1.523999,-0.16934 -0.931334,0 -1.439334,0.635 -0.465666,0.59267 -0.804333,1.524 -0.296333,0.889 -0.677333,1.82034 -0.381,0.93133 -1.100667,1.56633 -0.677333,0.59267 -1.947333,0.59267 h -2.794 q -0.931334,0 -1.566334,-0.59267 -0.592666,-0.635 -0.592666,-1.18533 0,-0.93134 0.677333,-1.48167 0.677333,-0.59267 1.566333,-1.016 0.931334,-0.46567 1.608667,-0.97367 0.169333,-1.31233 0.719667,-3.048 0.592666,-1.778 2.370666,-3.25966 0.550334,-0.46567 1.016,-0.55034 0.465667,-0.127 0.465667,-0.93133 0,-0.16933 -0.127,-0.42333 -0.08467,-0.254 -0.296333,-0.254 -0.762,0 -1.481667,0.42333 -0.677333,0.381 -1.439333,0.80433 -0.719667,0.381 -1.524,0.381 -0.931334,0 -1.820334,-0.59266 -0.846666,-0.59267 -1.396999,-1.48167 -0.550334,-0.889 -0.550334,-1.778 0,-1.82033 1.143,-3.25967 1.143,-1.481662 2.667,-2.582329 -0.338667,-1.058333 -0.550333,-2.582333 -0.169334,-1.524 -0.296334,-3.048 -0.08467,-1.524 -0.08467,-2.582333 0,-1.481667 0.254,-2.963333 0.254,-1.481667 0.889,-2.455334 0.635,-0.973666 1.735666,-0.973666 0.931334,0 1.439334,0.846666 0.550333,0.846667 0.762,1.989667 0.211666,1.100667 0.211666,1.905 0,1.947333 -0.465666,3.81 -0.465667,1.862666 -0.465667,3.81 0,0.889 0.169333,1.27 0.169334,0.381 0.677334,0.381 1.016,0 1.651,-1.016 0.635,-1.058334 1.524,-2.751667 0.338666,-0.635 0.931333,-1.862667 0.635,-1.27 1.524,-2.624666 0.889,-1.354667 2.074333,-2.286 1.227667,-0.931333 2.751667,-0.931333 0.592666,0 1.143,0.762 0.550333,0.719666 0.550333,1.862666 0,1.27 -0.804333,2.667 -0.804334,1.397 -1.989667,2.794 -1.185333,1.397 -2.370667,2.709333 -1.185333,1.312334 -1.989666,2.413 -0.804334,1.100669 -0.804334,1.947329 0,0.55034 0.381,0.80434 0.423334,0.21166 0.846667,0.21166 4.318,0 7.366005,-0.0847 3.09033,-0.127 5.207,-0.46567 0.71967,-0.42333 1.60867,-0.71967 0.93133,-0.29633 2.11666,-0.29633 1.778,0 2.921,1.35467 1.18534,1.31233 1.18534,3.429 0,1.35466 -0.42334,1.905 -0.42333,0.508 -1.05833,0.635 -0.59267,0.0847 -1.18533,0.127 -0.59267,0.0423 -1.016,0.381 -0.42334,0.33866 -0.42334,1.397 0,0.889 0.635,1.397 0.635,0.508 1.22767,0.762 1.73567,0.80433 2.11667,1.35466 0.42333,0.508 0.42333,1.22767 0,1.05833 -0.42333,2.159 -0.42334,1.05833 -1.05834,1.98967 -0.635,0.889 -1.31233,1.43933 -0.635,0.55033 -1.05833,0.55033 z m 0.0847,-1.397 q 0.29634,0 0.84667,-0.71966 0.55033,-0.762 0.97367,-1.778 0.46566,-1.016 0.46566,-1.905 0,-0.71967 -0.381,-1.05834 -0.33866,-0.33866 -1.31233,-0.762 -1.05833,-0.508 -1.778,-1.43933 -0.71967,-0.93133 -0.71967,-2.07433 0,-1.18534 0.381,-1.69334 0.42334,-0.55033 1.016,-0.71966 0.635,-0.21167 1.22767,-0.29634 0.635,-0.0847 1.016,-0.33866 0.42333,-0.29634 0.42333,-1.016 0,-1.524 -0.84666,-2.58234 -0.80434,-1.05833 -2.11667,-1.05833 -1.10067,0 -1.73567,0.29633 -0.59266,0.254 -1.35466,0.67734 -1.48167,0.254 -3.64067,0.381 -2.11667,0.127 -4.572001,0.16933 -2.455333,0.0423 -4.953,0.0423 -1.143,0 -1.778,-0.508 -0.592666,-0.508 -0.592666,-1.82033 0,-1.05833 0.804333,-2.243665 0.804333,-1.227667 1.989666,-2.54 1.185334,-1.312334 2.328334,-2.624667 1.185333,-1.354667 1.989666,-2.624667 0.804334,-1.27 0.804334,-2.370666 0,-0.338667 -0.127,-0.889 -0.127,-0.550333 -0.762,-0.550333 -0.804334,0 -1.651,0.804333 -0.846667,0.804333 -1.693334,2.074333 -0.846666,1.227667 -1.608666,2.582333 -0.719667,1.312334 -1.312333,2.413 -0.592667,1.058334 -0.973667,1.862667 -0.381,0.762 -1.016,1.185333 -0.592667,0.423334 -1.820333,0.423334 -0.973667,0 -1.439334,-0.635 -0.423333,-0.677334 -0.423333,-1.524 0,-1.989667 0.381,-3.894667 0.423333,-1.947333 0.423333,-3.894667 0,-0.719666 -0.08467,-1.650999 -0.04233,-0.931334 -0.296334,-1.608667 -0.211666,-0.677333 -0.677333,-0.677333 -0.677333,0 -1.058333,0.889 -0.338667,0.846666 -0.508,2.032 -0.127,1.142999 -0.127,2.031999 0,1.143 0.04233,2.667 0.04233,1.524 0.169333,3.005667 0.127,1.481667 0.423334,2.497667 0.127,0.254 0.127,0.465666 0,0.169334 -0.127,0.296334 -0.08467,0.08467 -0.211667,0.211666 -0.677333,0.550333 -1.439333,1.227669 -0.762,0.67733 -1.312334,1.56633 -0.508,0.889 -0.508,2.20133 0,0.80434 0.677334,1.73567 0.677333,0.93133 1.735666,0.93133 0.804334,0 1.524,-0.381 0.719667,-0.42333 1.439334,-0.80433 0.762,-0.42333 1.651,-0.42333 0.719666,0 1.185333,0.508 0.465667,0.508 0.465667,1.22766 0,0.97367 -0.381,1.397 -0.338667,0.42334 -0.889,0.67734 -0.508,0.254 -1.058334,0.80433 -1.185333,1.18533 -1.651,2.49767 -0.423333,1.31233 -0.592666,2.667 -0.08467,0.635 -0.592667,1.016 -0.508,0.381 -1.185333,0.71966 -0.677334,0.29634 -1.27,0.67734 -0.550334,0.381 -0.804334,1.05833 0.211667,0.21167 0.423334,0.33867 0.254,0.127 1.058333,0.127 h 2.54 q 0.677333,0 1.058333,-0.59267 0.423334,-0.635 0.762,-1.56633 0.338667,-0.93134 0.762,-1.86267 0.423334,-0.93133 1.100667,-1.524 0.677333,-0.635 1.778,-0.635 0.592667,0 1.397,0.21167 0.804333,0.21166 1.481666,0.21166 2.413,0 4.572,-0.42333 2.159,-0.46567 3.217335,-0.889 -0.0423,-0.21167 -0.0423,-0.42333 0,-0.254 0,-0.46567 l 1.18534,0.254 q 0,1.86267 0.55033,2.96333 0.55033,1.10067 1.905,1.10067 0.33867,0 1.10067,-0.0847 0.762,-0.0847 1.48166,-0.127 0.71967,-0.0847 0.93134,-0.0847 0.762,0 1.05833,0.42333 0.33867,0.381 0.33867,0.84667 0,1.05833 -0.508,1.69333 -0.46567,0.635 -0.46567,0.84667 0,0.59266 0.29633,0.71966 0.33867,0.127 0.889,0.127 z m -24.722664,-17.272 q -0.465667,0 -0.846667,-0.33866 -0.338666,-0.381 -0.338666,-0.84667 0,-0.508 0.338666,-0.84667 0.381,-0.380996 0.846667,-0.380996 0.508,0 0.846667,0.380996 0.381,0.33867 0.381,0.84667 0,0.46567 -0.381,0.84667 -0.338667,0.33866 -0.846667,0.33866 z" /> + </g> + </g> +</svg> diff --git a/examples/applicationmanager/frame-timer/doc/images/frame-timer-example.png b/examples/applicationmanager/frame-timer/doc/images/frame-timer-example.png Binary files differnew file mode 100644 index 00000000..6654660f --- /dev/null +++ b/examples/applicationmanager/frame-timer/doc/images/frame-timer-example.png diff --git a/examples/applicationmanager/frame-timer/doc/src/frame-timer-example.qdoc b/examples/applicationmanager/frame-timer/doc/src/frame-timer-example.qdoc new file mode 100644 index 00000000..a6f90b72 --- /dev/null +++ b/examples/applicationmanager/frame-timer/doc/src/frame-timer-example.qdoc @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + +\example applicationmanager/frame-timer +\title Displaying Frame-Rate of System-UI and Applications Example +\image frame-timer-example.png The "FrameTimer" example with two applications running. +\brief How to use FrameTimer to display frame-rate information. +\ingroup applicationmanager-examples + +This example shows you how to use the \l FrameTimer component to display frame-rate information +of both System-UI and application windows. + +The System-UI is comprised of a column of application icons on the left side and a graph on the top +right side, displaying the average frame-rate of the System-UI itself (actually of System-UI's top-level +Window, to be more precise). If there are no applications running, System-UI's frame rate will mostly +stay at 1 frame per second. That's because a Qt QML application window is only redrawn when needed. If +nothing changed on it, it won't redraw (zero frames per second then). The only reason that System-UI +stays around 1 FPS when there are no apps running is because of the FPS graph itself, which is updated +once every second and thus causes a redraw of the System-UI (an +\l{https://en.wikipedia.org/wiki/Observer_effect_(information_technology)}{Observer effect}). + +The Fish application animates (and therefore redraws) at a rate of 25 frames per second. So running it will +instantly raise the frame-rate of System-UI to 25 FPS (frames per second) as well. + +The Rabbit application animates at native speed (ie, as fast as the system can or is configured to do, which +is usually 60 FPS). So running it will raise System-UI's FPS further, to 60 FPS. + +*/ diff --git a/examples/applicationmanager/monitor/monitor.pro b/examples/applicationmanager/frame-timer/frame-timer.pro index c77dbd4f..e35a8a9d 100644 --- a/examples/applicationmanager/monitor/monitor.pro +++ b/examples/applicationmanager/frame-timer/frame-timer.pro @@ -3,14 +3,15 @@ CONFIG += am-systemui OTHER_FILES += \ am-config.yaml \ - monitor.qmlproject \ - doc/src/*.qdoc \ - doc/images/*.png \ system-ui/*.qml \ - apps/tld.monitor.app/*.yaml \ - apps/tld.monitor.app/*.qml + apps/frame-timer.fish/*.yaml \ + apps/frame-timer.fish/*.qml \ + apps/frame-timer.fish/*.svg \ + apps/frame-timer.rabbit/*.yaml \ + apps/frame-timer.rabbit/*.qml \ + apps/frame-timer.rabbit/*.svg \ -target.path = $$[QT_INSTALL_EXAMPLES]/applicationmanager/monitor +target.path = $$[QT_INSTALL_EXAMPLES]/applicationmanager/frame-timer INSTALLS += target AM_COPY_DIRECTORIES += apps system-ui @@ -19,8 +20,8 @@ AM_COPY_FILES += am-config.yaml prefix_build:tpath = $$target.path else:tpath = $$_PRO_FILE_PWD_ -AM_DEFAULT_ARGS = -c $$tpath/am-config.yaml --start-session-dbus --verbose +AM_DEFAULT_ARGS = -c $$tpath/am-config.yaml --start-session-dbus --verbose -r example_sources.path = $$target.path -example_sources.files = $$AM_COPY_FILES $$AM_COPY_DIRECTORIES doc +example_sources.files = $$AM_COPY_FILES $$AM_COPY_DIRECTORIES INSTALLS += example_sources diff --git a/examples/applicationmanager/frame-timer/system-ui/main.qml b/examples/applicationmanager/frame-timer/system-ui/main.qml new file mode 100644 index 00000000..2c13f84c --- /dev/null +++ b/examples/applicationmanager/frame-timer/system-ui/main.qml @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:BSD-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: BSD-3-Clause +** +****************************************************************************/ + +import QtQuick 2.11 +import QtQuick.Layouts 1.11 +import QtQuick.Window 2.11 +import QtApplicationManager 1.0 +import QtApplicationManager.SystemUI 1.0 + +Window { + id: sysuiWindow + + width: 1024 + height: 640 + + Rectangle { + anchors.fill: parent + color: "linen" + + + // A graph displaying the FPS of the System UI itself + Rectangle { + id: fpsGraph + anchors.top: parent.top + anchors.right: parent.right + width: 500 + height: 200 + color: "grey" + ListView { + id: listView + anchors.fill: parent + orientation: ListView.Horizontal + spacing: (fpsGraph.width / model.count) * 0.2 + clip: true + interactive: false + + model: MonitorModel { + id: monitorModel + running: true + // Just put a FrameTimer inside a MonitorModel and you can use it as a data source + // There's no need to set its running property as the MonitorModel will take care of asking + // it to update itself when appropriate. + FrameTimer { window: sysuiWindow } + } + + delegate: Rectangle { + width: (fpsGraph.width / monitorModel.count) * 0.8 + height: (model.averageFps / 100) * fpsGraph.height + y: fpsGraph.height - height + color: "blue" + } + } + + Text { + anchors.top: parent.top + text: "100" + font.pixelSize: 15 + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: "50" + font.pixelSize: 15 + } + + Text { + anchors.bottom: parent.bottom + text: "0" + font.pixelSize: 15 + } + } + + + // Application icons. + // Click on an icon to start its application and click on it again to stop it. + ColumnLayout { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: 10 + spacing: 15 + Repeater { + model: ApplicationManager + ColumnLayout { + Layout.alignment: Qt.AlignHCenter + Rectangle { + Layout.alignment: Qt.AlignHCenter + width: 100; height: 100; radius: width/4 + color: model.isRunning ? "darkgrey" : "lightgrey" + Image { + anchors.fill: parent + source: icon + sourceSize.width: 100 + sourceSize.height: 100 + } + MouseArea { + anchors.fill: parent + onClicked: { + if (model.isRunning) + application.stop(); + else + application.start(); + } + } + } + Text { + Layout.alignment: Qt.AlignHCenter + text: model.name + " application" + horizontalAlignment: Text.AlignHCenter + } + } + } + } + + // Application windows. + // Each WindowObject is put in a WindowItem decorated with a border and a title bar. + Repeater { + model: ListModel { id: windowsModel } + + delegate: Rectangle { + id: winChrome + + width: 400; height: 320 + z: model.index + color: "tan" + + // Title bar text + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: model.window.application.name("en") + " application window" + } + + // Raises the window when the title bar is clicked and moves it around when dragged. + MouseArea { + anchors.fill: parent + drag.target: parent + onPressed: windowsModel.move(model.index, windowsModel.count-1, 1); + } + + // Close button + Rectangle { + width: 25; height: 25 + color: "chocolate" + Text { + anchors.fill: parent + fontSizeMode: Text.Fit; minimumPixelSize: 10; font.pixelSize: 25 + horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter + text: "x" + } + + MouseArea { + anchors.fill: parent + onClicked: model.window.close() + } + } + + // The window itself + WindowItem { + id: windowItem + anchors.fill: parent + anchors.margins: 3 + anchors.topMargin: 25 + window: model.window + + Rectangle { + anchors.fill: fpsOverlay + color: "black" + opacity: 0.3 + } + + // And its FPS overlay + Column { + id: fpsOverlay + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 4 + Text { + text: "averageFps: " + Number(frameTimer.averageFps).toLocaleString(Qt.locale("en_US"), 'f', 1) + font.pixelSize: 16; color: "white" + } + Text { + text: "maximumFps: " + Number(frameTimer.maximumFps).toLocaleString(Qt.locale("en_US"), 'f', 1) + font.pixelSize: 16; color: "white" + } + Text { + text: "minimumFps: " + Number(frameTimer.minimumFps).toLocaleString(Qt.locale("en_US"), 'f', 1) + font.pixelSize: 16; color: "white" + } + Text { + text: "jitterFps: " + Number(frameTimer.jitterFps).toLocaleString(Qt.locale("en_US"), 'f', 1) + font.pixelSize: 16; color: "white" + } + } + } + + // FrameTimer will calculate the frame rate numbers for the given window + FrameTimer { + id: frameTimer + // no sense in trying to update the FrameTimer while the window has no surface (or has just an empty one) + running: window && window.contentState === WindowObject.SurfaceWithContent + window: model.window + } + + Component.onCompleted: { + winChrome.x = 300 + model.index * 50; + winChrome.y = 10 + model.index * 30; + } + + readonly property bool shouldBeRemoved: model.window && model.window.contentState === WindowObject.NoSurface + onShouldBeRemovedChanged: if (shouldBeRemoved) windowsModel.remove(model.index, 1) + } + } + + // Populates the windowsModel + Connections { + target: WindowManager + onWindowAdded: windowsModel.append({"window":window}) + } + } +} diff --git a/examples/applicationmanager/monitor/apps/tld.monitor.app/dummyicon b/examples/applicationmanager/monitor/apps/tld.monitor.app/dummyicon deleted file mode 100644 index e69de29b..00000000 --- a/examples/applicationmanager/monitor/apps/tld.monitor.app/dummyicon +++ /dev/null diff --git a/examples/applicationmanager/monitor/apps/tld.monitor.app/info.yaml b/examples/applicationmanager/monitor/apps/tld.monitor.app/info.yaml deleted file mode 100644 index cd0a58c8..00000000 --- a/examples/applicationmanager/monitor/apps/tld.monitor.app/info.yaml +++ /dev/null @@ -1,9 +0,0 @@ -formatVersion: 1 -formatType: am-application ---- -id: 'tld.monitor.app' -icon: 'dummyicon' -code: 'app.qml' -runtime: 'qml' -name: - en: 'Application' diff --git a/examples/applicationmanager/monitor/doc/images/monitor.png b/examples/applicationmanager/monitor/doc/images/monitor.png Binary files differdeleted file mode 100644 index d3b3cddd..00000000 --- a/examples/applicationmanager/monitor/doc/images/monitor.png +++ /dev/null diff --git a/examples/applicationmanager/monitor/doc/src/monitor.qdoc b/examples/applicationmanager/monitor/doc/src/monitor.qdoc deleted file mode 100644 index 5fc0faa3..00000000 --- a/examples/applicationmanager/monitor/doc/src/monitor.qdoc +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:FDL-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - -\example applicationmanager/monitor -\title Performance Monitoring Example -\image monitor.png Screenshot -\brief A resource and performance monitor. -\ingroup applicationmanager-examples - -\section1 Introduction - -This example shows the basic usage of system and process monitoring APIs offered by the -application-manager: - \list - \li SystemMonitor - \li ProcessMonitor - \endlist - -The example monitors performance (frame rate), as well as rescource usage (memory and CPU). - -\section2 Invocation -The example can be started from within the "monitor" folder with: -\badcode -path/to/bin/appman -c am-config.yaml -\endcode - -\note The application-manager attempts to register a \c freedesktop.org compliant notification -server. DBus errors might occur if it conflicts with the server running on the host desktop -environment. In this case, a private session bus needs to be started by adding the -\c --start-session-dbus option. - -\section1 Walkthrough - -We will start from the bottom, because this is the essential part. - -\section2 SystemMonitor and ProcessMonitor Usage - -\quotefromfile applicationmanager/monitor/system-ui/main.qml -\skipto ProcessMonitor -\printuntil ApplicationManager.application(0).start() -\printline } -The ProcessMonitor will monitor the process that is associated with -its \l {ProcessMonitor::applicationId}{applicationId} property. An empty applicationId string means -that the System-UI process is monitored. By clicking the "Switch Process" button, the monitored -process can be changed to the \c tld.monitor.app application. Measurements will be performed each -second (1000 ms) and 12 reading points will be kept in the model (ProcessMonitor is a model). -The model is used below to display the bar charts. - -Memory and frame rate reporting need to be enabled, since we are interested in both. For frame rate -measurements the list of \c monitoredWindows has to be filled with windows that we are interested -in. For the System-UI this is the single root window itself and for the tld.monitor.app process it -is the currently selected window. Hence the list will always include just one element. The memory -and frame rate changed signal handlers will update the current values of the corresponding views. - -The Connections type is used to implement signal handlers for the property changes of the -SystemMonitor. The current values of the corresponding views are updated, as well. - -For the SystemMonitor, like above, measurements will be performed each second (1000 ms) and -12 reading points will be kept in the model (the SystemMonitor is a model, as well). - -The very last line will start the only application that is provided by this example. Note that, if -the application-manager is running in single-process mode, the application will run within the -System-UI process and consequently the ProcessMonitor will not report anything and the associated -ProcessMonitor::processId will be set to 0. - -\section2 The User Interface - -\quotefromfile applicationmanager/monitor/system-ui/main.qml -\skipto import Qt -\printto ProcessMonitor -\dots - -We won't go into much detail, because it's rather conventional QML code. The MonitorChart is a -ListView that uses either an instance of a ProcessMonitor or the SystemMonitor singleton as its -model. The reading values are represented as bars. Their height is determined by the -corresponding model role, e.g. for the PSS memory consumption it is \c memoryPss.total. - -When the tld.monitor.app process is monitored, its two windows will be shown (primary and -secondary). The window that is monitored in terms of frame rate can be selected and is highlighted -with a white border. - -*/ diff --git a/examples/applicationmanager/monitor/monitor.qmlproject b/examples/applicationmanager/monitor/monitor.qmlproject deleted file mode 100644 index 5ce6345e..00000000 --- a/examples/applicationmanager/monitor/monitor.qmlproject +++ /dev/null @@ -1,17 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "system-ui/main.qml" - - QmlFiles { - directory: "." - } - ImageFiles { - directory: "apps" - } - Files { - directory: "." - filter: "*.yaml" - } -} - diff --git a/examples/applicationmanager/monitor/system-ui/MonitorChart.qml b/examples/applicationmanager/monitor/system-ui/MonitorChart.qml deleted file mode 100644 index 0d49e346..00000000 --- a/examples/applicationmanager/monitor/system-ui/MonitorChart.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:BSD-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: BSD-3-Clause -** -****************************************************************************/ - -import QtQuick 2.6 - -Rectangle { - property alias title: title.text - property alias reading: reading.text - property alias model: listview.model - property alias delegate: listview.delegate - - width: 185 - height: 250 - color: "black" - border { width: 1; color: "white" } - - Rectangle { - width: parent.width - height: 30 - color: "black" - border { width: 1; color: "white" } - - MonitorText { - id: title - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.verticalCenter: parent.verticalCenter - } - - MonitorText { - id: reading - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - } - } - - ListView { - id: listview - anchors.fill: parent - anchors.margins: 10 - anchors.topMargin: 40 - orientation: ListView.Horizontal - layoutDirection: Qt.RightToLeft - spacing: 3 - clip: true - } -} diff --git a/examples/applicationmanager/monitor/system-ui/MonitorText.qml b/examples/applicationmanager/monitor/system-ui/MonitorText.qml deleted file mode 100644 index 263a22ec..00000000 --- a/examples/applicationmanager/monitor/system-ui/MonitorText.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:BSD-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: BSD-3-Clause -** -****************************************************************************/ - -import QtQuick 2.6 - -Text { - font.pixelSize: 14 - color: "white" -} diff --git a/examples/applicationmanager/monitor/system-ui/Tile.qml b/examples/applicationmanager/monitor/system-ui/Tile.qml deleted file mode 100644 index d3a06b18..00000000 --- a/examples/applicationmanager/monitor/system-ui/Tile.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:BSD-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: BSD-3-Clause -** -****************************************************************************/ - -import QtQuick 2.6 - -Item { - width: 225 - height: 300 -} diff --git a/examples/applicationmanager/monitor/system-ui/main.qml b/examples/applicationmanager/monitor/system-ui/main.qml deleted file mode 100644 index 8d3a1327..00000000 --- a/examples/applicationmanager/monitor/system-ui/main.qml +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Pelagicore Application Manager. -** -** $QT_BEGIN_LICENSE:BSD-QTAS$ -** Commercial License Usage -** Licensees holding valid commercial Qt Automotive Suite licenses may use -** this file in accordance with the commercial license agreement provided -** with the Software or, alternatively, in accordance with the terms -** contained in a written agreement between you and The Qt Company. For -** licensing terms and conditions see https://www.qt.io/terms-conditions. -** For further information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -** SPDX-License-Identifier: BSD-3-Clause -** -****************************************************************************/ - -import QtQuick 2.6 -import QtQuick.Window 2.0 -import QtApplicationManager.SystemUI 1.0 - -Window { - id: root - - property alias primaryWindow: primaryContainer.window - property alias secondaryWindow: secondaryContainer.window - - width: 720 - height: 600 - color: "black" - - SystemMonitor { - id: systemMonitor - reportingInterval: 1000 - count: 12 - idleLoadThreshold: 0.05 - cpuLoadReportingEnabled: true - gpuLoadReportingEnabled: true - memoryReportingEnabled: true - } - - Column { - x: 10 - padding: 20 - - Tile { - Column { - spacing: 10 - MonitorText { text: "System"; font.pixelSize: 26 } - MonitorText { text: "CPU Cores: " + systemMonitor.cpuCores } - MonitorText { text: "Total Memory: " + (systemMonitor.totalMemory / 1e9).toFixed(1) + " GB" } - MonitorText { text: "Used Memory: " + (systemMonitor.memoryUsed / 1e9).toFixed(1) + " GB" } - MonitorText { text: "Idle Threshold: " + systemMonitor.idleLoadThreshold * 100 + " %" } - MonitorText { text: "Idle: " + systemMonitor.idle } - MonitorText { text: "GPU Load: " + systemMonitor.gpuLoad * 100 + " %" } - } - } - - Tile { - MonitorChart { - title: "CPU Load" - model: systemMonitor - reading: (systemMonitor.cpuLoad * 100).toFixed(1) + " %" - delegate: Rectangle { - width: 11 - height: parent.height - gradient: Gradient { - GradientStop { position: 0.5; color: "#FF0000" } - GradientStop { position: 1.0; color: "#00FF00" } - } - Rectangle { - width: parent.width - height: parent.height - cpuLoad * parent.height - color: "black" - } - } - } - } - } - - Rectangle { - x: 246; y: 25 - width: 1; height: root.height - 50 - color: "white" - } - - Grid { - columns: 2 - padding: 20 - x: 260 - - Tile { - Column { - spacing: 20 - - MonitorText { - text: processMon.applicationId === "" ? "System-UI" : processMon.applicationId - font.pixelSize: 26 - } - MonitorText { text: "Process ID: " + processMon.processId } - - Switch { - onToggle: { - processMon.applicationId = processMon.applicationId === "" - ? ApplicationManager.application(0).id : "" - if (processMon.applicationId !== "") { - if (ApplicationManager.singleProcess) - console.warn("There is no dedicated application process in single-process mode"); - - if (primaryWindow && secondaryWindow) { - processMon.monitoredWindows = primaryContainer.active ? [primaryWindow] : [secondaryWindow] - } else { - processMon.monitoredWindows = [] - console.warn("No application window available. Please check your QtWayland configuration."); - } - } else { - processMon.monitoredWindows = [root] - } - } - } - } - } - - Tile { - Column { - visible: processMon.applicationId !== "" - spacing: 20 - Item { - width: 200; height: 65 - MonitorText { anchors.bottom: parent.bottom; text: "Application Windows:" } - } - - WindowContainer { - id: primaryContainer - active: true - window: root.primaryWindow - onActivated: { - processMon.monitoredWindows = [primaryWindow]; - secondaryContainer.active = false; - } - } - - WindowContainer { - id: secondaryContainer - window: root.secondaryWindow - onActivated: { - processMon.monitoredWindows = [secondaryWindow]; - primaryContainer.active = false; - } - } - } - } - - Tile { - MonitorChart { - id: processPss - title: "Memory PSS" - model: processMon - delegate: Rectangle { - width: 11 - height: memoryPss.total / 5e6 - anchors.bottom: parent.bottom - color: "lightsteelblue" - } - } - } - - Tile { - MonitorChart { - id: frameChart - title: "Frame rate" - model: processMon - delegate: Rectangle { - width: 11 - height: frameRate[0] ? frameRate[0].average * 3 : 0 - anchors.bottom: parent.bottom - color.r: frameRate[0] ? (frameRate[0].average >= 60 ? 0 : 1 - frameRate[0].average / 60) : 0 - color.g: frameRate[0] ? (frameRate[0].average >= 60 ? 1 : frameRate[0].average / 60) : 0 - color.b: 0 - - } - } - } - } - - Connections { - target: WindowManager - onWindowAdded: { - if (window.windowProperty("windowType") === "primary") { - primaryWindow = window - } else { - secondaryWindow = window - } - } - - onWindowAboutToBeRemoved: { - if (primaryWindow === window) { - primaryWindow = null; - } else if (secondaryWindow === window) { - secondaryWindow = null; - } - } - } - - ProcessMonitor { - id: processMon - applicationId: "" - reportingInterval: 1000 - count: 12 - - memoryReportingEnabled: true - frameRateReportingEnabled: true - monitoredWindows: [root] - - onMemoryReportingChanged: processPss.reading = (memoryPss.total / 1e6).toFixed(0) + " MB"; - onFrameRateReportingChanged: { - if (frameRate[0]) - frameChart.reading = frameRate[0].average.toFixed(0) + " fps"; - } - } - - Component.onCompleted: { - ApplicationManager.application(0).start(); - } -} diff --git a/examples/applicationmanager/process-status/am-config.yaml b/examples/applicationmanager/process-status/am-config.yaml new file mode 100644 index 00000000..5db21e36 --- /dev/null +++ b/examples/applicationmanager/process-status/am-config.yaml @@ -0,0 +1,8 @@ +formatVersion: 1 +formatType: am-configuration +--- +applications: + builtinAppsManifestDir: "${CONFIG_PWD}/apps" + +ui: + mainQml: "${CONFIG_PWD}/system-ui/main.qml" diff --git a/examples/applicationmanager/process-status/apps/process-status.cpu-hog/icon.png b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/icon.png Binary files differnew file mode 100644 index 00000000..04ca44dd --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/icon.png diff --git a/examples/applicationmanager/process-status/apps/process-status.cpu-hog/info.yaml b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/info.yaml new file mode 100644 index 00000000..89807bd3 --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'process-status.cpu-hog' +icon: 'icon.png' +code: 'main.qml' +runtime: 'qml' +name: + en: 'CPU Hog' diff --git a/examples/applicationmanager/process-status/apps/process-status.cpu-hog/main.qml b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/main.qml new file mode 100644 index 00000000..f38964cc --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.cpu-hog/main.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:BSD-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: BSD-3-Clause +** +****************************************************************************/ + +import QtQuick 2.4 +import QtApplicationManager.Application 1.0 + +ApplicationManagerWindow { + color: "red" + + Text { + anchors.fill: parent + text: "This application consumes a lot of CPU time." + font.pixelSize: 15 + color: "white" + } + + Rectangle { + id: rectangle + width: Math.min(parent.width, parent.height) / 2 + height: width + anchors.centerIn: parent + color: "grey" + Timer { + interval: 10 + repeat: true + running: true + onTriggered: { + rectangle.rotation += 1; + doBusyWork(); + } + function doBusyWork() { + var i = 1; + var n = 1; + for (i = 1; i < 100000; i++) { + n = n + n * n / 1.5; + } + } + } + } +} diff --git a/examples/applicationmanager/process-status/apps/process-status.mem-hog/icon.png b/examples/applicationmanager/process-status/apps/process-status.mem-hog/icon.png Binary files differnew file mode 100644 index 00000000..b149340c --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.mem-hog/icon.png diff --git a/examples/applicationmanager/process-status/apps/process-status.mem-hog/info.yaml b/examples/applicationmanager/process-status/apps/process-status.mem-hog/info.yaml new file mode 100644 index 00000000..a437b108 --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.mem-hog/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'process-status.mem-hog' +icon: 'icon.png' +code: 'main.qml' +runtime: 'qml' +name: + en: 'Memory Hog' diff --git a/examples/applicationmanager/monitor/system-ui/WindowContainer.qml b/examples/applicationmanager/process-status/apps/process-status.mem-hog/main.qml index 66215eb9..ba62b988 100644 --- a/examples/applicationmanager/monitor/system-ui/WindowContainer.qml +++ b/examples/applicationmanager/process-status/apps/process-status.mem-hog/main.qml @@ -50,29 +50,37 @@ ** ****************************************************************************/ -import QtQuick 2.6 -import QtApplicationManager.SystemUI 1.0 +import QtQuick 2.4 +import QtApplicationManager.Application 1.0 -Rectangle { - property bool active: false - property alias window: windowItem.window - signal activated() +ApplicationManagerWindow { + id: root + color: "green" - width: 180; height: 65 - - color: active ? "white" : "transparent" - - WindowItem { - id: windowItem - anchors.margins: 2 + Text { anchors.fill: parent + text: "This application consumes a lot of memory." + font.pixelSize: 15 + color: "white" } - MouseArea { - anchors.fill: parent - onClicked: { - active = true; - activated(); + Rectangle { + id: rectangle + width: Math.min(parent.width, parent.height) / 2 + height: width + anchors.centerIn: parent + color: "grey" + Timer { + interval: 10 + repeat: true + running: true + onTriggered: { + rectangle.rotation += 1; + root.contentItem.grabToImage(function(result) { + foo.push(result); + }); + } + property var foo: [] } } } diff --git a/examples/applicationmanager/process-status/apps/process-status.slim/icon.png b/examples/applicationmanager/process-status/apps/process-status.slim/icon.png Binary files differnew file mode 100644 index 00000000..be6ffc57 --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.slim/icon.png diff --git a/examples/applicationmanager/process-status/apps/process-status.slim/info.yaml b/examples/applicationmanager/process-status/apps/process-status.slim/info.yaml new file mode 100644 index 00000000..3c148ed4 --- /dev/null +++ b/examples/applicationmanager/process-status/apps/process-status.slim/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'process-status.slim' +icon: 'icon.png' +code: 'main.qml' +runtime: 'qml' +name: + en: 'Slim' diff --git a/examples/applicationmanager/monitor/apps/tld.monitor.app/ApplicationWindow.qml b/examples/applicationmanager/process-status/apps/process-status.slim/main.qml index bcafcc7a..5967789b 100644 --- a/examples/applicationmanager/monitor/apps/tld.monitor.app/ApplicationWindow.qml +++ b/examples/applicationmanager/process-status/apps/process-status.slim/main.qml @@ -50,31 +50,33 @@ ** ****************************************************************************/ -import QtQuick 2.4 +import QtQuick 2.11 import QtApplicationManager.Application 1.0 ApplicationManagerWindow { - id: root + color: "blue" - property alias title: title.text - property alias idle: pause.duration - property string windowType - - color: "darkgreen" - - Text{ - id: title + Text { + anchors.fill: parent + text: "This a slim application that just animates." + font.pixelSize: 15 color: "white" - anchors.centerIn: parent } - SequentialAnimation on color { - loops: Animation.Infinite - ColorAnimation { to: "darkolivegreen"; duration: 500 } - PauseAnimation { id: pause; duration: 0 } - ColorAnimation { to: "darkgreen"; duration: 500 } - PauseAnimation { duration: pause.duration } - } + Rectangle { + id: rectangle + width: Math.min(parent.width, parent.height) / 2 + height: width + anchors.centerIn: parent + color: "grey" + RotationAnimation { + target: rectangle + from: 0 + to: 360 + duration: 1000 + running: true + loops: Animation.Infinite + } - onWindowTypeChanged: root.setWindowProperty("windowType", windowType) + } } diff --git a/examples/applicationmanager/process-status/doc/images/process-status-example.png b/examples/applicationmanager/process-status/doc/images/process-status-example.png Binary files differnew file mode 100644 index 00000000..6c7df5e4 --- /dev/null +++ b/examples/applicationmanager/process-status/doc/images/process-status-example.png diff --git a/examples/applicationmanager/process-status/doc/src/process-status-example.qdoc b/examples/applicationmanager/process-status/doc/src/process-status-example.qdoc new file mode 100644 index 00000000..0cad1578 --- /dev/null +++ b/examples/applicationmanager/process-status/doc/src/process-status-example.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + +\example applicationmanager/process-status +\title Displaying Information About Application Processes +\image process-status-example.png +\brief How to use ProcessStatus to display application process information. +\ingroup applicationmanager-examples + +This example shows you how to use the \l ProcessStatus component to display information +about an application's process. + +This example is based on the simpler \l {"Hello World!" System-UI Example} {Hello World} one. You might +want to start from there if you haven't seen it already. + +On the left side the built-in applications are listed in a column, where each application has a row containing +its icon and name next to a tabbed view that shows information about the application's process (in case the +application is actually running). + +On the right side of the System-UI the windows of the running applications are stacked in a column, in order of +appearance (oldest window at the top and youngest at the bottom). + +There are three applications available, a red one called "CPU Hog" which consumes a lot of CPU, a green one +called "Memory Hog" that continually increases its memory consumption (so don't leave it running for too long +as it will eat up all available RAM eventually) and a blue one called "Slim", which behaves normally. + +*/ diff --git a/examples/applicationmanager/process-status/process-status.pro b/examples/applicationmanager/process-status/process-status.pro new file mode 100644 index 00000000..e2a794d0 --- /dev/null +++ b/examples/applicationmanager/process-status/process-status.pro @@ -0,0 +1,17 @@ +TEMPLATE = app +CONFIG += am-systemui + +target.path = $$[QT_INSTALL_EXAMPLES]/applicationmanager/process-status +INSTALLS += target + +AM_COPY_DIRECTORIES += apps system-ui +AM_COPY_FILES += am-config.yaml + +prefix_build:tpath = $$target.path +else:tpath = $$_PRO_FILE_PWD_ + +AM_DEFAULT_ARGS = -c $$tpath/am-config.yaml --start-session-dbus --verbose -r + +example_sources.path = $$target.path +example_sources.files = $$AM_COPY_FILES $$AM_COPY_DIRECTORIES +INSTALLS += example_sources diff --git a/examples/applicationmanager/process-status/system-ui/ApplicationDisplay.qml b/examples/applicationmanager/process-status/system-ui/ApplicationDisplay.qml new file mode 100644 index 00000000..652cffd4 --- /dev/null +++ b/examples/applicationmanager/process-status/system-ui/ApplicationDisplay.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.4 +import QtApplicationManager.SystemUI 1.0 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 + +Frame { + id: root + property string name + property var application + + width: 450 + + RowLayout { + width: parent.width + + Column { + id: iconAndText + + Image { + source: root.application.icon + MouseArea { + anchors.fill: parent + onClicked: root.application.runState === Am.Running ? application.stop() : application.start() + } + } + Label { + font.pixelSize: 18 + text: root.name + } + + } + + Frame { + opacity: root.application.runState === Am.Running ? 1 : 0 + Layout.fillWidth: true + + ColumnLayout { + width: parent.width + TabBar { + id: tabBar + Layout.fillWidth: true + TabButton { + text: "Stats" + font.pixelSize: 15 + } + TabButton { + text: "CPU Graph" + font.pixelSize: 15 + } + } + + StackLayout { + Layout.fillWidth: true + currentIndex: tabBar.currentIndex + Stats { + application: root.application + } + CpuGraph { + application: root.application + } + } + } + } + + } +} diff --git a/examples/applicationmanager/process-status/system-ui/CpuGraph.qml b/examples/applicationmanager/process-status/system-ui/CpuGraph.qml new file mode 100644 index 00000000..109e902b --- /dev/null +++ b/examples/applicationmanager/process-status/system-ui/CpuGraph.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtApplicationManager 1.0 +import QtApplicationManager.SystemUI 1.0 + +/* + This file shows how to use ProcessStatus inside a MonitorModel to draw a graph + */ +Pane { + id: root + + property var application + + ListView { + id: listView + anchors.fill: parent + orientation: ListView.Horizontal + spacing: (root.width / model.count) * 0.2 + clip: true + interactive: false + + model: MonitorModel { + id: monitorModel + running: root.visible && root.application.runState === Am.Running + ProcessStatus { + applicationId: root.application.id + } + } + + delegate: Rectangle { + width: (root.width / monitorModel.count) * 0.8 + height: model.cpuLoad * root.height + y: root.height - height + color: root.palette.highlight + } + } + + Label { + anchors.top: parent.top + text: "100%" + font.pixelSize: 15 + } + + Label { + anchors.verticalCenter: parent.verticalCenter + text: "50%" + font.pixelSize: 15 + } + + Label { + anchors.bottom: parent.bottom + text: "0%" + font.pixelSize: 15 + } +} diff --git a/examples/applicationmanager/process-status/system-ui/MemoryText.qml b/examples/applicationmanager/process-status/system-ui/MemoryText.qml new file mode 100644 index 00000000..fc745d55 --- /dev/null +++ b/examples/applicationmanager/process-status/system-ui/MemoryText.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 2.4 + +Label { + property var value + property string name + text: name + ": " + (value / 1e6).toFixed(0) + " MB" + font.pixelSize: 15 +} diff --git a/examples/applicationmanager/process-status/system-ui/Stats.qml b/examples/applicationmanager/process-status/system-ui/Stats.qml new file mode 100644 index 00000000..69e4d3ea --- /dev/null +++ b/examples/applicationmanager/process-status/system-ui/Stats.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 2.4 +import QtApplicationManager.SystemUI 1.0 + +/* + This file shows how to use ProcessStatus alongside a Timer (instead of putting it inside a MonitorModel) + when all that is needed is the latest information on a given application process. + */ +Grid { + spacing: 10 + columns: 2 + rows: 5 + + property var application + + property var status: ProcessStatus { + id: processStatus + applicationId: root.application.id + } + property var timer: Timer { + id: updateTimer + interval: 500 + repeat: true + running: root.visible && root.application.runState === Am.Running + onTriggered: processStatus.update() + } + + + Label { text: "processId: " + processStatus.processId; font.pixelSize: 15 } + Label { + property string loadPercent: Number(processStatus.cpuLoad * 100).toLocaleString(Qt.locale("en_US"), 'f', 1) + text: "cpuLoad: " + loadPercent + "%" + font.pixelSize: 15 + } + MemoryText { name: "PSS.total"; value: processStatus.memoryPss.total } + MemoryText { name: "PSS.text"; value: processStatus.memoryPss.text } + MemoryText { name: "PSS.heap"; value: processStatus.memoryPss.heap } + MemoryText { name: "RSS.total"; value: processStatus.memoryRss.total } + MemoryText { name: "RSS.text"; value: processStatus.memoryRss.text } + MemoryText { name: "RSS.heap"; value: processStatus.memoryRss.heap } + MemoryText { name: "Virtual.total"; value: processStatus.memoryVirtual.total } +} diff --git a/examples/applicationmanager/process-status/system-ui/main.qml b/examples/applicationmanager/process-status/system-ui/main.qml new file mode 100644 index 00000000..5bc7cf68 --- /dev/null +++ b/examples/applicationmanager/process-status/system-ui/main.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 2.4 +import QtApplicationManager.SystemUI 1.0 + +Pane { + width: 900 + height: appsColumn.y + appsColumn.height + + // Show name, icon and ProcessStatus data for each application + Column { + id: appsColumn + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: 2 + spacing: 10 + Repeater { + model: ApplicationManager + ApplicationDisplay { + name: model.name + application: model.application + } + } + } + + // Show windows of running applications + Column { + id: windowsColumn + anchors.left: appsColumn.right + anchors.right: parent.right + anchors.margins: 10 + Repeater { + model: WindowManager + WindowItem { + width: windowsColumn.width + height: 200 + window: model.window + } + } + } +} |