2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-05-23 11:29:58 +00:00
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-05-23 11:29:58 +00:00
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import shared 1.0
|
2022-03-07 22:59:38 +00:00
|
|
|
import shared.controls 1.0
|
2024-10-21 22:01:34 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.stores 1.0
|
2024-10-16 07:56:23 +00:00
|
|
|
import shared.validators 1.0
|
2022-07-14 11:03:36 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
import "../popups"
|
|
|
|
import "../stores"
|
2022-05-23 11:29:58 +00:00
|
|
|
import "../shared"
|
2022-03-07 22:59:38 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
2023-12-27 13:09:06 +00:00
|
|
|
objectName: "onboardingInsertDetailsView"
|
2022-07-20 12:34:44 +00:00
|
|
|
|
2024-04-24 16:31:22 +00:00
|
|
|
property StartupStore startupStore
|
2024-10-21 22:01:34 +00:00
|
|
|
property UtilsStore utilsStore
|
2022-03-07 22:59:38 +00:00
|
|
|
|
2022-03-29 19:15:42 +00:00
|
|
|
Component.onCompleted: {
|
2022-07-20 12:34:44 +00:00
|
|
|
nameInput.text = root.startupStore.getDisplayName();
|
2022-08-11 11:55:08 +00:00
|
|
|
userImage.asset.name = root.startupStore.getCroppedProfileImage();
|
2024-04-24 16:31:22 +00:00
|
|
|
nameInput.input.edit.forceActiveFocus()
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
|
2023-04-03 09:15:34 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
function doAction() {
|
2024-04-24 16:31:22 +00:00
|
|
|
if (!nextBtn.enabled) {
|
2023-04-03 09:15:34 +00:00
|
|
|
return
|
|
|
|
}
|
2024-04-24 16:31:22 +00:00
|
|
|
root.startupStore.setDisplayName(nameInput.text)
|
2023-04-03 09:15:34 +00:00
|
|
|
root.startupStore.doPrimaryAction()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
ColumnLayout {
|
2022-05-25 15:24:01 +00:00
|
|
|
height: 461
|
2022-06-20 09:50:57 +00:00
|
|
|
anchors.centerIn: parent
|
2022-03-07 22:59:38 +00:00
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: usernameText
|
2024-01-11 14:47:59 +00:00
|
|
|
objectName: "onboardingHeaderText"
|
2022-03-07 22:59:38 +00:00
|
|
|
text: qsTr("Your profile")
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 22
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: txtDesc
|
2022-07-20 12:34:44 +00:00
|
|
|
Layout.preferredWidth: root.state === Constants.startupState.userProfileCreate? 338 : 643
|
2022-06-01 15:52:23 +00:00
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
Layout.topMargin: Theme.smallPadding
|
|
|
|
color: Theme.palette.secondaryText
|
2022-03-07 22:59:38 +00:00
|
|
|
text: qsTr("Longer and unusual names are better as they are less likely to be used by someone else.")
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: 15
|
2022-07-27 11:30:35 +00:00
|
|
|
lineHeight: 1.2
|
|
|
|
font.letterSpacing: -0.2
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
2022-07-27 13:17:33 +00:00
|
|
|
Layout.preferredWidth: 86
|
|
|
|
Layout.preferredHeight: 86
|
2022-06-01 15:52:23 +00:00
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
Layout.topMargin: Theme.bigPadding
|
2022-03-07 22:59:38 +00:00
|
|
|
StatusSmartIdenticon {
|
|
|
|
id: userImage
|
2022-08-18 07:38:47 +00:00
|
|
|
objectName: "welcomeScreenUserProfileImage"
|
2024-04-24 16:31:22 +00:00
|
|
|
anchors.left: parent.left
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.width: 86
|
|
|
|
asset.height: 86
|
|
|
|
asset.letterSize: 32
|
2024-04-24 16:31:22 +00:00
|
|
|
asset.color: Utils.colorForColorId(0) // We haven't generated the keys yet, show default color
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.charactersLen: 2
|
|
|
|
asset.isImage: !!asset.name
|
|
|
|
asset.imgIsIdenticon: false
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
StatusRoundButton {
|
|
|
|
id: updatePicButton
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
2022-06-01 15:52:23 +00:00
|
|
|
anchors.rightMargin: -20
|
2022-03-07 22:59:38 +00:00
|
|
|
type: StatusFlatRoundButton.Type.Secondary
|
|
|
|
icon.name: "add"
|
|
|
|
onClicked: {
|
2022-06-01 15:52:23 +00:00
|
|
|
cropperModal.chooseImageToCrop();
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-01 15:52:23 +00:00
|
|
|
Item {
|
|
|
|
id: nameInputItem
|
2022-07-27 11:30:35 +00:00
|
|
|
Layout.preferredWidth: 328
|
2022-07-27 13:17:33 +00:00
|
|
|
Layout.preferredHeight: 66
|
2022-06-01 15:52:23 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
|
|
Layout.topMargin: 37
|
|
|
|
StatusInput {
|
|
|
|
id: nameInput
|
2022-07-29 22:51:34 +00:00
|
|
|
input.edit.objectName: "onboardingDisplayNameInput"
|
2022-06-01 15:52:23 +00:00
|
|
|
width: parent.width
|
2022-07-22 10:28:04 +00:00
|
|
|
placeholderText: qsTr("Display name")
|
2023-05-02 13:37:31 +00:00
|
|
|
input.clearable: true
|
2022-06-01 15:52:23 +00:00
|
|
|
errorMessageCmp.wrapMode: Text.NoWrap
|
|
|
|
errorMessageCmp.horizontalAlignment: Text.AlignHCenter
|
2024-10-16 07:56:23 +00:00
|
|
|
validators: displayNameValidators.validators
|
2022-06-01 15:52:23 +00:00
|
|
|
onTextChanged: {
|
|
|
|
userImage.name = text;
|
|
|
|
}
|
2023-04-03 09:15:34 +00:00
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
2022-06-01 15:52:23 +00:00
|
|
|
event.accepted = true
|
2023-04-03 09:15:34 +00:00
|
|
|
d.doAction()
|
2022-06-01 15:52:23 +00:00
|
|
|
}
|
2022-05-10 15:42:35 +00:00
|
|
|
}
|
2024-10-16 07:56:23 +00:00
|
|
|
|
|
|
|
DisplayNameValidators {
|
|
|
|
id: displayNameValidators
|
2024-10-21 22:01:34 +00:00
|
|
|
|
|
|
|
utilsStore: root.utilsStore
|
2024-10-16 07:56:23 +00:00
|
|
|
}
|
2022-05-10 15:42:35 +00:00
|
|
|
}
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
|
2022-06-01 15:52:23 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
|
2022-03-07 22:59:38 +00:00
|
|
|
StatusButton {
|
2022-05-10 15:42:35 +00:00
|
|
|
id: nextBtn
|
2022-07-29 22:51:34 +00:00
|
|
|
objectName: "onboardingDetailsViewNextButton"
|
2022-07-27 11:30:35 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-04-01 08:06:39 +00:00
|
|
|
enabled: !!nameInput.text && nameInput.valid
|
2022-07-27 11:30:35 +00:00
|
|
|
font.weight: Font.Medium
|
2022-03-07 22:59:38 +00:00
|
|
|
text: qsTr("Next")
|
|
|
|
onClicked: {
|
2023-04-03 09:15:34 +00:00
|
|
|
d.doAction()
|
|
|
|
}
|
|
|
|
Keys.onPressed: {
|
|
|
|
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
|
|
event.accepted = true
|
|
|
|
d.doAction()
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-01 14:00:57 +00:00
|
|
|
ImageCropWorkflow {
|
2022-05-23 11:29:58 +00:00
|
|
|
id: cropperModal
|
2024-02-13 17:11:11 +00:00
|
|
|
objectName: "imageCropWorkflow"
|
2022-05-31 09:07:45 +00:00
|
|
|
imageFileDialogTitle: qsTr("Choose an image for profile picture")
|
|
|
|
title: qsTr("Profile picture")
|
|
|
|
acceptButtonText: qsTr("Make this my profile picture")
|
2022-05-23 11:29:58 +00:00
|
|
|
onImageCropped: {
|
2022-07-20 12:34:44 +00:00
|
|
|
const croppedImg = root.startupStore.generateImage(image,
|
2022-06-01 15:52:23 +00:00
|
|
|
cropRect.x.toFixed(),
|
|
|
|
cropRect.y.toFixed(),
|
|
|
|
(cropRect.x + cropRect.width).toFixed(),
|
|
|
|
(cropRect.y + cropRect.height).toFixed());
|
2022-08-11 11:55:08 +00:00
|
|
|
userImage.asset.name = croppedImg;
|
2022-04-04 12:45:27 +00:00
|
|
|
}
|
2022-03-07 22:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|