Skip to content

Commit

Permalink
Finished screen: How you found us
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Dec 13, 2023
1 parent 3b7685c commit 87357d2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
34 changes: 30 additions & 4 deletions app/qml/onboarding/MMHowYouFoundUs.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ import QtQuick.Layouts
import QtQuick.Controls

import "../components"
import "../inputs"

Page {
id: root

width: parent.width

property string selectedText: ""

signal backClicked
signal continueClicked
signal continueClicked(var selectedText)

readonly property string headerTitle: qsTr("How did you learn about us?")
readonly property real hPadding: width < __style.maxPageWidth
Expand All @@ -45,7 +48,7 @@ Page {

Item {
width: parent.width
height: parent.height - header.height - 40 * __dp
height: parent.height - (listView.model.count === listView.currentIndex + 1 ? header.height + 50 * __dp : 0)
anchors.top: header.bottom
anchors.topMargin: 20 * __dp

Expand All @@ -58,6 +61,8 @@ Page {
spacing: 10 * __dp
clip: true

Component.onCompleted: currentIndex = -1

model: ListModel {
Component.onCompleted: {
listView.model.append({name: qsTr("Search engine (Google, ...)"), icon: __style.searchIcon, submenu: false})
Expand Down Expand Up @@ -99,7 +104,28 @@ Page {
small: model.submenu
checked: listView.currentIndex === index

onClicked: listView.currentIndex = index
onClicked: {
root.selectedText = model.name
listView.currentIndex = index

if(listView.model.count === listView.currentIndex + 1)
listView.positionViewAtEnd()
}
}

footer: Column {
width: root.width - 2 * root.hPadding
topPadding: 20 * __dp
visible: listView.model.count === listView.currentIndex + 1

MMInputEditor {
title: qsTr("Source")
placeholderText: qsTr("Please specify the source")
onTextChanged: root.selectedText = text
onVisibleChanged: if(visible) hasFocus = true
}

Item { width: 1; height: 60 * __dp }
}
}
}
Expand All @@ -111,6 +137,6 @@ Page {
anchors.bottomMargin: 20 * __dp
text: qsTr("Continue")

onClicked: root.continueClicked()
onClicked: root.continueClicked(root.selectedText)
}
}
7 changes: 5 additions & 2 deletions gallery/qml/pages/OnboardingPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ Page {
id: howYouFoundUs

anchors.fill: parent
//visible: false
visible: false

onContinueClicked: visible = false
onBackClicked: visible = false
onContinueClicked: function(selectedText) {
console.log("Selected: " + selectedText)
visible = false
}
}


Expand Down

0 comments on commit 87357d2

Please sign in to comment.