Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | ui->groupFee | ||||
(int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt()))) | (int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt()))) | ||||
->setChecked(true); | ->setChecked(true); | ||||
ui->groupCustomFee->setId(ui->radioCustomPerKilobyte, 0); | ui->groupCustomFee->setId(ui->radioCustomPerKilobyte, 0); | ||||
ui->groupCustomFee->setId(ui->radioCustomAtLeast, 1); | ui->groupCustomFee->setId(ui->radioCustomAtLeast, 1); | ||||
ui->groupCustomFee | ui->groupCustomFee | ||||
->button((int)std::max( | ->button((int)std::max( | ||||
0, std::min(1, settings.value("nCustomFeeRadio").toInt()))) | 0, std::min(1, settings.value("nCustomFeeRadio").toInt()))) | ||||
->setChecked(true); | ->setChecked(true); | ||||
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong()); | ui->customFee->setValue( | ||||
Amount(settings.value("nTransactionFee").toLongLong())); | |||||
ui->checkBoxMinimumFee->setChecked( | ui->checkBoxMinimumFee->setChecked( | ||||
settings.value("fPayOnlyMinFee").toBool()); | settings.value("fPayOnlyMinFee").toBool()); | ||||
minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool()); | minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool()); | ||||
} | } | ||||
void SendCoinsDialog::setClientModel(ClientModel *_clientModel) { | void SendCoinsDialog::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients()) { | ||||
} | } | ||||
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 /><br />%1"); | ||||
if (txFee > 0) { | if (txFee > Amount(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 /><span style='color:#aa0000;'>"); | ||||
questionString.append(BitcoinUnits::formatHtmlWithUnit( | questionString.append(BitcoinUnits::formatHtmlWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), txFee)); | model->getOptionsModel()->getDisplayUnit(), txFee)); | ||||
questionString.append("</span> "); | questionString.append("</span> "); | ||||
questionString.append(tr("added as transaction fee")); | questionString.append(tr("added as transaction fee")); | ||||
// append transaction size | // append transaction size | ||||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | void SendCoinsDialog::setBalance(const Amount balance, | ||||
if (model && model->getOptionsModel()) { | if (model && model->getOptionsModel()) { | ||||
ui->labelBalance->setText(BitcoinUnits::formatWithUnit( | ui->labelBalance->setText(BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), balance)); | model->getOptionsModel()->getDisplayUnit(), balance)); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateDisplayUnit() { | void SendCoinsDialog::updateDisplayUnit() { | ||||
setBalance(model->getBalance(), 0, 0, 0, 0, 0); | setBalance(model->getBalance(), Amount(0), Amount(0), Amount(0), Amount(0), | ||||
Amount(0)); | |||||
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); | ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); | ||||
updateMinFeeLabel(); | updateMinFeeLabel(); | ||||
updateSmartFeeLabel(); | updateSmartFeeLabel(); | ||||
} | } | ||||
void SendCoinsDialog::processSendCoinsReturn( | void SendCoinsDialog::processSendCoinsReturn( | ||||
const WalletModel::SendCoinsReturn &sendCoinsReturn, | const WalletModel::SendCoinsReturn &sendCoinsReturn, | ||||
const QString &msgArg) { | const QString &msgArg) { | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | if (ui->radioSmartFee->isChecked()) { | ||||
" / " + tr("%n block(s)", "", nConfirmTarget)); | " / " + tr("%n block(s)", "", nConfirmTarget)); | ||||
} else { | } else { | ||||
payTxFee = CFeeRate(Amount(ui->customFee->value())); | payTxFee = CFeeRate(Amount(ui->customFee->value())); | ||||
// if user has selected to set a minimum absolute fee, pass the value to | // if user has selected to set a minimum absolute fee, pass the value to | ||||
// coincontrol | // coincontrol | ||||
// set nMinimumTotalFee to 0 in case of user has selected that the fee | // set nMinimumTotalFee to 0 in case of user has selected that the fee | ||||
// is per KB | // is per KB | ||||
CoinControlDialog::coinControl->nMinimumTotalFee = Amount( | CoinControlDialog::coinControl->nMinimumTotalFee = | ||||
ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0); | ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() | ||||
: Amount(0); | |||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateFeeMinimizedLabel() { | void SendCoinsDialog::updateFeeMinimizedLabel() { | ||||
if (!model || !model->getOptionsModel()) return; | if (!model || !model->getOptionsModel()) return; | ||||
if (ui->radioSmartFee->isChecked()) | if (ui->radioSmartFee->isChecked()) | ||||
ui->labelFeeMinimized->setText(ui->labelSmartFee->text()); | ui->labelFeeMinimized->setText(ui->labelSmartFee->text()); | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | void SendCoinsDialog::coinControlUpdateLabels() { | ||||
// set pay amounts | // set pay amounts | ||||
CoinControlDialog::payAmounts.clear(); | CoinControlDialog::payAmounts.clear(); | ||||
CoinControlDialog::fSubtractFeeFromAmount = false; | CoinControlDialog::fSubtractFeeFromAmount = false; | ||||
for (int i = 0; i < ui->entries->count(); ++i) { | for (int i = 0; i < ui->entries->count(); ++i) { | ||||
SendCoinsEntry *entry = | SendCoinsEntry *entry = | ||||
qobject_cast<SendCoinsEntry *>(ui->entries->itemAt(i)->widget()); | qobject_cast<SendCoinsEntry *>(ui->entries->itemAt(i)->widget()); | ||||
if (entry && !entry->isHidden()) { | if (entry && !entry->isHidden()) { | ||||
SendCoinsRecipient rcp = entry->getValue(); | SendCoinsRecipient rcp = entry->getValue(); | ||||
CoinControlDialog::payAmounts.append(rcp.amount.GetSatoshis()); | CoinControlDialog::payAmounts.append(rcp.amount); | ||||
if (rcp.fSubtractFeeFromAmount) | if (rcp.fSubtractFeeFromAmount) | ||||
CoinControlDialog::fSubtractFeeFromAmount = true; | CoinControlDialog::fSubtractFeeFromAmount = true; | ||||
} | } | ||||
} | } | ||||
if (CoinControlDialog::coinControl->HasSelected()) { | if (CoinControlDialog::coinControl->HasSelected()) { | ||||
// actual coin control calculation | // actual coin control calculation | ||||
CoinControlDialog::updateLabels(model, this); | CoinControlDialog::updateLabels(model, this); | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |