Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
SendCoinsEntry *SendCoinsDialog::addEntry() { | SendCoinsEntry *SendCoinsDialog::addEntry() { | ||||
SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this); | SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this); | ||||
entry->setModel(model); | entry->setModel(model); | ||||
ui->entries->addWidget(entry); | ui->entries->addWidget(entry); | ||||
connect(entry, SIGNAL(removeEntry(SendCoinsEntry *)), this, | connect(entry, SIGNAL(removeEntry(SendCoinsEntry *)), this, | ||||
SLOT(removeEntry(SendCoinsEntry *))); | SLOT(removeEntry(SendCoinsEntry *))); | ||||
connect(entry, SIGNAL(useAvailableBalance(SendCoinsEntry *)), this, | |||||
SLOT(useAvailableBalance(SendCoinsEntry *))); | |||||
connect(entry, SIGNAL(payAmountChanged()), this, | connect(entry, SIGNAL(payAmountChanged()), this, | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, | connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, | ||||
SLOT(coinControlUpdateLabels())); | SLOT(coinControlUpdateLabels())); | ||||
// Focus the field, so that entry can start immediately | // Focus the field, so that entry can start immediately | ||||
entry->clear(); | entry->clear(); | ||||
entry->setFocus(); | entry->setFocus(); | ||||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | void SendCoinsDialog::on_buttonChooseFee_clicked() { | ||||
minimizeFeeSection(false); | minimizeFeeSection(false); | ||||
} | } | ||||
void SendCoinsDialog::on_buttonMinimizeFee_clicked() { | void SendCoinsDialog::on_buttonMinimizeFee_clicked() { | ||||
updateFeeMinimizedLabel(); | updateFeeMinimizedLabel(); | ||||
minimizeFeeSection(true); | minimizeFeeSection(true); | ||||
} | } | ||||
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry *entry) { | |||||
// Get CCoinControl instance if CoinControl is enabled or create a new one. | |||||
CCoinControl coin_control; | |||||
if (model->getOptionsModel()->getCoinControlFeatures()) { | |||||
coin_control = *CoinControlDialog::coinControl; | |||||
} | |||||
// Calculate available amount to send. | |||||
Amount amount = model->getBalance(&coin_control); | |||||
for (int i = 0; i < ui->entries->count(); ++i) { | |||||
SendCoinsEntry *e = | |||||
qobject_cast<SendCoinsEntry *>(ui->entries->itemAt(i)->widget()); | |||||
if (e && !e->isHidden() && e != entry) { | |||||
amount -= e->getValue().amount; | |||||
} | |||||
} | |||||
if (amount > Amount::zero()) { | |||||
entry->checkSubtractFeeFromAmount(); | |||||
entry->setAmount(amount); | |||||
} else { | |||||
entry->setAmount(Amount::zero()); | |||||
} | |||||
} | |||||
void SendCoinsDialog::setMinimumFee() { | void SendCoinsDialog::setMinimumFee() { | ||||
ui->radioCustomPerKilobyte->setChecked(true); | ui->radioCustomPerKilobyte->setChecked(true); | ||||
ui->customFee->setValue(CWallet::GetRequiredFee(1000)); | ui->customFee->setValue(CWallet::GetRequiredFee(1000)); | ||||
} | } | ||||
void SendCoinsDialog::updateFeeSectionControls() { | void SendCoinsDialog::updateFeeSectionControls() { | ||||
ui->sliderSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ui->sliderSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ||||
ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ui->labelSmartFee->setEnabled(ui->radioSmartFee->isChecked()); | ||||
▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines |