Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
| Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, | ||||
| } | } | ||||
| ui->groupFee->setId(ui->radioSmartFee, 0); | ui->groupFee->setId(ui->radioSmartFee, 0); | ||||
| ui->groupFee->setId(ui->radioCustomFee, 1); | ui->groupFee->setId(ui->radioCustomFee, 1); | ||||
| ui->groupFee | ui->groupFee | ||||
| ->button( | ->button( | ||||
| std::max<int>(0, std::min(1, settings.value("nFeeRadio").toInt()))) | std::max<int>(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 | ui->groupCustomFee | ||||
| ->button(std::max<int>( | ->button(std::max<int>( | ||||
| 0, std::min(1, settings.value("nCustomFeeRadio").toInt()))) | 0, std::min(1, settings.value("nCustomFeeRadio").toInt()))) | ||||
| ->setChecked(true); | ->setChecked(true); | ||||
markblundeberg: I am having crashes here. | |||||
| ui->customFee->setValue( | ui->customFee->setValue( | ||||
| int64_t(settings.value("nTransactionFee").toLongLong()) * SATOSHI); | int64_t(settings.value("nTransactionFee").toLongLong()) * SATOSHI); | ||||
| 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) { | ||||
| ▲ Show 20 Lines • Show All 563 Lines • ▼ Show 20 Lines | void SendCoinsDialog::updateFeeSectionControls() { | ||||
| 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()); | ||||
| ui->checkBoxMinimumFee->setEnabled(ui->radioCustomFee->isChecked()); | ui->checkBoxMinimumFee->setEnabled(ui->radioCustomFee->isChecked()); | ||||
| ui->labelMinFeeWarning->setEnabled(ui->radioCustomFee->isChecked()); | ui->labelMinFeeWarning->setEnabled(ui->radioCustomFee->isChecked()); | ||||
| ui->radioCustomPerKilobyte->setEnabled( | ui->radioCustomPerKilobyte->setEnabled( | ||||
| ui->radioCustomFee->isChecked() && | ui->radioCustomFee->isChecked() && | ||||
| !ui->checkBoxMinimumFee->isChecked()); | !ui->checkBoxMinimumFee->isChecked()); | ||||
| ui->radioCustomAtLeast->setEnabled( | |||||
| ui->radioCustomFee->isChecked() && | |||||
| !ui->checkBoxMinimumFee->isChecked() && | |||||
| CoinControlDialog::coinControl->HasSelected()); | |||||
| ui->customFee->setEnabled(ui->radioCustomFee->isChecked() && | ui->customFee->setEnabled(ui->radioCustomFee->isChecked() && | ||||
| !ui->checkBoxMinimumFee->isChecked()); | !ui->checkBoxMinimumFee->isChecked()); | ||||
| } | } | ||||
| void SendCoinsDialog::updateGlobalFeeVariables() { | void SendCoinsDialog::updateGlobalFeeVariables() { | ||||
| if (ui->radioSmartFee->isChecked()) { | if (ui->radioSmartFee->isChecked()) { | ||||
| payTxFee = CFeeRate(Amount::zero()); | payTxFee = CFeeRate(Amount::zero()); | ||||
| // set nMinimumTotalFee to 0 to not accidentally pay a custom fee | |||||
| CoinControlDialog::coinControl->nMinimumTotalFee = Amount::zero(); | |||||
| } 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 | |||||
| // coincontrol | |||||
| // set nMinimumTotalFee to 0 in case of user has selected that the fee | |||||
| // is per KB | |||||
| CoinControlDialog::coinControl->nMinimumTotalFee = | |||||
| ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() | |||||
| : Amount::zero(); | |||||
| } | } | ||||
| } | } | ||||
| void SendCoinsDialog::updateFeeMinimizedLabel() { | void SendCoinsDialog::updateFeeMinimizedLabel() { | ||||
| if (!model || !model->getOptionsModel()) { | if (!model || !model->getOptionsModel()) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| // Coin Control: update labels | // Coin Control: update labels | ||||
| void SendCoinsDialog::coinControlUpdateLabels() { | void SendCoinsDialog::coinControlUpdateLabels() { | ||||
| if (!model || !model->getOptionsModel()) { | if (!model || !model->getOptionsModel()) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (model->getOptionsModel()->getCoinControlFeatures()) { | |||||
| // enable minimum absolute fee UI controls | |||||
| ui->radioCustomAtLeast->setVisible(true); | |||||
| // only enable the feature if inputs are selected | |||||
| ui->radioCustomAtLeast->setEnabled( | |||||
| ui->radioCustomFee->isChecked() && | |||||
| !ui->checkBoxMinimumFee->isChecked() && | |||||
| CoinControlDialog::coinControl->HasSelected()); | |||||
| } else { | |||||
| // in case coin control is disabled (=default), hide minimum absolute | |||||
| // fee UI controls | |||||
| ui->radioCustomAtLeast->setVisible(false); | |||||
| return; | |||||
| } | |||||
| // 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(); | ||||
| ▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines | |||||
I am having crashes here.