WizardHome: enable keyboard navigation; enable accessibility

This commit is contained in:
rating89us 2021-07-03 16:51:29 +02:00 committed by rating89us
parent b6682330a6
commit 03ba099be4
7 changed files with 127 additions and 6 deletions

View file

@ -35,7 +35,7 @@ import "." 1.0
import "." as MoneroComponents import "." as MoneroComponents
import "effects/" as MoneroEffects import "effects/" as MoneroEffects
RowLayout { Item {
id: checkBox id: checkBox
property alias text: label.text property alias text: label.text
property bool checked: false property bool checked: false
@ -50,10 +50,21 @@ RowLayout {
checkBox.clicked() checkBox.clicked()
} }
Keys.onReturnPressed: toggle()
Keys.onEnterPressed: toggle()
Keys.onSpacePressed: toggle()
Rectangle {
width: itemRectangle.width + 15
height: itemRectangle.height * 1.15
color: checkBox.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
}
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Rectangle{ Rectangle {
id: itemRectangle
height: label.height height: label.height
width: (label.width + indicatorRect.width + checkBox.textMargin) width: (label.width + indicatorRect.width + checkBox.textMargin)
color: "transparent" color: "transparent"

View file

@ -36,6 +36,15 @@ import "../components" as MoneroComponents
Item { Item {
implicitHeight: layout.height implicitHeight: layout.height
implicitWidth: layout.width implicitWidth: layout.width
Keys.onReturnPressed: appWindow.toggleLanguageView()
Keys.onEnterPressed: appWindow.toggleLanguageView()
Rectangle {
width: parent.width * 1.25
height: parent.height
anchors.centerIn: parent
color: parent.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
}
RowLayout { RowLayout {
id: layout id: layout

View file

@ -210,6 +210,7 @@ ApplicationWindow {
passwordDialog.onRejectedCallback = function() { passwordDialog.onRejectedCallback = function() {
if (prevState) { if (prevState) {
appWindow.viewState = prevState; appWindow.viewState = prevState;
if (prevState == "wizard" && wizard.wizardState == "wizardHome") wizard.wizardStateView.wizardHomeView.pageRoot.forceActiveFocus();
} }
if (wizard.wizardState == "wizardOpenWallet1") { if (wizard.wizardState == "wizardOpenWallet1") {
wizard.wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus(); wizard.wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus();
@ -1097,6 +1098,7 @@ ApplicationWindow {
wizard.restart(); wizard.restart();
wizard.wizardState = "wizardHome"; wizard.wizardState = "wizardHome";
rootItem.state = "wizard" rootItem.state = "wizard"
wizard.wizardStateView.wizardHomeView.pageRoot.forceActiveFocus();
// reset balance, clear spendable funds message // reset balance, clear spendable funds message
clearMoneroCardLabelText(); clearMoneroCardLabelText();
leftPanel.minutesToUnlock = ""; leftPanel.minutesToUnlock = "";

View file

@ -166,8 +166,10 @@ Rectangle {
previousView = currentView; previousView = currentView;
// reset push direction // reset push direction
if(wizardController.wizardState == "wizardHome") if (wizardController.wizardState == "wizardHome") {
wizardController.wizardStackView.backTransition = false; wizardController.wizardStackView.backTransition = false;
wizardStateView.wizardHomeView.pageRoot.forceActiveFocus();
}
} }
states: [ states: [

View file

@ -38,6 +38,7 @@ Rectangle {
id: wizardHome id: wizardHome
color: "transparent" color: "transparent"
property alias pageHeight: pageRoot.height property alias pageHeight: pageRoot.height
property alias pageRoot: pageRoot
property string viewName: "wizardHome" property string viewName: "wizardHome"
ColumnLayout { ColumnLayout {
@ -48,6 +49,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter; anchors.horizontalCenter: parent.horizontalCenter;
spacing: 10 spacing: 10
KeyNavigation.tab: wizardHeader
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
@ -61,18 +63,33 @@ Rectangle {
spacing: 10 spacing: 10
WizardHeader { WizardHeader {
id: wizardHeader
Layout.bottomMargin: 7 Layout.bottomMargin: 7
Layout.fillWidth: true Layout.fillWidth: true
title: qsTr("Welcome to Monero") + translationManager.emptyString title: qsTr("Welcome to Monero") + translationManager.emptyString
subtitle: "" subtitle: ""
Accessible.role: Accessible.StaticText
Accessible.name: title
KeyNavigation.up: showAdvancedCheckbox.checked ? kdfRoundsText : showAdvancedCheckbox
KeyNavigation.backtab: showAdvancedCheckbox.checked ? kdfRoundsText : showAdvancedCheckbox
KeyNavigation.down: languageButton
KeyNavigation.tab: languageButton
} }
MoneroComponents.LanguageButton { MoneroComponents.LanguageButton {
id: languageButton
Layout.bottomMargin: 8 Layout.bottomMargin: 8
Accessible.role: Accessible.Button
Accessible.name: qsTr("Selected language ") + persistentSettings.language + translationManager.emptyString
KeyNavigation.up: wizardHeader
KeyNavigation.backtab: wizardHeader
KeyNavigation.down: createNewWalletMenuItem
KeyNavigation.tab: createNewWalletMenuItem
} }
} }
WizardMenuItem { WizardMenuItem {
id: createNewWalletMenuItem
headerText: qsTr("Create a new wallet") + translationManager.emptyString headerText: qsTr("Create a new wallet") + translationManager.emptyString
bodyText: qsTr("Choose this option if this is your first time using Monero.") + translationManager.emptyString bodyText: qsTr("Choose this option if this is your first time using Monero.") + translationManager.emptyString
imageIcon: "qrc:///images/create-wallet.png" imageIcon: "qrc:///images/create-wallet.png"
@ -82,6 +99,13 @@ Rectangle {
wizardController.createWallet(); wizardController.createWallet();
wizardStateView.state = "wizardCreateWallet1" wizardStateView.state = "wizardCreateWallet1"
} }
Accessible.role: Accessible.MenuItem
Accessible.name: headerText + ". " + bodyText
KeyNavigation.up: languageButton
KeyNavigation.backtab: languageButton
KeyNavigation.down: createNewWalletFromHardwareMenuItem
KeyNavigation.tab: createNewWalletFromHardwareMenuItem
} }
Rectangle { Rectangle {
@ -94,6 +118,7 @@ Rectangle {
} }
WizardMenuItem { WizardMenuItem {
id: createNewWalletFromHardwareMenuItem
headerText: qsTr("Create a new wallet from hardware") + translationManager.emptyString headerText: qsTr("Create a new wallet from hardware") + translationManager.emptyString
bodyText: qsTr("Connect your hardware wallet to create a new Monero wallet.") + translationManager.emptyString bodyText: qsTr("Connect your hardware wallet to create a new Monero wallet.") + translationManager.emptyString
imageIcon: "qrc:///images/restore-wallet-from-hardware.png" imageIcon: "qrc:///images/restore-wallet-from-hardware.png"
@ -102,6 +127,13 @@ Rectangle {
wizardController.restart(); wizardController.restart();
wizardStateView.state = "wizardCreateDevice1" wizardStateView.state = "wizardCreateDevice1"
} }
Accessible.role: Accessible.MenuItem
Accessible.name: headerText + ". " + bodyText
KeyNavigation.up: createNewWalletMenuItem
KeyNavigation.backtab: createNewWalletMenuItem
KeyNavigation.down: openWalletFromFileMenuItem
KeyNavigation.tab: openWalletFromFileMenuItem
} }
Rectangle { Rectangle {
@ -114,6 +146,7 @@ Rectangle {
} }
WizardMenuItem { WizardMenuItem {
id: openWalletFromFileMenuItem
headerText: qsTr("Open a wallet from file") + translationManager.emptyString headerText: qsTr("Open a wallet from file") + translationManager.emptyString
bodyText: qsTr("Import an existing .keys wallet file from your computer.") + translationManager.emptyString bodyText: qsTr("Import an existing .keys wallet file from your computer.") + translationManager.emptyString
imageIcon: "qrc:///images/open-wallet-from-file.png" imageIcon: "qrc:///images/open-wallet-from-file.png"
@ -122,6 +155,13 @@ Rectangle {
wizardStateView.state = "wizardOpenWallet1" wizardStateView.state = "wizardOpenWallet1"
wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus(); wizardStateView.wizardOpenWallet1View.pageRoot.forceActiveFocus();
} }
Accessible.role: Accessible.MenuItem
Accessible.name: headerText + ". " + bodyText
KeyNavigation.up: createNewWalletFromHardwareMenuItem
KeyNavigation.backtab: createNewWalletFromHardwareMenuItem
KeyNavigation.down: restoreWalletFromKeysOrSeed
KeyNavigation.tab: restoreWalletFromKeysOrSeed
} }
Rectangle { Rectangle {
@ -134,6 +174,7 @@ Rectangle {
} }
WizardMenuItem { WizardMenuItem {
id: restoreWalletFromKeysOrSeed
headerText: qsTr("Restore wallet from keys or mnemonic seed") + translationManager.emptyString headerText: qsTr("Restore wallet from keys or mnemonic seed") + translationManager.emptyString
bodyText: qsTr("Enter your private keys or 25-word mnemonic seed to restore your wallet.") + translationManager.emptyString bodyText: qsTr("Enter your private keys or 25-word mnemonic seed to restore your wallet.") + translationManager.emptyString
imageIcon: "qrc:///images/restore-wallet.png" imageIcon: "qrc:///images/restore-wallet.png"
@ -142,6 +183,13 @@ Rectangle {
wizardController.restart(); wizardController.restart();
wizardStateView.state = "wizardRestoreWallet1" wizardStateView.state = "wizardRestoreWallet1"
} }
Accessible.role: Accessible.MenuItem
Accessible.name: headerText + ". " + bodyText
KeyNavigation.up: openWalletFromFileMenuItem
KeyNavigation.backtab: openWalletFromFileMenuItem
KeyNavigation.down: changeWalletModeButton
KeyNavigation.tab: changeWalletModeButton
} }
RowLayout { RowLayout {
@ -150,13 +198,22 @@ Rectangle {
spacing: 20 spacing: 20
MoneroComponents.StandardButton { MoneroComponents.StandardButton {
id: changeWalletModeButton
small: true small: true
text: qsTr("Change wallet mode") + translationManager.emptyString text: qsTr("Change wallet mode") + translationManager.emptyString
onClicked: { onClicked: {
wizardController.wizardStackView.backTransition = true; wizardController.wizardStackView.backTransition = true;
wizardController.wizardState = 'wizardModeSelection'; wizardController.wizardState = 'wizardModeSelection';
wizardStateView.wizardModeSelectionView.pageRoot.forceActiveFocus();
} }
Accessible.role: Accessible.Button
Accessible.name: text
KeyNavigation.up: restoreWalletFromKeysOrSeed
KeyNavigation.backtab: restoreWalletFromKeysOrSeed
KeyNavigation.down: showAdvancedCheckbox
KeyNavigation.tab: showAdvancedCheckbox
} }
} }
@ -168,6 +225,13 @@ Rectangle {
checked: false checked: false
text: qsTr("Advanced options") + translationManager.emptyString text: qsTr("Advanced options") + translationManager.emptyString
visible: appWindow.walletMode >= 2 visible: appWindow.walletMode >= 2
Accessible.role: Accessible.CheckBox
Accessible.name: qsTr("Show advanced options") + translationManager.emptyString
KeyNavigation.up: changeWalletModeButton
KeyNavigation.backtab: changeWalletModeButton
KeyNavigation.down: showAdvancedCheckbox.checked ? networkTypeDropdown : wizardHeader
KeyNavigation.tab: showAdvancedCheckbox.checked ? networkTypeDropdown : wizardHeader
} }
ListModel { ListModel {
@ -203,6 +267,8 @@ Rectangle {
} }
appWindow.disconnectRemoteNode() appWindow.disconnectRemoteNode()
} }
KeyNavigation.backtab: showAdvancedCheckbox
KeyNavigation.tab: kdfRoundsText
} }
MoneroComponents.LineEdit { MoneroComponents.LineEdit {
@ -219,6 +285,12 @@ Rectangle {
onTextChanged: { onTextChanged: {
persistentSettings.kdfRounds = parseInt(kdfRoundsText.text) >= 1 ? parseInt(kdfRoundsText.text) : 1; persistentSettings.kdfRounds = parseInt(kdfRoundsText.text) >= 1 ? parseInt(kdfRoundsText.text) : 1;
} }
Accessible.role: Accessible.EditableText
Accessible.name: labelText + text
KeyNavigation.up: networkTypeDropdown
KeyNavigation.backtab: networkTypeDropdown
KeyNavigation.down: wizardHeader
KeyNavigation.tab: wizardHeader
} }
Item { Item {

View file

@ -40,12 +40,36 @@ RowLayout {
Layout.bottomMargin: 10 Layout.bottomMargin: 10
property alias imageIcon: icon.source property alias imageIcon: icon.source
property bool checkbox: false property bool checkbox: false
property bool selected: false
property alias checked: checkboxItem.checked property alias checked: checkboxItem.checked
property alias headerText: header.text property alias headerText: header.text
property alias bodyText: body.text property alias bodyText: body.text
signal menuClicked(); signal menuClicked();
spacing: 10 spacing: 10
function doClick() {
rowlayout.menuClicked();
if (!rowlayout.checkbox) {
rowlayout.focus = false;
}
}
Keys.onReturnPressed: rowlayout.doClick();
Keys.onEnterPressed: rowlayout.doClick();
Keys.onSpacePressed: rowlayout.doClick();
Rectangle {
width: rowlayout.width
height: rowlayout.height
color: rowlayout.focus ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
}
Rectangle {
height: 70
width: 2
color: rowlayout.selected ? MoneroComponents.Style.buttonBackgroundColor : "transparent"
}
Item { Item {
Layout.preferredWidth: 70 Layout.preferredWidth: 70
Layout.preferredHeight: 70 Layout.preferredHeight: 70
@ -82,7 +106,7 @@ RowLayout {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
rowlayout.menuClicked(); rowlayout.doClick();
} }
} }
} }
@ -113,7 +137,7 @@ RowLayout {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
rowlayout.menuClicked(); rowlayout.doClick();
} }
} }
} }
@ -138,7 +162,7 @@ RowLayout {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
rowlayout.menuClicked(); rowlayout.doClick();
} }
} }
} }

View file

@ -39,6 +39,7 @@ Rectangle {
color: "transparent" color: "transparent"
property alias pageHeight: pageRoot.height property alias pageHeight: pageRoot.height
property alias pageRoot: pageRoot
property string viewName: "wizardModeSelection1" property string viewName: "wizardModeSelection1"
property bool portable: persistentSettings.portable property bool portable: persistentSettings.portable