From a2a3adf7de2ffc9784fea177a43f3124862a992a Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Fri, 6 Nov 2009 12:58:19 +0100 Subject: API review: *Count() are not plural Obsolete the plural version, and replace its usage in Qt. Reviewed-by: Andreas Aardal Hanssen --- tools/assistant/lib/qhelpsearchengine.cpp | 18 ++++++++++++++---- tools/assistant/lib/qhelpsearchengine.h | 3 ++- tools/assistant/lib/qhelpsearchindexreader.cpp | 2 +- tools/assistant/lib/qhelpsearchindexreader_p.h | 2 +- tools/assistant/lib/qhelpsearchresultwidget.cpp | 10 +++++----- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp index cb18142..893495d 100644 --- a/tools/assistant/lib/qhelpsearchengine.cpp +++ b/tools/assistant/lib/qhelpsearchengine.cpp @@ -95,12 +95,11 @@ private: delete indexWriter; } - - int hitsCount() const + int hitCount() const { int count = 0; if (indexReader) - count = indexReader->hitsCount(); + count = indexReader->hitCount(); return count; } @@ -366,11 +365,22 @@ QHelpSearchResultWidget* QHelpSearchEngine::resultWidget() } /*! + \obsolete Returns the amount of hits the search engine found. + \sa hitCount() */ int QHelpSearchEngine::hitsCount() const { - return d->hitsCount(); + return d->hitCount(); +} + +/*! + \since 4.6 + Returns the amount of hits the search engine found. +*/ +int QHelpSearchEngine::hitCount() const +{ + return d->hitCount(); } /*! diff --git a/tools/assistant/lib/qhelpsearchengine.h b/tools/assistant/lib/qhelpsearchengine.h index 1d53411..21f04c5 100644 --- a/tools/assistant/lib/qhelpsearchengine.h +++ b/tools/assistant/lib/qhelpsearchengine.h @@ -86,7 +86,8 @@ public: QHelpSearchQueryWidget* queryWidget(); QHelpSearchResultWidget* resultWidget(); - int hitsCount() const; + QT_DEPRECATED int hitsCount() const; + int hitCount() const; typedef QPair SearchHit; QList hits(int start, int end) const; diff --git a/tools/assistant/lib/qhelpsearchindexreader.cpp b/tools/assistant/lib/qhelpsearchindexreader.cpp index 20d181b..b134605 100644 --- a/tools/assistant/lib/qhelpsearchindexreader.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader.cpp @@ -83,7 +83,7 @@ void QHelpSearchIndexReader::search(const QString &collectionFile, const QString start(QThread::NormalPriority); } -int QHelpSearchIndexReader::hitsCount() const +int QHelpSearchIndexReader::hitCount() const { QMutexLocker lock(&mutex); return hitList.count(); diff --git a/tools/assistant/lib/qhelpsearchindexreader_p.h b/tools/assistant/lib/qhelpsearchindexreader_p.h index 31c392f..adbcdc2 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_p.h @@ -81,7 +81,7 @@ public: void search(const QString &collectionFile, const QString &indexFilesFolder, const QList &queryList); - int hitsCount() const; + int hitCount() const; QList hits(int start, int end) const; signals: diff --git a/tools/assistant/lib/qhelpsearchresultwidget.cpp b/tools/assistant/lib/qhelpsearchresultwidget.cpp index a2f0021..c0d17dd 100644 --- a/tools/assistant/lib/qhelpsearchresultwidget.cpp +++ b/tools/assistant/lib/qhelpsearchresultwidget.cpp @@ -169,13 +169,13 @@ private slots: void showNextResultPage() { if (!searchEngine.isNull() - && resultLastToShow < searchEngine->hitsCount()) { + && resultLastToShow < searchEngine->hitCount()) { resultLastToShow += 20; resultFirstToShow += 20; resultTextBrowser->showResultPage(searchEngine->hits(resultFirstToShow, resultLastToShow), isIndexing); - if (resultLastToShow >= searchEngine->hitsCount()) + if (resultLastToShow >= searchEngine->hitCount()) updateNextButtonState(false); } updateHitRange(); @@ -184,7 +184,7 @@ private slots: void showLastResultPage() { if (!searchEngine.isNull()) { - resultLastToShow = searchEngine->hitsCount(); + resultLastToShow = searchEngine->hitCount(); resultFirstToShow = resultLastToShow - (resultLastToShow % 20); if (resultFirstToShow == resultLastToShow) @@ -214,7 +214,7 @@ private slots: { if (!searchEngine.isNull()) { int count = resultLastToShow % 20; - if (count == 0 || resultLastToShow != searchEngine->hitsCount()) + if (count == 0 || resultLastToShow != searchEngine->hitCount()) count = 20; resultLastToShow -= count; @@ -298,7 +298,7 @@ private: int count = 0; if (!searchEngine.isNull()) { - count = searchEngine->hitsCount(); + count = searchEngine->hitCount(); if (count > 0) { first = resultFirstToShow +1; last = resultLastToShow > count ? count : resultLastToShow; -- cgit v0.12