1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-23 02:52:58 +01:00

Merge pull request #1807

6fa805d qrscanner: update addressbook and transfer UI (mmbyday)
This commit is contained in:
luigi1111 2019-02-06 15:59:10 -06:00
commit b4e19cb3e8
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
7 changed files with 56 additions and 45 deletions

View File

@ -42,6 +42,7 @@ Item {
property string textColor: "#FFFFFF" property string textColor: "#FFFFFF"
property int fontSize: 12 * scaleRatio property int fontSize: 12 * scaleRatio
property alias text: inlineText.text property alias text: inlineText.text
property alias buttonColor: rect.color
signal clicked() signal clicked()
function doClick() { function doClick() {
@ -55,7 +56,7 @@ Item {
color: MoneroComponents.Style.buttonBackgroundColorDisabled color: MoneroComponents.Style.buttonBackgroundColorDisabled
border.color: "black" border.color: "black"
height: 28 * scaleRatio height: 28 * scaleRatio
width: inlineText.width + 22 * scaleRatio width: inlineText.text ? (inlineText.width + 22) * scaleRatio : inlineButton.icon ? (inlineImage.width + 16) * scaleRatio : rect.height
radius: 4 radius: 4
anchors.top: parent.top anchors.top: parent.top
@ -71,6 +72,13 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Image {
id: inlineImage
visible: inlineButton.icon !== ""
anchors.centerIn: parent
source: inlineButton.icon
}
MouseArea { MouseArea {
id: buttonArea id: buttonArea
cursorShape: rect.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: rect.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
@ -78,12 +86,12 @@ Item {
anchors.fill: parent anchors.fill: parent
onClicked: doClick() onClicked: doClick()
onEntered: { onEntered: {
rect.color = "#707070"; rect.color = buttonColor ? buttonColor : "#707070";
rect.opacity = 0.8; rect.opacity = 0.8;
} }
onExited: { onExited: {
rect.opacity = 1.0; rect.opacity = 1.0;
rect.color = "#808080"; rect.color = buttonColor ? buttonColor : "#808080";
} }
} }
} }

View File

@ -83,6 +83,9 @@ ColumnLayout {
property alias addressValidation: input.addressValidation property alias addressValidation: input.addressValidation
property string backgroundColor: "" // mock property string backgroundColor: "" // mock
property alias inlineButton: inlineButtonId
property bool inlineButtonVisible: false
signal labelButtonClicked(); signal labelButtonClicked();
signal inputLabelLinkActivated(); signal inputLabelLinkActivated();
signal editingFinished(); signal editingFinished();
@ -183,5 +186,14 @@ ColumnLayout {
anchors.fill: parent anchors.fill: parent
visible: !item.borderDisabled visible: !item.borderDisabled
} }
MoneroComponents.InlineButton {
id: inlineButtonId
visible: (inlineButtonId.text || inlineButtonId.icon) && inlineButtonVisible ? true : false
anchors.right: parent.right
anchors.rightMargin: 8 * scaleRatio
anchors.top: parent.top
anchors.topMargin: 4 * scaleRatio
}
} }
} }

