From 923ad40057acef0eb9196eb8311a1022400bec4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 31 May 2019 20:10:35 +0200 Subject: [PATCH] Use nullptr instead of 0 --- YACReader/bookmarks_dialog.h | 2 +- YACReader/goto_dialog.h | 2 +- YACReader/goto_flow.h | 2 +- YACReader/goto_flow_gl.h | 2 +- YACReader/goto_flow_toolbar.h | 2 +- YACReader/goto_flow_widget.h | 2 +- YACReader/main_window_viewer.cpp | 2 +- YACReader/notifications_label_widget.cpp | 2 +- YACReader/options_dialog.cpp | 2 +- YACReader/options_dialog.h | 2 +- YACReader/page_label_widget.cpp | 8 +++--- YACReader/render.cpp | 32 ++++++++++++------------ YACReader/shortcuts_dialog.h | 2 +- YACReader/viewer.cpp | 8 +++--- YACReader/viewer.h | 2 +- YACReader/width_slider.h | 4 +-- YACReader/yacreader_local_client.h | 2 +- 17 files changed, 39 insertions(+), 39 deletions(-) diff --git a/YACReader/bookmarks_dialog.h b/YACReader/bookmarks_dialog.h index 2b520663..21b0c559 100644 --- a/YACReader/bookmarks_dialog.h +++ b/YACReader/bookmarks_dialog.h @@ -31,7 +31,7 @@ protected: //QPropertyAnimation * animation; public: - BookmarksDialog(QWidget *parent = 0); + BookmarksDialog(QWidget *parent = nullptr); public slots: void setBookmarks(const Bookmarks &bookmarks); diff --git a/YACReader/goto_dialog.h b/YACReader/goto_dialog.h index 29f52b6d..a80d0d8a 100644 --- a/YACReader/goto_dialog.h +++ b/YACReader/goto_dialog.h @@ -11,7 +11,7 @@ class GoToDialog : public QDialog { Q_OBJECT public: - GoToDialog(QWidget *parent = 0); + GoToDialog(QWidget *parent = nullptr); private: QLabel *numPagesLabel; diff --git a/YACReader/goto_flow.h b/YACReader/goto_flow.h index db4aaeff..ff36064a 100644 --- a/YACReader/goto_flow.h +++ b/YACReader/goto_flow.h @@ -29,7 +29,7 @@ class GoToFlow : public GoToFlowWidget { Q_OBJECT public: - GoToFlow(QWidget *parent = 0, FlowType flowType = CoverFlowLike); + GoToFlow(QWidget *parent = nullptr, FlowType flowType = CoverFlowLike); ~GoToFlow(); bool ready; //comic is ready for read. private: diff --git a/YACReader/goto_flow_gl.h b/YACReader/goto_flow_gl.h index ea3dbbce..5ec92151 100644 --- a/YACReader/goto_flow_gl.h +++ b/YACReader/goto_flow_gl.h @@ -16,7 +16,7 @@ class GoToFlowGL : public GoToFlowWidget { Q_OBJECT public: - GoToFlowGL(QWidget *parent = 0, FlowType flowType = CoverFlowLike); + GoToFlowGL(QWidget *parent = nullptr, FlowType flowType = CoverFlowLike); ~GoToFlowGL(); void reset(); void centerSlide(int slide); diff --git a/YACReader/goto_flow_toolbar.h b/YACReader/goto_flow_toolbar.h index 6656b243..f31c50fe 100644 --- a/YACReader/goto_flow_toolbar.h +++ b/YACReader/goto_flow_toolbar.h @@ -24,7 +24,7 @@ private: void paintEvent(QPaintEvent *); public: - GoToFlowToolBar(QWidget *parent = 0); + GoToFlowToolBar(QWidget *parent = nullptr); public slots: void setPage(int pageNumber); diff --git a/YACReader/goto_flow_widget.h b/YACReader/goto_flow_widget.h index 5d7c0a75..0720d55a 100644 --- a/YACReader/goto_flow_widget.h +++ b/YACReader/goto_flow_widget.h @@ -19,7 +19,7 @@ protected: GoToFlowToolBar *toolBar; public: - GoToFlowWidget(QWidget *paret = 0); + GoToFlowWidget(QWidget *paret = nullptr); virtual ~GoToFlowWidget() = 0; public slots: virtual void reset() = 0; diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 062eb3da..f618e955 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -952,7 +952,7 @@ void MainWindowViewer::saveImage() QFileInfo fi(pathFile); currentDirectoryImgDest = fi.absolutePath(); const QPixmap *p = viewer->pixmap(); - if (p != NULL) + if (p != nullptr) p->save(pathFile); } } diff --git a/YACReader/notifications_label_widget.cpp b/YACReader/notifications_label_widget.cpp index de535484..f804719d 100644 --- a/YACReader/notifications_label_widget.cpp +++ b/YACReader/notifications_label_widget.cpp @@ -68,7 +68,7 @@ void NotificationsLabelWidget::setText(const QString &text) void NotificationsLabelWidget::updatePosition() { QWidget *parent = dynamic_cast(this->parent()); - if (parent == 0) { + if (parent == nullptr) { return; } move(QPoint((parent->geometry().size().width() - this->width()) / 2, (parent->geometry().size().height() - this->height()) / 2)); diff --git a/YACReader/options_dialog.cpp b/YACReader/options_dialog.cpp index 7772d11a..0daa2540 100644 --- a/YACReader/options_dialog.cpp +++ b/YACReader/options_dialog.cpp @@ -174,7 +174,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) void OptionsDialog::findFolder() { - QString s = QFileDialog::getExistingDirectory(0, tr("Comics directory"), "."); + QString s = QFileDialog::getExistingDirectory(nullptr, tr("Comics directory"), "."); if (!s.isEmpty()) { pathEdit->setText(s); } diff --git a/YACReader/options_dialog.h b/YACReader/options_dialog.h index 4cbfcd6a..7f19f7ee 100644 --- a/YACReader/options_dialog.h +++ b/YACReader/options_dialog.h @@ -17,7 +17,7 @@ class OptionsDialog : public YACReaderOptionsDialog { Q_OBJECT public: - OptionsDialog(QWidget *parent = 0); + OptionsDialog(QWidget *parent = nullptr); private: //QLabel * pathLabel; diff --git a/YACReader/page_label_widget.cpp b/YACReader/page_label_widget.cpp index 1fe23658..9a1a8d6a 100644 --- a/YACReader/page_label_widget.cpp +++ b/YACReader/page_label_widget.cpp @@ -34,7 +34,7 @@ PageLabelWidget::PageLabelWidget(QWidget *parent) setFixedSize(labelSize); - if (parent != 0) + if (parent != nullptr) move(QPoint((parent->geometry().size().width() - this->width()), -this->height())); layout->addWidget(textLabel, 0, Qt::AlignCenter); @@ -45,7 +45,7 @@ void PageLabelWidget::show() { if (this->pos().y() <= 0 && animation->state() != QPropertyAnimation::Running) { QWidget *parent = dynamic_cast(this->parent()); - if (parent == 0) { + if (parent == nullptr) { return; } @@ -63,7 +63,7 @@ void PageLabelWidget::hide() { if (this->pos().y() >= 0 && animation->state() != QPropertyAnimation::Running) { QWidget *parent = dynamic_cast(this->parent()); - if (parent == 0) { + if (parent == nullptr) { return; } //connect(animation,SIGNAL(finished()),this,SLOT(setHidden())); @@ -88,7 +88,7 @@ void PageLabelWidget::paintEvent(QPaintEvent *) void PageLabelWidget::updatePosition() { QWidget *parent = dynamic_cast(this->parent()); - if (parent == 0) { + if (parent == nullptr) { return; } diff --git a/YACReader/render.cpp b/YACReader/render.cpp index 785d4dc5..b50fd7e1 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -365,7 +365,7 @@ void PageRender::run() //----------------------------------------------------------------------------- Render::Render() - : comic(0), doublePage(false), doubleMangaPage(false), currentIndex(0), numLeftPages(4), numRightPages(4), loadedComic(false), imageRotation(0) + : comic(nullptr), doublePage(false), doubleMangaPage(false), currentIndex(0), numLeftPages(4), numRightPages(4), loadedComic(false), imageRotation(0) { int size = numLeftPages + numRightPages + 1; currentPageBufferedIndex = numLeftPages; @@ -381,13 +381,13 @@ Render::Render() Render::~Render() { - if (comic != 0) { + if (comic != nullptr) { comic->moveToThread(QApplication::instance()->thread()); comic->deleteLater(); } foreach (PageRender *pr, pageRenders) - if (pr != 0) { + if (pr != nullptr) { if (pr->wait()) delete pr; } @@ -480,7 +480,7 @@ QPixmap *Render::getCurrentDoublePage() leftpage.setY(rightsize.rheight()); break; default: - return NULL; + return nullptr; } QPixmap *page = new QPixmap(totalWidth, totalHeight); QPainter painter(page); @@ -488,7 +488,7 @@ QPixmap *Render::getCurrentDoublePage() painter.drawImage(QRect(rightpage, rightsize), *buffer[currentPageBufferedIndex + 1]); return page; } else { - return NULL; + return nullptr; } } @@ -530,7 +530,7 @@ QPixmap *Render::getCurrentDoubleMangaPage() leftpage.setY(rightsize.rheight()); break; default: - return NULL; + return nullptr; } QPixmap *page = new QPixmap(totalWidth, totalHeight); QPainter painter(page); @@ -538,7 +538,7 @@ QPixmap *Render::getCurrentDoubleMangaPage() painter.drawImage(QRect(leftpage, leftsize), *buffer[currentPageBufferedIndex + 1]); return page; } else { - return NULL; + return nullptr; } } @@ -607,7 +607,7 @@ void Render::setRotation(int degrees) void Render::setComic(Comic *c) { - if (comic != 0) { + if (comic != nullptr) { comic->moveToThread(QApplication::instance()->thread()); comic->disconnect(); comic->deleteLater(); @@ -642,7 +642,7 @@ void Render::update() void Render::load(const QString &path, int atPage) { createComic(path); - if (comic != 0) { + if (comic != nullptr) { loadComic(path, atPage); startLoad(); } @@ -673,7 +673,7 @@ void Render::load(const QString &path, const ComicDB &comicDB) } } createComic(path); - if (comic != 0) { + if (comic != nullptr) { loadComic(path, comicDB); startLoad(); } @@ -684,7 +684,7 @@ void Render::createComic(const QString &path) previousIndex = currentIndex = 0; pagesEmited.clear(); - if (comic != 0) { + if (comic != nullptr) { //comic->moveToThread(QApplication::instance()->thread()); comic->invalidate(); @@ -694,7 +694,7 @@ void Render::createComic(const QString &path) //comic->moveToThread(QApplication::instance()->thread()); comic = FactoryComic::newComic(path); - if (comic == NULL) //archivo no encontrado o no válido + if (comic == nullptr) //archivo no encontrado o no válido { emit errorOpening(); reset(); @@ -841,7 +841,7 @@ unsigned int Render::numPages() bool Render::hasLoadedComic() { - if (comic != 0) + if (comic != nullptr) return comic->loaded(); return false; } @@ -920,7 +920,7 @@ void Render::updateBuffer() //renders PageRender *pr = pageRenders.front(); pageRenders.pop_front(); - if (pr != 0) { + if (pr != nullptr) { if (pr->wait()) delete pr; } @@ -942,7 +942,7 @@ void Render::updateBuffer() //renders PageRender *pr = pageRenders.back(); pageRenders.pop_back(); - if (pr != 0) { + if (pr != nullptr) { if (pr->wait()) delete pr; } @@ -951,7 +951,7 @@ void Render::updateBuffer() //images buffer.push_front(new QImage()); QImage *p = buffer.back(); - if (p != 0) + if (p != nullptr) delete p; buffer.pop_back(); } diff --git a/YACReader/shortcuts_dialog.h b/YACReader/shortcuts_dialog.h index 876868b9..cf985c39 100644 --- a/YACReader/shortcuts_dialog.h +++ b/YACReader/shortcuts_dialog.h @@ -9,7 +9,7 @@ class ShortcutsDialog : public QDialog { Q_OBJECT public: - ShortcutsDialog(QWidget *parent = 0); + ShortcutsDialog(QWidget *parent = nullptr); private: QTextEdit *shortcuts; diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 30839bef..4e57aced 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -29,7 +29,7 @@ Viewer::Viewer(QWidget *parent) doublePage(false), doubleMangaPage(false), zoom(100), - currentPage(0), + currentPage(nullptr), wheelStop(false), direction(1), drag(false), @@ -145,7 +145,7 @@ Viewer::~Viewer() delete bd; delete notificationsLabel; delete mglass; - if (currentPage != 0) + if (currentPage != nullptr) delete currentPage; } @@ -286,7 +286,7 @@ void Viewer::updatePage() else { currentPage = render->getCurrentDoubleMangaPage(); } - if (currentPage == NULL) { + if (currentPage == nullptr) { currentPage = render->getCurrentPage(); } } else { @@ -318,7 +318,7 @@ void Viewer::updatePage() void Viewer::updateContentSize() { //there is an image to resize - if (currentPage != 0 && !currentPage->isNull()) { + if (currentPage != nullptr && !currentPage->isNull()) { QSize pagefit; YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode(); switch (fitmode) { diff --git a/YACReader/viewer.h b/YACReader/viewer.h index 1edfa13d..f5a150eb 100644 --- a/YACReader/viewer.h +++ b/YACReader/viewer.h @@ -170,7 +170,7 @@ private: void scrollTo(int x, int y); public: - Viewer(QWidget *parent = 0); + Viewer(QWidget *parent = nullptr); ~Viewer(); void toggleFullScreen(); const QPixmap *pixmap(); diff --git a/YACReader/width_slider.h b/YACReader/width_slider.h index 2fbb4079..f7a019cb 100644 --- a/YACReader/width_slider.h +++ b/YACReader/width_slider.h @@ -14,7 +14,7 @@ private: QSlider *slider; public: - YACReaderSlider(QWidget *parent = 0); + YACReaderSlider(QWidget *parent = nullptr); void show(); protected: @@ -37,7 +37,7 @@ private: YACReaderSlider *widget; public: - YACReaderSliderAction(QWidget *parent = 0); + YACReaderSliderAction(QWidget *parent = nullptr); public slots: void updateText(int value); diff --git a/YACReader/yacreader_local_client.h b/YACReader/yacreader_local_client.h index 4bbbd616..3d06c215 100644 --- a/YACReader/yacreader_local_client.h +++ b/YACReader/yacreader_local_client.h @@ -10,7 +10,7 @@ class YACReaderLocalClient : public QObject { Q_OBJECT public: - explicit YACReaderLocalClient(QObject *parent = 0); + explicit YACReaderLocalClient(QObject *parent = nullptr); ~YACReaderLocalClient(); signals: void finished();