diff options
author | Nico Vertriest <nico.vertriest@qt.io> | 2017-09-25 14:16:02 +0200 |
---|---|---|
committer | Nico Vertriest <nico.vertriest@qt.io> | 2017-10-12 09:35:47 +0000 |
commit | 510e0303f9bb25991a9b25a0dd3644ac29f71ff5 (patch) | |
tree | e69bfd8ab5108be0aadd2273749c987062e60564 | |
parent | 59cd20b07364bc1c08217a6d669cb09fa827d097 (diff) | |
download | qtdoc-510e0303f9bb25991a9b25a0dd3644ac29f71ff5.tar.gz |
Doc: add doc to Coffee Machine Example
Change-Id: I4d40d5b5b16cba2a49349c39a5b7938e2503f48c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
-rw-r--r-- | doc/src/images/coffee_machine_emptycup.png | bin | 0 -> 16905 bytes | |||
-rw-r--r-- | doc/src/images/coffee_machine_modify.png | bin | 0 -> 22094 bytes | |||
-rw-r--r-- | doc/src/images/coffee_machine_overview.png | bin | 0 -> 38140 bytes | |||
-rw-r--r-- | doc/src/images/coffee_machine_selection.png | bin | 0 -> 43989 bytes | |||
-rw-r--r-- | doc/src/snippets/coffee/ApplicationFlow.qml | 6 | ||||
-rw-r--r-- | doc/src/snippets/coffee/Brewing.qml | 4 | ||||
-rw-r--r-- | doc/src/snippets/coffee/CoffeeButton.qml | 3 | ||||
-rw-r--r-- | doc/src/snippets/coffee/SideBar.qml | 2 | ||||
-rw-r--r-- | doc/src/snippets/coffee/coffee.qdoc | 114 |
9 files changed, 126 insertions, 3 deletions
diff --git a/doc/src/images/coffee_machine_emptycup.png b/doc/src/images/coffee_machine_emptycup.png Binary files differnew file mode 100644 index 00000000..d13d91f5 --- /dev/null +++ b/doc/src/images/coffee_machine_emptycup.png diff --git a/doc/src/images/coffee_machine_modify.png b/doc/src/images/coffee_machine_modify.png Binary files differnew file mode 100644 index 00000000..16ad7e85 --- /dev/null +++ b/doc/src/images/coffee_machine_modify.png diff --git a/doc/src/images/coffee_machine_overview.png b/doc/src/images/coffee_machine_overview.png Binary files differnew file mode 100644 index 00000000..3ac002d3 --- /dev/null +++ b/doc/src/images/coffee_machine_overview.png diff --git a/doc/src/images/coffee_machine_selection.png b/doc/src/images/coffee_machine_selection.png Binary files differnew file mode 100644 index 00000000..ae1d5111 --- /dev/null +++ b/doc/src/images/coffee_machine_selection.png diff --git a/doc/src/snippets/coffee/ApplicationFlow.qml b/doc/src/snippets/coffee/ApplicationFlow.qml index 143f6200..406a19b8 100644 --- a/doc/src/snippets/coffee/ApplicationFlow.qml +++ b/doc/src/snippets/coffee/ApplicationFlow.qml @@ -57,11 +57,13 @@ ApplicationFlowForm { 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: { @@ -72,15 +74,19 @@ ApplicationFlowForm { 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() diff --git a/doc/src/snippets/coffee/Brewing.qml b/doc/src/snippets/coffee/Brewing.qml index c8097244..3abe35b3 100644 --- a/doc/src/snippets/coffee/Brewing.qml +++ b/doc/src/snippets/coffee/Brewing.qml @@ -51,6 +51,7 @@ import QtQuick 2.4 +//! [0] BrewingForm { id: root function start() { @@ -96,5 +97,4 @@ BrewingForm { } } } - - +//! [0] diff --git a/doc/src/snippets/coffee/CoffeeButton.qml b/doc/src/snippets/coffee/CoffeeButton.qml index 158881b9..35480a9c 100644 --- a/doc/src/snippets/coffee/CoffeeButton.qml +++ b/doc/src/snippets/coffee/CoffeeButton.qml @@ -60,7 +60,7 @@ Image { property int duration: 250 property alias text: label.text - +//! [0] MouseArea { anchors.fill: parent onClicked: root.clicked() @@ -70,6 +70,7 @@ Image { animation2.start() } } +//! [0] Rectangle { id: glow diff --git a/doc/src/snippets/coffee/SideBar.qml b/doc/src/snippets/coffee/SideBar.qml index 285215b4..bd11f16b 100644 --- a/doc/src/snippets/coffee/SideBar.qml +++ b/doc/src/snippets/coffee/SideBar.qml @@ -86,10 +86,12 @@ SideBarForm { sideBar.coffeeSelected() } +//! [0] cappuccinoButton.onClicked: { sideBar.currentCoffee = qsTr("Cappucino") sideBar.currentMilk = 7 sideBar.currentCoffeeAmount = 3.5 sideBar.coffeeSelected() } +//! [0] } diff --git a/doc/src/snippets/coffee/coffee.qdoc b/doc/src/snippets/coffee/coffee.qdoc new file mode 100644 index 00000000..c274870c --- /dev/null +++ b/doc/src/snippets/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. +*/ |