From e5357c8a0b55a23d065021092db6118a03f29533 Mon Sep 17 00:00:00 2001
From: Sander Ferdinand
Date: Sat, 9 Dec 2017 00:01:10 +0100
Subject: [PATCH] Receive page development
---
components/LineEdit.qml | 61 +++-------
pages/AddressBook.qml | 4 +-
pages/Receive.qml | 165 +++++++++++++++++++++-----
pages/Transfer.qml | 250 ++++++++++++++++++++++++++--------------
qml.qrc | 2 +
5 files changed, 316 insertions(+), 166 deletions(-)
diff --git a/components/LineEdit.qml b/components/LineEdit.qml
index f1299519..d52db763 100644
--- a/components/LineEdit.qml
+++ b/components/LineEdit.qml
@@ -43,6 +43,7 @@ Item {
property bool copyButton: false
property int fontSize: 18 * scaleRatio
property bool showBorder: true
+ property bool fontBold: true
property bool error: false
property alias labelText: inputLabel.text
property alias labelColor: inputLabel.color
@@ -53,7 +54,7 @@ Item {
property alias labelWrapMode: inputLabel.wrapMode
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
signal labelLinkActivated(); // input label, rich text signal
- signal editingFinished()
+ signal editingFinished();
signal accepted();
signal textUpdated();
@@ -82,7 +83,7 @@ Item {
id: inputLabel
anchors.top: parent.top
anchors.left: parent.left
- anchors.topMargin: 2
+ anchors.topMargin: 2 * scaleRatio
font.family: Style.fontRegular.name
font.pixelSize: labelFontSize
font.bold: labelFontBold
@@ -97,53 +98,25 @@ Item {
}
}
- Rectangle{
- id: copyButtonRect
- color: "#808080"
- radius: 3
- height: 20
- width: 44
+ LabelButton {
+ id: copyButtonId
+ text: qsTr("Copy")
anchors.right: parent.right
- visible: copyButton && input.text !== "" ? true : false
-
- Text {
- id: copyButtonText
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- font.family: Style.fontRegular.name
- font.pixelSize: 12
- font.bold: true
- text: "Copy"
- color: "black"
- }
-
- MouseArea {
- cursorShape: Qt.PointingHandCursor
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- if (addressLine.text.length > 0) {
- console.log(addressLine.text + " copied to clipboard")
- clipboard.setText(addressLine.text)
- appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3)
- }
- }
- onEntered: {
- copyButtonRect.color = "#707070";
- copyButtonText.opacity = 0.8;
- }
- onExited: {
- copyButtonRect.color = "#808080";
- copyButtonText.opacity = 1.0;
+ onClicked: {
+ if (input.text.length > 0) {
+ console.log(input.text + " copied to clipboard")
+ clipboard.setText(input.text)
+ appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
}
}
+ visible: input.text && copyButton ? true : false
}
Item{
id: inputItem
height: 40 * scaleRatio
anchors.top: inputLabel.bottom
- anchors.topMargin: 6
+ anchors.topMargin: 6 * scaleRatio
width: parent.width
Text {
@@ -151,7 +124,7 @@ Item {
visible: input.text ? false : true
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
- anchors.leftMargin: inlineIcon.visible ? 50 : 10
+ anchors.leftMargin: inlineIcon.visible ? 50 * scaleRatio : 10 * scaleRatio
opacity: 0.25
color: Style.defaultFontColor
font.family: Style.fontRegular.name
@@ -197,6 +170,7 @@ Item {
anchors.fill: parent
anchors.leftMargin: inlineIcon.visible ? 38 : 0
font.pixelSize: item.fontSize
+ font.bold: fontBold
onEditingFinished: item.editingFinished()
onAccepted: item.accepted();
onTextChanged: item.textUpdated()
@@ -204,12 +178,11 @@ Item {
InlineButton {
id: inlineButtonId
- onClicked: inlineButtonId.onClicked
visible: item.inlineButtonText ? true : false
anchors.right: parent.right
- anchors.rightMargin: 8
+ anchors.rightMargin: 8 * scaleRatio
anchors.top: parent.top
- anchors.topMargin: 6
+ anchors.topMargin: 6 * scaleRatio
}
}
}
diff --git a/pages/AddressBook.qml b/pages/AddressBook.qml
index b1c2bad9..4613e260 100644
--- a/pages/AddressBook.qml
+++ b/pages/AddressBook.qml
@@ -38,11 +38,11 @@ Rectangle {
property var model
ColumnLayout {
- anchors.margins: 17 * scaleRatio
+ anchors.margins: (isMobile)? 17 : 40
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
- spacing: 10 * scaleRatio
+ spacing: 26 * scaleRatio
RowLayout {
StandardButton {
diff --git a/pages/Receive.qml b/pages/Receive.qml
index 2b070c9f..18c5ef72 100644
--- a/pages/Receive.qml
+++ b/pages/Receive.qml
@@ -26,8 +26,8 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import QtQuick 2.0
-import QtQuick.Controls 1.4
+import QtQuick 2.7
+import QtQuick.Controls 2.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
@@ -43,7 +43,7 @@ import moneroComponents.SubaddressModel 1.0
Rectangle {
id: pageReceive
- color: "#F0EEEE"
+ color: "transparent"
property alias addressText : addressLine.text
property alias paymentIdText : paymentIdLine.text
property alias integratedAddressText : integratedAddressLine.text
@@ -156,14 +156,14 @@ Rectangle {
anchors.top: parent.top
anchors.right: parent.right
- spacing: 20 * scaleRatio
+ spacing: 26 * scaleRatio
property int labelWidth: 120 * scaleRatio
property int editWidth: 400 * scaleRatio
property int lineEditFontSize: 12 * scaleRatio
property int qrCodeSize: 240 * scaleRatio
-
ColumnLayout {
+<<<<<<< HEAD
id: addressRow
Label {
id: addressLabel
@@ -224,43 +224,123 @@ Rectangle {
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex)
inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex, inputDialog.inputText)
+=======
+ id: addressLineRow
+
+ LineEditMulti {
+ id: addressLine
+ inputLabelText: qsTr("Address") + translationManager.emptyString
+ placeholderText: qsTr("ReadOnly wallet address displayed here") + translationManager.emptyString;
+ readOnly: true
+ Layout.fillWidth: true
+ copyButton: true
+ }
+ }
+
+ GridLayout {
+ id: paymentIdRow
+ columns:2
+
+ // @TODO: copy button copies the wrong input box
+ LineEdit {
+ id: paymentIdLine
+ placeholderText: qsTr("16 hexadecimal characters") + translationManager.emptyString;
+ readOnly: false
+ onTextChanged: updatePaymentId(paymentIdLine.text)
+ inlineButtonText: "Generate"
+ inlineButton.onClicked: updatePaymentId()
+ width: mainLayout.editWidth
+ Layout.fillWidth: true
+ copyButton: true
+ labelText: qsTr("Payment ID") + qsTr("\
+ ( help ) ")
+ + translationManager.emptyString
+ onLabelLinkActivated: {
+ trackingHowToUseDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
+ trackingHowToUseDialog.text = qsTr(
+ "This is a simple sales tracker:
" +
+ "Click Generate to create a random payment id for a new customer
" +
+ "Let your customer scan that QR code to make a payment (if that customer has software which " +
+ "supports QR code scanning).
" +
+ "This page will automatically scan the blockchain and the tx pool " +
+ "for incoming transactions using this QR code. If you input an amount, it will also check " +
+ "that incoming transactions total up to that amount.
" +
+ "It's up to you whether to accept unconfirmed transactions or not. It is likely they'll be " +
+ "confirmed in short order, but there is still a possibility they might not, so for larger " +
+ "values you may want to wait for one or more confirmation(s).
"
+ )
+ trackingHowToUseDialog.icon = StandardIcon.Information
+ trackingHowToUseDialog.open()
+ }
+ }
+
+ // @TODO: CLEAR BUTTON should be present as labelButton
+// StandardButton {
+// id: clearPaymentId
+// enabled: !!paymentIdLine.text
+// shadowReleasedColor: "#FF4304"
+// shadowPressedColor: "#B32D00"
+// releasedColor: "#FF6C3C"
+// pressedColor: "#FF4304"
+// text: qsTr("Clear") + translationManager.emptyString;
+// onClicked: updatePaymentId("")
+// }
+ }
+
+ ColumnLayout {
+ id: integratedAddressRow
+
+ LineEditMulti {
+ id: integratedAddressLine
+ inputLabelText: qsTr("Integrated address") + translationManager.emptyString
+ placeholderText: qsTr("Generate payment ID for integrated address") + translationManager.emptyString
+ readOnly: true
+ Layout.fillWidth: true
+ copyButton: true
+ }
+ }
+
+ GridLayout {
+ columns: (isMobile)? 1 : 2
+ Layout.fillWidth: true
+ columnSpacing: 32
+
+ ColumnLayout {
+ Layout.fillWidth: true
+
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.minimumWidth: 200
+ LineEdit {
+ id: amountLine
+ placeholderText: qsTr("Amount to receive") + translationManager.emptyString
+ readOnly: false
+ inlineIcon: true
+ labelText: qsTr("Amount")
+ Layout.fillWidth: true
+ validator: DoubleValidator {
+ bottom: 0.0
+ top: 18446744.073709551615
+ decimals: 12
+ notation: DoubleValidator.StandardNotation
+ locale: "C"
+>>>>>>> Receive page development
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
}
}
}
- }
-
- ColumnLayout {
- id: amountRow
- Label {
- id: amountLabel
- text: qsTr("Amount") + translationManager.emptyString
- width: mainLayout.labelWidth
- }
-
-
- LineEdit {
- id: amountLine
-// fontSize: mainLayout.lineEditFontSize
- placeholderText: qsTr("Amount to receive") + translationManager.emptyString
- readOnly: false
- width: mainLayout.editWidth
+ ColumnLayout {
Layout.fillWidth: true
- validator: DoubleValidator {
- bottom: 0.0
- top: 18446744.073709551615
- decimals: 12
- notation: DoubleValidator.StandardNotation
- locale: "C"
- }
}
}
RowLayout {
id: trackingRow
+ Layout.fillWidth: true
visible: !isAndroid && !isIOS
+<<<<<<< HEAD
Label {
id: trackingLabel
textFormat: Text.RichText
@@ -288,16 +368,39 @@ Rectangle {
trackingHowToUseDialog.open()
}
}
+=======
+>>>>>>> Receive page development
TextEdit {
id: trackingLine
anchors.top: trackingRow.top
+ horizontalAlignment: TextInput.AlignLeft
+ Layout.fillWidth: true
textFormat: Text.RichText
text: ""
readOnly: true
- width: mainLayout.editWidth
- Layout.fillWidth: true
selectByMouse: true
+ color: Style.defaultFontColor
+ font.family: Style.fontRegular.name
+ font.pixelSize: 16 * scaleRatio
+ leftPadding: 12 * scaleRatio
+ rightPadding: 12 * scaleRatio
+ topPadding: 8 * scaleRatio
+ bottomPadding: 8 * scaleRatio
+
+ Rectangle {
+ color: "transparent"
+ border.width: 1
+ border.color: {
+ if(trackingLine.activeFocus){
+ return Qt.rgba(255, 255, 255, 0.35);
+ } else {
+ return Qt.rgba(255, 255, 255, 0.25);
+ }
+ }
+ radius: 4
+ anchors.fill: parent
+ }
}
}
diff --git a/pages/Transfer.qml b/pages/Transfer.qml
index 80604763..ee0d7aa4 100644
--- a/pages/Transfer.qml
+++ b/pages/Transfer.qml
@@ -113,19 +113,19 @@ Rectangle {
ColumnLayout {
id: pageRoot
- anchors.margins: (isMobile)? 17 : 40
+ anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 40 * scaleRatio
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
- spacing: 20 * scaleRatio
+ spacing: 26 * scaleRatio
GridLayout {
columns: (isMobile)? 1 : 2
Layout.fillWidth: true
- columnSpacing: 48
+ columnSpacing: 32
ColumnLayout {
Layout.fillWidth: true
@@ -198,97 +198,169 @@ Rectangle {
id: addressLineRow
Layout.fillWidth: true
- ColumnLayout {
- Rectangle{
- id: inputLabelRect
- color: "transparent"
- Layout.fillWidth: true
- height: inputLabel.height + 10
+ LineEditMulti{
+ id: addressLine
+ spacing: 0
+// @TODO:
+// - fix wrong copy @ receive.qml
+// - resolve button click @ multiline @ transfer.qml
- Text {
- id: inputLabel
- anchors.top: parent.top
- anchors.left: parent.left
- font.family: Style.fontRegular.name
- font.pixelSize: 16 * scaleRatio
- font.bold: labelFontBold
- textFormat: Text.RichText
- color: Style.defaultFontColor
- onLinkActivated: { appWindow.showPageRequest("AddressBook") }
- text: qsTr("\
- Address ( Address book )")
- + translationManager.emptyString
- }
-
- Rectangle{
- id: copyButton
- color: "#808080"
- radius: 3
- height: 20
- width: copyButtonText.width + 8
- anchors.right: parent.right
- visible: addressLine.text !== ""
-
- Text {
- id: copyButtonText
- anchors.verticalCenter: parent.verticalCenter
- anchors.horizontalCenter: parent.horizontalCenter
- font.family: Style.fontRegular.name
- font.pixelSize: 12
- font.bold: true
- text: qsTr("Copy") + translationManager.emptyString
- color: "black"
- }
-
- MouseArea {
- cursorShape: Qt.PointingHandCursor
- anchors.fill: parent
- hoverEnabled: true
- onClicked: {
- if (addressLine.text.length > 0) {
- console.log(addressLine.text + " copied to clipboard");
- clipboard.setText(addressLine.text);
- appWindow.showStatusMessage(qsTr("Address copied to clipboard"), 3);
- }
- }
- onEntered: {
- copyButton.color = "#707070";
- copyButtonText.opacity = 0.8;
- }
- onExited: {
- copyButtonText.opacity = 1.0;
- copyButton.color = "#808080";
- }
- }
- }
- }
-
- InputMulti {
- id: addressLine
- readOnly: false
- addressValidation: true
- anchors.top: inputLabelRect.bottom
- placeholderText: "4..."
- Layout.fillWidth: true
-
- Rectangle {
- color: "transparent"
- border.width: 1
- border.color: {
- if(addressLine.error && addressLine.text !== ""){
- return Qt.rgba(255, 0, 0, 0.45);
- } else if(addressLine.activeFocus){
- return Qt.rgba(255, 255, 255, 0.35);
- } else {
- return Qt.rgba(255, 255, 255, 0.25);
+ inputLabelText: qsTr("\
+ Address ( Address book )")
+ + translationManager.emptyString
+ labelButtonText: qsTr("Resolve") + translationManager.emptyString
+ placeholderText: "4.."
+ onInputLabelLinkActivated: { appWindow.showPageRequest("AddressBook") }
+ onLabelButtonClicked: {
+ var result = walletManager.resolveOpenAlias(addressLine.text)
+ if (result) {
+ var parts = result.split("|")
+ if (parts.length == 2) {
+ var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.testnet)
+ if (parts[0] === "true") {
+ if (address_ok) {
+ addressLine.text = parts[1]
+ addressLine.cursorPosition = 0
}
+ else
+ oa_message(qsTr("No valid address found at this OpenAlias address"))
+ } else if (parts[0] === "false") {
+ if (address_ok) {
+ addressLine.text = parts[1]
+ addressLine.cursorPosition = 0
+ oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed"))
+ } else {
+ oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed"))
+ }
+ } else {
+ oa_message(qsTr("Internal error"))
}
- radius: 4
- anchors.fill: parent
+ } else {
+ oa_message(qsTr("Internal error"))
+ }
+ } else {
+ oa_message(qsTr("No address found"))
}
}
}
+// ColumnLayout {
+// spacing: 0
+// Rectangle{
+// id: inputLabelRect
+// color: "transparent"
+// Layout.fillWidth: true
+// height: inputLabel.height + 10
+
+// Text {
+// id: inputLabel
+// anchors.top: parent.top
+// anchors.left: parent.left
+// font.family: Style.fontRegular.name
+// font.pixelSize: 16 * scaleRatio
+// font.bold: labelFontBold
+// textFormat: Text.RichText
+// color: Style.defaultFontColor
+// onLinkActivated: { appWindow.showPageRequest("AddressBook") }
+// text: qsTr("\
+// Address ( Address book )")
+// + translationManager.emptyString
+// }
+
+// Rectangle{
+// id: resolveButton
+// color: "#808080"
+// radius: 3
+// height: 20
+// width: resolveButtonText.width + 8
+// anchors.right: copyButton.left
+// anchors.rightMargin: 6
+// visible: isValidOpenAliasAddress(addressLine.text)
+
+// Text {
+// id: resolveButtonText
+// anchors.verticalCenter: parent.verticalCenter
+// anchors.horizontalCenter: parent.horizontalCenter
+// font.family: Style.fontRegular.name
+// font.pixelSize: 12
+// font.bold: true
+// text: qsTr("Resolve") + translationManager.emptyString
+// color: "black"
+// }
+
+// MouseArea {
+// cursorShape: Qt.PointingHandCursor
+// anchors.fill: parent
+// hoverEnabled: true
+// onClicked: {
+// var result = walletManager.resolveOpenAlias(addressLine.text)
+// if (result) {
+// var parts = result.split("|")
+// if (parts.length == 2) {
+// var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.testnet)
+// if (parts[0] === "true") {
+// if (address_ok) {
+// addressLine.text = parts[1]
+// addressLine.cursorPosition = 0
+// }
+// else
+// oa_message(qsTr("No valid address found at this OpenAlias address"))
+// } else if (parts[0] === "false") {
+// if (address_ok) {
+// addressLine.text = parts[1]
+// addressLine.cursorPosition = 0
+// oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed"))
+// } else {
+// oa_message(qsTr("No valid address found at this OpenAlias address, but the DNSSEC signatures could not be verified, so this may be spoofed"))
+// }
+// } else {
+// oa_message(qsTr("Internal error"))
+// }
+// } else {
+// oa_message(qsTr("Internal error"))
+// }
+// } else {
+// oa_message(qsTr("No address found"))
+// }
+// }
+// onEntered: {
+// resolveButton.color = "#707070";
+// resolveButtonText.opacity = 0.8;
+// }
+// onExited: {
+// resolveButtonText.opacity = 1.0;
+// resolveButton.color = "#808080";
+// }
+// }
+// }
+// }
+
+// InputMulti {
+// id: addressLine
+// readOnly: false
+// addressValidation: true
+// anchors.top: inputLabelRect.bottom
+// placeholderText: "4..."
+// Layout.fillWidth: true
+
+// Rectangle {
+// color: "transparent"
+// border.width: 1
+// border.color: {
+// if(addressLine.error && addressLine.text !== ""){
+// return Qt.rgba(255, 0, 0, 0.45);
+// } else if(addressLine.activeFocus){
+// return Qt.rgba(255, 255, 255, 0.35);
+// } else {
+// return Qt.rgba(255, 255, 255, 0.25);
+// }
+// }
+// radius: 4
+// anchors.fill: parent
+// }
+// }
+// }
+
StandardButton {
id: qrfinderButton
text: qsTr("QR Code") + translationManager.emptyString
@@ -374,9 +446,9 @@ Rectangle {
anchors.top: pageRoot.bottom
anchors.left: parent.left
anchors.right: parent.right
- anchors.margins: (isMobile)? 17 : 40
+ anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 40 * scaleRatio
- spacing: 20 * scaleRatio
+ spacing: 26 * scaleRatio
enabled: !viewOnly || pageRoot.enabled
RowLayout {
diff --git a/qml.qrc b/qml.qrc
index 18aa7da3..bb32bfbf 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -192,5 +192,7 @@
images/middlePanelBg.jpg
components/InputMulti.qml
images/checkedIcon-black.png
+ components/LineEditMulti.qml
+ components/LabelButton.qml