Skip to content

Commit

Permalink
Qt: Rename confusingly-named "address prefix" to "search string"
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Nov 10, 2017
1 parent 0e70791 commit b1f6342
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/qt/transactionfilterproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
QSortFilterProxyModel(parent),
dateFrom(MIN_DATE),
dateTo(MAX_DATE),
addrPrefix(),
m_search_string(),
typeFilter(ALL_TYPES),
watchOnlyFilter(WatchOnlyFilter_All),
minAmount(0),
Expand Down Expand Up @@ -51,7 +51,7 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
return false;
if(datetime < dateFrom || datetime > dateTo)
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))
return false;
if(amount < minAmount)
return false;
Expand All @@ -66,9 +66,9 @@ void TransactionFilterProxy::setDateRange(const QDateTime &from, const QDateTime
invalidateFilter();
}

void TransactionFilterProxy::setAddressPrefix(const QString &_addrPrefix)
void TransactionFilterProxy::setSearchString(const QString &search_string)
{
this->addrPrefix = _addrPrefix;
m_search_string = search_string;
invalidateFilter();
}

Expand Down
4 changes: 2 additions & 2 deletions src/qt/transactionfilterproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TransactionFilterProxy : public QSortFilterProxyModel
};

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
*/
Expand All @@ -57,7 +57,7 @@ class TransactionFilterProxy : public QSortFilterProxyModel
private:
QDateTime dateFrom;
QDateTime dateTo;
QString addrPrefix;
QString m_search_string;
quint32 typeFilter;
WatchOnlyFilter watchOnlyFilter;
CAmount minAmount;
Expand Down
14 changes: 7 additions & 7 deletions src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa

hlayout->addWidget(typeWidget);

addressWidget = new QLineEdit(this);
search_widget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
addressWidget->setPlaceholderText(tr("Enter address or label to search"));
search_widget->setPlaceholderText(tr("Enter address or label to search"));
#endif
hlayout->addWidget(addressWidget);
hlayout->addWidget(search_widget);

amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
Expand Down Expand Up @@ -187,8 +187,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
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(addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start()));
connect(prefix_typing_delay, SIGNAL(timeout()), this, SLOT(changedPrefix()));
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)));
Expand Down Expand Up @@ -326,11 +326,11 @@ void TransactionView::chooseWatchonly(int idx)
(TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
}

void TransactionView::changedPrefix()
void TransactionView::changedSearch()
{
if(!transactionProxyModel)
return;
transactionProxyModel->setAddressPrefix(addressWidget->text());
transactionProxyModel->setSearchString(search_widget->text());
}

void TransactionView::changedAmount()
Expand Down
4 changes: 2 additions & 2 deletions src/qt/transactionview.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TransactionView : public QWidget
QComboBox *dateWidget;
QComboBox *typeWidget;
QComboBox *watchOnlyWidget;
QLineEdit *addressWidget;
QLineEdit *search_widget;
QLineEdit *amountWidget;

QMenu *contextMenu;
Expand Down Expand Up @@ -113,7 +113,7 @@ public Q_SLOTS:
void chooseType(int idx);
void chooseWatchonly(int idx);
void changedAmount();
void changedPrefix();
void changedSearch();
void exportClicked();
void focusTransaction(const QModelIndex&);

Expand Down

0 comments on commit b1f6342

Please sign in to comment.