Changeset View
Changeset View
Standalone View
Standalone View
src/qt/coincontroldialog.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, | ||||
// restore list mode and sortorder as a convenience feature | // restore list mode and sortorder as a convenience feature | ||||
QSettings settings; | QSettings settings; | ||||
if (settings.contains("nCoinControlMode") && | if (settings.contains("nCoinControlMode") && | ||||
!settings.value("nCoinControlMode").toBool()) | !settings.value("nCoinControlMode").toBool()) | ||||
ui->radioTreeMode->click(); | ui->radioTreeMode->click(); | ||||
if (settings.contains("nCoinControlSortColumn") && | if (settings.contains("nCoinControlSortColumn") && | ||||
settings.contains("nCoinControlSortOrder")) | settings.contains("nCoinControlSortOrder")) | ||||
sortView( | sortView(settings.value("nCoinControlSortColumn").toInt(), | ||||
settings.value("nCoinControlSortColumn").toInt(), | (static_cast<Qt::SortOrder>( | ||||
((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt())); | settings.value("nCoinControlSortOrder").toInt()))); | ||||
} | } | ||||
CoinControlDialog::~CoinControlDialog() { | CoinControlDialog::~CoinControlDialog() { | ||||
QSettings settings; | QSettings settings; | ||||
settings.setValue("nCoinControlMode", ui->radioListMode->isChecked()); | settings.setValue("nCoinControlMode", ui->radioListMode->isChecked()); | ||||
settings.setValue("nCoinControlSortColumn", sortColumn); | settings.setValue("nCoinControlSortColumn", sortColumn); | ||||
settings.setValue("nCoinControlSortOrder", (int)sortOrder); | settings.setValue("nCoinControlSortOrder", (int)sortOrder); | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | void CoinControlDialog::updateLabels(WalletModel *model, QDialog *dialog) { | ||||
// nPayAmount | // nPayAmount | ||||
Amount nPayAmount = Amount::zero(); | Amount nPayAmount = Amount::zero(); | ||||
bool fDust = false; | bool fDust = false; | ||||
CMutableTransaction txDummy; | CMutableTransaction txDummy; | ||||
for (const Amount amount : CoinControlDialog::payAmounts) { | for (const Amount amount : CoinControlDialog::payAmounts) { | ||||
nPayAmount += amount; | nPayAmount += amount; | ||||
if (amount > Amount::zero()) { | if (amount > Amount::zero()) { | ||||
CTxOut txout(Amount(amount), (CScript)std::vector<uint8_t>(24, 0)); | CTxOut txout(amount, | ||||
static_cast<CScript>(std::vector<uint8_t>(24, 0))); | |||||
txDummy.vout.push_back(txout); | txDummy.vout.push_back(txout); | ||||
if (txout.IsDust(dustRelayFee)) { | if (txout.IsDust(dustRelayFee)) { | ||||
fDust = true; | fDust = true; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Amount nAmount = Amount::zero(); | Amount nAmount = Amount::zero(); | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | if (nQuantity > 0) { | ||||
nChange = nAmount - nPayAmount; | nChange = nAmount - nPayAmount; | ||||
if (!CoinControlDialog::fSubtractFeeFromAmount) { | if (!CoinControlDialog::fSubtractFeeFromAmount) { | ||||
nChange -= nPayFee; | nChange -= nPayFee; | ||||
} | } | ||||
// Never create dust outputs; if we would, just add the dust to the | // Never create dust outputs; if we would, just add the dust to the | ||||
// fee. | // fee. | ||||
if (nChange > Amount::zero() && nChange < MIN_CHANGE) { | if (nChange > Amount::zero() && nChange < MIN_CHANGE) { | ||||
CTxOut txout(nChange, (CScript)std::vector<uint8_t>(24, 0)); | CTxOut txout(nChange, | ||||
static_cast<CScript>(std::vector<uint8_t>(24, 0))); | |||||
if (txout.IsDust(dustRelayFee)) { | if (txout.IsDust(dustRelayFee)) { | ||||
// dust-change will be raised until no dust | // dust-change will be raised until no dust | ||||
if (CoinControlDialog::fSubtractFeeFromAmount) { | if (CoinControlDialog::fSubtractFeeFromAmount) { | ||||
nChange = txout.GetDustThreshold(dustRelayFee); | nChange = txout.GetDustThreshold(dustRelayFee); | ||||
} else { | } else { | ||||
nPayFee += nChange; | nPayFee += nChange; | ||||
nChange = Amount::zero(); | nChange = Amount::zero(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |