diff --git a/src/commoncomponents/PhotoboothView.qml b/src/commoncomponents/PhotoboothView.qml index ccd71b0305abc1409a7d88a960c3cbe456480a5d..0ad3c88f52a7cdc9b9f66c11de40c069a745de84 100644 --- a/src/commoncomponents/PhotoboothView.qml +++ b/src/commoncomponents/PhotoboothView.qml @@ -56,7 +56,10 @@ Item { } function focusOnPreviousPhotoBoothItem () { - importButton.forceActiveFocus() + if (isPreviewing) + clearButton.forceActiveFocus() + else + importButton.forceActiveFocus() } onVisibleChanged: { @@ -231,28 +234,35 @@ Item { Layout.alignment: Qt.AlignHCenter - visible: LRCInstance.currentAccountAvatarSet + visible: isPreviewing || LRCInstance.currentAccountAvatarSet radius: JamiTheme.primaryRadius source: JamiResources.round_close_24dp_svg - toolTipText: JamiStrings.clearAvatar + toolTipText: isPreviewing ? JamiStrings.stopTakingPhoto : + JamiStrings.clearAvatar imageColor: JamiTheme.textColor - KeyNavigation.tab: importButton KeyNavigation.up: takePhotoButton - KeyNavigation.down: KeyNavigation.tab Keys.onPressed: function (keyEvent) { if (keyEvent.matches(StandardKey.InsertParagraphSeparator)) { clicked() takePhotoButton.forceActiveFocus() keyEvent.accepted = true + } else if (keyEvent.matches(StandardKey.MoveToNextLine) || + keyEvent.key === Qt.Key_Tab) { + if (isPreviewing) { + root.focusOnNextItem() + } else + importButton.forceActiveFocus() + keyEvent.accepted = true } } onClicked: { stopBooth() - AccountAdapter.setCurrentAccountAvatarBase64() + if (!isPreviewing) + AccountAdapter.setCurrentAccountAvatarBase64() } } @@ -265,6 +275,8 @@ Item { Layout.alignment: Qt.AlignHCenter + visible: !isPreviewing + radius: JamiTheme.primaryRadius source: JamiResources.round_folder_24dp_svg toolTipText: JamiStrings.importFromFile diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml index 7bb9e5e9cdac4a9d9e44b2e23eee4d478cc82313..5d136c349423cccd43b73ed14546022f8b647add 100644 --- a/src/constant/JamiStrings.qml +++ b/src/constant/JamiStrings.qml @@ -422,6 +422,7 @@ Item { // PhotoBoothView property string chooseAvatarImage: qsTr("Choose a picture as avatar") property string importFromFile: qsTr("Import avatar from image file") + property string stopTakingPhoto: qsTr("Stop taking photo") property string clearAvatar: qsTr("Clear avatar image") property string takePhoto: qsTr("Take photo") diff --git a/src/wizardview/components/ProfilePage.qml b/src/wizardview/components/ProfilePage.qml index 69a0fae71d95550c96e0912bf45f2109e0680ba7..c5d187b2716039642a078a8e5a3ee7e5bf4b5b14 100644 --- a/src/wizardview/components/ProfilePage.qml +++ b/src/wizardview/components/ProfilePage.qml @@ -103,6 +103,7 @@ Rectangle { Layout.alignment: Qt.AlignCenter + enabled: !saveProfileBtn.spinnerTriggered imageId: createdAccountId avatarSize: 200 @@ -134,6 +135,7 @@ Rectangle { focus: visible selectByMouse: true + enabled: !saveProfileBtn.spinnerTriggered placeholderText: { if (WizardViewStepModel.accountCreationOption !== WizardViewStepModel.AccountCreationOption.CreateRendezVous) diff --git a/tests/qml/src/tst_WizardView.qml b/tests/qml/src/tst_WizardView.qml index 9049cbad6c66641601b12c142951a48770dfb36a..ac0889f4ebc400a1a88e67e54fb71cee0ff8cefc 100644 --- a/tests/qml/src/tst_WizardView.qml +++ b/tests/qml/src/tst_WizardView.qml @@ -1514,6 +1514,56 @@ WizardView { keyClick(Qt.Key_Enter) compare(takePhotoButton.focus, true) + // Taking photo focus test + setAvatarWidget.isPreviewing = true + + keyClick(Qt.Key_Tab) + compare(photoboothViewClearButton.focus, true) + + keyClick(Qt.Key_Tab) + compare(aliasEdit.focus, true) + + keyClick(Qt.Key_Tab) + compare(saveProfileBtn.focus, true) + + keyClick(Qt.Key_Tab) + compare(skipProfileSavingButton.focus, true) + + keyClick(Qt.Key_Tab) + compare(takePhotoButton.focus, true) + + keyClick(Qt.Key_Down) + compare(photoboothViewClearButton.focus, true) + + keyClick(Qt.Key_Down) + compare(aliasEdit.focus, true) + + keyClick(Qt.Key_Down) + compare(saveProfileBtn.focus, true) + + keyClick(Qt.Key_Down) + compare(skipProfileSavingButton.focus, true) + + keyClick(Qt.Key_Down) + compare(takePhotoButton.focus, true) + + keyClick(Qt.Key_Up) + compare(skipProfileSavingButton.focus, true) + + keyClick(Qt.Key_Up) + compare(saveProfileBtn.focus, true) + + keyClick(Qt.Key_Up) + compare(aliasEdit.focus, true) + + keyClick(Qt.Key_Up) + compare(photoboothViewClearButton.focus, true) + + keyClick(Qt.Key_Up) + compare(takePhotoButton.focus, true) + + setAvatarWidget.isPreviewing = false + WizardViewStepModel.nextStep() var showBackup = (WizardViewStepModel.accountCreationOption ===