Compare commits

...

2 Commits

Author SHA1 Message Date
Roberto Viola
54cdd3aa0c added age and heart rate UI in the wizard 2021-12-22 17:33:30 +01:00
Roberto Viola
ed73d115eb adding first pages of the wizard 2021-12-22 09:57:58 +01:00
7 changed files with 411 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ HomeForm{
}
lap.onClicked: { lap_clicked(); popupLap.open(); popupLapAutoClose.running = true; }
Component.onCompleted: { console.log("completed"); }
Component.onCompleted: { stackView.push("Wizard_10_Welcome.qml") }
GridView {
anchors.horizontalCenter: parent.horizontalCenter

48
src/Wizard_10_Welcome.qml Normal file
View File

@@ -0,0 +1,48 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
Page {
background: Material.color
Label {
id: welcome
horizontalAlignment: Text.AlignHCenter
topPadding: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: "Welcome to QZ Fitness!"
font.pointSize: 30
}
Label {
topPadding: 20
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
text: "I will help you in the\nsetup process of the app\n\nI just need to answer some\nquestions.\n\nDon't worry! You will be able to change them\nin the settings!"
font.pointSize: 18
}
Button {
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
text: "Skip"
onClicked: stackView.pop();
}
Button {
anchors.rightMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Next"
onClicked: stackView.push("Wizard_11_Age.qml");
}
}

76
src/Wizard_11_Age.qml Normal file
View File

@@ -0,0 +1,76 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
Page {
Settings{
property string wizard_machinery_type: "bike"
}
background: Material.color
Label {
id: welcome
horizontalAlignment: Text.AlignHCenter
topPadding: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: "Age"
font.pointSize: 30
}
Label {
id: question
topPadding: 20
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
text: "Simple question: how old are you?"
font.pointSize: 18
}
TextField {
anchors.top: question.bottom
id: ageTextField
text: settings.age
horizontalAlignment: Text.AlignHCenter
inputMethodHints: Qt.ImhFormattedNumbersOnly
onTextChanged: settings.age = ageTextField.text
onActiveFocusChanged: if(this.focus) this.cursorPosition = this.text.length
}
Button {
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
text: "Back"
onClicked: stackView.pop();
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
text: "Skip"
onClicked: stackView.pop(stackView.find(function(item) {
return item.objectName === "home";
}));
}
Button {
id: next
anchors.rightMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Next"
onClicked: {
stackView.push("Wizard_20_MachineryType.qml")
}
}
}

View File

@@ -0,0 +1,90 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
Page {
Settings{
property string wizard_machinery_type: "bike"
}
background: Material.color
Label {
id: welcome
horizontalAlignment: Text.AlignHCenter
topPadding: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: "Fitness Machine"
font.pointSize: 30
}
Label {
id: question
topPadding: 20
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
text: "Which Fitness Machine do you have\ndo you use the most?"
font.pointSize: 18
}
Column {
anchors.top: question.bottom
topPadding: 20
RadioButton {
id: bike
checked: true
text: qsTr("Spin bike")
}
RadioButton {
id: treadmill
text: qsTr("Treadmill")
}
RadioButton {
id: rower
text: qsTr("Rower")
}
RadioButton {
id: elliptical
text: qsTr("Elliptical")
}
}
Button {
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
text: "Back"
onClicked: stackView.pop();
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
text: "Skip"
onClicked: stackView.pop(stackView.find(function(item) {
return item.objectName === "home";
}));
}
Button {
id: next
anchors.rightMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Next"
onClicked: {
if(bike.checked == false) {
stackView.push("Wizard_900_HeartRate.qml")
}
}
}
}

View File

@@ -0,0 +1,141 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
import QtQuick.Layouts 1.3
ScrollView {
contentWidth: -1
focus: true
anchors.horizontalCenter: parent.horizontalCenter
anchors.fill: parent
Settings {
property string heart_rate_belt_name: "Disabled"
}
background: Material.color
ColumnLayout {
id: column1
spacing: 0
anchors.fill: parent
Label {
id: welcome
horizontalAlignment: Text.AlignHCenter
topPadding: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: "Heart Rate Sensor"
font.pointSize: 30
}
Label {
id: question
topPadding: 20
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
text: "Do you have an heart rate sensor?"
font.pointSize: 18
}
Column {
anchors.top: question.bottom
topPadding: 20
RadioButton {
id: builtin
text: qsTr("Yes, it's built-in in the machinery")
onClicked: {
heartBeltNameTextField.enabled = false;
okHeartBeltNameButton.enabled = false;
refreshHeartBeltNameButton.enabled = false;
settings.heart_rate_belt_name = "Disabled";
}
}
RadioButton {
id: applewatch
text: qsTr("Yes, I have an Apple Watch")
onClicked: {
heartBeltNameTextField.enabled = false;
okHeartBeltNameButton.enabled = false;
refreshHeartBeltNameButton.enabled = false;
settings.heart_rate_belt_name = "Disabled";
}
}
RadioButton {
id: yes
checked: true
text: qsTr("Yes, it's bluetooth")
onClicked: {
heartBeltNameTextField.enabled = true;
okHeartBeltNameButton.enabled = true;
refreshHeartBeltNameButton.enabled = true;
}
}
ComboBox {
id: heartBeltNameTextField
model: rootItem.bluetoothDevices
displayText: settings.heart_rate_belt_name
Layout.fillHeight: false
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onActivated: {
console.log("combomodel activated" + heartBeltNameTextField.currentIndex)
displayText = heartBeltNameTextField.currentValue
settings.heart_rate_belt_name = heartBeltNameTextField.displayText;
}
}
Button {
id: refreshHeartBeltNameButton
text: "Refresh Devices List"
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onClicked: refresh_bluetooth_devices_clicked();
}
RadioButton {
id: no
text: qsTr("No")
onClicked: {
heartBeltNameTextField.enabled = false;
okHeartBeltNameButton.enabled = false;
refreshHeartBeltNameButton.enabled = false;
settings.heart_rate_belt_name = "Disabled";
}
}
}
Button {
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
text: "Back"
onClicked: stackView.pop();
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
text: "Skip"
onClicked: stackView.pop(stackView.find(function(item) {
return item.objectName === "home";
}));
}
Button {
id: next
anchors.rightMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Next"
onClicked: {
stackView.push("Wizard_999_Finish.qml")
}
}
}
}

50
src/Wizard_999_Finish.qml Normal file
View File

@@ -0,0 +1,50 @@
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.12
import QtQuick.Window 2.12
import Qt.labs.settings 1.0
import Qt.labs.platform 1.1
Page {
background: Material.color
Label {
id: welcome
horizontalAlignment: Text.AlignHCenter
topPadding: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
text: "Everything is done!"
font.pointSize: 30
}
Label {
topPadding: 20
horizontalAlignment: Text.AlignHCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: welcome.bottom
text: "Just click finish and start to use QZ"
font.pointSize: 18
}
Button {
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
text: "Skip"
onClicked: stackView.pop();
}
Button {
anchors.rightMargin: 20
anchors.bottomMargin: 20
anchors.bottom: parent.bottom
anchors.right: parent.right
text: "Finish"
onClicked: stackView.pop(stackView.find(function(item) {
return item.objectName === "home";
}));
}
}

View File

@@ -41,5 +41,10 @@
<file>inner_templates/chartjs/ajax-loader.gif</file>
<file>Classifica.qml</file>
<file>Credits.qml</file>
<file>Wizard_10_Welcome.qml</file>
<file>Wizard_20_MachineryType.qml</file>
<file>Wizard_999_Finish.qml</file>
<file>Wizard_900_HeartRate.qml</file>
<file>Wizard_11_Age.qml</file>
</qresource>
</RCC>