BIN
images/qr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
images/qr@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -28,14 +28,16 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "../components" import "../components" as MoneroComponents
import moneroComponents.AddressBook 1.0 import moneroComponents.AddressBook 1.0
import moneroComponents.AddressBookModel 1.0 import moneroComponents.AddressBookModel 1.0
import moneroComponents.Clipboard 1.0
ColumnLayout { ColumnLayout {
id: root id: root
property var model property var model
property bool selectAndSend: false property bool selectAndSend: false
Clipboard { id: clipboard }
ColumnLayout { ColumnLayout {
Layout.margins: (isMobile ? 17 : 20) * scaleRatio Layout.margins: (isMobile ? 17 : 20) * scaleRatio
@ -44,34 +46,27 @@ ColumnLayout {
spacing: 26 * scaleRatio spacing: 26 * scaleRatio
visible: !root.selectAndSend visible: !root.selectAndSend
RowLayout { MoneroComponents.LineEditMulti {
StandardButton { id: addressLine
id: qrfinderButton Layout.fillWidth: true
text: qsTr("Qr Code") + translationManager.emptyString fontBold: true
visible : appWindow.qrScannerEnabled labelText: qsTr("Address") + translationManager.emptyString
enabled : visible placeholderText: qsTr("4.. / 8..") + translationManager.emptyString
width: visible ? 60 * scaleRatio : 0 wrapMode: Text.WrapAnywhere
onClicked: { addressValidation: true
cameraUi.state = "Capture" inlineButton.icon: "../images/qr.png"
cameraUi.qrcode_decoded.connect(updateFromQrCode) inlineButton.buttonColor: MoneroComponents.Style.orange
} inlineButton.onClicked: {
} cameraUi.state = "Capture"
cameraUi.qrcode_decoded.connect(updateFromQrCode)
LineEditMulti {
Layout.fillWidth: true;
id: addressLine
labelText: qsTr("Address") + translationManager.emptyString
error: true;
placeholderText: qsTr("4.. / 8..") + translationManager.emptyString
wrapMode: Text.WrapAnywhere
addressValidation: true
} }
inlineButtonVisible : appWindow.qrScannerEnabled && !addressLine.text
} }
LineEditMulti { MoneroComponents.LineEditMulti {
id: paymentIdLine id: paymentIdLine
visible: appWindow.persistentSettings.showPid visible: appWindow.persistentSettings.showPid
Layout.fillWidth: true; Layout.fillWidth: true
labelText: qsTr("Payment ID <font size='2'>(Optional)</font>") + translationManager.emptyString labelText: qsTr("Payment ID <font size='2'>(Optional)</font>") + translationManager.emptyString
placeholderText: qsTr("Paste 64 hexadecimal characters") + translationManager.emptyString placeholderText: qsTr("Paste 64 hexadecimal characters") + translationManager.emptyString
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
@ -79,9 +74,9 @@ ColumnLayout {
// + translationManager.emptyString // + translationManager.emptyString
} }
LineEditMulti { MoneroComponents.LineEditMulti {
id: descriptionLine id: descriptionLine
Layout.fillWidth: true; Layout.fillWidth: true
labelText: qsTr("Description <font size='2'>(Optional)</font>") + translationManager.emptyString labelText: qsTr("Description <font size='2'>(Optional)</font>") + translationManager.emptyString
placeholderText: qsTr("Give this entry a name or description") + translationManager.emptyString placeholderText: qsTr("Give this entry a name or description") + translationManager.emptyString
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
@ -91,7 +86,7 @@ ColumnLayout {
RowLayout { RowLayout {
id: addButton id: addButton
Layout.bottomMargin: 17 * scaleRatio Layout.bottomMargin: 17 * scaleRatio
StandardButton { MoneroComponents.StandardButton {
text: qsTr("Add") + translationManager.emptyString text: qsTr("Add") + translationManager.emptyString
enabled: checkInformation(addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype) enabled: checkInformation(addressLine.text, paymentIdLine.text, appWindow.persistentSettings.nettype)
@ -129,16 +124,16 @@ ColumnLayout {
NumberAnimation { duration: 200; easing.type: Easing.InQuad } NumberAnimation { duration: 200; easing.type: Easing.InQuad }
} }
Scroll { MoneroComponents.Scroll {
id: flickableScroll id: flickableScroll
anchors.right: table.right anchors.right: table.right
anchors.rightMargin: -14 anchors.rightMargin: -14 * scaleRatio
anchors.top: table.top anchors.top: table.top
anchors.bottom: table.bottom anchors.bottom: table.bottom
flickable: table flickable: table
} }
AddressBookTable { MoneroComponents.AddressBookTable {
id: table id: table
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -179,7 +174,6 @@ ColumnLayout {
console.log("updateFromQrCode") console.log("updateFromQrCode")
addressLine.text = address addressLine.text = address
paymentIdLine.text = payment_id paymentIdLine.text = payment_id
//amountLine.text = amount
descriptionLine.text = recipient_name + " " + tx_description descriptionLine.text = recipient_name + " " + tx_description
cameraUi.qrcode_decoded.disconnect(updateFromQrCode) cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
} }

View File

@ -168,7 +168,7 @@ Rectangle {
Layout.topMargin: 12 * scaleRatio Layout.topMargin: 12 * scaleRatio
text: qsTr("Transaction priority") + translationManager.emptyString text: qsTr("Transaction priority") + translationManager.emptyString
fontBold: false fontBold: false
fontSize: 16 fontSize: 16 * scaleRatio
} }
// Note: workaround for translations in listElements // Note: workaround for translations in listElements
// ListElement: cannot use script for property value, so // ListElement: cannot use script for property value, so
@ -235,24 +235,19 @@ Rectangle {
addressLine.text = clipboardText; addressLine.text = clipboardText;
} }
} }
} inlineButton.icon: "../images/qr.png"
inlineButton.buttonColor: MoneroComponents.Style.orange
StandardButton { inlineButton.onClicked: {
id: qrfinderButton
text: qsTr("QR Code") + translationManager.emptyString
visible : appWindow.qrScannerEnabled
enabled : visible
width: visible ? 60 * scaleRatio : 0
onClicked: {
cameraUi.state = "Capture" cameraUi.state = "Capture"
cameraUi.qrcode_decoded.connect(updateFromQrCode) cameraUi.qrcode_decoded.connect(updateFromQrCode)
} }
inlineButtonVisible : appWindow.qrScannerEnabled && !addressLine.text
} }
} }
StandardButton { StandardButton {
id: resolveButton id: resolveButton
width: 80 width: 80 * scaleRatio
text: qsTr("Resolve") + translationManager.emptyString text: qsTr("Resolve") + translationManager.emptyString
visible: TxUtils.isValidOpenAliasAddress(addressLine.text) visible: TxUtils.isValidOpenAliasAddress(addressLine.text)
enabled : visible enabled : visible

View File

@ -213,6 +213,8 @@
<file>components/RadioButton.qml</file> <file>components/RadioButton.qml</file>
<file>images/editIcon.png</file> <file>images/editIcon.png</file>
<file>images/editIcon@2x.png</file> <file>images/editIcon@2x.png</file>
<file>images/qr.png</file>
<file>images/qr@2x.png</file>
<file>pages/settings/Settings.qml</file> <file>pages/settings/Settings.qml</file>
<file>pages/settings/SettingsWallet.qml</file> <file>pages/settings/SettingsWallet.qml</file>
<file>pages/settings/SettingsNode.qml</file> <file>pages/settings/SettingsNode.qml</file>