update sendTab

This commit is contained in:
DenioD
2019-10-28 10:26:04 +01:00
6 changed files with 71 additions and 37 deletions

View File

@@ -489,8 +489,6 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
confirm.setupUi(&d);
Settings::saveRestore(&d);
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
// Remove all existing address/amt qlabels on the confirm dialog.
int totalConfirmAddrItems = confirm.sendToAddrs->children().size();
for (int i = 0; i < totalConfirmAddrItems / 3; i++) {
@@ -526,7 +524,6 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
Addr->setObjectName(QString("Addr") % QString::number(i + 1));
Addr->setWordWrap(true);
Addr->setText(fnSplitAddressForWrap(toAddr.addr));
Addr->setFont(fixedFont);
confirm.gridLayout->addWidget(Addr, row, 0, 1, 1);
// Amount (hush)
@@ -646,11 +643,36 @@ void MainWindow::sendButton() {
// Then delete the additional fields from the sendTo tab
clearSendForm();
// Create a new Dialog to show that we are computing/sending the Tx
auto d = new QDialog(this);
auto connD = new Ui_ConnectionDialog();
connD->setupUi(d);
QPixmap logo(":/img/res/logobig.gif");
connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation));
connD->status->setText(tr("Please wait..."));
connD->statusDetail->setText(tr("Computing your transaction"));
d->show();
// And send the Tx
rpc->executeTransaction(tx,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
connD->status->setText(tr("Done!"));
connD->statusDetail->setText(txid);
QTimer::singleShot(1000, [=]() {
d->accept();
d->close();
delete connD;
delete d;
});
// Force a UI update so we get the unconfirmed Tx
rpc->refresh(true);
// If this was a recurring payment, update the payment with the info
if (!recurringPaymentHash.isEmpty()) {
// Since this is the send button payment, this is the first payment
@@ -661,6 +683,11 @@ void MainWindow::sendButton() {
// Errored out
[=] (QString opid, QString errStr) {
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
d->accept();
d->close();
delete connD;
delete d;
if (!opid.isEmpty())
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;