Commit 7a411e5f authored by Artem Sidyakin's avatar Artem Sidyakin
Browse files

First commit

parents
**/build-*/*
*.pro.user*
*.qmlc
import QtQuick 2.11
Item {
id: root
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: Styles.backgroundColor
anchors.fill: parent
Image {
id: background
x: 12
y: 170
source: "qrc:/images/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: "qrc:/images/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: "qrc:/images/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: "qrc:/images/liquid_coffee.png"
}
}
Image {
id: cupFront
x: 11
y: 170
source: "qrc:/images/coffee_cup_front.png"
}
Text {
x: 499
y: 370
color: "#ffffff"
text: qsTr("Hot Milk")
font.capitalization: Font.AllUppercase
wrapMode: Text.WrapAnywhere
font.pixelSize: 18
visible: root.showLabels
}
Text {
x: 486
y: 468
color: "#ffffff"
text: qsTr("Espresso Coffee")
font.capitalization: Font.AllUppercase
wrapMode: Text.WrapAnywhere
font.pixelSize: 18
visible: root.showLabels
}
Image {
x: 414
y: 274
visible: root.showLabels
source: "qrc:/images/line.png"
}
Text {
x: 512
y: 259
color: "#ffffff"
text: qsTr("Milk Foam")
wrapMode: Text.WrapAnywhere
font.pixelSize: 18
font.capitalization: Font.AllUppercase
visible: root.showLabels
}
Image {
x: 404
y: 382
source: "qrc:/images/line.png"
visible: root.showLabels
}
Image {
x: 388
y: 482
source: "qrc:/images/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
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: "qrc:/images/coffee_cup_large.png"
}
}
import QtQuick 2.11
Row {
id: row
signal clicked
property alias text: label.text
property alias textSize: label.font.pixelSize
property bool forward: true
layoutDirection: row.forward ? Qt.LeftToRight : Qt.RightToLeft
spacing: 10
Text {
id: label
color: Styles.labelColor
}
Image {
id: image
height: label.height
anchors.verticalCenter: parent.verticalCenter
source: row.forward ? "qrc:/images/forward.png" : "qrc:/images/back.png"
fillMode: Image.PreserveAspectFit
scale: mouseArea.containsMouse ? 1.1 : 1
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
Connections {
target: mouseArea
onClicked: row.clicked()
}
}
}
}
import QtQuick 2.11
Item {
id: root
signal brewingReady
Rectangle {
anchors.fill: parent
color: Styles.backgroundColor
Cup {
anchors.fill: parent
}
// debug
MouseArea {
anchors.fill: parent
onClicked: {
root.brewingReady()
}
}
}
}
import QtQuick 2.11
import QtQuick.Layouts 1.11
Item {
id: root
state: "choosing"
signal choiceReady
RowLayout {
anchors.fill: parent
spacing: 0
Rectangle {
id: leftSideBar
Layout.preferredWidth: parent.width * 0.3
Layout.maximumWidth: 300
Layout.fillHeight: true
color: Styles.sideBarColor
}
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Styles.backgroundColor
// debug
MouseArea {
anchors.fill: parent
onClicked: {
root.state = "customising"
}
}
}
Rectangle {
id: rightSideBar
Layout.preferredWidth: parent.width * 0.3
Layout.maximumWidth: 300
Layout.fillHeight: true
color: Styles.sideBarColor
// debug
MouseArea {
anchors.fill: parent
onClicked: {
root.choiceReady()
}
}
}
}
states: [
State {
name: "choosing"
PropertyChanges { target: leftSideBar; visible: true }
PropertyChanges { target: rightSideBar; visible: false }
},
State {
name: "customising"
PropertyChanges { target: leftSideBar; visible: false }
PropertyChanges { target: rightSideBar; visible: true }
}
]
}
QT += quick
CONFIG += c++11
# 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
SOURCES += \
main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
import QtQuick 2.11
import QtQuick.Layouts 1.11
Item {
id: root
signal cupReady
Rectangle {
anchors.fill: parent
color: Styles.backgroundColor
ColumnLayout {
anchors.centerIn: parent
Text {
Layout.bottomMargin: 30
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: qsTr("PLEASE, INSERT CUP INTO TRAY")
color: Styles.labelColor
font.pixelSize: image.height / 10
}
Image {
id: image
Layout.preferredHeight: root.height * 0.6
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
fillMode: Image.PreserveAspectFit
source: "qrc:/images/coffee_cup_outline.png"
}
NavigationButton {
Layout.topMargin: 30
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: qsTr("CONTINUE")
textSize: image.height / 10
onClicked: {
root.cupReady()
}
}
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment