Receive page development

pull/2/head
Sander Ferdinand 7 years ago committed by moneromooo-monero
parent de3fd183d8
commit e5357c8a0b

@ -43,6 +43,7 @@ Item {
property bool copyButton: false property bool copyButton: false
property int fontSize: 18 * scaleRatio property int fontSize: 18 * scaleRatio
property bool showBorder: true property bool showBorder: true
property bool fontBold: true
property bool error: false property bool error: false
property alias labelText: inputLabel.text property alias labelText: inputLabel.text
property alias labelColor: inputLabel.color property alias labelColor: inputLabel.color
@ -53,7 +54,7 @@ Item {
property alias labelWrapMode: inputLabel.wrapMode property alias labelWrapMode: inputLabel.wrapMode
property alias labelHorizontalAlignment: inputLabel.horizontalAlignment property alias labelHorizontalAlignment: inputLabel.horizontalAlignment
signal labelLinkActivated(); // input label, rich text <a> signal signal labelLinkActivated(); // input label, rich text <a> signal
signal editingFinished() signal editingFinished();
signal accepted(); signal accepted();
signal textUpdated(); signal textUpdated();
@ -82,7 +83,7 @@ Item {
id: inputLabel id: inputLabel
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: 2 anchors.topMargin: 2 * scaleRatio
font.family: Style.fontRegular.name font.family: Style.fontRegular.name
font.pixelSize: labelFontSize font.pixelSize: labelFontSize
font.bold: labelFontBold font.bold: labelFontBold
@ -97,53 +98,25 @@ Item {
} }
} }
Rectangle{ LabelButton {
id: copyButtonRect id: copyButtonId
color: "#808080" text: qsTr("Copy")
radius: 3
height: 20
width: 44
anchors.right: parent.right anchors.right: parent.right
visible: copyButton && input.text !== "" ? true : false onClicked: {
if (input.text.length > 0) {
Text { console.log(input.text + " copied to clipboard")
id: copyButtonText clipboard.setText(input.text)
anchors.verticalCenter: parent.verticalCenter appWindow.showStatusMessage(qsTr("Copied to clipboard"),3)
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;
} }
} }
visible: input.text && copyButton ? true : false
} }
Item{ Item{
id: inputItem id: inputItem
height: 40 * scaleRatio height: 40 * scaleRatio
anchors.top: inputLabel.bottom anchors.top: inputLabel.bottom
anchors.topMargin: 6 anchors.topMargin: 6 * scaleRatio
width: parent.width width: parent.width
Text { Text {
@ -151,7 +124,7 @@ Item {
visible: input.text ? false : true visible: input.text ? false : true
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: inlineIcon.visible ? 50 : 10 anchors.leftMargin: inlineIcon.visible ? 50 * scaleRatio : 10 * scaleRatio
opacity: 0.25 opacity: 0.25
color: Style.defaultFontColor color: Style.defaultFontColor
font.family: Style.fontRegular.name font.family: Style.fontRegular.name
@ -197,6 +170,7 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: inlineIcon.visible ? 38 : 0 anchors.leftMargin: inlineIcon.visible ? 38 : 0
font.pixelSize: item.fontSize font.pixelSize: item.fontSize
font.bold: fontBold
onEditingFinished: item.editingFinished() onEditingFinished: item.editingFinished()
onAccepted: item.accepted(); onAccepted: item.accepted();
onTextChanged: item.textUpdated() onTextChanged: item.textUpdated()
@ -204,12 +178,11 @@ Item {
InlineButton { InlineButton {
id: inlineButtonId id: inlineButtonId
onClicked: inlineButtonId.onClicked
visible: item.inlineButtonText ? true : false visible: item.inlineButtonText ? true : false
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 8 anchors.rightMargin: 8 * scaleRatio
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 6 anchors.topMargin: 6 * scaleRatio
} }
} }
} }

@ -38,11 +38,11 @@ Rectangle {
property var model property var model
ColumnLayout { ColumnLayout {
anchors.margins: 17 * scaleRatio anchors.margins: (isMobile)? 17 : 40
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
spacing: 10 * scaleRatio spacing: 26 * scaleRatio
RowLayout { RowLayout {
StandardButton { StandardButton {

@ -26,8 +26,8 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // 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. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 2.2
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
@ -43,7 +43,7 @@ import moneroComponents.SubaddressModel 1.0
Rectangle { Rectangle {
id: pageReceive id: pageReceive
color: "#F0EEEE" color: "transparent"
property alias addressText : addressLine.text property alias addressText : addressLine.text
property alias paymentIdText : paymentIdLine.text property alias paymentIdText : paymentIdLine.text
property alias integratedAddressText : integratedAddressLine.text property alias integratedAddressText : integratedAddressLine.text
@ -156,14 +156,14 @@ Rectangle {
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
spacing: 20 * scaleRatio spacing: 26 * scaleRatio
property int labelWidth: 120 * scaleRatio property int labelWidth: 120 * scaleRatio
property int editWidth: 400 * scaleRatio property int editWidth: 400 * scaleRatio
property int lineEditFontSize: 12 * scaleRatio property int lineEditFontSize: 12 * scaleRatio
property int qrCodeSize: 240 * scaleRatio property int qrCodeSize: 240 * scaleRatio
ColumnLayout { ColumnLayout {
<<<<<<< HEAD
id: addressRow id: addressRow
Label { Label {
id: addressLabel id: addressLabel
@ -224,43 +224,123 @@ Rectangle {
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex) inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex)
inputDialog.onAcceptedCallback = function() { inputDialog.onAcceptedCallback = function() {
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex, inputDialog.inputText) appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, table.currentIndex, inputDialog.inputText)
} =======
inputDialog.onRejectedCallback = null; id: addressLineRow
inputDialog.open()
} 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("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
<font size='2'> ( </font><a href='#'>help</a><font size='2'> )</font> ")
+ translationManager.emptyString
onLabelLinkActivated: {
trackingHowToUseDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
trackingHowToUseDialog.text = qsTr(
"<p><font size='+2'>This is a simple sales tracker:</font></p>" +
"<p>Click Generate to create a random payment id for a new customer</p> " +
"<p>Let your customer scan that QR code to make a payment (if that customer has software which " +
"supports QR code scanning).</p>" +
"<p>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.</p>" +
"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).</p>"
)
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 { ColumnLayout {
id: amountRow id: integratedAddressRow
Label {
id: amountLabel LineEditMulti {
text: qsTr("Amount") + translationManager.emptyString id: integratedAddressLine
width: mainLayout.labelWidth 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
LineEdit { ColumnLayout {
id: amountLine
// fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
readOnly: false
width: mainLayout.editWidth
Layout.fillWidth: true Layout.fillWidth: true
validator: DoubleValidator {
bottom: 0.0 RowLayout {
top: 18446744.073709551615 Layout.fillWidth: true
decimals: 12 Layout.minimumWidth: 200
notation: DoubleValidator.StandardNotation LineEdit {
locale: "C" 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 {
Layout.fillWidth: true
}
} }
RowLayout { RowLayout {
id: trackingRow id: trackingRow
Layout.fillWidth: true
visible: !isAndroid && !isIOS visible: !isAndroid && !isIOS
<<<<<<< HEAD
Label { Label {
id: trackingLabel id: trackingLabel
textFormat: Text.RichText textFormat: Text.RichText
@ -288,16 +368,39 @@ Rectangle {
trackingHowToUseDialog.open() trackingHowToUseDialog.open()
} }
} }
=======
>>>>>>> Receive page development
TextEdit { TextEdit {
id: trackingLine id: trackingLine
anchors.top: trackingRow.top anchors.top: trackingRow.top
horizontalAlignment: TextInput.AlignLeft
Layout.fillWidth: true
textFormat: Text.RichText textFormat: Text.RichText
text: "" text: ""
readOnly: true readOnly: true
width: mainLayout.editWidth
Layout.fillWidth: true
selectByMouse: 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
}
} }
} }

@ -113,19 +113,19 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: pageRoot id: pageRoot
anchors.margins: (isMobile)? 17 : 40 anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 40 * scaleRatio anchors.topMargin: 40 * scaleRatio
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
spacing: 20 * scaleRatio spacing: 26 * scaleRatio
GridLayout { GridLayout {
columns: (isMobile)? 1 : 2 columns: (isMobile)? 1 : 2
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 48 columnSpacing: 32
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
@ -198,97 +198,169 @@ Rectangle {
id: addressLineRow id: addressLineRow
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout { LineEditMulti{
Rectangle{ id: addressLine
id: inputLabelRect spacing: 0
color: "transparent" // @TODO:
Layout.fillWidth: true // - fix wrong copy @ receive.qml
height: inputLabel.height + 10 // - resolve button click @ multiline @ transfer.qml
Text { inputLabelText: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
id: inputLabel Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
anchors.top: parent.top + translationManager.emptyString
anchors.left: parent.left labelButtonText: qsTr("Resolve") + translationManager.emptyString
font.family: Style.fontRegular.name placeholderText: "4.."
font.pixelSize: 16 * scaleRatio onInputLabelLinkActivated: { appWindow.showPageRequest("AddressBook") }
font.bold: labelFontBold onLabelButtonClicked: {
textFormat: Text.RichText var result = walletManager.resolveOpenAlias(addressLine.text)
color: Style.defaultFontColor if (result) {
onLinkActivated: { appWindow.showPageRequest("AddressBook") } var parts = result.split("|")
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\ if (parts.length == 2) {
Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>") var address_ok = walletManager.addressValid(parts[1], appWindow.persistentSettings.testnet)
+ translationManager.emptyString if (parts[0] === "true") {
} if (address_ok) {
addressLine.text = parts[1]
Rectangle{ addressLine.cursorPosition = 0
id: copyButton }
color: "#808080" else
radius: 3 oa_message(qsTr("No valid address found at this OpenAlias address"))
height: 20 } else if (parts[0] === "false") {
width: copyButtonText.width + 8 if (address_ok) {
anchors.right: parent.right addressLine.text = parts[1]
visible: addressLine.text !== "" addressLine.cursorPosition = 0
oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed"))
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 { } else {
return Qt.rgba(255, 255, 255, 0.25); 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 } else {
anchors.fill: parent 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("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
// Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
// + 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 { StandardButton {
id: qrfinderButton id: qrfinderButton
text: qsTr("QR Code") + translationManager.emptyString text: qsTr("QR Code") + translationManager.emptyString
@ -374,9 +446,9 @@ Rectangle {
anchors.top: pageRoot.bottom anchors.top: pageRoot.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: (isMobile)? 17 : 40 anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 40 * scaleRatio anchors.topMargin: 40 * scaleRatio
spacing: 20 * scaleRatio spacing: 26 * scaleRatio
enabled: !viewOnly || pageRoot.enabled enabled: !viewOnly || pageRoot.enabled
RowLayout { RowLayout {

@ -192,5 +192,7 @@
<file>images/middlePanelBg.jpg</file> <file>images/middlePanelBg.jpg</file>
<file>components/InputMulti.qml</file> <file>components/InputMulti.qml</file>
<file>images/checkedIcon-black.png</file> <file>images/checkedIcon-black.png</file>
<file>components/LineEditMulti.qml</file>
<file>components/LabelButton.qml</file>
</qresource> </qresource>
</RCC> </RCC>