Mercurial > hg > easyhg
changeset 566:1e76d1009167
Show matching branch names in search results as well as matching on comment
author | Chris Cannam |
---|---|
date | Wed, 29 Feb 2012 10:44:34 +0000 |
parents | c2e212ab0068 |
children | a25706487852 |
files | src/changesetitem.cpp src/changesetitem.h src/historywidget.cpp |
diffstat | 3 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/changesetitem.cpp Wed Feb 29 10:38:28 2012 +0000 +++ b/src/changesetitem.cpp Wed Feb 29 10:44:34 2012 +0000 @@ -92,11 +92,18 @@ } bool -ChangesetItem::setSearchText(QString text) +ChangesetItem::matchSearchText(QString text) { m_searchText = text; - m_searchMatches = (m_changeset->comment().contains - (text, Qt::CaseInsensitive)); + m_searchMatches = false; + if (m_showBranch) { + m_searchMatches = (m_changeset->branch().contains + (text, Qt::CaseInsensitive)); + } + if (!m_searchMatches) { + m_searchMatches = (m_changeset->comment().contains + (text, Qt::CaseInsensitive)); + } return m_searchMatches; }
--- a/src/changesetitem.h Wed Feb 29 10:38:28 2012 +0000 +++ b/src/changesetitem.h Wed Feb 29 10:44:34 2012 +0000 @@ -65,7 +65,7 @@ bool showBranch() const { return m_showBranch; } void setShowBranch(bool s) { m_showBranch = s; } - bool setSearchText(QString text); // return true if it matches + bool matchSearchText(QString text); // return true and records the match if it matches signals: void detailShown();
--- a/src/historywidget.cpp Wed Feb 29 10:38:28 2012 +0000 +++ b/src/historywidget.cpp Wed Feb 29 10:44:34 2012 +0000 @@ -326,7 +326,7 @@ ChangesetItem *csit = dynamic_cast<ChangesetItem *>(it); if (!csit) continue; - bool matched = csit->setSearchText(m_searchText); + bool matched = csit->matchSearchText(m_searchText); if (matched && (!toFocus || csit->row() < toFocus->row())) { toFocus = csit; }