Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsdialog.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (!_platformStyle->getImagesOnButtons()) { | ||||
ui->sendButton->setIcon( | ui->sendButton->setIcon( | ||||
_platformStyle->SingleColorIcon(":/icons/send")); | _platformStyle->SingleColorIcon(":/icons/send")); | ||||
} | } | ||||
GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); | GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); | ||||
addEntry(); | addEntry(); | ||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry())); | connect(ui->addButton, &QPushButton::clicked, this, | ||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); | &SendCoinsDialog::addEntry); | ||||
connect(ui->clearButton, &QPushButton::clicked, this, | |||||
&SendCoinsDialog::clear); | |||||
// Coin Control | // Coin Control | ||||
connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, | connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, | ||||
SLOT(coinControlButtonClicked())); | &SendCoinsDialog::coinControlButtonClicked); | ||||
connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, | connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, | ||||
SLOT(coinControlChangeChecked(int))); | &SendCoinsDialog::coinControlChangeChecked); | ||||
connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), | connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, | ||||
this, SLOT(coinControlChangeEdited(const QString &))); | this, &SendCoinsDialog::coinControlChangeEdited); | ||||
// Coin Control: clipboard actions | // Coin Control: clipboard actions | ||||
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); | QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); | ||||
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); | QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); | ||||
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); | QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); | ||||
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); | QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); | ||||
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); | QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); | ||||
QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); | QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); | ||||
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); | QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); | ||||
connect(clipboardQuantityAction, SIGNAL(triggered()), this, | connect(clipboardQuantityAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardQuantity())); | &SendCoinsDialog::coinControlClipboardQuantity); | ||||
connect(clipboardAmountAction, SIGNAL(triggered()), this, | connect(clipboardAmountAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardAmount())); | &SendCoinsDialog::coinControlClipboardAmount); | ||||
connect(clipboardFeeAction, SIGNAL(triggered()), this, | connect(clipboardFeeAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardFee())); | &SendCoinsDialog::coinControlClipboardFee); | ||||
connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, | connect(clipboardAfterFeeAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardAfterFee())); | &SendCoinsDialog::coinControlClipboardAfterFee); | ||||
connect(clipboardBytesAction, SIGNAL(triggered()), this, | connect(clipboardBytesAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardBytes())); | &SendCoinsDialog::coinControlClipboardBytes); | ||||
connect(clipboardLowOutputAction, SIGNAL(triggered()), this, | connect(clipboardLowOutputAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardLowOutput())); | &SendCoinsDialog::coinControlClipboardLowOutput); | ||||
connect(clipboardChangeAction, SIGNAL(triggered()), this, | connect(clipboardChangeAction, &QAction::triggered, this, | ||||
SLOT(coinControlClipboardChange())); | &SendCoinsDialog::coinControlClipboardChange); | ||||
ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); | ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); | ||||
ui->labelCoinControlAmount->addAction(clipboardAmountAction); | ui->labelCoinControlAmount->addAction(clipboardAmountAction); | ||||
ui->labelCoinControlFee->addAction(clipboardFeeAction); | ui->labelCoinControlFee->addAction(clipboardFeeAction); | ||||
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); | ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); | ||||
ui->labelCoinControlBytes->addAction(clipboardBytesAction); | ui->labelCoinControlBytes->addAction(clipboardBytesAction); | ||||
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); | ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); | ||||
ui->labelCoinControlChange->addAction(clipboardChangeAction); | ui->labelCoinControlChange->addAction(clipboardChangeAction); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, | ||||
// Set the model properly. | // Set the model properly. | ||||
setModel(model); | setModel(model); | ||||
} | } | ||||
void SendCoinsDialog::setClientModel(ClientModel *_clientModel) { | void SendCoinsDialog::setClientModel(ClientModel *_clientModel) { | ||||
this->clientModel = _clientModel; | this->clientModel = _clientModel; | ||||
if (_clientModel) { | if (_clientModel) { | ||||
connect(_clientModel, | connect(_clientModel, &ClientModel::numBlocksChanged, this, | ||||
SIGNAL(numBlocksChanged(int, QDateTime, double, bool)), this, | &SendCoinsDialog::updateSmartFeeLabel); | ||||
SLOT(updateSmartFeeLabel())); | |||||
} | } | ||||
} | } | ||||
void SendCoinsDialog::setModel(WalletModel *_model) { | void SendCoinsDialog::setModel(WalletModel *_model) { | ||||
this->model = _model; | this->model = _model; | ||||
if (_model && _model->getOptionsModel()) { | if (_model && _model->getOptionsModel()) { | ||||
for (int i = 0; i < ui->entries->count(); ++i) { | for (int i = 0; i < ui->entries->count(); ++i) { | ||||
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry *>( | SendCoinsEntry *entry = qobject_cast<SendCoinsEntry *>( | ||||
ui->entries->itemAt(i)->widget()); | ui->entries->itemAt(i)->widget()); | ||||
if (entry) { | if (entry) { | ||||
entry->setModel(_model); | entry->setModel(_model); | ||||
} | } | ||||
} | } | ||||
interfaces::WalletBalances balances = _model->wallet().getBalances(); | interfaces::WalletBalances balances = _model->wallet().getBalances(); | ||||
setBalance(balances); | setBalance(balances); | ||||
connect(_model, SIGNAL(balanceChanged(interfaces::WalletBalances)), | connect(_model, &WalletModel::balanceChanged, this, | ||||
this, SLOT(setBalance(interfaces::WalletBalances))); | &SendCoinsDialog::setBalance); | ||||
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), | connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, | ||||
this, SLOT(updateDisplayUnit())); | this, &SendCoinsDialog::updateDisplayUnit); | ||||
updateDisplayUnit(); | updateDisplayUnit(); | ||||
// Coin Control | // Coin Control | ||||
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), | connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, | ||||
this, SLOT(coinControlUpdateLabels())); | this, &SendCoinsDialog::coinControlUpdateLabels); | ||||
connect(_model->getOptionsModel(), | connect(_model->getOptionsModel(), | ||||
SIGNAL(coinControlFeaturesChanged(bool)), this, | &OptionsModel::coinControlFeaturesChanged, this, | ||||
SLOT(coinControlFeatureChanged(bool))); | &SendCoinsDialog::coinControlFeatureChanged); | ||||
ui->frameCoinControl->setVisible( | ui->frameCoinControl->setVisible( | ||||
_model->getOptionsModel()->getCoinControlFeatures()); | _model->getOptionsModel()->getCoinControlFeatures()); | ||||
coinControlUpdateLabels(); | coinControlUpdateLabels(); | ||||
// fee section | // fee section | ||||
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, | connect(ui->groupFee, | ||||
SLOT(updateFeeSectionControls())); | static_cast<void (QButtonGroup::*)(int)>( | ||||
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, | &QButtonGroup::buttonClicked), | ||||
SLOT(coinControlUpdateLabels())); | this, &SendCoinsDialog::updateFeeSectionControls); | ||||
connect(ui->groupCustomFee, SIGNAL(buttonClicked(int)), this, | connect(ui->groupFee, | ||||
SLOT(coinControlUpdateLabels())); | static_cast<void (QButtonGroup::*)(int)>( | ||||
connect(ui->customFee, SIGNAL(valueChanged()), this, | &QButtonGroup::buttonClicked), | ||||
SLOT(coinControlUpdateLabels())); | this, &SendCoinsDialog::coinControlUpdateLabels); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->groupCustomFee, | ||||
SLOT(setMinimumFee())); | static_cast<void (QButtonGroup::*)(int)>( | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | &QButtonGroup::buttonClicked), | ||||
SLOT(updateFeeSectionControls())); | this, &SendCoinsDialog::coinControlUpdateLabels); | ||||
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, | connect(ui->customFee, &BitcoinAmountField::valueChanged, this, | ||||
SLOT(coinControlUpdateLabels())); | &SendCoinsDialog::coinControlUpdateLabels); | ||||
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, | |||||
&SendCoinsDialog::setMinimumFee); | |||||
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, | |||||
&SendCoinsDialog::updateFeeSectionControls); | |||||
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, | |||||
&SendCoinsDialog::coinControlUpdateLabels); | |||||
ui->customFee->setSingleStep(model->wallet().getRequiredFee(1000)); | ui->customFee->setSingleStep(model->wallet().getRequiredFee(1000)); | ||||
updateFeeSectionControls(); | updateFeeSectionControls(); | ||||
updateMinFeeLabel(); | updateMinFeeLabel(); | ||||
updateSmartFeeLabel(); | updateSmartFeeLabel(); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | |||||
void SendCoinsDialog::accept() { | void SendCoinsDialog::accept() { | ||||
clear(); | clear(); | ||||
} | } | ||||
SendCoinsEntry *SendCoinsDialog::addEntry() { | SendCoinsEntry *SendCoinsDialog::addEntry() { | ||||
SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, model, this); | SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, model, this); | ||||
ui->entries->addWidget(entry); | ui->entries->addWidget(entry); | ||||
connect(entry, SIGNAL(removeEntry(SendCoinsEntry *)), this, | connect(entry, &SendCoinsEntry::removeEntry, this, | ||||
SLOT(removeEntry(SendCoinsEntry *))); | &SendCoinsDialog::removeEntry); | ||||
connect(entry, SIGNAL(useAvailableBalance(SendCoinsEntry *)), this, | connect(entry, &SendCoinsEntry::useAvailableBalance, this, | ||||
SLOT(useAvailableBalance(SendCoinsEntry *))); | &SendCoinsDialog::useAvailableBalance); | ||||
connect(entry, SIGNAL(payAmountChanged()), this, | connect(entry, &SendCoinsEntry::payAmountChanged, this, | ||||
SLOT(coinControlUpdateLabels())); | &SendCoinsDialog::coinControlUpdateLabels); | ||||
connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, | connect(entry, &SendCoinsEntry::subtractFeeFromAmountChanged, this, | ||||
SLOT(coinControlUpdateLabels())); | &SendCoinsDialog::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(); | ||||
ui->scrollAreaWidgetContents->resize( | ui->scrollAreaWidgetContents->resize( | ||||
ui->scrollAreaWidgetContents->sizeHint()); | ui->scrollAreaWidgetContents->sizeHint()); | ||||
qApp->processEvents(); | qApp->processEvents(); | ||||
QScrollBar *bar = ui->scrollArea->verticalScrollBar(); | QScrollBar *bar = ui->scrollArea->verticalScrollBar(); | ||||
▲ Show 20 Lines • Show All 465 Lines • ▼ Show 20 Lines | SendConfirmationDialog::SendConfirmationDialog(const QString &title, | ||||
const QString &text, | const QString &text, | ||||
int _secDelay, QWidget *parent) | int _secDelay, QWidget *parent) | ||||
: QMessageBox(QMessageBox::Question, title, text, | : QMessageBox(QMessageBox::Question, title, text, | ||||
QMessageBox::Yes | QMessageBox::Cancel, parent), | QMessageBox::Yes | QMessageBox::Cancel, parent), | ||||
secDelay(_secDelay) { | secDelay(_secDelay) { | ||||
setDefaultButton(QMessageBox::Cancel); | setDefaultButton(QMessageBox::Cancel); | ||||
yesButton = button(QMessageBox::Yes); | yesButton = button(QMessageBox::Yes); | ||||
updateYesButton(); | updateYesButton(); | ||||
connect(&countDownTimer, SIGNAL(timeout()), this, SLOT(countDown())); | connect(&countDownTimer, &QTimer::timeout, this, | ||||
&SendConfirmationDialog::countDown); | |||||
} | } | ||||
int SendConfirmationDialog::exec() { | int SendConfirmationDialog::exec() { | ||||
updateYesButton(); | updateYesButton(); | ||||
countDownTimer.start(1000); | countDownTimer.start(1000); | ||||
return QMessageBox::exec(); | return QMessageBox::exec(); | ||||
} | } | ||||
Show All 18 Lines |