Skip to content

Commit

Permalink
Merge pull request #149 from BlockMechanic/segwit
Browse files Browse the repository at this point in the history
Minor
  • Loading branch information
BlockMechanic authored Oct 24, 2022
2 parents f21aba7 + ac70f27 commit 8443138
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 37 deletions.
22 changes: 11 additions & 11 deletions src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@
<x>0</x>
<y>0</y>
<width>830</width>
<height>104</height>
<height>70</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
Expand Down Expand Up @@ -761,15 +761,15 @@
</item>
<item>
<widget class="QLabel" name="fallbackFeeWarningLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Warning: Fee estimation is currently not possible.</string>
</property>
Expand Down Expand Up @@ -850,7 +850,7 @@
<property name="toolTip">
<string>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.</string>
Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satoshis per kB&quot; for a transaction size of 500 bytes (half of 1 kB) would ultimately yield a fee of only 50 satoshis.</string>
</property>
<property name="text">
<string>per kilobyte</string>
Expand Down Expand Up @@ -1074,12 +1074,12 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
</item>
<item>
<widget class="QCheckBox" name="optInRBF">
<property name="text">
<string>Enable Replace-By-Fee</string>
</property>
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Enable Replace-By-Fee</string>
</property>
</widget>
</item>
</layout>
Expand Down
1 change: 1 addition & 0 deletions src/qt/forms/sendcoinsentry.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,7 @@
<class>CrownAmountField</class>
<extends>QLineEdit</extends>
<header>qt/crownamountfield.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, " "));
}
}

Expand Down
26 changes: 11 additions & 15 deletions src/qt/sendcoinsentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}

Expand All @@ -139,6 +134,7 @@ void SendCoinsEntry::clear()

// update the display unit, to not use the default ("BTC")
updateDisplayUnit();
assetList();
}

void SendCoinsEntry::checkSubtractFeeFromAmount()
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/qt/sendcoinsentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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);

};

Expand Down
21 changes: 14 additions & 7 deletions src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 += "<b>" + tr("Credit") + ":</b> ";
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 += "<br>";

}
else if (mapNet > CAmountMap())
{
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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 += "<b>" + tr("Credit") + ":</b> " + formatMultiAssetAmount(wallet.getCredit(txout, ISMINE_ALL),unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "<br>";
}
Expand Down Expand Up @@ -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 += "<b>" + tr("Debit") + ":</b> " + formatMultiAssetAmount(wallet.getDebit(txin, ISMINE_ALL)*-1,unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "<br>";
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 += "<b>" + tr("Credit") + ":</b> " + formatMultiAssetAmount(wallet.getCredit(txout, ISMINE_ALL),unit, CrownUnits::SeparatorStyle::ALWAYS, "\n") + "<br>";

}
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
strHTML += GUIUtil::HtmlEscape(wtx.tx->ToString(), true);

Expand All @@ -338,7 +345,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
{
{
strHTML += "<li>";
const CTxOut &vout = prev.out;
const CTxOutAsset &vout = prev.out;
CTxDestination address;
if (ExtractDestination(vout.scriptPubKey, address))
{
Expand Down

0 comments on commit 8443138

Please sign in to comment.