aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/help
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/help')
-rw-r--r--src/modules/help/HelpIndex.cpp52
-rw-r--r--src/modules/help/HelpWidget.cpp4
-rw-r--r--src/modules/help/HelpWindow.cpp8
-rw-r--r--src/modules/help/libkvihelp.cpp10
4 files changed, 37 insertions, 37 deletions
diff --git a/src/modules/help/HelpIndex.cpp b/src/modules/help/HelpIndex.cpp
index 3fba3c74d..2504d1dc8 100644
--- a/src/modules/help/HelpIndex.cpp
+++ b/src/modules/help/HelpIndex.cpp
@@ -77,7 +77,7 @@ QDataStream & operator<<(QDataStream & s, const Document & l)
}
HelpIndex::HelpIndex(const QString & dp, const QString & hp)
- : QObject(0), docPath(dp)
+ : QObject(nullptr), docPath(dp)
{
Q_UNUSED(hp);
@@ -93,7 +93,7 @@ HelpIndex::HelpIndex(const QString & dp, const QString & hp)
}
HelpIndex::HelpIndex(const QStringList & dl, const QString & hp)
- : QObject(0)
+ : QObject(nullptr)
{
Q_UNUSED(hp);
docList = dl;
@@ -172,7 +172,7 @@ void HelpIndex::insertInDict(const QString & str, int docNum)
{
if(str == QLatin1String("amp") || str == QLatin1String("nbsp"))
return;
- Entry * e = 0;
+ Entry * e = nullptr;
if(dict.count())
e = dict[str];
@@ -349,18 +349,18 @@ void HelpIndex::readDocumentList()
QStringList HelpIndex::query(const QStringList & terms, const QStringList & termSeq, const QStringList & seqWords)
{
QList<Term> termList;
- for(QStringList::ConstIterator it = terms.begin(); it != terms.end(); ++it)
+ for(const auto & term : terms)
{
- Entry * e = 0;
- if((*it).contains(QLatin1Char('*')))
+ Entry * e = nullptr;
+ if(term.contains(QLatin1Char('*')))
{
- QVector<Document> wcts = setupDummyTerm(getWildcardTerms(*it));
+ QVector<Document> wcts = setupDummyTerm(getWildcardTerms(term));
termList.append(Term(QLatin1String("dummy"), wcts.count(), wcts));
}
- else if(dict[*it])
+ else if(dict[term])
{
- e = dict[*it];
- termList.append(Term(*it, e->documents.count(), e->documents));
+ e = dict[term];
+ termList.append(Term(term, e->documents.count(), e->documents));
}
else
{
@@ -372,9 +372,9 @@ QStringList HelpIndex::query(const QStringList & terms, const QStringList & term
qSort(termList);
QVector<Document> minDocs = termList.takeFirst().documents;
- for(QList<Term>::Iterator it = termList.begin(); it != termList.end(); ++it)
+ for(auto & it : termList)
{
- Term * t = &(*it);
+ Term * t = &it;
QVector<Document> docs = t->documents;
for(QVector<Document>::Iterator minDoc_it = minDocs.begin(); minDoc_it != minDocs.end();)
{
@@ -399,15 +399,15 @@ QStringList HelpIndex::query(const QStringList & terms, const QStringList & term
qSort(minDocs);
if(termSeq.isEmpty())
{
- for(QVector<Document>::Iterator it = minDocs.begin(); it != minDocs.end(); ++it)
- results << docList.at((int)(*it).docNumber);
+ for(auto & minDoc : minDocs)
+ results << docList.at((int)minDoc.docNumber);
return results;
}
QString fileName;
- for(QVector<Document>::Iterator it = minDocs.begin(); it != minDocs.end(); ++it)
+ for(auto & minDoc : minDocs)
{
- fileName = docList[(int)(*it).docNumber];
+ fileName = docList[(int)minDoc.docNumber];
if(searchForPattern(termSeq, seqWords, fileName))
results << fileName;
}
@@ -531,13 +531,13 @@ QStringList HelpIndex::split(const QString & str)
QVector<Document> HelpIndex::setupDummyTerm(const QStringList & terms)
{
QList<Term> termList;
- for(QStringList::ConstIterator it = terms.begin(); it != terms.end(); ++it)
+ for(const auto & term : terms)
{
- Entry * e = 0;
- if(dict[*it])
+ Entry * e = nullptr;
+ if(dict[term])
{
- e = dict[*it];
- termList.append(Term(*it, e->documents.count(), e->documents));
+ e = dict[term];
+ termList.append(Term(term, e->documents.count(), e->documents));
}
}
QVector<Document> maxList(0);
@@ -546,14 +546,14 @@ QVector<Document> HelpIndex::setupDummyTerm(const QStringList & terms)
qSort(termList);
maxList = termList.takeLast().documents;
- for(QList<Term>::Iterator it = termList.begin(); it != termList.end(); ++it)
+ for(auto & it : termList)
{
- Term * t = &(*it);
+ Term * t = &it;
QVector<Document> docs = t->documents;
- for(QVector<Document>::iterator docIt = docs.begin(); docIt != docs.end(); ++docIt)
+ for(auto & doc : docs)
{
- if(maxList.indexOf(*docIt) == -1)
- maxList.append(*docIt);
+ if(maxList.indexOf(doc) == -1)
+ maxList.append(doc);
}
}
return maxList;
diff --git a/src/modules/help/HelpWidget.cpp b/src/modules/help/HelpWidget.cpp
index bdf6ec329..d8e3dbd33 100644
--- a/src/modules/help/HelpWidget.cpp
+++ b/src/modules/help/HelpWidget.cpp
@@ -59,8 +59,8 @@ HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone)
g_pHelpWidgetList->append(this);
m_bIsStandalone = bIsStandalone;
- new QShortcut(QKeySequence::Copy, this, SLOT(slotCopy()), 0, Qt::WidgetWithChildrenShortcut);
- new QShortcut(QKeySequence::Find, this, SLOT(slotShowHideFind()), 0, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut);
+ new QShortcut(QKeySequence::Copy, this, SLOT(slotCopy()), nullptr, Qt::WidgetWithChildrenShortcut);
+ new QShortcut(QKeySequence::Find, this, SLOT(slotShowHideFind()), nullptr, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut);
// layout
m_pLayout = new QVBoxLayout(this);
diff --git a/src/modules/help/HelpWindow.cpp b/src/modules/help/HelpWindow.cpp
index 541ca1ca8..0f1803eca 100644
--- a/src/modules/help/HelpWindow.cpp
+++ b/src/modules/help/HelpWindow.cpp
@@ -249,9 +249,9 @@ void HelpWindow::startSearch()
m_terms.clear();
bool isPhrase = false;
QString s = "";
- for(int i = 0; i < (int)buf.length(); ++i)
+ for(const auto & i : buf)
{
- if(buf[i] == '\"')
+ if(i == '\"')
{
isPhrase = !isPhrase;
s = s.simplified();
@@ -259,7 +259,7 @@ void HelpWindow::startSearch()
m_terms << s;
s = "";
}
- else if(buf[i] == ' ' && !isPhrase)
+ else if(i == ' ' && !isPhrase)
{
s = s.simplified();
if(!s.isEmpty())
@@ -267,7 +267,7 @@ void HelpWindow::startSearch()
s = "";
}
else
- s += buf[i];
+ s += i;
}
if(!s.isEmpty())
m_terms << s;
diff --git a/src/modules/help/libkvihelp.cpp b/src/modules/help/libkvihelp.cpp
index c5dde5b99..d526c77a5 100644
--- a/src/modules/help/libkvihelp.cpp
+++ b/src/modules/help/libkvihelp.cpp
@@ -36,9 +36,9 @@
#include <QFileInfo>
#include <QSplitter>
-HelpIndex * g_pDocIndex = 0;
-KviPointerList<HelpWidget> * g_pHelpWidgetList = 0;
-KviPointerList<HelpWindow> * g_pHelpWindowList = 0;
+HelpIndex * g_pDocIndex = nullptr;
+KviPointerList<HelpWidget> * g_pHelpWidgetList = nullptr;
+KviPointerList<HelpWindow> * g_pHelpWindowList = nullptr;
/*
@doc: help.open
@@ -246,11 +246,11 @@ static bool help_module_cleanup(KviModule *)
while(g_pHelpWidgetList->first())
delete g_pHelpWidgetList->first();
delete g_pHelpWidgetList;
- g_pHelpWidgetList = 0;
+ g_pHelpWidgetList = nullptr;
while(g_pHelpWindowList->first())
g_pHelpWindowList->first()->close();
delete g_pHelpWindowList;
- g_pHelpWindowList = 0;
+ g_pHelpWindowList = nullptr;
return true;
}