Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionview.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
contextMenu->addAction(showDetailsAction); | contextMenu->addAction(showDetailsAction); | ||||
contextMenu->addSeparator(); | contextMenu->addSeparator(); | ||||
contextMenu->addAction(abandonAction); | contextMenu->addAction(abandonAction); | ||||
contextMenu->addAction(editLabelAction); | contextMenu->addAction(editLabelAction); | ||||
mapperThirdPartyTxUrls = new QSignalMapper(this); | mapperThirdPartyTxUrls = new QSignalMapper(this); | ||||
// Connect actions | // Connect actions | ||||
connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, | connect(mapperThirdPartyTxUrls, | ||||
SLOT(openThirdPartyTxUrl(QString))); | static_cast<void (QSignalMapper::*)(const QString &)>( | ||||
&QSignalMapper::mapped), | |||||
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); | this, &TransactionView::openThirdPartyTxUrl); | ||||
connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); | |||||
connect(watchOnlyWidget, SIGNAL(activated(int)), this, | connect(dateWidget, | ||||
SLOT(chooseWatchonly(int))); | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, | &TransactionView::chooseDate); | ||||
SLOT(start())); | connect(typeWidget, | ||||
connect(amount_typing_delay, SIGNAL(timeout()), this, | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
SLOT(changedAmount())); | &TransactionView::chooseType); | ||||
connect(search_widget, SIGNAL(textChanged(QString)), prefix_typing_delay, | connect(watchOnlyWidget, | ||||
SLOT(start())); | static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, | ||||
connect(prefix_typing_delay, SIGNAL(timeout()), this, | &TransactionView::chooseWatchonly); | ||||
SLOT(changedSearch())); | connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, | ||||
static_cast<void (QTimer::*)()>(&QTimer::start)); | |||||
connect(view, SIGNAL(doubleClicked(QModelIndex)), this, | connect(amount_typing_delay, &QTimer::timeout, this, | ||||
SIGNAL(doubleClicked(QModelIndex))); | &TransactionView::changedAmount); | ||||
connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, | connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, | ||||
SLOT(contextualMenu(QPoint))); | static_cast<void (QTimer::*)()>(&QTimer::start)); | ||||
connect(prefix_typing_delay, &QTimer::timeout, this, | |||||
connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); | &TransactionView::changedSearch); | ||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); | |||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); | connect(view, &QTableView::doubleClicked, this, | ||||
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); | &TransactionView::doubleClicked); | ||||
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); | connect(view, &QTableView::customContextMenuRequested, this, | ||||
connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex())); | &TransactionView::contextualMenu); | ||||
connect(copyTxPlainText, SIGNAL(triggered()), this, | |||||
SLOT(copyTxPlainText())); | connect(abandonAction, &QAction::triggered, this, | ||||
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); | &TransactionView::abandonTx); | ||||
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); | 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); | |||||
} | } | ||||
void TransactionView::setModel(WalletModel *_model) { | void TransactionView::setModel(WalletModel *_model) { | ||||
this->model = _model; | this->model = _model; | ||||
if (_model) { | if (_model) { | ||||
transactionProxyModel = new TransactionFilterProxy(this); | transactionProxyModel = new TransactionFilterProxy(this); | ||||
transactionProxyModel->setSourceModel( | transactionProxyModel->setSourceModel( | ||||
_model->getTransactionTableModel()); | _model->getTransactionTableModel()); | ||||
Show All 38 Lines | if (_model) { | ||||
QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); | QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host(); | ||||
if (!host.isEmpty()) { | if (!host.isEmpty()) { | ||||
// use host as menu item label | // use host as menu item label | ||||
QAction *thirdPartyTxUrlAction = new QAction(host, this); | QAction *thirdPartyTxUrlAction = new QAction(host, this); | ||||
if (i == 0) { | if (i == 0) { | ||||
contextMenu->addSeparator(); | contextMenu->addSeparator(); | ||||
} | } | ||||
contextMenu->addAction(thirdPartyTxUrlAction); | contextMenu->addAction(thirdPartyTxUrlAction); | ||||
connect(thirdPartyTxUrlAction, SIGNAL(triggered()), | connect(thirdPartyTxUrlAction, &QAction::triggered, | ||||
mapperThirdPartyTxUrls, SLOT(map())); | mapperThirdPartyTxUrls, | ||||
static_cast<void (QSignalMapper::*)()>( | |||||
&QSignalMapper::map)); | |||||
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, | mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, | ||||
listUrls[i].trimmed()); | listUrls[i].trimmed()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// show/hide column Watch-only | // show/hide column Watch-only | ||||
updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); | updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); | ||||
// Watch-only signal | // Watch-only signal | ||||
connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, | connect(_model, &WalletModel::notifyWatchonlyChanged, this, | ||||
SLOT(updateWatchOnlyColumn(bool))); | &TransactionView::updateWatchOnlyColumn); | ||||
} | } | ||||
} | } | ||||
void TransactionView::chooseDate(int idx) { | void TransactionView::chooseDate(int idx) { | ||||
if (!transactionProxyModel) { | if (!transactionProxyModel) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | QWidget *TransactionView::createDateRangeWidget() { | ||||
dateTo->setDate(QDate::currentDate()); | dateTo->setDate(QDate::currentDate()); | ||||
layout->addWidget(dateTo); | layout->addWidget(dateTo); | ||||
layout->addStretch(); | layout->addStretch(); | ||||
// Hide by default | // Hide by default | ||||
dateRangeWidget->setVisible(false); | dateRangeWidget->setVisible(false); | ||||
// Notify on change | // Notify on change | ||||
connect(dateFrom, SIGNAL(dateChanged(QDate)), this, | connect(dateFrom, &QDateTimeEdit::dateChanged, this, | ||||
SLOT(dateRangeChanged())); | &TransactionView::dateRangeChanged); | ||||
connect(dateTo, SIGNAL(dateChanged(QDate)), this, SLOT(dateRangeChanged())); | connect(dateTo, &QDateTimeEdit::dateChanged, this, | ||||
&TransactionView::dateRangeChanged); | |||||
return dateRangeWidget; | return dateRangeWidget; | ||||
} | } | ||||
void TransactionView::dateRangeChanged() { | void TransactionView::dateRangeChanged() { | ||||
if (!transactionProxyModel) { | if (!transactionProxyModel) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |