diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-07-25 11:36:18 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2018-07-27 13:31:53 +0000 |
commit | 580e5eac4dadfd96b591b81e4af3bf072bcb461a (patch) | |
tree | f5bc749cc1554643c619399045ddc0a5095608b0 /examples | |
parent | d3c84382386ffbae0a24b1b09727abf03e6f779e (diff) |
Example on animating appearance and disappearance of windows
Change-Id: Ie4bac7ca24513666ff52f5967d00e845e7cfbe00
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'examples')
12 files changed, 629 insertions, 0 deletions
diff --git a/examples/applicationmanager/animated-windows/am-config.yaml b/examples/applicationmanager/animated-windows/am-config.yaml new file mode 100644 index 00000000..48eeb1a4 --- /dev/null +++ b/examples/applicationmanager/animated-windows/am-config.yaml @@ -0,0 +1,11 @@ +formatVersion: 1 +formatType: am-configuration +--- +applications: + builtinAppsManifestDir: "${CONFIG_PWD}/apps" + installedAppsManifestDir: "/tmp/animated-windows/manifests" + appImageMountDir: "/tmp/animated-windows/image-mounts" + database: "/tmp/animated-windows/apps.db" + +ui: + mainQml: "${CONFIG_PWD}/system-ui/main.qml" diff --git a/examples/applicationmanager/animated-windows/animated-windows.pro b/examples/applicationmanager/animated-windows/animated-windows.pro new file mode 100644 index 00000000..831dcdac --- /dev/null +++ b/examples/applicationmanager/animated-windows/animated-windows.pro @@ -0,0 +1,26 @@ +TEMPLATE = app +CONFIG += am-systemui + +OTHER_FILES += \ + am-config.yaml \ + system-ui/*.qml \ + apps/animated-windows.fish/*.yaml \ + apps/animated-windows.fish/*.qml \ + apps/animated-windows.fish/*.svg \ + apps/animated-windows.rabbit/*.yaml \ + apps/animated-windows.rabbit/*.qml \ + apps/animated-windows.rabbit/*.svg \ + doc/images/*.png \ + doc/src/*.qdoc \ + +target.path = $$[QT_INSTALL_EXAMPLES]/applicationmanager/animated-windows +INSTALLS += target + +AM_COPY_DIRECTORIES += apps system-ui +AM_COPY_FILES += am-config.yaml + +AM_DEFAULT_ARGS=-c 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/animated-windows/apps/animated-windows.fish/fish.qml b/examples/applicationmanager/animated-windows/apps/animated-windows.fish/fish.qml new file mode 100644 index 00000000..46000b84 --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.fish/fish.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 1.0 + +ApplicationManagerWindow { + id: root + color: mouseArea.pressed ? "red" : "darkblue" + + Rectangle { + anchors.centerIn: parent + width: 180; height: 180; radius: width/4 + color: "aqua" + + 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 + } +} diff --git a/examples/applicationmanager/animated-windows/apps/animated-windows.fish/fish.svg b/examples/applicationmanager/animated-windows/apps/animated-windows.fish/fish.svg new file mode 100644 index 00000000..69a95ea7 --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.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/animated-windows/apps/animated-windows.fish/info.yaml b/examples/applicationmanager/animated-windows/apps/animated-windows.fish/info.yaml new file mode 100644 index 00000000..b56df275 --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.fish/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'animated-windows.fish' +icon: 'fish.svg' +code: 'fish.qml' +runtime: 'qml' +name: + en: 'Fish' diff --git a/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/info.yaml b/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/info.yaml new file mode 100644 index 00000000..71363225 --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/info.yaml @@ -0,0 +1,9 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'animated-windows.rabbit' +icon: 'rabbit.svg' +code: 'rabbit.qml' +runtime: 'qml' +name: + en: 'Rabbit' diff --git a/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/rabbit.qml b/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/rabbit.qml new file mode 100644 index 00000000..6077f046 --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/rabbit.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 1.0 + +ApplicationManagerWindow { + id: root + color: mouseArea.pressed ? "red" : "forestgreen" + + Rectangle { + anchors.centerIn: parent + 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 + } +} diff --git a/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/rabbit.svg b/examples/applicationmanager/animated-windows/apps/animated-windows.rabbit/rabbit.svg new file mode 100644 index 00000000..639841df --- /dev/null +++ b/examples/applicationmanager/animated-windows/apps/animated-windows.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/animated-windows/doc/images/animated-windows-example.jpg b/examples/applicationmanager/animated-windows/doc/images/animated-windows-example.jpg Binary files differnew file mode 100644 index 00000000..b92a1dc4 --- /dev/null +++ b/examples/applicationmanager/animated-windows/doc/images/animated-windows-example.jpg diff --git a/examples/applicationmanager/animated-windows/doc/src/animated-windows.qdoc b/examples/applicationmanager/animated-windows/doc/src/animated-windows.qdoc new file mode 100644 index 00000000..cae708b4 --- /dev/null +++ b/examples/applicationmanager/animated-windows/doc/src/animated-windows.qdoc @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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/animated-windows +\title Animated Windows System-UI Example +\image animated-windows-example.jpg The "Animated Windows" example with two applications running. +\brief How to animate the appearance and disappearance of windows. +\ingroup applicationmanager-examples + +This example shows you how to animate the appearance and disappearance of windows in a System-UI. It +assumes you're already familiar with the concepts and topics introduced in the \l {"Hello World!" +System-UI Example}. + +Unlike our \l {"Hello World!" System-UI Example} {Hello World} example, most graphical user interfaces +avoid making sudden, abrupt, changes since they can confuse the user and are not visually pleasant. So +when a new WindowObject is created by the WindowManager we want to animate its appearance instead of +simply having it popping up on the screen. Likewise, once a WindowObject loses its surface (because +the application closed this window or stopped altogether) and is thus removed from WindowManager's +model we want to animate its disappearance instead of having it vanish immediately. + +If you are using a ready-made, advanced, layout such as ListView, you can assign Transitions to +different actions like add, remove, displaced, etc and keep using WindowManager as your model. +But in many situations this is not the case and thus you will have to create your own separate model +(a ListModel should suffice), so that a WindowObject only leaves it once you have finished animating +the disappearance of its delegate. This example showcases such a technique. + +\section1 The windows model + +The key point in this example is the model we use for instantiating our \l{WindowItem}{windows}. + +Instead of using WindowManager directly as our model we use a plain ListModel: + +\quotefromfile applicationmanager/animated-windows/system-ui/main.qml +\skipto Each WindowObject +\skipline Each WindowObject +\printuntil delegate: Rectangle + +We remove a WindowObject from that model only after is has reached its end state (WindowObject.NoSurface) +and it's no longer being shown on screen (any state transition has already finished). + +\skipto property bool safeToRemove +\printuntil onSafeToRemoveChanged + +And we add a WindowObject to it (and hence have it displayed on screen) as soon as WindowManager creates one. + +\skipto Connections +\printuntil /\s+\}/ + +*/ diff --git a/examples/applicationmanager/animated-windows/system-ui/main.qml b/examples/applicationmanager/animated-windows/system-ui/main.qml new file mode 100644 index 00000000..3f0cafc3 --- /dev/null +++ b/examples/applicationmanager/animated-windows/system-ui/main.qml @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** 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 QtQuick.Layouts 1.11 +import QtApplicationManager 1.0 + +Rectangle { + width: 1024 + height: 640 + color: "linen" + + // 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 + } + + Component.onCompleted: { + winChrome.x = 300 + model.index * 50; + winChrome.y = 10 + model.index * 30; + } + + // Its default state represents a closed window. It's the starting point for + // an open animation and the end point for a close animation. + opacity: 0.25 + scale: 0.50 + visible: false + + // Animation code from here on + states: [ + State { + name: "open" + when: model.window && model.window.contentState === WindowObject.SurfaceWithContent + PropertyChanges { + target: winChrome + opacity: 1 + scale: 1 + visible: true + } + } + ] + + // true when the window is not being shown on the screen anymore. + // + // When the state changes away from "open", the visible property momentarily turns to false + // before being put back to true again for the disappearance animation. Hence the need for + // a more stable property. + property bool fullyDisappeared: true + + transitions: [ + Transition { // window appears + to: "open" + PropertyAction { target: winChrome; property: "fullyDisappeared"; value: false } + NumberAnimation { target: winChrome; properties: "opacity,scale"; duration: 500; easing.type: Easing.OutQuad} + }, + Transition { // window disappears + id: disappearTransition + from: "open" + SequentialAnimation { + PropertyAction { target: winChrome; property: "visible"; value: true } // we wanna see the window during the closing animation + NumberAnimation { target: winChrome; properties: "opacity,scale"; duration: 500; easing.type: Easing.InQuad} + PropertyAction { target: winChrome; property: "fullyDisappeared"; value: true } + } + } + ] + + readonly property bool safeToRemove: fullyDisappeared && model.window && model.window.contentState === WindowObject.NoSurface + onSafeToRemoveChanged: if (safeToRemove) windowsModel.remove(model.index, 1) + } + } + + // Populates the windowsModel + Connections { + target: WindowManager + onWindowAdded: windowsModel.append({"window":window}) + } +} diff --git a/examples/applicationmanager/applicationmanager.pro b/examples/applicationmanager/applicationmanager.pro index 3e2e0bea..4f173f0d 100644 --- a/examples/applicationmanager/applicationmanager.pro +++ b/examples/applicationmanager/applicationmanager.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS = \ + animated-windows \ hello-world \ minidesk \ monitor \ |