Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
LW: update following upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielhourt authored and vikramrajkumar committed Feb 9, 2015
1 parent 6fe07a3 commit 223ed14
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 110 deletions.
181 changes: 92 additions & 89 deletions programs/light_wallet/qml/BackupLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,112 @@ import QtQuick 2.3
import Material 0.1

Dialog {
id: backupLayout
z: 20
anchors.fill: parent
id: backupDialog
title: qsTr("Keep it secret. Keep it safe.")
positiveBtnText: qsTr("Next")
positiveButtonText: qsTr("Next")

signal finished()

Label {
id: detailLabel
anchors {
left: parent.left
right: parent.right
margins: visuals.margins
}
style: "body2"
height: units.dp(200)
text: qsTr("A password has been generated to protect your funds. This password should be written down and " +
"stored somewhere safe. It can be used to recover your account if you forget your " +
"login password or lose this %1. Anyone with this password can spend your money and use your " +
"BitShares identity, so it should be kept in a safe place.").arg(deviceType())
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
horizontalAlignment: Text.AlignJustify
}
TextField {
id: brainKeyField
anchors {
left: parent.left
right: parent.right
margins: visuals.margins
onShowingChanged: if( showing ) backupLayout.state = ""

Column {
id: backupLayout
width: parent.width

Label {
id: detailLabel
anchors {
left: parent.left
right: parent.right
margins: visuals.margins
}
style: "body2"
height: units.dp(200)
text: qsTr("A password has been generated to protect your funds. This password should be written down and " +
"stored somewhere safe. It can be used to recover your account if you forget your " +
"login password or lose this %1. Anyone with this password can spend your money and use your " +
"BitShares identity, so it should be kept in a safe place.").arg(deviceType())
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
horizontalAlignment: Text.AlignJustify
}
width: parent.width - visuals.margins*2
input {
font.pixelSize: units.dp(12)
readOnly: true
text: wallet.brainKey.toUpperCase()
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhUppercaseOnly | Qt.ImhLatinOnly
TextField {
id: brainKeyField
anchors {
left: parent.left
right: parent.right
margins: visuals.margins
}
width: parent.width - visuals.margins*2
input {
font.pixelSize: units.dp(12)
readOnly: true
text: wallet.brainKey.toUpperCase()
inputMethodHints: Qt.ImhSensitiveData | Qt.ImhUppercaseOnly | Qt.ImhLatinOnly
}
transform: ShakeAnimation { id: brainShaker }
helperText: qsTr("Write down this password, then click the Next button below")

Component.onCompleted: forceActiveFocus()
}
transform: ShakeAnimation { id: brainShaker }
helperText: qsTr("Write down this password, then click the Next button below")
states: [
State {
name: "verifying"
extend: "open"
PropertyChanges {
target: backupDialog
title: qsTr("Is it secret? Is it safe?")
onRejected: backupLayout.state = "open"
positiveButtonText: qsTr("Verify")
negativeButtonText: qsTr("Back")
}
PropertyChanges {
target: detailLabel
text: qsTr("To make sure you've copied your password down correctly, please re-enter it below. " +
"After you have verified the password, it will be removed from your %1 and it cannot be " +
"recovered, so be careful not to lose it.").arg(deviceType())
}
PropertyChanges {
target: brainKeyField
text: ""
input.readOnly: false
helperText: qsTr("Enter your password now. Spaces and case do not matter")
onAccepted: backupLayout.accepted()
}
}
]
transitions: [
Transition {
SequentialAnimation {
PropertyAnimation {
targets: [detailLabel,brainKeyField]
property: "opacity"
from: "1"; to: "0"
duration: 200
}
PropertyAction { target: detailLabel; property: "text" }
PropertyAction { target: brainKeyField; properties: "helperText,text" }
PropertyAnimation {
targets: [detailLabel,brainKeyField]
property: "opacity"
from: "0"; to: "1"
duration: 200
}

Component.onCompleted: forceActiveFocus()
}
}
]
}

onRejected: finished()
onRejected: close()
onAccepted: {
if( state === "verifying" ) {
if( backupLayout.state === "verifying" ) {
if( !wallet.verifyBrainKey(brainKeyField.text) ) {
brainShaker.shake()
} else {
wallet.clearBrainKey()
backupLayout.state = ""
backupLayout.finished()
backupLayout.state = "open"
close()
}
} else {
state = "verifying"
backupLayout.state = "verifying"
}
}

states: [
State {
name: "verifying"
PropertyChanges {
target: backupLayout
title: qsTr("Is it secret? Is it safe?")
onRejected: backupLayout.state = ""
positiveBtnText: qsTr("Verify")
negativeBtnText: qsTr("Back")
}
PropertyChanges {
target: detailLabel
text: qsTr("To make sure you've copied your password down correctly, please re-enter it below. " +
"After you have verified the password, it will be removed from your %1 and it cannot be " +
"recovered, so be careful not to lose it.").arg(deviceType())
}
PropertyChanges {
target: brainKeyField
text: ""
input.readOnly: false
helperText: qsTr("Enter your password now. Spaces and case do not matter")
onAccepted: backupLayout.accepted()
}
}
]
transitions: [
Transition {
SequentialAnimation {
PropertyAnimation {
targets: [detailLabel,brainKeyField]
property: "opacity"
from: "1"; to: "0"
duration: 200
}
PropertyAction { target: detailLabel; property: "text" }
PropertyAction { target: brainKeyField; property: "helperText" }
PropertyAnimation {
targets: [detailLabel,brainKeyField]
property: "opacity"
from: "0"; to: "1"
duration: 200
}

}
}
]
}
4 changes: 2 additions & 2 deletions programs/light_wallet/qml/OnboardingLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ MainView {
}
PropertyChanges {
target: statusText
text: useFaucet? qsTr("Please complete your registration in the browser window. Your wallet will open shortly after you finish.")
: qsTr("OK! Now registering your BitShares Account. Just a moment...")
text: useFaucet()? qsTr("Please complete your registration in the browser window. Your wallet will open shortly after you finish.")
: qsTr("OK! Now registering your BitShares Account. Just a moment...")
}
PropertyChanges {
target: wallet
Expand Down
12 changes: 3 additions & 9 deletions programs/light_wallet/qml/TransferLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Page {
if( !amountField.canProceed() )
return amountShaker.shake()
if( !amountField.canPayFee() )
return badFeeDialog.open()
return badFeeDialog.show()
if( memoField.characterCount > memoField.characterLimit )
return memoShaker.shake()

Expand All @@ -217,18 +217,12 @@ Page {
}
}

MouseArea {
anchors.fill: parent
onClicked: badFeeDialog.close()
enabled: badFeeDialog.visible
}
Dialog {
id: badFeeDialog
title: qsTr("Cannot pay fee")
height: units.dp(200)
negativeBtnText: ""
positiveBtnText: qsTr("OK")
visible: false
negativeButtonText: ""
positiveButtonText: qsTr("OK")

onAccepted: close()

Expand Down
15 changes: 5 additions & 10 deletions programs/light_wallet/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Window {
Item {
id: applicationArea
anchors.fill: parent
enabled: wallet.unlocked && !onboardLoader.sourceComponent
enabled: wallet.unlocked
Toolbar {
id: toolbar
width: parent.width
Expand All @@ -248,8 +248,7 @@ Window {
z: -1

//Show iff brain key is set, the main page is not active or transitioning out, and we're not already in an onboarding UI
property bool active: wallet.brainKey.length > 0 &&
!onboardLoader.sourceComponent
property bool active: wallet.brainKey.length > 0

Label {
anchors.verticalCenter: parent.verticalCenter
Expand All @@ -269,7 +268,7 @@ Window {
text: qsTr("Back Up Wallet")
textColor: "white"

onClicked: onboardLoader.sourceComponent = backupUi
onClicked: backupUi.show()
}

states: [
Expand Down Expand Up @@ -350,17 +349,13 @@ Window {
}
}
}
Component {
BackupLayout {
id: backupUi

BackupLayout {
onFinished: onboardLoader.sourceComponent = undefined
}
minimumWidth: parent.width / 2
}
Loader {
id: onboardLoader
z: 2
anchors.fill: parent
}
Snackbar {
id: snack
Expand Down

0 comments on commit 223ed14

Please sign in to comment.