diff options
Diffstat (limited to 'src/qt/transactionview.cpp')
-rw-r--r-- | src/qt/transactionview.cpp | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 6405b70659..68410c8bd6 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -19,6 +19,7 @@ #include <ui_interface.h> +#include <QApplication> #include <QComboBox> #include <QDateTimeEdit> #include <QDesktopServices> @@ -105,7 +106,11 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa } else { amountWidget->setFixedWidth(100); } - amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); + QDoubleValidator *amountValidator = new QDoubleValidator(0, 1e20, 8, this); + QLocale amountLocale(QLocale::C); + amountLocale.setNumberOptions(QLocale::RejectGroupSeparator); + amountValidator->setLocale(amountLocale); + amountWidget->setValidator(amountValidator); hlayout->addWidget(amountWidget); // Delay before filtering transactions in ms @@ -175,29 +180,35 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa mapperThirdPartyTxUrls = new QSignalMapper(this); // Connect actions - connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString))); - - connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); - connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); - connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int))); - connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start())); - connect(amount_typing_delay, SIGNAL(timeout()), this, SLOT(changedAmount())); - connect(search_widget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start())); - connect(prefix_typing_delay, SIGNAL(timeout()), this, SLOT(changedSearch())); - - connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); - connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); - - connect(bumpFeeAction, SIGNAL(triggered()), this, SLOT(bumpFee())); - connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); - connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); - connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); - connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); - connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); - connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex())); - connect(copyTxPlainText, SIGNAL(triggered()), this, SLOT(copyTxPlainText())); - connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); - connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); + connect(mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped), this, &TransactionView::openThirdPartyTxUrl); + + connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate); + connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType); + connect(watchOnlyWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseWatchonly); + connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, static_cast<void (QTimer::*)()>(&QTimer::start)); + connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount); + connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, static_cast<void (QTimer::*)()>(&QTimer::start)); + connect(prefix_typing_delay, &QTimer::timeout, this, &TransactionView::changedSearch); + + connect(view, &QTableView::doubleClicked, this, &TransactionView::doubleClicked); + connect(view, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu); + + connect(bumpFeeAction, &QAction::triggered, this, &TransactionView::bumpFee); + connect(abandonAction, &QAction::triggered, this, &TransactionView::abandonTx); + connect(copyAddressAction, &QAction::triggered, this, &TransactionView::copyAddress); + connect(copyLabelAction, &QAction::triggered, this, &TransactionView::copyLabel); + connect(copyAmountAction, &QAction::triggered, this, &TransactionView::copyAmount); + connect(copyTxIDAction, &QAction::triggered, this, &TransactionView::copyTxID); + connect(copyTxHexAction, &QAction::triggered, this, &TransactionView::copyTxHex); + connect(copyTxPlainText, &QAction::triggered, this, &TransactionView::copyTxPlainText); + connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel); + connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails); + // Double-clicking on a transaction on the transaction history page shows details + connect(this, &TransactionView::doubleClicked, this, &TransactionView::showDetails); + // Highlight transaction after fee bump + connect(this, &TransactionView::bumpedFee, [this](const uint256& txid) { + focusTransaction(txid); + }); } void TransactionView::setModel(WalletModel *_model) @@ -243,7 +254,7 @@ void TransactionView::setModel(WalletModel *_model) if (i == 0) contextMenu->addSeparator(); contextMenu->addAction(thirdPartyTxUrlAction); - connect(thirdPartyTxUrlAction, SIGNAL(triggered()), mapperThirdPartyTxUrls, SLOT(map())); + connect(thirdPartyTxUrlAction, &QAction::triggered, mapperThirdPartyTxUrls, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map)); mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, listUrls[i].trimmed()); } } @@ -253,7 +264,7 @@ void TransactionView::setModel(WalletModel *_model) updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); // Watch-only signal - connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool))); + connect(_model, &WalletModel::notifyWatchonlyChanged, this, &TransactionView::updateWatchOnlyColumn); } } @@ -428,9 +439,14 @@ void TransactionView::bumpFee() hash.SetHex(hashQStr.toStdString()); // Bump tx fee over the walletModel - if (model->bumpFee(hash)) { + uint256 newHash; + if (model->bumpFee(hash, newHash)) { // Update the table + transactionView->selectionModel()->clearSelection(); model->getTransactionTableModel()->updateTransaction(hashQStr, CT_UPDATED, true); + + qApp->processEvents(); + Q_EMIT bumpedFee(newHash); } } @@ -562,8 +578,8 @@ QWidget *TransactionView::createDateRangeWidget() dateRangeWidget->setVisible(false); // Notify on change - connect(dateFrom, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); - connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); + connect(dateFrom, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); + connect(dateTo, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged); return dateRangeWidget; } |