From 1784c1d0cb2ca79983d138bbdd0b9f681f7beb7b Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Sun, 13 Sep 2020 11:20:09 +0200 Subject: [PATCH] Use more nullptr instead of 0 --- core/document.cpp | 8 ++++---- generators/dvi/psgs.cpp | 8 ++++---- generators/ooo/manifest.cpp | 2 +- generators/poppler/generator_pdf.cpp | 2 +- part.cpp | 2 +- ui/annotationproxymodels.cpp | 4 ++-- ui/pagepainter.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/document.cpp b/core/document.cpp index f31345d5c..9b9769749 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1444,7 +1444,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest() void DocumentPrivate::rotationFinished(int page, Okular::Page *okularPage) { - Okular::Page *wantedPage = m_pagesVector.value(page, 0); + Okular::Page *wantedPage = m_pagesVector.value(page, nullptr); if (!wantedPage || wantedPage != okularPage) return; @@ -1512,7 +1512,7 @@ void DocumentPrivate::slotGeneratorConfigChanged() void DocumentPrivate::refreshPixmaps(int pageNumber) { - Page *page = m_pagesVector.value(pageNumber, 0); + Page *page = m_pagesVector.value(pageNumber, nullptr); if (!page) return; @@ -3150,7 +3150,7 @@ void Document::requestPixmaps(const QLinkedList &requests, Pixm for (PixmapRequest *request : requests) { // set the 'page field' (see PixmapRequest) and check if it is valid qCDebug(OkularCoreDebug).nospace() << "request observer=" << request->observer() << " " << request->width() << "x" << request->height() << "@" << request->pageNumber(); - if (d->m_pagesVector.value(request->pageNumber()) == 0) { + if (d->m_pagesVector.value(request->pageNumber()) == nullptr) { // skip requests referencing an invalid page (must not happen) delete request; continue; @@ -3614,7 +3614,7 @@ void Document::searchText(int searchID, const QString &text, bool fromStart, Qt: const int viewportPage = (*d->m_viewportIterator).pageNumber; const int fromStartSearchPage = forward ? 0 : d->m_pagesVector.count() - 1; int currentPage = fromStart ? fromStartSearchPage : ((s->continueOnPage != -1) ? s->continueOnPage : viewportPage); - Page *lastPage = fromStart ? 0 : d->m_pagesVector[currentPage]; + Page *lastPage = fromStart ? nullptr : d->m_pagesVector[currentPage]; int pagesDone = 0; // continue checking last TextPage first (if it is the current page) diff --git a/generators/dvi/psgs.cpp b/generators/dvi/psgs.cpp index 5452ec3cf..8126f4a35 100644 --- a/generators/dvi/psgs.cpp +++ b/generators/dvi/psgs.cpp @@ -70,7 +70,7 @@ void ghostscript_interface::setPostScript(const PageNumber page, const QString & qCDebug(OkularDviDebug) << "ghostscript_interface::setPostScript( " << page << ", ... )"; #endif - if (pageList.value(page) == 0) { + if (pageList.value(page) == nullptr) { pageInfo *info = new pageInfo(PostScript); // Check if dict is big enough if (pageList.count() > pageList.capacity() - 2) @@ -94,7 +94,7 @@ void ghostscript_interface::setBackgroundColor(const PageNumber page, const QCol qCDebug(OkularDviDebug) << "ghostscript_interface::setBackgroundColor( " << page << ", " << background_color << " )"; #endif - if (pageList.value(page) == 0) { + if (pageList.value(page) == nullptr) { pageInfo *info = new pageInfo(QString()); info->background = background_color; if (permanent) @@ -115,7 +115,7 @@ void ghostscript_interface::restoreBackgroundColor(const PageNumber page) #ifdef DEBUG_PSGS qCDebug(OkularDviDebug) << "ghostscript_interface::restoreBackgroundColor( " << page << " )"; #endif - if (pageList.value(page) == 0) + if (pageList.value(page) == nullptr) return; pageInfo *info = pageList.value(page); @@ -131,7 +131,7 @@ QColor ghostscript_interface::getBackgroundColor(const PageNumber page) const qCDebug(OkularDviDebug) << "ghostscript_interface::getBackgroundColor( " << page << " )"; #endif - if (pageList.value(page) == 0) + if (pageList.value(page) == nullptr) return Qt::white; else return pageList.value(page)->background; diff --git a/generators/ooo/manifest.cpp b/generators/ooo/manifest.cpp index 81d999290..1302b2df6 100644 --- a/generators/ooo/manifest.cpp +++ b/generators/ooo/manifest.cpp @@ -213,7 +213,7 @@ Manifest::~Manifest() ManifestEntry *Manifest::entryByName(const QString &filename) { - return mEntries.value(filename, 0); + return mEntries.value(filename, nullptr); } bool Manifest::testIfEncrypted(const QString &filename) diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index b990c11a7..b40a7329c 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -239,7 +239,7 @@ Okular::Movie *createMovieFromPopplerScreen(const Poppler::LinkRendition *popple QPair createMovieFromPopplerRichMedia(const Poppler::RichMediaAnnotation *popplerRichMedia) { - const QPair emptyResult(0, 0); + const QPair emptyResult(nullptr, nullptr); /** * To convert a Flash/Video based RichMedia annotation to a movie, we search for the first diff --git a/part.cpp b/part.cpp index e648fc65e..8d035778c 100644 --- a/part.cpp +++ b/part.cpp @@ -3191,7 +3191,7 @@ void Part::psTransformEnded(int exit, QProcess::ExitStatus status) if (status != QProcess::NormalExit) return; - QProcess *senderobj = sender() ? qobject_cast(sender()) : 0; + QProcess *senderobj = sender() ? qobject_cast(sender()) : nullptr; if (senderobj) { senderobj->close(); senderobj->deleteLater(); diff --git a/ui/annotationproxymodels.cpp b/ui/annotationproxymodels.cpp index a44ccac76..f22eb3928 100644 --- a/ui/annotationproxymodels.cpp +++ b/ui/annotationproxymodels.cpp @@ -563,7 +563,7 @@ void AuthorGroupProxyModel::rebuildIndexes() if (!author.isEmpty()) { // We have the annotations as top-level, so introduce authors as new // top-levels and append the annotations - AuthorGroupItem *authorItem = authorMap.value(author, 0); + AuthorGroupItem *authorItem = authorMap.value(author, nullptr); if (!authorItem) { authorItem = new AuthorGroupItem(d->mRoot, AuthorGroupItem::Author); authorItem->setAuthor(author); @@ -589,7 +589,7 @@ void AuthorGroupProxyModel::rebuildIndexes() const QModelIndex annIdx = sourceModel()->index(subRow, 0, idx); const QString author = sourceModel()->data(annIdx, AnnotationModel::AuthorRole).toString(); - AuthorGroupItem *authorItem = pageAuthorMap.value(author, 0); + AuthorGroupItem *authorItem = pageAuthorMap.value(author, nullptr); if (!authorItem) { authorItem = new AuthorGroupItem(pageItem, AuthorGroupItem::Author); authorItem->setAuthor(author); diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp index 6930a56c9..da6d0f382 100644 --- a/ui/pagepainter.cpp +++ b/ui/pagepainter.cpp @@ -37,7 +37,7 @@ #include "settings_core.h" #include "ui/debug_ui.h" -Q_GLOBAL_STATIC_WITH_ARGS(QPixmap, busyPixmap, (KIconLoader::global()->loadIcon(QLatin1String("okular"), KIconLoader::NoGroup, IconSize(KIconLoader::Desktop), KIconLoader::DefaultState, QStringList(), 0, true))) +Q_GLOBAL_STATIC_WITH_ARGS(QPixmap, busyPixmap, (KIconLoader::global()->loadIcon(QLatin1String("okular"), KIconLoader::NoGroup, IconSize(KIconLoader::Desktop), KIconLoader::DefaultState, QStringList(), nullptr, true))) #define TEXTANNOTATION_ICONSIZE 24