aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-04-13 15:35:44 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-04-13 15:35:44 -0500
commit6a889bdaa19bd6ef66165d18d10f82c2c5ed6fa0 (patch)
tree4c89a95703d33dce1081856efca18d0741f52f62 /pages
parent042400b83fdea6c18ea8a7970cb0a8af2070c03a (diff)
parentb5fafb55c9ba3e3e1c8122b066202784f1339691 (diff)
downloadmonzero-gui-6a889bdaa19bd6ef66165d18d10f82c2c5ed6fa0.tar.gz
monzero-gui-6a889bdaa19bd6ef66165d18d10f82c2c5ed6fa0.tar.xz
monzero-gui-6a889bdaa19bd6ef66165d18d10f82c2c5ed6fa0.zip
Merge pull request #2739
b5fafb5 Transfer: display estimated transaction fee, requires #6302 (xiphon)
Diffstat (limited to 'pages')
-rw-r--r--pages/Transfer.qml59
1 files changed, 53 insertions, 6 deletions
diff --git a/pages/Transfer.qml b/pages/Transfer.qml
index 67f53eb6..15442ba4 100644
--- a/pages/Transfer.qml
+++ b/pages/Transfer.qml
@@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.9
+import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import moneroComponents.Clipboard 1.0
@@ -38,6 +39,7 @@ import "../components"
import "../components" as MoneroComponents
import "." 1.0
import "../js/TxUtils.js" as TxUtils
+import "../js/Utils.js" as Utils
Rectangle {
@@ -180,7 +182,7 @@ Rectangle {
%1 <a href='#'>(%2)</a>".arg(qsTr("Amount")).arg(qsTr("Change account"))
+ translationManager.emptyString
copyButton: !isNaN(amountLine.text) && persistentSettings.fiatPriceEnabled
- copyButtonText: fiatApiCurrencySymbol() + " ~" + fiatApiConvertToFiat(amountLine.text)
+ copyButtonText: "~%1 %2".arg(fiatApiConvertToFiat(amountLine.text)).arg(fiatApiCurrencySymbol())
copyButtonEnabled: false
onLabelLinkActivated: {
@@ -211,14 +213,61 @@ Rectangle {
regExp: /^(\d{1,8})?([\.]\d{1,12})?$/
}
}
+
+ MoneroComponents.TextPlain {
+ id: feeLabel
+ Layout.alignment: Qt.AlignRight
+ Layout.topMargin: 12
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 14
+ color: MoneroComponents.Style.defaultFontColor
+ property bool estimating: false
+ property var estimatedFee: null
+ property string estimatedFeeFiat: {
+ if (!persistentSettings.fiatPriceEnabled || estimatedFee == null) {
+ return "";
+ }
+ const fiatFee = fiatApiConvertToFiat(estimatedFee);
+ return " (%1 %3)".arg(fiatFee < 0.01 ? "<0.01" : "~" + fiatFee).arg(fiatApiCurrencySymbol());
+ }
+ property var fee: {
+ estimatedFee = null;
+ estimating = sendButton.enabled;
+ if (!sendButton.enabled) {
+ return;
+ }
+ currentWallet.estimateTransactionFeeAsync(
+ addressLine.text,
+ walletManager.amountFromString(amountLine.text),
+ priorityModelV5.get(priorityDropdown.currentIndex).priority,
+ function (amount) {
+ estimatedFee = Utils.removeTrailingZeros(amount);
+ estimating = false;
+ });
+ }
+ text: {
+ if (!sendButton.enabled || estimatedFee == null) {
+ return ""
+ }
+ return "%1: ~%2 XMR".arg(qsTr("Fee")).arg(estimatedFee) +
+ estimatedFeeFiat +
+ translationManager.emptyString;
+ }
+
+ BusyIndicator {
+ anchors.right: parent.right
+ running: feeLabel.estimating
+ height: parent.height
+ }
+ }
}
ColumnLayout {
visible: appWindow.walletMode >= 2
- Layout.fillWidth: true
+ Layout.alignment: Qt.AlignTop
Label {
id: transactionPriority
- Layout.topMargin: 12
+ Layout.topMargin: 0
text: qsTr("Transaction priority") + translationManager.emptyString
fontBold: false
fontSize: 16
@@ -242,14 +291,12 @@ Rectangle {
}
StandardDropdown {
- Layout.fillWidth: true
+ Layout.preferredWidth: 200
id: priorityDropdown
Layout.topMargin: 5
currentIndex: 0
}
}
- // Make sure dropdown is on top
- z: parent.z + 1
}
// recipient address input