Transfer page QML development

This commit is contained in:
Sander Ferdinand 2017-12-06 14:09:37 +01:00 committed by moneromooo-monero
parent 3d65a5d90d
commit 01f7b6cbfb

View File

@ -29,6 +29,7 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import moneroComponents.Clipboard 1.0
import moneroComponents.PendingTransaction 1.0 import moneroComponents.PendingTransaction 1.0
import moneroComponents.Wallet 1.0 import moneroComponents.Wallet 1.0
import "../components" import "../components"
@ -45,13 +46,7 @@ Rectangle {
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
property bool showAdvanced: false property bool showAdvanced: false
Image { Clipboard { id: clipboard }
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: panel.height
source: "../images/leftPanelBg.jpg"
}
function scaleValueToMixinCount(scaleValue) { function scaleValueToMixinCount(scaleValue) {
var scaleToMixinCount = [6,7,8,9,10,11,12,13,14,16,18,20,22,25]; var scaleToMixinCount = [6,7,8,9,10,11,12,13,14,16,18,20,22,25];
@ -118,36 +113,22 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: pageRoot id: pageRoot
anchors.top: parent.top anchors.margins: (isMobile)? 17 : 40
anchors.topMargin: 40 * scaleRatio
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 17 * scaleRatio
spacing: 0
RowLayout{ spacing: 20 * scaleRatio
Layout.fillWidth: true
Layout.bottomMargin: 20
height: 150
Text {
id: panelHeader
font.family: Style.fontMedium.name
font.pixelSize: 32 * scaleRatio
color: "#FFFFFF"
text: "Send"
height: 150
}
}
GridLayout { GridLayout {
columns: (isMobile)? 1 : 2 columns: (isMobile)? 1 : 2
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 48
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Label {
id: amountLabel
text: qsTr("Amount") + translationManager.emptyString
}
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
@ -159,6 +140,7 @@ Rectangle {
id: amountLine id: amountLine
Layout.fillWidth: true Layout.fillWidth: true
inlineIcon: true inlineIcon: true
labelText: qsTr("Amount") + translationManager.emptyString
placeholderText: qsTr("") + translationManager.emptyString placeholderText: qsTr("") + translationManager.emptyString
width: 100 width: 100
inlineButtonText: qsTr("All") + translationManager.emptyString inlineButtonText: qsTr("All") + translationManager.emptyString
@ -186,20 +168,7 @@ Rectangle {
// ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low } // ListElement { column1: qsTr("LOW") + translationManager.emptyString ; column2: ""; priority: PendingTransaction.Priority_Low }
// For translations to work, the strings need to be listed in // For translations to work, the strings need to be listed in
// the file components/StandardDropdown.qml too. // the file components/StandardDropdown.qml too.
<<<<<<< HEAD
=======
// Priorities before v5
ListModel {
id: priorityModel
ListElement { column1: qsTr("Low (x1 fee)") ; column2: ""; priority: PendingTransaction.Priority_Low }
ListElement { column1: qsTr("Medium (x20 fee)") ; column2: ""; priority: PendingTransaction.Priority_Medium }
ListElement { column1: qsTr("High (x166 fee)") ; column2: ""; priority: PendingTransaction.Priority_High }
}
>>>>>>> InlineButton development
// Priorites after v5 // Priorites after v5
ListModel { ListModel {
id: priorityModelV5 id: priorityModelV5
@ -209,7 +178,6 @@ Rectangle {
ListElement { column1: qsTr("Normal (x1 fee)") ; column2: ""; priority: 2 } ListElement { column1: qsTr("Normal (x1 fee)") ; column2: ""; priority: 2 }
ListElement { column1: qsTr("Fast (x5 fee)") ; column2: ""; priority: 3 } ListElement { column1: qsTr("Fast (x5 fee)") ; column2: ""; priority: 3 }
ListElement { column1: qsTr("Fastest (x41.5 fee)") ; column2: ""; priority: 4 } ListElement { column1: qsTr("Fastest (x41.5 fee)") ; column2: ""; priority: 4 }
} }
StandardDropdown { StandardDropdown {
@ -217,53 +185,81 @@ Rectangle {
id: priorityDropdown id: priorityDropdown
shadowReleasedColor: "#FF4304" shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00" shadowPressedColor: "#B32D00"
releasedColor: "black" releasedColor: "#363636"
pressedColor: "#404040" pressedColor: "#202020"
} }
} }
// Make sure dropdown is on top // Make sure dropdown is on top
z: parent.z + 1 z: parent.z + 1
} }
ColumnLayout { // recipient address input
RowLayout {
id: addressLineRow
Layout.fillWidth: true Layout.fillWidth: true
Label {
id: addressLabel
textFormat: Text.RichText
<<<<<<< HEAD
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" +
qsTr("Address") +
"<font size='2'> ( " +
qsTr("Paste in or select from <a href='#'>Address book</a>") +
" )</font>" +
translationManager.emptyString
=======
text: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
Address <font size='2'> ( Paste in or select from </font> <a href='#'>Address book</a><font size='2'> )</font>")
+ translationManager.emptyString
>>>>>>> InlineButton development ColumnLayout {
onLinkActivated: appWindow.showPageRequest("AddressBook") Rectangle{
Layout.fillWidth: true id: inputLabelRect
} color: "transparent"
// recipient address input Layout.fillWidth: true
RowLayout { height: inputLabel.height + 10
id: addressLineRow
Layout.fillWidth: true
StandardButton { Text {
id: qrfinderButton id: inputLabel
text: qsTr("QR Code") + translationManager.emptyString anchors.top: parent.top
shadowReleasedColor: "#FF4304" anchors.left: parent.left
shadowPressedColor: "#B32D00" font.family: Style.fontRegular.name
releasedColor: "#FF6C3C" font.pixelSize: 16 * scaleRatio
pressedColor: "#FF4304" font.bold: labelFontBold
visible : appWindow.qrScannerEnabled textFormat: Text.RichText
enabled : visible color: "white"
width: visible ? 60 * scaleRatio : 0 onLinkActivated: { appWindow.showPageRequest("AddressBook") }
onClicked: { text: qsTr("<style type='text/css'>a {text-decoration: none; color: #858585; font-size: 14px;}</style>\
cameraUi.state = "Capture" Address <font size='2'> ( </font> <a href='#'>Address book</a><font size='2'> )</font>")
cameraUi.qrcode_decoded.connect(updateFromQrCode) + 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";
}
}
} }
} }
LineEdit { LineEdit {
@ -292,55 +288,98 @@ Rectangle {
addressLine.cursorPosition = 0 addressLine.cursorPosition = 0
oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed")) oa_message(qsTr("Address found, but the DNSSEC signatures could not be verified, so this address may be spoofed"))
} else { } 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")) oa_message(qsTr("No address found"))
} }
} else {
oa_message(qsTr("Internal error"))
}
} else {
oa_message(qsTr("Internal error"))
} }
} else { onEntered: {
oa_message(qsTr("No address found")) resolveButton.color = "#707070";
resolveButtonText.opacity = 0.8;
}
onExited: {
resolveButtonText.opacity = 1.0;
resolveButton.color = "#808080";
}
} }
} }
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g } }
InputMulti {
// validator: RegExpValidator { regExp: /[0-9A-Fa-f]{95}/g }
id: addressLine
readOnly: false
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
}
} }
} }
Label { StandardButton {
id: paymentIdLabel id: qrfinderButton
text: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString text: qsTr("QR Code") + translationManager.emptyString
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
visible : appWindow.qrScannerEnabled
enabled : visible
width: visible ? 60 * scaleRatio : 0
onClicked: {
cameraUi.state = "Capture"
cameraUi.qrcode_decoded.connect(updateFromQrCode)
}
} }
}
RowLayout {
// payment id input // payment id input
LineEdit { LineEdit {
id: paymentIdLine id: paymentIdLine
labelText: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString
Layout.fillWidth: true Layout.fillWidth: true
} }
}
Label { RowLayout {
text: qsTr("Description <font size='2'>( Optional )</font>")
+ translationManager.emptyString
}
LineEdit { LineEdit {
id: descriptionLine id: descriptionLine
labelText: qsTr("Description <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString
Layout.fillWidth: true Layout.fillWidth: true
} }
}
RowLayout {
StandardButton { StandardButton {
id: sendButton id: sendButton
Layout.bottomMargin: 17 * scaleRatio Layout.bottomMargin: 17 * scaleRatio
Layout.topMargin: 17 * scaleRatio Layout.topMargin: 17 * scaleRatio
text: qsTr("Send") + translationManager.emptyString text: qsTr("Send") + translationManager.emptyString
<<<<<<< HEAD
shadowReleasedColor: "#FF4304" shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00" shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C" releasedColor: "#FF6C3C"
pressedColor: "#FF4304" pressedColor: "#FF4304"
enabled : !appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype) enabled : !appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)
=======
enabled : !appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
>>>>>>> Transfer page QML development
onClicked: { onClicked: {
console.log("Transfer: paymentClicked") console.log("Transfer: paymentClicked")
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
@ -390,7 +429,7 @@ Rectangle {
anchors.leftMargin: 17 * scaleRatio anchors.leftMargin: 17 * scaleRatio
anchors.topMargin: 17 * scaleRatio anchors.topMargin: 17 * scaleRatio
anchors.bottomMargin: 17 * scaleRatio anchors.bottomMargin: 17 * scaleRatio
spacing: 10 * scaleRatio spacing: 20 * scaleRatio
enabled: !viewOnly || pageRoot.enabled enabled: !viewOnly || pageRoot.enabled
RowLayout { RowLayout {
@ -433,8 +472,6 @@ Rectangle {
} }
} }
PrivacyLevel { PrivacyLevel {
visible: persistentSettings.transferShowAdvanced && !isMobile visible: persistentSettings.transferShowAdvanced && !isMobile
id: privacyLevelItem id: privacyLevelItem