Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | if (_model && _model->getOptionsModel()) { | ||||
SLOT(setMinimumFee())); | SLOT(setMinimumFee())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(updateFeeSectionControls())); | SLOT(updateFeeSectionControls())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(updateGlobalFeeVariables())); | SLOT(updateGlobalFeeVariables())); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
ui->customFee->setSingleStep(GetMinimumFee(1000, g_mempool)); | ui->customFee->setSingleStep(GetMinimumFee(1000, 2, g_mempool)); | ||||
updateFeeSectionControls(); | updateFeeSectionControls(); | ||||
updateMinFeeLabel(); | updateMinFeeLabel(); | ||||
updateSmartFeeLabel(); | updateSmartFeeLabel(); | ||||
updateGlobalFeeVariables(); | updateGlobalFeeVariables(); | ||||
// set the smartfee-sliders default value (wallets default conf.target | // set the smartfee-sliders default value (wallets default conf.target | ||||
// or last stored value) | // or last stored value) | ||||
QSettings settings; | QSettings settings; | ||||
▲ Show 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | if (amount > Amount::zero()) { | ||||
entry->setAmount(amount); | entry->setAmount(amount); | ||||
} else { | } else { | ||||
entry->setAmount(Amount::zero()); | entry->setAmount(Amount::zero()); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::setMinimumFee() { | void SendCoinsDialog::setMinimumFee() { | ||||
ui->radioCustomPerKilobyte->setChecked(true); | ui->radioCustomPerKilobyte->setChecked(true); | ||||
ui->customFee->setValue(GetMinimumFee(1000, g_mempool)); | ui->customFee->setValue(GetMinimumFee(1000, 2, g_mempool)); | ||||
} | } | ||||
void SendCoinsDialog::updateFeeSectionControls() { | void SendCoinsDialog::updateFeeSectionControls() { | ||||
ui->confTargetSelector->setEnabled(ui->radioSmartFee->isChecked()); | ui->confTargetSelector->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelSmartFee2->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee2->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelSmartFee3->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee3->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelFeeEstimation->setEnabled(ui->radioSmartFee->isChecked()); | ||||
Show All 31 Lines | |||||
} | } | ||||
void SendCoinsDialog::updateMinFeeLabel() { | void SendCoinsDialog::updateMinFeeLabel() { | ||||
if (model && model->getOptionsModel()) { | if (model && model->getOptionsModel()) { | ||||
ui->checkBoxMinimumFee->setText( | ui->checkBoxMinimumFee->setText( | ||||
tr("Pay only the required fee of %1") | tr("Pay only the required fee of %1") | ||||
.arg(BitcoinUnits::formatWithUnit( | .arg(BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
GetMinimumFee(1000, g_mempool)) + | GetMinimumFee(1000, 2, g_mempool)) + | ||||
"/kB")); | "/kB")); | ||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::updateSmartFeeLabel() { | void SendCoinsDialog::updateSmartFeeLabel() { | ||||
if (!model || !model->getOptionsModel()) { | if (!model || !model->getOptionsModel()) { | ||||
return; | return; | ||||
} | } | ||||
int nBlocksToConfirm = | int nBlocksToConfirm = | ||||
getConfTargetForIndex(ui->confTargetSelector->currentIndex()); | getConfTargetForIndex(ui->confTargetSelector->currentIndex()); | ||||
CFeeRate feeRate = g_mempool.estimateFee(nBlocksToConfirm); | CFeeRate feeRate = g_mempool.estimateFee(nBlocksToConfirm); | ||||
// not enough data => minfee | // not enough data => minfee | ||||
if (feeRate <= CFeeRate(Amount::zero())) { | if (feeRate <= CFeeRate(Amount::zero())) { | ||||
ui->labelSmartFee->setText( | ui->labelSmartFee->setText( | ||||
BitcoinUnits::formatWithUnit( | BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
std::max(CWallet::fallbackFee.GetFeePerK(), | std::max(CWallet::fallbackFee.GetFeePerK(), | ||||
GetMinimumFee(1000, g_mempool))) + | GetMinimumFee(1000, 2, g_mempool))) + | ||||
"/kB"); | "/kB"); | ||||
// (Smart fee not initialized yet. This usually takes a few blocks...) | // (Smart fee not initialized yet. This usually takes a few blocks...) | ||||
ui->labelSmartFee2->show(); | ui->labelSmartFee2->show(); | ||||
ui->labelFeeEstimation->setText(""); | ui->labelFeeEstimation->setText(""); | ||||
} else { | } else { | ||||
ui->labelSmartFee->setText( | ui->labelSmartFee->setText( | ||||
BitcoinUnits::formatWithUnit( | BitcoinUnits::formatWithUnit( | ||||
model->getOptionsModel()->getDisplayUnit(), | model->getOptionsModel()->getDisplayUnit(), | ||||
std::max(feeRate.GetFeePerK(), | std::max(feeRate.GetFeePerK(), | ||||
GetMinimumFee(1000, g_mempool))) + | GetMinimumFee(1000, 2, g_mempool))) + | ||||
"/kB"); | "/kB"); | ||||
ui->labelSmartFee2->hide(); | ui->labelSmartFee2->hide(); | ||||
ui->labelFeeEstimation->setText( | ui->labelFeeEstimation->setText( | ||||
tr("Estimated to begin confirmation within %n block(s).", "", | tr("Estimated to begin confirmation within %n block(s).", "", | ||||
nBlocksToConfirm)); | nBlocksToConfirm)); | ||||
} | } | ||||
updateFeeMinimizedLabel(); | updateFeeMinimizedLabel(); | ||||
▲ Show 20 Lines • Show All 215 Lines • Show Last 20 Lines |