mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-27 07:14:48 +00:00
Merge #11395: Qt: Enable searching by transaction id
eac2abca0 Qt: Enable searching by transaction id (Luke Dashjr) c407c61c5 Qt: Avoid invalidating the search filter, when it doesn't really change (Luke Dashjr) b1f634242 Qt: Rename confusingly-named "address prefix" to "search string" (Luke Dashjr) Pull request description: Tree-SHA512: 1c67037d19689fbaff21d15ed7848ac86188e5de34728312e1f9758dada759cab50d913a5bc09e413ecaa3e07557cf253809b95b5637ff79f2e3cf24d86dd3ed
This commit is contained in:
commit
38d31f95d3
@ -20,7 +20,7 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
|
|||||||
QSortFilterProxyModel(parent),
|
QSortFilterProxyModel(parent),
|
||||||
dateFrom(MIN_DATE),
|
dateFrom(MIN_DATE),
|
||||||
dateTo(MAX_DATE),
|
dateTo(MAX_DATE),
|
||||||
addrPrefix(),
|
m_search_string(),
|
||||||
typeFilter(ALL_TYPES),
|
typeFilter(ALL_TYPES),
|
||||||
watchOnlyFilter(WatchOnlyFilter_All),
|
watchOnlyFilter(WatchOnlyFilter_All),
|
||||||
minAmount(0),
|
minAmount(0),
|
||||||
@ -38,6 +38,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
|
|||||||
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
|
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
|
||||||
QString address = index.data(TransactionTableModel::AddressRole).toString();
|
QString address = index.data(TransactionTableModel::AddressRole).toString();
|
||||||
QString label = index.data(TransactionTableModel::LabelRole).toString();
|
QString label = index.data(TransactionTableModel::LabelRole).toString();
|
||||||
|
QString txid = index.data(TransactionTableModel::TxIDRole).toString();
|
||||||
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
|
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
|
||||||
int status = index.data(TransactionTableModel::StatusRole).toInt();
|
int status = index.data(TransactionTableModel::StatusRole).toInt();
|
||||||
|
|
||||||
@ -51,8 +52,11 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
|
|||||||
return false;
|
return false;
|
||||||
if(datetime < dateFrom || datetime > dateTo)
|
if(datetime < dateFrom || datetime > dateTo)
|
||||||
return false;
|
return false;
|
||||||
if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive))
|
if (!address.contains(m_search_string, Qt::CaseInsensitive) &&
|
||||||
|
! label.contains(m_search_string, Qt::CaseInsensitive) &&
|
||||||
|
! txid.contains(m_search_string, Qt::CaseInsensitive)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if(amount < minAmount)
|
if(amount < minAmount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -66,9 +70,10 @@ void TransactionFilterProxy::setDateRange(const QDateTime &from, const QDateTime
|
|||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionFilterProxy::setAddressPrefix(const QString &_addrPrefix)
|
void TransactionFilterProxy::setSearchString(const QString &search_string)
|
||||||
{
|
{
|
||||||
this->addrPrefix = _addrPrefix;
|
if (m_search_string == search_string) return;
|
||||||
|
m_search_string = search_string;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void setDateRange(const QDateTime &from, const QDateTime &to);
|
void setDateRange(const QDateTime &from, const QDateTime &to);
|
||||||
void setAddressPrefix(const QString &addrPrefix);
|
void setSearchString(const QString &);
|
||||||
/**
|
/**
|
||||||
@note Type filter takes a bit field created with TYPE() or ALL_TYPES
|
@note Type filter takes a bit field created with TYPE() or ALL_TYPES
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
QDateTime dateFrom;
|
QDateTime dateFrom;
|
||||||
QDateTime dateTo;
|
QDateTime dateTo;
|
||||||
QString addrPrefix;
|
QString m_search_string;
|
||||||
quint32 typeFilter;
|
quint32 typeFilter;
|
||||||
WatchOnlyFilter watchOnlyFilter;
|
WatchOnlyFilter watchOnlyFilter;
|
||||||
CAmount minAmount;
|
CAmount minAmount;
|
||||||
|
@ -95,11 +95,11 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
|
|
||||||
hlayout->addWidget(typeWidget);
|
hlayout->addWidget(typeWidget);
|
||||||
|
|
||||||
addressWidget = new QLineEdit(this);
|
search_widget = new QLineEdit(this);
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
addressWidget->setPlaceholderText(tr("Enter address or label to search"));
|
search_widget->setPlaceholderText(tr("Enter address, transaction id, or label to search"));
|
||||||
#endif
|
#endif
|
||||||
hlayout->addWidget(addressWidget);
|
hlayout->addWidget(search_widget);
|
||||||
|
|
||||||
amountWidget = new QLineEdit(this);
|
amountWidget = new QLineEdit(this);
|
||||||
#if QT_VERSION >= 0x040700
|
#if QT_VERSION >= 0x040700
|
||||||
@ -187,8 +187,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
|
connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
|
||||||
connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start()));
|
connect(amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start()));
|
||||||
connect(amount_typing_delay, SIGNAL(timeout()), this, SLOT(changedAmount()));
|
connect(amount_typing_delay, SIGNAL(timeout()), this, SLOT(changedAmount()));
|
||||||
connect(addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start()));
|
connect(search_widget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start()));
|
||||||
connect(prefix_typing_delay, SIGNAL(timeout()), this, SLOT(changedPrefix()));
|
connect(prefix_typing_delay, SIGNAL(timeout()), this, SLOT(changedSearch()));
|
||||||
|
|
||||||
connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
|
connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
|
||||||
connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
|
connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
|
||||||
@ -326,11 +326,11 @@ void TransactionView::chooseWatchonly(int idx)
|
|||||||
(TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
|
(TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionView::changedPrefix()
|
void TransactionView::changedSearch()
|
||||||
{
|
{
|
||||||
if(!transactionProxyModel)
|
if(!transactionProxyModel)
|
||||||
return;
|
return;
|
||||||
transactionProxyModel->setAddressPrefix(addressWidget->text());
|
transactionProxyModel->setSearchString(search_widget->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionView::changedAmount()
|
void TransactionView::changedAmount()
|
||||||
|
@ -66,7 +66,7 @@ private:
|
|||||||
QComboBox *dateWidget;
|
QComboBox *dateWidget;
|
||||||
QComboBox *typeWidget;
|
QComboBox *typeWidget;
|
||||||
QComboBox *watchOnlyWidget;
|
QComboBox *watchOnlyWidget;
|
||||||
QLineEdit *addressWidget;
|
QLineEdit *search_widget;
|
||||||
QLineEdit *amountWidget;
|
QLineEdit *amountWidget;
|
||||||
|
|
||||||
QMenu *contextMenu;
|
QMenu *contextMenu;
|
||||||
@ -113,7 +113,7 @@ public Q_SLOTS:
|
|||||||
void chooseType(int idx);
|
void chooseType(int idx);
|
||||||
void chooseWatchonly(int idx);
|
void chooseWatchonly(int idx);
|
||||||
void changedAmount();
|
void changedAmount();
|
||||||
void changedPrefix();
|
void changedSearch();
|
||||||
void exportClicked();
|
void exportClicked();
|
||||||
void focusTransaction(const QModelIndex&);
|
void focusTransaction(const QModelIndex&);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user