Merge #13158: [Qt]: Improve sendcoinsdialog readability
f08a385590
[qt]: changes sendcoinsdialog's box layout for improved readability. (marcoagner)
Pull request description:
I'm addressing two (probably duplicate) issues: https://github.com/bitcoin/bitcoin/issues/11606 and https://github.com/bitcoin/bitcoin/issues/10613.
Some points worth noting:
- I've tried to balance the proposed changes on both issues without going too far and remaining a bit conservative. It will be easier to improve based on suggestions where necessary.
- I preferred to maintain a layout that doesn't ask for an address truncation because, in my view, this wallet should be conservative on this.
- I didn't follow the idea of aligning the amounts to the right for finding it more natural (and minimalist) to read the information without having to map alignments. Additionally, that approach seems to need more `<hr />`'s (or similar) in order to help the user to map information, which ended up cluttering the box too much (specially with multiple recipients). Thus, I preferred to just give some more space between recipients. Let me know if there are better ideas on this.
Visually, I went from this (current):
![screenshot from 2018-05-03 15-11-30](https://user-images.githubusercontent.com/5016303/39581859-16abec82-4edc-11e8-86d3-eb722f8a7ed6.png)
To this:
![screenshot from 2018-05-03 15-15-41](https://user-images.githubusercontent.com/5016303/39582066-96856adc-4edc-11e8-804c-468aec44cc8d.png)
As a side note, while doing this, I thought about a better way to show fees and found there's already a PR on this (https://github.com/bitcoin/bitcoin/pull/12189) and thought it is
Tree-SHA512: e94b740fab6c1babd853a97be65c3b6f86ec174c975a926fde66b147f7a47e0cf0fa10f7255ba92aaba68c76a80dde8c688008179a34705a9799bf24d3c5cd46
This commit is contained in:
commit
81c533c6f4
1 changed files with 29 additions and 22 deletions
|
@ -288,44 +288,60 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||||
address.append("</span>");
|
address.append("</span>");
|
||||||
|
|
||||||
QString recipientElement;
|
QString recipientElement;
|
||||||
|
recipientElement = "<br />";
|
||||||
|
|
||||||
if (!rcp.paymentRequest.IsInitialized()) // normal payment
|
if (!rcp.paymentRequest.IsInitialized()) // normal payment
|
||||||
{
|
{
|
||||||
if(rcp.label.length() > 0) // label with address
|
if(rcp.label.length() > 0) // label with address
|
||||||
{
|
{
|
||||||
recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label));
|
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label)));
|
||||||
recipientElement.append(QString(" (%1)").arg(address));
|
recipientElement.append(QString(" (%1)").arg(address));
|
||||||
}
|
}
|
||||||
else // just address
|
else // just address
|
||||||
{
|
{
|
||||||
recipientElement = tr("%1 to %2").arg(amount, address);
|
recipientElement.append(tr("%1 to %2").arg(amount, address));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!rcp.authenticatedMerchant.isEmpty()) // authenticated payment request
|
else if(!rcp.authenticatedMerchant.isEmpty()) // authenticated payment request
|
||||||
{
|
{
|
||||||
recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant));
|
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant)));
|
||||||
}
|
}
|
||||||
else // unauthenticated payment request
|
else // unauthenticated payment request
|
||||||
{
|
{
|
||||||
recipientElement = tr("%1 to %2").arg(amount, address);
|
recipientElement.append(tr("%1 to %2").arg(amount, address));
|
||||||
}
|
}
|
||||||
|
|
||||||
formatted.append(recipientElement);
|
formatted.append(recipientElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString questionString = tr("Are you sure you want to send?");
|
QString questionString = tr("Are you sure you want to send?");
|
||||||
questionString.append("<br /><br />%1");
|
questionString.append("<br /><span style='font-size:10pt;'>");
|
||||||
|
questionString.append(tr("Please, review your transaction."));
|
||||||
|
questionString.append("</span><br />%1");
|
||||||
|
|
||||||
if(txFee > 0)
|
if(txFee > 0)
|
||||||
{
|
{
|
||||||
// append fee string if a fee is required
|
// append fee string if a fee is required
|
||||||
questionString.append("<hr /><span style='color:#aa0000;'>");
|
questionString.append("<hr /><b>");
|
||||||
questionString.append(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
|
questionString.append(tr("Transaction fee"));
|
||||||
questionString.append("</span> ");
|
questionString.append("</b>");
|
||||||
questionString.append(tr("added as transaction fee"));
|
|
||||||
|
|
||||||
// append transaction size
|
// append transaction size
|
||||||
questionString.append(" (" + QString::number((double)currentTransaction.getTransactionSize() / 1000) + " kB)");
|
questionString.append(" (" + QString::number((double)currentTransaction.getTransactionSize() / 1000) + " kB): ");
|
||||||
|
|
||||||
|
// append transaction fee value
|
||||||
|
questionString.append("<span style='color:#aa0000; font-weight:bold;'>");
|
||||||
|
questionString.append(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
|
||||||
|
questionString.append("</span><br />");
|
||||||
|
|
||||||
|
// append RBF message according to transaction's signalling
|
||||||
|
questionString.append("<span style='font-size:10pt; font-weight:normal;'>");
|
||||||
|
if (ui->optInRBF->isChecked()) {
|
||||||
|
questionString.append(tr("You can increase the fee later (signals Replace-By-Fee, BIP-125)."));
|
||||||
|
} else {
|
||||||
|
questionString.append(tr("Not signalling Replace-By-Fee, BIP-125."));
|
||||||
|
}
|
||||||
|
questionString.append("</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// add total amount in all subdivision units
|
// add total amount in all subdivision units
|
||||||
|
@ -337,19 +353,10 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||||
if(u != model->getOptionsModel()->getDisplayUnit())
|
if(u != model->getOptionsModel()->getDisplayUnit())
|
||||||
alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount));
|
alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount));
|
||||||
}
|
}
|
||||||
questionString.append(tr("Total Amount %1")
|
questionString.append(QString("<b>%1</b>: <b>%2</b>").arg(tr("Total Amount"))
|
||||||
.arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)));
|
.arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)));
|
||||||
questionString.append(QString("<span style='font-size:10pt;font-weight:normal;'><br />(=%1)</span>")
|
questionString.append(QString("<br /><span style='font-size:10pt; font-weight:normal;'>(=%1)</span>")
|
||||||
.arg(alternativeUnits.join(" " + tr("or") + "<br />")));
|
.arg(alternativeUnits.join(" " + tr("or") + " ")));
|
||||||
|
|
||||||
questionString.append("<hr /><span>");
|
|
||||||
if (ui->optInRBF->isChecked()) {
|
|
||||||
questionString.append(tr("You can increase the fee later (signals Replace-By-Fee, BIP-125)."));
|
|
||||||
} else {
|
|
||||||
questionString.append(tr("Not signalling Replace-By-Fee, BIP-125."));
|
|
||||||
}
|
|
||||||
questionString.append("</span>");
|
|
||||||
|
|
||||||
|
|
||||||
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
|
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
|
||||||
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);
|
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);
|
||||||
|
|
Loading…
Reference in a new issue