From ac70f27fe3ea192a4ab0be7c2844a181b6e943f3 Mon Sep 17 00:00:00 2001 From: Block Mechanic Date: Mon, 24 Oct 2022 14:56:17 +0200 Subject: [PATCH] Minor --- src/qt/forms/sendcoinsdialog.ui | 22 +++++++++++----------- src/qt/forms/sendcoinsentry.ui | 1 + src/qt/sendcoinsdialog.cpp | 2 +- src/qt/sendcoinsentry.cpp | 26 +++++++++++--------------- src/qt/sendcoinsentry.h | 4 +--- src/qt/transactiondesc.cpp | 21 ++++++++++++++------- 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 7af57a4..f00d5fb 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -588,7 +588,7 @@ 0 0 830 - 104 + 70 @@ -761,15 +761,15 @@ + + + 75 + true + + Using the fallbackfee can result in sending a transaction that will take several hours or days (or never) to confirm. Consider choosing your fee manually or wait until you have validated the complete chain. - - - 75 - true - - Warning: Fee estimation is currently not possible. @@ -850,7 +850,7 @@ Specify a custom fee per kB (1,000 bytes) of the transaction's virtual size. -Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis per kB" for a transaction size of 500 bytes (half of 1 kB) would ultimately yield a fee of only 50 satoshis. +Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis per kB" for a transaction size of 500 bytes (half of 1 kB) would ultimately yield a fee of only 50 satoshis. per kilobyte @@ -1074,12 +1074,12 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p - - Enable Replace-By-Fee - With Replace-By-Fee (BIP-125) you can increase a transaction's fee after it is sent. Without this, a higher fee may be recommended to compensate for increased transaction delay risk. + + Enable Replace-By-Fee + diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index e911153..8badedf 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -1326,6 +1326,7 @@ CrownAmountField QLineEdit
qt/crownamountfield.h
+ 1 diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index a589ec0..ae45d4c 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -753,7 +753,7 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances) balance = balances.watch_only_balance; ui->labelBalanceName->setText(tr("Watch-only balance:")); } - ui->labelBalance->setText(formatMultiAssetAmount(balance, model->getOptionsModel()->getDisplayUnit(), CrownUnits::SeparatorStyle::ALWAYS, "")); + ui->labelBalance->setText(formatMultiAssetAmount(balance, model->getOptionsModel()->getDisplayUnit(), CrownUnits::SeparatorStyle::ALWAYS, " ")); } } diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index a592869..c93e0ed 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -62,26 +62,23 @@ SendCoinsEntry::~SendCoinsEntry() void SendCoinsEntry::assetList(){ // Keep up to date with wallet - interfaces::Wallet& wallet = model->wallet(); - m_balances = wallet.getBalances(); + if(!model) + return; + + interfaces::WalletBalances m_balances = model->wallet().getBalances(); + QStringList list; - - for(auto const& x : m_balances.balance){ + + for(auto const& x : m_balances.balance) list << QString::fromStdString(x.first.getAssetName()); - } - std::sort(list.begin(), list.end()); - + //std::sort(list.begin(), list.end()); + QStringListModel *a_model = new QStringListModel(); a_model->setStringList(list); ui->assetBox->setModel(a_model); } -void SendCoinsEntry::setBalance(const interfaces::WalletBalances& balances) -{ - assetList(); -} - void SendCoinsEntry::on_pasteButton_clicked() { // Paste text from clipboard into recipient field @@ -113,8 +110,6 @@ void SendCoinsEntry::setModel(WalletModel *_model) if (_model && _model->getOptionsModel()) connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); - connect(model, &WalletModel::balanceChanged, this, &SendCoinsEntry::setBalance); - clear(); } @@ -139,6 +134,7 @@ void SendCoinsEntry::clear() // update the display unit, to not use the default ("BTC") updateDisplayUnit(); + assetList(); } void SendCoinsEntry::checkSubtractFeeFromAmount() @@ -201,7 +197,7 @@ SendAssetsRecipient SendCoinsEntry::getValue() for(auto const& x : passetsCache->GetItemsMap()){ if(QString::fromStdString(x.second->second.asset.getAssetName()) == ui->assetBox->currentText()) - recipient.asset = x.second->second.asset; + recipient.asset = x.second->second.asset; } return recipient; diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index b7a0579..db84d08 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -44,6 +44,7 @@ class SendCoinsEntry : public QStackedWidget void setValue(const SendAssetsRecipient &value); void setAddress(const QString &address); void setAmount(const CAmount &amount); + void assetList(); /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases * (issue https://bugreports.qt-project.org/browse/QTBUG-10907). @@ -76,11 +77,8 @@ private Q_SLOTS: Ui::SendCoinsEntry *ui; WalletModel *model; const PlatformStyle *platformStyle; - interfaces::WalletBalances m_balances; bool updateLabel(const QString &address); - void assetList(); - void setBalance(const interfaces::WalletBalances &balances); }; diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index d740366..c2dd50d 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -163,14 +163,19 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall // Coinbase // CAmountMap mapUnmatured; - for (const CTxOut& txout : wtx.tx->vout) + for (size_t o = 0; o < (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout.size() : wtx.tx->vout.size()); o++) { + const CTxOutAsset &txout = (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout[o] : wtx.tx->vout[o]); + + //for (const CTxOutAsset& txout :(wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout : wtx.tx->vout)) mapUnmatured += wallet.getCredit(txout, ISMINE_ALL); + } strHTML += "" + tr("Credit") + ": "; if (status.is_in_main_chain) strHTML += formatMultiAssetAmount(mapUnmatured,unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + " (" + tr("matures in %n more block(s)", "", status.blocks_to_maturity) + ")"; else strHTML += "(" + tr("not accepted") + ")"; strHTML += "
"; + } else if (mapNet > CAmountMap()) { @@ -202,8 +207,8 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall // Debit // auto mine = wtx.txout_is_mine.begin(); - for (const CTxOut& txout : wtx.tx->vout) - { + for (size_t o = 0; o < (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout.size() : wtx.tx->vout.size()); o++) { + const CTxOutAsset &txout = (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout[o] : wtx.tx->vout[o]); // Ignore change isminetype toSelf = *(mine++); if ((toSelf == ISMINE_SPENDABLE) && (fAllFromMe == ISMINE_SPENDABLE)) @@ -259,7 +264,8 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall } } mine = wtx.txout_is_mine.begin(); - for (const CTxOut& txout : wtx.tx->vout) { + for (size_t o = 0; o < (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout.size() : wtx.tx->vout.size()); o++) { + const CTxOutAsset &txout = (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout[o] : wtx.tx->vout[o]); if (*(mine++)) { strHTML += "" + tr("Credit") + ": " + formatMultiAssetAmount(wallet.getCredit(txout, ISMINE_ALL),unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "
"; } @@ -319,10 +325,11 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall for (const CTxIn& txin : wtx.tx->vin) if(wallet.txinIsMine(txin)) strHTML += "" + tr("Debit") + ": " + formatMultiAssetAmount(wallet.getDebit(txin, ISMINE_ALL)*-1,unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "
"; - for (const CTxOut& txout : wtx.tx->vout) + for (size_t o = 0; o < (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout.size() : wtx.tx->vout.size()); o++) { + const CTxOutAsset &txout = (wtx.tx->nVersion >= TX_ELE_VERSION ? wtx.tx->vpout[o] : wtx.tx->vout[o]); if(wallet.txoutIsMine(txout)) strHTML += "" + tr("Credit") + ": " + formatMultiAssetAmount(wallet.getCredit(txout, ISMINE_ALL),unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "
"; - + } strHTML += "
" + tr("Transaction") + ":
"; strHTML += GUIUtil::HtmlEscape(wtx.tx->ToString(), true); @@ -338,7 +345,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall { { strHTML += "
  • "; - const CTxOut &vout = prev.out; + const CTxOutAsset &vout = prev.out; CTxDestination address; if (ExtractDestination(vout.scriptPubKey, address)) {