diff options
author | Nico Vertriest <nico.vertriest@qt.io> | 2018-05-22 14:01:05 +0200 |
---|---|---|
committer | Nico Vertriest <nico.vertriest@qt.io> | 2018-06-07 11:07:19 +0000 |
commit | d6686a578debb0a235baeb4b626bc931c7695780 (patch) | |
tree | 00c7e461b16519ed8f860efa7bd43cfbf9d99b6b /examples | |
parent | 96bfc87db384f10b7e85931268972941f63a0680 (diff) |
Doc: Move coffeemachine examples to examples/demos
-Also add license file for TitilliumWeb-Regular.ttf
-Add qt_qttribution.json and LICENSE.txt
Task-number: QTBUG-68357
Change-Id: I705a28ed9f113e7ad3cca1b93eb162cc223d9d2d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'examples')
43 files changed, 2219 insertions, 0 deletions
diff --git a/examples/demos/coffee/ApplicationFlow.qml b/examples/demos/coffee/ApplicationFlow.qml new file mode 100644 index 000000000..406a19b8f --- /dev/null +++ b/examples/demos/coffee/ApplicationFlow.qml @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 +import Coffee 1.0 + +ApplicationFlowForm { + id: applicationFlow + state: "initial" + + property int animationDuration: 400 + +//! [0] + choosingCoffee.brewButtonSelection.onClicked: { + applicationFlow.state = "settings" + applicationFlow.choosingCoffee.milkSlider.value = applicationFlow.choosingCoffee.sideBar.currentMilk + applicationFlow.choosingCoffee.sugarSlider.value = 2 + } +//! [0] + + + choosingCoffee.sideBar.onCoffeeSelected: { + applicationFlow.state = "selection" + } + + choosingCoffee.backButton.onClicked: { + applicationFlow.state = "selection" + } + +//! [2] + choosingCoffee.brewButton.onClicked: { + applicationFlow.state = "empty cup" + } +//! [2] + +//! [1] + emptyCup.continueButton.onClicked: { + applicationFlow.state = "brewing" + brewing.coffeeName = choosingCoffee.sideBar.currentCoffee + brewing.start() + } +//! [1] + + brewing.onFinished: { + finalAnimation.start() + } + + SequentialAnimation { + id: finalAnimation + + PropertyAction { + target: applicationFlow + property: "state" + value: "finished" + } + + PauseAnimation { + duration: 1000 + } + + PropertyAction { + target: applicationFlow + property: "state" + value: "start" + } + + PauseAnimation { + duration: applicationFlow.animationDuration + } + + PauseAnimation { + duration: 400 + } + + PropertyAction { + target: applicationFlow + property: "state" + value: "initial" + } + } + + + Behavior on choosingCoffee.x { + PropertyAnimation { + duration: applicationFlow.animationDuration + easing.type: Easing.InOutQuad + } + } + + + Behavior on emptyCup.x { + PropertyAnimation { + duration: applicationFlow.animationDuration + easing.type: Easing.InOutQuad + } + } + + Behavior on brewing.x { + PropertyAnimation { + duration: applicationFlow.animationDuration + easing.type: Easing.InOutQuad + } + } + +} diff --git a/examples/demos/coffee/ApplicationFlowForm.ui.qml b/examples/demos/coffee/ApplicationFlowForm.ui.qml new file mode 100644 index 000000000..1844d133b --- /dev/null +++ b/examples/demos/coffee/ApplicationFlowForm.ui.qml @@ -0,0 +1,198 @@ + +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ +import QtQuick 2.4 +import Coffee 1.0 + +Rectangle { + id: root + width: Constants.width + height: Constants.height + property alias choosingCoffee: choosingCoffee + property alias brewing: brewing + property alias emptyCup: emptyCup + + color: Constants.backgroundColor + + state: intital + + EmptyCupForm { + id: emptyCup + x: Constants.width + y: 0 + } + + Brewing { + id: brewing + x: Constants.width * 2 + y: 0 + } + + ChoosingCoffee { + id: choosingCoffee + } + + states: [ + State { + name: "initial" + }, + State { + name: "selection" + + PropertyChanges { + target: choosingCoffee + selected: true + } + }, + State { + name: "settings" + + PropertyChanges { + target: choosingCoffee + x: -Constants.leftSideBarWidth + selected: false + inSettings: true + } + + PropertyChanges { + target: emptyCup + x: Constants.width + y: 0 + } + + PropertyChanges { + target: brewing + x: Constants.width * 2 + y: 0 + } + }, + State { + name: "empty cup" + + PropertyChanges { + target: emptyCup + x: 0 + } + + PropertyChanges { + target: choosingCoffee + x: -Constants.width - Constants.leftSideBarWidth + inSettings: true + selected: false + } + + PropertyChanges { + target: brewing + x: Constants.width + } + }, + State { + name: "brewing" + + PropertyChanges { + target: emptyCup + x: -Constants.width + } + + PropertyChanges { + target: brewing + x: 0 + } + + PropertyChanges { + target: choosingCoffee + x: -Constants.width * 2 - Constants.leftSideBarWidth + } + }, + State { + name: "finished" + + PropertyChanges { + target: emptyCup + x: -Constants.width + y: 0 + visible: false + } + + PropertyChanges { + target: brewing + x: 0 + } + + PropertyChanges { + target: choosingCoffee + x: -Constants.leftSideBarWidth - Constants.width + questionVisible: true + inSettings: true + } + }, + State { + name: "start" + + PropertyChanges { + target: emptyCup + x: 0 + visible: false + } + + PropertyChanges { + target: brewing + x: Constants.width + y: 0 + } + + PropertyChanges { + target: choosingCoffee + x: 0 + inSettings: true + } + } + ] +} diff --git a/examples/demos/coffee/Brewing.qml b/examples/demos/coffee/Brewing.qml new file mode 100644 index 000000000..3abe35b39 --- /dev/null +++ b/examples/demos/coffee/Brewing.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + + +import QtQuick 2.4 + +//! [0] +BrewingForm { + id: root + function start() { + animation.start() + } + + signal finished() + + SequentialAnimation { + id: animation + PauseAnimation { + duration: 1500 + } + PropertyAction { + target: root + property: "state" + value: "coffee" + } + PauseAnimation { + duration: 1500 + } + PropertyAction { + target: root + property: "state" + value: "milk" + } + PauseAnimation { + duration: 1500 + } + ScriptAction { + script: root.finished() + } + } + + Behavior on cup.coffeeAmount { + PropertyAnimation { + + } + } + + Behavior on cup.milkAmount { + PropertyAnimation { + } + } +} +//! [0] diff --git a/examples/demos/coffee/BrewingForm.ui.qml b/examples/demos/coffee/BrewingForm.ui.qml new file mode 100644 index 000000000..8de3d880a --- /dev/null +++ b/examples/demos/coffee/BrewingForm.ui.qml @@ -0,0 +1,122 @@ + +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Item { + id: root + width: Constants.width + height: Constants.height + clip: true + property string coffeeName: qsTr("Cappucino") + property alias cup: cup + + state: "initial state" + + Rectangle { + id: rectangle + color: Constants.backgroundColor + anchors.fill: parent + + CupForm { + id: cup + x: 256 + y: 96 + anchors.horizontalCenterOffset: 150 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + questionVisible: false + coffeeLabel: "" + showLabels: false + milkAmount: 0 + coffeeAmount: 0 + sugarAmount: 0 + } + } + Text { + id: brewLabel + + color: "#ffffff" + text: qsTr("Making ") + root.coffeeName + anchors.topMargin: Constants.defaultMargin + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 64 + font.capitalization: Font.AllUppercase + } + states: [ + State { + name: "coffee" + + PropertyChanges { + target: cup + coffeeAmount: 4 + } + }, + State { + name: "milk" + PropertyChanges { + target: cup + milkAmount: 6 + coffeeAmount: 4 + } + + PropertyChanges { + target: brewLabel + text: root.coffeeName + qsTr(" Ready") + } + } + ] +} diff --git a/examples/demos/coffee/ChoosingCoffee.ui.qml b/examples/demos/coffee/ChoosingCoffee.ui.qml new file mode 100644 index 000000000..8b9be8b92 --- /dev/null +++ b/examples/demos/coffee/ChoosingCoffee.ui.qml @@ -0,0 +1,235 @@ + +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Item { + id: root + + width: Constants.width + Constants.leftSideBarWidth + height: Constants.height + + property alias milkSlider: milkSlider + property alias sugarSlider: sugarSlider + + property alias brewButtonSelection: brewButtonSelection + property bool selected: false + property alias brewButton: brewButton + property alias sideBar: sideBar + property alias backButton: backButton + + property alias questionVisible: cup.questionVisible + + property real coffeeAmount: 5 + + property bool inSettings: false + + state: "initial state" + + Rectangle { + id: rectangle + color: Constants.backgroundColor + anchors.fill: parent + } + + Rectangle { + id: rightSideBar + + x: 658 + y: 0 + width: Constants.leftSideBarWidth + height: 768 + color: "#eec1a2" + visible: false + anchors.right: parent.right + + Column { + spacing: 32 + anchors.bottom: brewButton.top + anchors.bottomMargin: 100 + anchors.horizontalCenter: parent.horizontalCenter + + Slider { + id: milkSlider + width: 256 + height: 48 + + to: 10 + value: 6 + + Image { + x: 48 + y: -12 + source: "images/icons/contents/milk.png" + } + } + Slider { + id: sugarSlider + + width: 256 + height: 48 + to: 10 + stepSize: 1 + value: 0 + + Image { + x: 48 + y: -12 + source: "images/icons/contents/sugar.png" + } + } + } + + NavigationButton { + id: brewButton + + text: "Brew" + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: Constants.defaultMargin + anchors.bottomMargin: Constants.defaultMargin + } + } + + SideBar { + id: sideBar + width: Constants.leftSideBarWidth + } + + states: [ + State { + name: "initial state" + when: !root.selected && !root.inSettings + }, + State { + name: "selected state" + when: root.selected + + PropertyChanges { + target: cup + + questionVisible: false + visible: true + } + + PropertyChanges { + target: brewButton + visible: true + } + + PropertyChanges { + target: brewButtonSelection + visible: true + } + }, + State { + name: "settings" + when: root.inSettings + PropertyChanges { + target: cup + x: 354 + y: 0 + questionVisible: false + visible: true + milkAmount: milkSlider.value + sugarAmount: sugarSlider.value + } + + PropertyChanges { + target: brewButton + visible: true + } + + PropertyChanges { + target: backButton + opacity: 1 + } + + PropertyChanges { + target: rightSideBar + visible: true + } + } + ] + + CupForm { + id: cup + anchors.right: rightSideBar.left + anchors.left: sideBar.right + visible: true + milkAmount: sideBar.currentMilk + coffeeAmount: sideBar.currentCoffeeAmount + coffeeLabel: sideBar.currentCoffee + questionVisible: true + } + NavigationButton { + id: backButton + text: "Back" + opacity: 0 + anchors.leftMargin: Constants.defaultMargin + anchors.bottom: parent.bottom + anchors.left: sideBar.right + anchors.bottomMargin: Constants.defaultMargin + forward: false + } + + NavigationButton { + id: brewButtonSelection + + anchors.left: sideBar.right + anchors.leftMargin: Constants.defaultMargin + anchors.bottom: parent.bottom + anchors.bottomMargin: Constants.defaultMargin + visible: false + } +} diff --git a/examples/demos/coffee/CoffeeButton.qml b/examples/demos/coffee/CoffeeButton.qml new file mode 100644 index 000000000..35480a9c4 --- /dev/null +++ b/examples/demos/coffee/CoffeeButton.qml @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Image { + id: root + source: "images/icons/coffees/cappucino.png" + signal clicked + + property int duration: 250 + property alias text: label.text +//! [0] + MouseArea { + anchors.fill: parent + onClicked: root.clicked() + onPressed: { + glow.visible = true + animation1.start() + animation2.start() + } + } +//! [0] + + Rectangle { + id: glow + visible: false + + width: 250 + height: 250 + color: "#00000000" + radius: 125 + scale: 1.05 + border.color: "#ffffff" + } + + Label { + id: label + x: 292 + y: 252 + text: qsTr("Label") + anchors.horizontalCenter: parent.horizontalCenter + color: "#443224" + font.family: Constants.fontFamily + font.pixelSize: 28 + } + + PropertyAnimation { + target: glow + id: animation1 + duration: root.duration + loops: 1 + from: 1.05 + to: 1.2 + property: "scale" + } + + ParallelAnimation { + id: animation2 + SequentialAnimation { + PropertyAnimation { + target: glow + duration: root.duration + loops: 1 + from: 0.2 + to: 1.0 + property: "opacity" + } + PropertyAnimation { + target: glow + duration: root.duration + loops: 1 + from: 1.0 + to: 0.0 + property: "opacity" + } + + PropertyAction { + target: glow + property: "visible" + value: false + } + } + + SequentialAnimation { + PropertyAction { + target: glow + property: "border.width" + value: 20 + } + + PauseAnimation { + duration: 200 + } + + PropertyAnimation { + target: glow + duration: root.duration + loops: 1 + from: 20 + to: 10 + property: "border.width" + } + } + } + + + +} diff --git a/examples/demos/coffee/Cup.qml b/examples/demos/coffee/Cup.qml new file mode 100644 index 000000000..08880c969 --- /dev/null +++ b/examples/demos/coffee/Cup.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 + +CupForm { +} diff --git a/examples/demos/coffee/CupForm.ui.qml b/examples/demos/coffee/CupForm.ui.qml new file mode 100644 index 000000000..6d01b3a3b --- /dev/null +++ b/examples/demos/coffee/CupForm.ui.qml @@ -0,0 +1,247 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Item { + id: root + + width: 768 + height: 768 + property alias questionVisible: question.visible + property bool showLabels: true + property alias coffeeLabel: cappuccinoLabel.text + + property real sugarAmount: 2 + property real milkAmount: 4 + property real coffeeAmount: 4 + + Rectangle { + id: rectangle + color: "#443224" + anchors.fill: parent + + Image { + id: background + x: 12 + y: 170 + source: "images/cup structure/cup elements/coffee_cup_back.png" + } + + Item { + id: foam + x: 12 + width: 457 + anchors.topMargin: milk.anchors.topMargin - 40 + anchors.bottom: background.bottom + anchors.top: background.top + clip: true + Image { + anchors.bottom: parent.bottom + source: "images/cup structure/liquids/liquid_foam.png" + } + } + + Item { + id: milk + x: 12 + width: 457 + anchors.topMargin: 400 - coffee.height - root.milkAmount * 15 + 20 + anchors.bottom: background.bottom + anchors.top: background.top + clip: true + Image { + source: "images/cup structure/liquids/liquid_milk.png" + anchors.bottom: parent.bottom + } + } + + Item { + id: coffee + x: 12 + width: 457 + height: root.coffeeAmount * 40 + anchors.bottomMargin: 0 + anchors.bottom: background.bottom + clip: true + + Image { + anchors.bottom: parent.bottom + source: "images/cup structure/liquids/liquid_coffee.png" + } + } + + Image { + id: cupFront + x: 11 + y: 170 + source: "images/cup structure/cup elements/coffee_cup_front.png" + } + + Text { + x: 499 + y: 370 + color: "#ffffff" + text: qsTr("Hot Milk") + font.capitalization: Font.AllUppercase + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 18 + visible: root.showLabels + } + + Text { + x: 486 + y: 468 + color: "#ffffff" + text: qsTr("Espresso Coffee") + font.capitalization: Font.AllUppercase + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 18 + visible: root.showLabels + } + + Image { + x: 414 + y: 274 + visible: root.showLabels + source: "images/ui controls/line.png" + } + + Text { + x: 512 + y: 259 + color: "#ffffff" + text: qsTr("Milk Foam") + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 18 + font.capitalization: Font.AllUppercase + visible: root.showLabels + } + + Image { + x: 404 + y: 382 + source: "images/ui controls/line.png" + visible: root.showLabels + } + + Image { + x: 388 + y: 482 + source: "images/ui controls/line.png" + visible: root.showLabels + } + + Text { + id: cappuccinoLabel + color: "#ffffff" + text: qsTr("CAPPUCCINO") + visible: !question.visible + anchors.top: parent.top + anchors.topMargin: 32 + anchors.left: parent.left + anchors.leftMargin: Constants.defaultMargin + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 64 + font.capitalization: Font.AllUppercase + } + + Item { + id: sugarItem + x: 181 + y: 419 + width: 119 + height: 111 + rotation: -45 + + Rectangle { + x: 21 + y: 8 + width: 48 + height: 48 + color: "#ffffff" + opacity: root.sugarAmount / 10 + } + + Rectangle { + x: 74 + y: 40 + width: 32 + height: 32 + color: "#ffffff" + visible: root.sugarAmount > 5 + opacity: root.sugarAmount / 30 + } + + Rectangle { + x: 45 + y: 62 + width: 24 + height: 24 + color: "#ffffff" + opacity: root.sugarAmount / 25 + } + } + } + Image { + id: question + y: 170 + anchors.left: parent.left + anchors.leftMargin: 11 + source: "images/cup structure/coffee_cup_large.png" + } +} diff --git a/examples/demos/coffee/EmptyCup.qml b/examples/demos/coffee/EmptyCup.qml new file mode 100644 index 000000000..3a74d27f6 --- /dev/null +++ b/examples/demos/coffee/EmptyCup.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 + +EmptyCupForm { +} diff --git a/examples/demos/coffee/EmptyCupForm.ui.qml b/examples/demos/coffee/EmptyCupForm.ui.qml new file mode 100644 index 000000000..3bdff6cdc --- /dev/null +++ b/examples/demos/coffee/EmptyCupForm.ui.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Item { + id: root + width: Constants.width + height: Constants.height + property alias continueButton: continueButton + + state: "initial state" + + Rectangle { + id: rectangle + color: Constants.backgroundColor + anchors.fill: parent + + Image { + id: image + x: 284 + y: 174 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + source: "images/cup structure/coffee_cup_outline.png" + } + } + + Text { + id: brewLabel + x: 84 + y: 26 + color: "#ffffff" + text: qsTr("Please insert cup into tray") + anchors.horizontalCenter: parent.horizontalCenter + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 64 + font.capitalization: Font.AllUppercase + } + + NavigationButton { + id: continueButton + x: 324 + y: 650 + text: "Continue" + anchors.bottomMargin: Constants.defaultMargin + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + } +} diff --git a/examples/demos/coffee/LICENSE.txt b/examples/demos/coffee/LICENSE.txt new file mode 100644 index 000000000..10ab55db6 --- /dev/null +++ b/examples/demos/coffee/LICENSE.txt @@ -0,0 +1,86 @@ +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/examples/demos/coffee/NavigationButton.ui.qml b/examples/demos/coffee/NavigationButton.ui.qml new file mode 100644 index 000000000..66216e6fd --- /dev/null +++ b/examples/demos/coffee/NavigationButton.ui.qml @@ -0,0 +1,95 @@ + +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ +import QtQuick 2.4 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +Row { + id: row + + signal clicked + + property alias text: brewLabel.text + + property bool forward: true + layoutDirection: row.forward ? Qt.LeftToRight : Qt.RightToLeft + + spacing: 17 + + Text { + id: brewLabel + color: "#ffffff" + text: qsTr("Brew Me a CUP") + font.family: Constants.fontFamily + wrapMode: Text.WrapAnywhere + font.pixelSize: 64 + font.capitalization: Font.AllUppercase + } + + Image { + id: image + + anchors.verticalCenter: parent.verticalCenter + source: row.forward ? "images/ui controls/buttons/go/white.png" : "images/ui controls/buttons/back/white.png" + scale: mouseArea.containsMouse ? 1.1 : 1 + MouseArea { + id: mouseArea + hoverEnabled: true + + anchors.fill: parent + Connections { + target: mouseArea + onClicked: row.clicked() + } + } + } +} diff --git a/examples/demos/coffee/SideBar.qml b/examples/demos/coffee/SideBar.qml new file mode 100644 index 000000000..bd11f16bd --- /dev/null +++ b/examples/demos/coffee/SideBar.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.4 + +SideBarForm { + id: sideBar + property string currentCoffee: qsTr("Cappucino") + signal coffeeSelected + property real currentMilk: 0 + property real currentCoffeeAmount: 4 + + Behavior on currentMilk { + NumberAnimation { duration: 250 } + } + + Behavior on currentCoffeeAmount { + NumberAnimation { duration: 250 } + } + + macchiatoButton.onClicked: { + sideBar.currentCoffee = qsTr("Macchiato") + sideBar.currentMilk = 1 + sideBar.currentCoffeeAmount = 4 + sideBar.coffeeSelected() + } + + latteButton.onClicked: { + sideBar.currentCoffee = qsTr("Latte") + sideBar.currentMilk = 10 + sideBar.currentCoffeeAmount = 3 + sideBar.coffeeSelected() + } + + espressoButton.onClicked: { + sideBar.currentCoffee = qsTr("Espresso") + sideBar.currentMilk = 0 + sideBar.currentCoffeeAmount = 4 + sideBar.coffeeSelected() + } + +//! [0] + cappuccinoButton.onClicked: { + sideBar.currentCoffee = qsTr("Cappucino") + sideBar.currentMilk = 7 + sideBar.currentCoffeeAmount = 3.5 + sideBar.coffeeSelected() + } +//! [0] +} diff --git a/examples/demos/coffee/SideBarForm.ui.qml b/examples/demos/coffee/SideBarForm.ui.qml new file mode 100644 index 000000000..adcf0cc1b --- /dev/null +++ b/examples/demos/coffee/SideBarForm.ui.qml @@ -0,0 +1,107 @@ + +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ +import QtQuick 2.4 +import QtQuick.Layouts 1.3 + +Flickable { + id: flickable + x: 0 + y: 0 + width: 354 + height: 768 + + property alias macchiatoButton: macchiatoButton + property alias latteButton: latteButton + property alias espressoButton: espressoButton + property alias cappuccinoButton: cappuccinoButton + + contentWidth: 250 + boundsBehavior: Flickable.StopAtBounds + contentHeight: 1506 + clip: true + + Rectangle { + id: background + x: 0 + width: 354 + height: 1506 + color: "#eec1a2" + } + + ColumnLayout { + x: 52 + y: 0 + spacing: 64 + + CoffeeButton { + id: cappuccinoButton + text: "Cappuccino" + } + + CoffeeButton { + id: espressoButton + text: "Espresso" + source: "images/icons/coffees/Espresso.png" + } + + CoffeeButton { + id: latteButton + text: "Latte" + source: "images/icons/coffees/Latte.png" + } + + CoffeeButton { + id: macchiatoButton + text: "Macchiato" + source: "images/icons/coffees/Macchiato.png" + } + } +} diff --git a/examples/demos/coffee/coffee.pro b/examples/demos/coffee/coffee.pro new file mode 100644 index 000000000..0c9dce00b --- /dev/null +++ b/examples/demos/coffee/coffee.pro @@ -0,0 +1,35 @@ +QT += qml quick + +CONFIG += c++11 + +SOURCES += main.cpp + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = $$PWD/imports + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + images/ui components/loader/loading bar 1.png \ + images/ui components/loader/loading bar 2.png \ + images/ui components/loader/loading bar 3.png \ + images/ui components/loader/loading bg.png diff --git a/examples/demos/coffee/coffee.qdoc b/examples/demos/coffee/coffee.qdoc new file mode 100644 index 000000000..c274870ce --- /dev/null +++ b/examples/demos/coffee/coffee.qdoc @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +/*! + + \example coffee + \title Coffee Machine Example + \ingroup examples-tutorials + + \borderedimage coffee_machine_overview.png + + The coffee machine application lets you choose a type of coffee on the + left side of the main screen. After selection, the app displays what + the coffee blend will contain (ratio coffee/hot milk/milk foam). + This can be modified with two sliders. When the brew has been started, + the app shows an animated display of the brewing process, then returns + to the start screen. + + First the start screen \c Animationflowform is displayed, showing a + sidebar with several types of coffee, and an empty cup on the right + screen. + + Selecting a coffee type - for example, cappuccino - triggers \c animation1 + and \c animation2 in CoffeeButton.qml. On the right side, you will see + the coffee blend you selected. + + \snippet coffee/CoffeeButton.qml 0 + + It also triggers cappuccinoButton.onClicked(), which sets the default + mix for the coffee type selected: + + \snippet coffee/SideBar.qml 0 + + \borderedimage coffee_machine_selection.png + \caption Coffee blend cappuccino + + \c sideBar.coffeeSelected() \c sets applicationFlow.state to "selection" + + If you click "Brew me a cup", choosingCoffee.brewButtonSelection.onClicked + is triggered: + + \snippet coffee/ApplicationFlow.qml 0 + + On the right side of the screen, you will see two sliders, one for + the amount of milk, and one for sugar. They will have default values, + but can be modified by the user. + + \borderedimage coffee_machine_modify.png + + If you click on \c Brew, \c choosingCoffee.brewButton.onClicked() is triggered, + which displays a screen with the message "Please insert cup into tray". + + \snippet coffee/ApplicationFlow.qml 2 + + \borderedimage coffee_machine_emptycup.png + + Clicking on \c Continue starts the brewing of the coffee type you + selected. + + \snippet coffee/ApplicationFlow.qml 1 + + The brewing process is defined as follows in \c Brewing.qml: + + \snippet coffee/Brewing.qml 0 + + After completion, the application returns to the start screen. +*/ diff --git a/examples/demos/coffee/images/cup structure/coffee_cup_large.png b/examples/demos/coffee/images/cup structure/coffee_cup_large.png Binary files differnew file mode 100644 index 000000000..e69889af5 --- /dev/null +++ b/examples/demos/coffee/images/cup structure/coffee_cup_large.png diff --git a/examples/demos/coffee/images/cup structure/coffee_cup_outline.png b/examples/demos/coffee/images/cup structure/coffee_cup_outline.png Binary files differnew file mode 100644 index 000000000..941e0c145 --- /dev/null +++ b/examples/demos/coffee/images/cup structure/coffee_cup_outline.png diff --git a/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_back.png b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_back.png Binary files differnew file mode 100644 index 000000000..045732cab --- /dev/null +++ b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_back.png diff --git a/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_coverplate.png b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_coverplate.png Binary files differnew file mode 100644 index 000000000..48041c539 --- /dev/null +++ b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_coverplate.png diff --git a/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_front.png b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_front.png Binary files differnew file mode 100644 index 000000000..e2c2a7743 --- /dev/null +++ b/examples/demos/coffee/images/cup structure/cup elements/coffee_cup_front.png diff --git a/examples/demos/coffee/images/cup structure/liquids/liquid_coffee.png b/examples/demos/coffee/images/cup structure/liquids/liquid_coffee.png Binary files differnew file mode 100644 index 000000000..0fff3e39d --- /dev/null +++ b/examples/demos/coffee/images/cup structure/liquids/liquid_coffee.png diff --git a/examples/demos/coffee/images/cup structure/liquids/liquid_foam.png b/examples/demos/coffee/images/cup structure/liquids/liquid_foam.png Binary files differnew file mode 100644 index 000000000..d07496ce2 --- /dev/null +++ b/examples/demos/coffee/images/cup structure/liquids/liquid_foam.png diff --git a/examples/demos/coffee/images/cup structure/liquids/liquid_milk.png b/examples/demos/coffee/images/cup structure/liquids/liquid_milk.png Binary files differnew file mode 100644 index 000000000..3235b4d6b --- /dev/null +++ b/examples/demos/coffee/images/cup structure/liquids/liquid_milk.png diff --git a/examples/demos/coffee/images/icons/coffees/Americano.png b/examples/demos/coffee/images/icons/coffees/Americano.png Binary files differnew file mode 100644 index 000000000..b1c0c384a --- /dev/null +++ b/examples/demos/coffee/images/icons/coffees/Americano.png diff --git a/examples/demos/coffee/images/icons/coffees/Espresso.png b/examples/demos/coffee/images/icons/coffees/Espresso.png Binary files differnew file mode 100644 index 000000000..faac7593c --- /dev/null +++ b/examples/demos/coffee/images/icons/coffees/Espresso.png diff --git a/examples/demos/coffee/images/icons/coffees/Latte.png b/examples/demos/coffee/images/icons/coffees/Latte.png Binary files differnew file mode 100644 index 000000000..d9e4e6164 --- /dev/null +++ b/examples/demos/coffee/images/icons/coffees/Latte.png diff --git a/examples/demos/coffee/images/icons/coffees/Macchiato.png b/examples/demos/coffee/images/icons/coffees/Macchiato.png Binary files differnew file mode 100644 index 000000000..fb7c1c91c --- /dev/null +++ b/examples/demos/coffee/images/icons/coffees/Macchiato.png diff --git a/examples/demos/coffee/images/icons/coffees/cappucino.png b/examples/demos/coffee/images/icons/coffees/cappucino.png Binary files differnew file mode 100644 index 000000000..d5557e8da --- /dev/null +++ b/examples/demos/coffee/images/icons/coffees/cappucino.png diff --git a/examples/demos/coffee/images/icons/contents/coffee.png b/examples/demos/coffee/images/icons/contents/coffee.png Binary files differnew file mode 100644 index 000000000..c4b35be19 --- /dev/null +++ b/examples/demos/coffee/images/icons/contents/coffee.png diff --git a/examples/demos/coffee/images/icons/contents/milk.png b/examples/demos/coffee/images/icons/contents/milk.png Binary files differnew file mode 100644 index 000000000..19709cfed --- /dev/null +++ b/examples/demos/coffee/images/icons/contents/milk.png diff --git a/examples/demos/coffee/images/icons/contents/sugar.png b/examples/demos/coffee/images/icons/contents/sugar.png Binary files differnew file mode 100644 index 000000000..ac83a7f37 --- /dev/null +++ b/examples/demos/coffee/images/icons/contents/sugar.png diff --git a/examples/demos/coffee/images/ui controls/buttons/back/white.png b/examples/demos/coffee/images/ui controls/buttons/back/white.png Binary files differnew file mode 100644 index 000000000..633f0f301 --- /dev/null +++ b/examples/demos/coffee/images/ui controls/buttons/back/white.png diff --git a/examples/demos/coffee/images/ui controls/buttons/go/white.png b/examples/demos/coffee/images/ui controls/buttons/go/white.png Binary files differnew file mode 100644 index 000000000..0172138d0 --- /dev/null +++ b/examples/demos/coffee/images/ui controls/buttons/go/white.png diff --git a/examples/demos/coffee/images/ui controls/line.png b/examples/demos/coffee/images/ui controls/line.png Binary files differnew file mode 100644 index 000000000..bd4484ef8 --- /dev/null +++ b/examples/demos/coffee/images/ui controls/line.png diff --git a/examples/demos/coffee/imports/Coffee/Constants.qml b/examples/demos/coffee/imports/Coffee/Constants.qml new file mode 100644 index 000000000..8816a9f58 --- /dev/null +++ b/examples/demos/coffee/imports/Coffee/Constants.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + + +pragma Singleton +import QtQuick 2.6 + +QtObject { + property FontLoader fontLoader: FontLoader { + id: fontLoader + source: "TitilliumWeb-Regular.ttf" + } + readonly property alias fontFamily: fontLoader.name + + readonly property int width: 1024 + readonly property int height: 768 + readonly property int leftSideBarWidth: 366 + + readonly property color backgroundColor: "#443224" + readonly property int defaultMargin: 8 +} diff --git a/examples/demos/coffee/imports/Coffee/TitilliumWeb-Regular.ttf b/examples/demos/coffee/imports/Coffee/TitilliumWeb-Regular.ttf Binary files differnew file mode 100644 index 000000000..6da821935 --- /dev/null +++ b/examples/demos/coffee/imports/Coffee/TitilliumWeb-Regular.ttf diff --git a/examples/demos/coffee/imports/Coffee/qmldir b/examples/demos/coffee/imports/Coffee/qmldir new file mode 100644 index 000000000..616ac2035 --- /dev/null +++ b/examples/demos/coffee/imports/Coffee/qmldir @@ -0,0 +1 @@ +singleton Constants 1.0 Constants.qml diff --git a/examples/demos/coffee/main.cpp b/examples/demos/coffee/main.cpp new file mode 100644 index 000000000..40c7e7577 --- /dev/null +++ b/examples/demos/coffee/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.addImportPath(":/imports"); + engine.load(QUrl(QLatin1String("qrc:/main.qml"))); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/examples/demos/coffee/main.qml b/examples/demos/coffee/main.qml new file mode 100644 index 000000000..14488156e --- /dev/null +++ b/examples/demos/coffee/main.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt 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$ +** +****************************************************************************/ + +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import Coffee 1.0 + +ApplicationWindow { + visible: true + width: Constants.width + height: Constants.height + title: qsTr("Coffee") + + ApplicationFlow { + } +} diff --git a/examples/demos/coffee/qml.qrc b/examples/demos/coffee/qml.qrc new file mode 100644 index 000000000..2f8c143bd --- /dev/null +++ b/examples/demos/coffee/qml.qrc @@ -0,0 +1,39 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>qtquickcontrols2.conf</file> + <file>images/cup structure/cup elements/coffee_cup_back.png</file> + <file>images/cup structure/cup elements/coffee_cup_coverplate.png</file> + <file>images/cup structure/cup elements/coffee_cup_front.png</file> + <file>images/cup structure/liquids/liquid_coffee.png</file> + <file>images/cup structure/liquids/liquid_foam.png</file> + <file>images/cup structure/liquids/liquid_milk.png</file> + <file>images/cup structure/coffee_cup_large.png</file> + <file>images/cup structure/coffee_cup_outline.png</file> + <file>images/icons/contents/coffee.png</file> + <file>images/icons/contents/milk.png</file> + <file>images/icons/contents/sugar.png</file> + <file>images/icons/coffees/Americano.png</file> + <file>images/icons/coffees/cappucino.png</file> + <file>images/icons/coffees/Espresso.png</file> + <file>images/icons/coffees/Latte.png</file> + <file>images/icons/coffees/Macchiato.png</file> + <file>images/ui controls/buttons/back/white.png</file> + <file>images/ui controls/buttons/go/white.png</file> + <file>images/ui controls/line.png</file> + <file>CoffeeButton.qml</file> + <file>CupForm.ui.qml</file> + <file>SideBar.qml</file> + <file>SideBarForm.ui.qml</file> + <file>NavigationButton.ui.qml</file> + <file>ApplicationFlow.qml</file> + <file>ApplicationFlowForm.ui.qml</file> + <file>EmptyCupForm.ui.qml</file> + <file>Brewing.qml</file> + <file>BrewingForm.ui.qml</file> + <file>ChoosingCoffee.ui.qml</file> + <file>imports/Coffee/Constants.qml</file> + <file>imports/Coffee/qmldir</file> + <file>imports/Coffee/TitilliumWeb-Regular.ttf</file> + </qresource> +</RCC> diff --git a/examples/demos/coffee/qt_attribution.json b/examples/demos/coffee/qt_attribution.json new file mode 100644 index 000000000..37e04600b --- /dev/null +++ b/examples/demos/coffee/qt_attribution.json @@ -0,0 +1,15 @@ +[ +{ + "Id": "coffeeexample-titillium", + "Name": "Titillium Web Font", + "QDocModule": "qtdoc", + "QtUsage": "Used in the Coffee Maker example.", + "QtParts": ["examples"], + "Files": "TitilliumWeb-Regular.ttf", + + "License": "SIL Open Font License 1.1", + "LicenseId": "OFL-1.1", + "LicenseFile": "LICENSE.txt", + "Copyright": "Copyright (c) 2009-2011 by Accademia di Belle Arti di Urbino and students of MA course of Visual design. Some rights reserved." +} +] diff --git a/examples/demos/coffee/qtquickcontrols2.conf b/examples/demos/coffee/qtquickcontrols2.conf new file mode 100644 index 000000000..e16b5bb52 --- /dev/null +++ b/examples/demos/coffee/qtquickcontrols2.conf @@ -0,0 +1,10 @@ +[Controls] +Style=Material + +[Universal] +Theme=Light + +[Material] +Theme=Dark +Primary=Grey +Accent=White |