|
33 | 33 | #include <QScrollBar>
|
34 | 34 | #include <QSignalMapper>
|
35 | 35 | #include <QTableView>
|
| 36 | +#include <QTimer> |
36 | 37 | #include <QUrl>
|
37 | 38 | #include <QVBoxLayout>
|
38 | 39 |
|
@@ -112,6 +113,17 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
112 | 113 | amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
|
113 | 114 | hlayout->addWidget(amountWidget);
|
114 | 115 |
|
| 116 | + // Delay before filtering transactions in ms |
| 117 | + static const int input_filter_delay = 200; |
| 118 | + |
| 119 | + QTimer* amount_typing_delay = new QTimer(this); |
| 120 | + amount_typing_delay->setSingleShot(true); |
| 121 | + amount_typing_delay->setInterval(input_filter_delay); |
| 122 | + |
| 123 | + QTimer* prefix_typing_delay = new QTimer(this); |
| 124 | + prefix_typing_delay->setSingleShot(true); |
| 125 | + prefix_typing_delay->setInterval(input_filter_delay); |
| 126 | + |
115 | 127 | QVBoxLayout *vlayout = new QVBoxLayout(this);
|
116 | 128 | vlayout->setContentsMargins(0,0,0,0);
|
117 | 129 | vlayout->setSpacing(0);
|
@@ -173,8 +185,10 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
173 | 185 | connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
|
174 | 186 | connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
|
175 | 187 | connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
|
176 |
| - connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); |
177 |
| - connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); |
| 188 | + connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start())); |
| 189 | + connect(amount_typing_delay, SIGNAL(timeout()), this, SLOT(changedAmount())); |
| 190 | + connect(addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start())); |
| 191 | + connect(prefix_typing_delay, SIGNAL(timeout()), this, SLOT(changedPrefix())); |
178 | 192 |
|
179 | 193 | connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
|
180 | 194 | connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
|
@@ -312,20 +326,19 @@ void TransactionView::chooseWatchonly(int idx)
|
312 | 326 | (TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
|
313 | 327 | }
|
314 | 328 |
|
315 |
| -void TransactionView::changedPrefix(const QString &prefix) |
| 329 | +void TransactionView::changedPrefix() |
316 | 330 | {
|
317 | 331 | if(!transactionProxyModel)
|
318 | 332 | return;
|
319 |
| - transactionProxyModel->setAddressPrefix(prefix); |
| 333 | + transactionProxyModel->setAddressPrefix(addressWidget->text()); |
320 | 334 | }
|
321 | 335 |
|
322 |
| -void TransactionView::changedAmount(const QString &amount) |
| 336 | +void TransactionView::changedAmount() |
323 | 337 | {
|
324 | 338 | if(!transactionProxyModel)
|
325 | 339 | return;
|
326 | 340 | CAmount amount_parsed = 0;
|
327 |
| - if(BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amount, &amount_parsed)) |
328 |
| - { |
| 341 | + if (BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amountWidget->text(), &amount_parsed)) { |
329 | 342 | transactionProxyModel->setMinAmount(amount_parsed);
|
330 | 343 | }
|
331 | 344 | else
|
|
0 commit comments