2022-06-03 11:26:02 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2017-07-04 17:20:08 +00:00
|
|
|
|
2020-12-01 12:57:32 +00:00
|
|
|
import QtQuick
|
2017-07-04 17:20:08 +00:00
|
|
|
|
|
|
|
ApplicationFlowForm {
|
|
|
|
id: applicationFlow
|
|
|
|
state: "initial"
|
|
|
|
|
|
|
|
property int animationDuration: 400
|
|
|
|
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [0]
|
2017-07-04 17:20:08 +00:00
|
|
|
choosingCoffee.brewButtonSelection.onClicked: {
|
|
|
|
applicationFlow.state = "settings"
|
|
|
|
applicationFlow.choosingCoffee.milkSlider.value = applicationFlow.choosingCoffee.sideBar.currentMilk
|
|
|
|
applicationFlow.choosingCoffee.sugarSlider.value = 2
|
|
|
|
}
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [0]
|
2017-07-04 17:20:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
choosingCoffee.sideBar.onCoffeeSelected: {
|
|
|
|
applicationFlow.state = "selection"
|
|
|
|
}
|
|
|
|
|
|
|
|
choosingCoffee.backButton.onClicked: {
|
|
|
|
applicationFlow.state = "selection"
|
|
|
|
}
|
|
|
|
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [2]
|
2017-07-04 17:20:08 +00:00
|
|
|
choosingCoffee.brewButton.onClicked: {
|
|
|
|
applicationFlow.state = "empty cup"
|
|
|
|
}
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [2]
|
2017-07-04 17:20:08 +00:00
|
|
|
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [1]
|
2017-07-04 17:20:08 +00:00
|
|
|
emptyCup.continueButton.onClicked: {
|
|
|
|
applicationFlow.state = "brewing"
|
|
|
|
brewing.coffeeName = choosingCoffee.sideBar.currentCoffee
|
|
|
|
brewing.start()
|
|
|
|
}
|
2017-09-25 12:16:02 +00:00
|
|
|
//! [1]
|
2017-07-04 17:20:08 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|