Use nullptr instead of 0

This commit is contained in:
Luis Ángel San Martín 2019-05-31 20:10:35 +02:00
parent 2fe3fcf041
commit 923ad40057
17 changed files with 39 additions and 39 deletions

View File

@ -31,7 +31,7 @@ protected:
//QPropertyAnimation * animation;
public:
BookmarksDialog(QWidget *parent = 0);
BookmarksDialog(QWidget *parent = nullptr);
public slots:
void setBookmarks(const Bookmarks &bookmarks);

View File

@ -11,7 +11,7 @@ class GoToDialog : public QDialog
{
Q_OBJECT
public:
GoToDialog(QWidget *parent = 0);
GoToDialog(QWidget *parent = nullptr);
private:
QLabel *numPagesLabel;

View File

@ -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:

View File

@ -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);

View File

@ -24,7 +24,7 @@ private:
void paintEvent(QPaintEvent *);
public:
GoToFlowToolBar(QWidget *parent = 0);
GoToFlowToolBar(QWidget *parent = nullptr);
public slots:
void setPage(int pageNumber);

View File

@ -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;

View File

@ -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);
}
}

View File

@ -68,7 +68,7 @@ void NotificationsLabelWidget::setText(const QString &text)
void NotificationsLabelWidget::updatePosition()
{
QWidget *parent = dynamic_cast<QWidget *>(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));

View File

@ -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);
}

View File

@ -17,7 +17,7 @@ class OptionsDialog : public YACReaderOptionsDialog
{
Q_OBJECT
public:
OptionsDialog(QWidget *parent = 0);
OptionsDialog(QWidget *parent = nullptr);
private:
//QLabel * pathLabel;

View File

@ -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<QWidget *>(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<QWidget *>(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<QWidget *>(this->parent());
if (parent == 0) {
if (parent == nullptr) {
return;
}

View File

@ -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();
}

View File

@ -9,7 +9,7 @@ class ShortcutsDialog : public QDialog
{
Q_OBJECT
public:
ShortcutsDialog(QWidget *parent = 0);
ShortcutsDialog(QWidget *parent = nullptr);
private:
QTextEdit *shortcuts;

View File

@ -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) {

View File

@ -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();

View File

@ -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);

View File

@ -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();