Virtual keyboard and logic

This commit is contained in:
Zach Fox 2017-08-29 15:27:53 -07:00
parent 50241078ae
commit c7ad875485
4 changed files with 125 additions and 35 deletions

View file

@ -877,7 +877,7 @@ Rectangle {
if (root.purchasesReceived && root.balanceReceived) { if (root.purchasesReceived && root.balanceReceived) {
if (root.balanceAfterPurchase < 0) { if (root.balanceAfterPurchase < 0) {
if (root.alreadyOwned) { if (root.alreadyOwned) {
buyText.text = "You do not have enough HFC to purchase this item again. Go to your Purchases to view the copy you own."; buyText.text = "You do not have enough HFC to purchase this item again. Go to your <b>Purchases</b> to view the copy you own.";
} else { } else {
buyText.text = "You do not have enough HFC to purchase this item."; buyText.text = "You do not have enough HFC to purchase this item.";
} }

View file

@ -74,6 +74,26 @@ Item {
text = ""; text = "";
} }
} }
onFocusChanged: {
if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
} else if (!passphraseFieldAgain.focus) {
sendMessageToLightbox({method: 'walletSetup_lowerKeyboard'});
}
}
MouseArea {
anchors.fill: parent;
onClicked: {
parent.focus = true;
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
}
}
onAccepted: {
passphraseFieldAgain.focus = true;
}
} }
HifiControlsUit.TextField { HifiControlsUit.TextField {
id: passphraseFieldAgain; id: passphraseFieldAgain;
@ -90,6 +110,26 @@ Item {
text = ""; text = "";
} }
} }
onFocusChanged: {
if (focus) {
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
} else if (!passphraseField.focus) {
sendMessageToLightbox({method: 'walletSetup_lowerKeyboard'});
}
}
MouseArea {
anchors.fill: parent;
onClicked: {
parent.focus = true;
sendMessageToLightbox({method: 'walletSetup_raiseKeyboard'});
}
}
onAccepted: {
focus = false;
}
} }
// Security Image // Security Image

View file

@ -28,6 +28,7 @@ Rectangle {
property string activeView: "initialize"; property string activeView: "initialize";
property bool securityImageResultReceived: false; property bool securityImageResultReceived: false;
property bool keyFilePathIfExistsResultReceived: false; property bool keyFilePathIfExistsResultReceived: false;
property bool keyboardRaised: false;
// Style // Style
color: hifi.colors.baseGray; color: hifi.colors.baseGray;
@ -57,27 +58,6 @@ Rectangle {
id: securityImageModel; id: securityImageModel;
} }
Connections {
target: walletSetupLightbox;
onSendSignalToWallet: {
if (msg.method === 'walletSetup_cancelClicked') {
walletSetupLightbox.visible = false;
} else if (msg.method === 'walletSetup_finished') {
root.activeView = "walletHome";
} else {
sendToScript(msg);
}
}
}
Connections {
target: notSetUp;
onSendSignalToWallet: {
if (msg.method === 'setUpClicked') {
walletSetupLightbox.visible = true;
}
}
}
Rectangle { Rectangle {
id: walletSetupLightboxContainer; id: walletSetupLightboxContainer;
visible: walletSetupLightbox.visible || passphraseSelectionLightbox.visible || securityImageSelectionLightbox.visible; visible: walletSetupLightbox.visible || passphraseSelectionLightbox.visible || securityImageSelectionLightbox.visible;
@ -89,29 +69,51 @@ Rectangle {
WalletSetupLightbox { WalletSetupLightbox {
id: walletSetupLightbox; id: walletSetupLightbox;
visible: false; visible: false;
z: 999; z: 998;
anchors.centerIn: walletSetupLightboxContainer; anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50; width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50; height: walletSetupLightboxContainer.height - 50;
Connections {
onSendSignalToWallet: {
if (msg.method === 'walletSetup_cancelClicked') {
walletSetupLightbox.visible = false;
} else if (msg.method === 'walletSetup_finished') {
root.activeView = "walletHome";
} else if (msg.method === 'walletSetup_raiseKeyboard') {
root.keyboardRaised = true;
} else if (msg.method === 'walletSetup_lowerKeyboard') {
root.keyboardRaised = false;
} else {
sendToScript(msg);
}
}
}
} }
PassphraseSelectionLightbox { PassphraseSelectionLightbox {
id: passphraseSelectionLightbox; id: passphraseSelectionLightbox;
visible: false; visible: false;
z: 999; z: 998;
anchors.centerIn: walletSetupLightboxContainer; anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50; width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50; height: walletSetupLightboxContainer.height - 50;
Connections { Connections {
onSendSignalToWallet: { onSendSignalToWallet: {
sendToScript(msg); if (msg.method === 'walletSetup_raiseKeyboard') {
root.keyboardRaised = true;
} else if (msg.method === 'walletSetup_lowerKeyboard') {
root.keyboardRaised = false;
} else {
sendToScript(msg);
}
} }
} }
} }
SecurityImageSelectionLightbox { SecurityImageSelectionLightbox {
id: securityImageSelectionLightbox; id: securityImageSelectionLightbox;
visible: false; visible: false;
z: 999; z: 998;
anchors.centerIn: walletSetupLightboxContainer; anchors.centerIn: walletSetupLightboxContainer;
width: walletSetupLightboxContainer.width - 50; width: walletSetupLightboxContainer.width - 50;
height: walletSetupLightboxContainer.height - 50; height: walletSetupLightboxContainer.height - 50;
@ -192,6 +194,14 @@ Rectangle {
anchors.bottom: tabButtonsContainer.top; anchors.bottom: tabButtonsContainer.top;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
Connections {
onSendSignalToWallet: {
if (msg.method === 'setUpClicked') {
walletSetupLightbox.visible = true;
}
}
}
} }
WalletHome { WalletHome {
@ -231,14 +241,14 @@ Rectangle {
anchors.leftMargin: 16; anchors.leftMargin: 16;
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: 16; anchors.rightMargin: 16;
}
Connections { Connections {
target: security; onSendSignalToWallet: {
onSendSignalToWallet: { if (msg.method === 'walletSecurity_changePassphrase') {
if (msg.method === 'walletSecurity_changePassphrase') { passphraseSelectionLightbox.visible = true;
passphraseSelectionLightbox.visible = true; } else if (msg.method === 'walletSecurity_changeSecurityImage') {
} else if (msg.method === 'walletSecurity_changeSecurityImage') { securityImageSelectionLightbox.visible = true;
securityImageSelectionLightbox.visible = true; }
} }
} }
} }
@ -467,7 +477,47 @@ Rectangle {
} }
// //
// TAB BUTTONS END // TAB BUTTONS END
// //
Item {
id: keyboardContainer;
z: 999;
visible: keyboard.raised;
anchors {
bottom: parent.bottom;
left: parent.left;
right: parent.right;
}
Image {
id: lowerKeyboardButton;
source: "images/lowerKeyboard.png";
anchors.horizontalCenter: parent.horizontalCenter;
anchors.bottom: keyboard.top;
height: 30;
width: 120;
MouseArea {
anchors.fill: parent;
onClicked: {
root.keyboardRaised = false;
}
}
}
HifiControlsUit.Keyboard {
id: keyboard;
property bool punctuationMode: false;
raised: HMD.mounted && root.keyboardRaised;
numeric: keyboard.punctuationMode;
anchors {
bottom: parent.bottom;
left: parent.left;
right: parent.right;
}
}
}
// //
// FUNCTION DEFINITIONS START // FUNCTION DEFINITIONS START

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B