Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionview.cpp
Show All 25 Lines | |||||
#include <QHeaderView> | #include <QHeaderView> | ||||
#include <QLabel> | #include <QLabel> | ||||
#include <QLineEdit> | #include <QLineEdit> | ||||
#include <QMenu> | #include <QMenu> | ||||
#include <QPoint> | #include <QPoint> | ||||
#include <QScrollBar> | #include <QScrollBar> | ||||
#include <QSignalMapper> | #include <QSignalMapper> | ||||
#include <QTableView> | #include <QTableView> | ||||
#include <QTimer> | |||||
#include <QUrl> | #include <QUrl> | ||||
#include <QVBoxLayout> | #include <QVBoxLayout> | ||||
TransactionView::TransactionView(const PlatformStyle *platformStyle, | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
QWidget *parent) | QWidget *parent) | ||||
: QWidget(parent), model(0), transactionProxyModel(0), transactionView(0), | : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0), | ||||
abandonAction(0), columnResizingFixer(0) { | abandonAction(0), columnResizingFixer(0) { | ||||
// Build filter row | // Build filter row | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
if (platformStyle->getUseExtraSpacing()) { | if (platformStyle->getUseExtraSpacing()) { | ||||
amountWidget->setFixedWidth(97); | amountWidget->setFixedWidth(97); | ||||
} else { | } else { | ||||
amountWidget->setFixedWidth(100); | amountWidget->setFixedWidth(100); | ||||
} | } | ||||
amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); | amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); | ||||
hlayout->addWidget(amountWidget); | hlayout->addWidget(amountWidget); | ||||
// Delay before filtering transactions in ms | |||||
static const int input_filter_delay = 200; | |||||
QTimer *amount_typing_delay = new QTimer(this); | |||||
amount_typing_delay->setSingleShot(true); | |||||
amount_typing_delay->setInterval(input_filter_delay); | |||||
QTimer *prefix_typing_delay = new QTimer(this); | |||||
prefix_typing_delay->setSingleShot(true); | |||||
prefix_typing_delay->setInterval(input_filter_delay); | |||||
QVBoxLayout *vlayout = new QVBoxLayout(this); | QVBoxLayout *vlayout = new QVBoxLayout(this); | ||||
vlayout->setContentsMargins(0, 0, 0, 0); | vlayout->setContentsMargins(0, 0, 0, 0); | ||||
vlayout->setSpacing(0); | vlayout->setSpacing(0); | ||||
QTableView *view = new QTableView(this); | QTableView *view = new QTableView(this); | ||||
vlayout->addLayout(hlayout); | vlayout->addLayout(hlayout); | ||||
vlayout->addWidget(createDateRangeWidget()); | vlayout->addWidget(createDateRangeWidget()); | ||||
vlayout->addWidget(view); | vlayout->addWidget(view); | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | TransactionView::TransactionView(const PlatformStyle *platformStyle, | ||||
// Connect actions | // Connect actions | ||||
connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, | connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, | ||||
SLOT(openThirdPartyTxUrl(QString))); | SLOT(openThirdPartyTxUrl(QString))); | ||||
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); | connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); | ||||
connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); | connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); | ||||
connect(watchOnlyWidget, SIGNAL(activated(int)), this, | connect(watchOnlyWidget, SIGNAL(activated(int)), this, | ||||
SLOT(chooseWatchonly(int))); | SLOT(chooseWatchonly(int))); | ||||
connect(addressWidget, SIGNAL(textChanged(QString)), this, | connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, | ||||
SLOT(changedPrefix(QString))); | SLOT(start())); | ||||
connect(amountWidget, SIGNAL(textChanged(QString)), this, | connect(amount_typing_delay, SIGNAL(timeout()), this, | ||||
SLOT(changedAmount(QString))); | SLOT(changedAmount())); | ||||
connect(addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, | |||||
SLOT(start())); | |||||
connect(prefix_typing_delay, SIGNAL(timeout()), this, | |||||
SLOT(changedPrefix())); | |||||
connect(view, SIGNAL(doubleClicked(QModelIndex)), this, | connect(view, SIGNAL(doubleClicked(QModelIndex)), this, | ||||
SIGNAL(doubleClicked(QModelIndex))); | SIGNAL(doubleClicked(QModelIndex))); | ||||
connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, | connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, | ||||
SLOT(contextualMenu(QPoint))); | SLOT(contextualMenu(QPoint))); | ||||
connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); | connect(abandonAction, SIGNAL(triggered()), this, SLOT(abandonTx())); | ||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); | connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | if (!transactionProxyModel) { | ||||
return; | return; | ||||
} | } | ||||
transactionProxyModel->setWatchOnlyFilter( | transactionProxyModel->setWatchOnlyFilter( | ||||
static_cast<TransactionFilterProxy::WatchOnlyFilter>( | static_cast<TransactionFilterProxy::WatchOnlyFilter>( | ||||
watchOnlyWidget->itemData(idx).toInt())); | watchOnlyWidget->itemData(idx).toInt())); | ||||
} | } | ||||
void TransactionView::changedPrefix(const QString &prefix) { | void TransactionView::changedPrefix() { | ||||
if (!transactionProxyModel) { | if (!transactionProxyModel) { | ||||
return; | return; | ||||
} | } | ||||
transactionProxyModel->setAddressPrefix(prefix); | transactionProxyModel->setAddressPrefix(addressWidget->text()); | ||||
} | } | ||||
void TransactionView::changedAmount(const QString &amount) { | void TransactionView::changedAmount() { | ||||
if (!transactionProxyModel) { | if (!transactionProxyModel) { | ||||
return; | return; | ||||
} | } | ||||
Amount amount_parsed = Amount::zero(); | Amount amount_parsed = Amount::zero(); | ||||
if (BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amount, | if (BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), | ||||
&amount_parsed)) { | amountWidget->text(), &amount_parsed)) { | ||||
transactionProxyModel->setMinAmount(amount_parsed); | transactionProxyModel->setMinAmount(amount_parsed); | ||||
} else { | } else { | ||||
transactionProxyModel->setMinAmount(Amount::zero()); | transactionProxyModel->setMinAmount(Amount::zero()); | ||||
} | } | ||||
} | } | ||||
void TransactionView::exportClicked() { | void TransactionView::exportClicked() { | ||||
if (!model || !model->getOptionsModel()) { | if (!model || !model->getOptionsModel()) { | ||||
▲ Show 20 Lines • Show All 307 Lines • Show Last 20 Lines |