Commit 13624878 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more nullptr

parent b4c4167b
......@@ -522,7 +522,7 @@ void BrowseMainPage::updateSortOrder()
void BrowseMainPage::updateThumbnailDetails()
{
PreviewItemDelegate::ThumbnailDetails details = 0;
PreviewItemDelegate::ThumbnailDetails details = {};
const auto actionList = d->mThumbnailDetailsActionGroup->actions();
for (const QAction * action : actionList) {
if (action->isChecked()) {
......
......@@ -67,8 +67,8 @@ KIPIExportAction::KIPIExportAction(QObject* parent)
, d(new KIPIExportActionPrivate)
{
d->q = this;
d->mKIPIInterface = 0;
d->mDefaultAction = 0;
d->mKIPIInterface = nullptr;
d->mDefaultAction = nullptr;
setToolTip(i18nc("@info:tooltip", "Share images using various services"));
setDelayed(false);
......
......@@ -496,12 +496,12 @@ void KIPIInterface::slotDirectoryChanged()
KIPI::FileReadWriteLock* KIPIInterface::createReadWriteLock(const QUrl& url) const
{
Q_UNUSED(url);
return NULL;
return nullptr;
}
KIPI::MetadataProcessor* KIPIInterface::createMetadataProcessor() const
{
return NULL;
return nullptr;
}
#ifdef GWENVIEW_KIPI_WITH_CREATE_RAW_PROCESSOR
......
......@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
// Workaround for QTBUG-38613
// Another solution would be to port BalooSemanticInfoBackend::refreshAllTags
// to be async rather than using exec().
qApp->sendPostedEvents(0, QEvent::DeferredDelete);
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
return app.exec();
}
......
......@@ -103,8 +103,8 @@ protected:
private:
BaseBinder(QObject* emitter)
: BinderInternal(emitter)
, mReceiver(0)
, mMethod(0)
, mReceiver(nullptr)
, mMethod(nullptr)
{}
Receiver* mReceiver;
......
......@@ -63,28 +63,28 @@ cmsHPROFILE loadFromPngData(const QByteArray& data)
buffer.open(QIODevice::ReadOnly);
// Initialize the internal structures
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
GV_RETURN_VALUE_IF_FAIL(png_ptr, 0);
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
GV_RETURN_VALUE_IF_FAIL(png_ptr, nullptr);
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, (png_infopp)nullptr, (png_infopp)nullptr);
qCWarning(GWENVIEW_LIB_LOG) << "Could not create info_struct";
return 0;
return nullptr;
}
png_infop end_info = png_create_info_struct(png_ptr);
if (!end_info) {
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)nullptr);
qCWarning(GWENVIEW_LIB_LOG) << "Could not create info_struct2";
return 0;
return nullptr;
}
// Catch errors
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
qCWarning(GWENVIEW_LIB_LOG) << "Error decoding png file";
return 0;
return nullptr;
}
// Initialize the special
......@@ -103,7 +103,7 @@ cmsHPROFILE loadFromPngData(const QByteArray& data)
int compression_type;
png_uint_32 proflen;
cmsHPROFILE profile = 0;
cmsHPROFILE profile = nullptr;
if (png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &profile_data, &proflen)) {
profile = cmsOpenProfileFromMem(profile_data, proflen);
}
......
......@@ -107,7 +107,7 @@ QLayoutItem *FlowLayout::takeAt(int index)
Qt::Orientations FlowLayout::expandingDirections() const
{
return 0;
return {};
}
bool FlowLayout::hasHeightForWidth() const
......
......@@ -98,7 +98,7 @@ HudButton::HudButton(QGraphicsItem* parent)
, d(new HudButtonPrivate)
{
d->q = this;
d->mAction = 0;
d->mAction = nullptr;
d->mIsDown = false;
// Palette to use for generating light icon. All we need is a light foreground.
......
......@@ -152,7 +152,7 @@ bool FITSData::loadFITS(QIODevice &buffer)
long nelements = stats.samples_per_channel * channels;
if (fits_read_img(fptr, data_type, 1, nelements, 0, imageBuffer, &anynull, &status)) {
if (fits_read_img(fptr, data_type, 1, nelements, nullptr, imageBuffer, &anynull, &status)) {
char errmsg[512];
fits_get_errstatus(status, errmsg);
errMessage = QString("Error reading image: %1").arg(errmsg);
......@@ -432,7 +432,7 @@ bool FITSData::debayer()
bayerBuffer = imageBuffer;
if (fits_read_img(fptr, data_type, 1, stats.samples_per_channel, 0, bayerBuffer, &anynull, &status)) {
if (fits_read_img(fptr, data_type, 1, stats.samples_per_channel, nullptr, bayerBuffer, &anynull, &status)) {
char errmsg[512];
fits_get_errstatus(status, errmsg);
return false;
......
......@@ -32,10 +32,10 @@ QImageIOPlugin::Capabilities FitsPlugin::capabilities(QIODevice *device, const Q
return Capabilities(CanRead);
}
if (!format.isEmpty()) {
return 0;
return {};
}
if (!device->isOpen()) {
return 0;
return {};
}
Capabilities cap;
......
......@@ -35,7 +35,7 @@ static const int SLIDE_DURATION = 250;
SlideContainer::SlideContainer(QWidget* parent)
: QFrame(parent)
{
mContent = 0;
mContent = nullptr;
mSlidingOut = false;
setFixedHeight(0);
}
......@@ -48,7 +48,7 @@ QWidget* SlideContainer::content() const
void SlideContainer::setContent(QWidget* content)
{
if (mContent) {
mContent->setParent(0);
mContent->setParent(nullptr);
mContent->removeEventFilter(this);
}
mContent = content;
......
......@@ -63,7 +63,7 @@ class RandomNumberGenerator
{
public:
RandomNumberGenerator()
: mSeed(time(0))
: mSeed(time(nullptr))
{
}
......
......@@ -63,7 +63,7 @@ class GWENVIEWLIB_EXPORT ThumbnailBarView : public ThumbnailView
{
Q_OBJECT
public:
ThumbnailBarView(QWidget* = 0);
ThumbnailBarView(QWidget* = nullptr);
~ThumbnailBarView() override;
Qt::Orientation orientation() const;
......
......@@ -37,7 +37,7 @@ class GWENVIEWLIB_EXPORT DoubleTap : public QGesture
{
Q_PROPERTY(QPointF pos READ pos WRITE pos)
public:
explicit DoubleTap(QObject* parent = 0);
explicit DoubleTap(QObject* parent = nullptr);
private:
QPointF pos;
};
......
......@@ -39,7 +39,7 @@ class GWENVIEWLIB_EXPORT OneAndTwoFingerSwipe : public QGesture
Q_PROPERTY(bool right READ right WRITE right)
public:
explicit OneAndTwoFingerSwipe(QObject* parent = 0);
explicit OneAndTwoFingerSwipe(QObject* parent = nullptr);
private:
bool left;
......
......@@ -38,7 +38,7 @@ class GWENVIEWLIB_EXPORT TapHoldAndMoving : public QGesture
Q_PROPERTY(QPoint pos READ getPos WRITE setPos)
public:
explicit TapHoldAndMoving(QObject* parent = 0);
explicit TapHoldAndMoving(QObject* parent = nullptr);
QPoint getPos() {return pos;};
void setPos(QPoint _pos) {pos = _pos;};
......
......@@ -39,7 +39,7 @@ class GWENVIEWLIB_EXPORT TwoFingerPan : public QGesture
Q_PROPERTY(bool delayActive READ getDelayActive WRITE setDelayActive)
public:
explicit TwoFingerPan(QObject* parent = 0);
explicit TwoFingerPan(QObject* parent = nullptr);
QPointF getDelta() {return delta;};
void setDelta(QPointF _delta) {delta = _delta;};
bool getDelayActive() {return delayActive;};
......
......@@ -37,7 +37,7 @@ class GWENVIEWLIB_EXPORT TwoFingerTap : public QGesture
{
public:
explicit TwoFingerTap(QObject* parent = 0);
explicit TwoFingerTap(QObject* parent = nullptr);
private:
};
......
......@@ -58,7 +58,7 @@ void ContextManagerTest::testRemove()
QCOMPARE(dirModel.rowCount(), 3);
ContextManager manager(&dirModel, 0);
ContextManager manager(&dirModel, nullptr);
// Select second row
manager.selectionModel()->setCurrentIndex(dirModel.index(1, 0), QItemSelectionModel::Select);
......
......@@ -61,13 +61,13 @@ void HistoryModelTest::testAddUrl()
QDateTime d2 = QDateTime::fromString("2009-01-29T23:01:47", Qt::ISODate);
QTemporaryDir dir;
{
HistoryModel model(0, dir.path());
HistoryModel model(nullptr, dir.path());
model.addUrl(u1, d1);
model.addUrl(u2, d2);
testModel(model, u2, u1);
}
HistoryModel model(0, dir.path());
HistoryModel model(nullptr, dir.path());
testModel(model, u2, u1);
// Make u1 the most recent
......@@ -87,7 +87,7 @@ void HistoryModelTest::testGarbageCollect()
QTemporaryDir dir;
{
HistoryModel model(0, dir.path(), 2);
HistoryModel model(nullptr, dir.path(), 2);
model.addUrl(u1, d1);
model.addUrl(u2, d2);
testModel(model, u2, u1);
......@@ -97,7 +97,7 @@ void HistoryModelTest::testGarbageCollect()
// Create a model with a larger history so that if garbage collecting fails
// to remove the collected url, the size of the model won't pass
// testModel()
HistoryModel model(0, dir.path(), 10);
HistoryModel model(nullptr, dir.path(), 10);
testModel(model, u3, u2);
}
......@@ -109,7 +109,7 @@ void HistoryModelTest::testRemoveRows()
QDateTime d2 = QDateTime::fromString("2009-01-29T23:01:47", Qt::ISODate);
QTemporaryDir dir;
HistoryModel model(0, dir.path(), 2);
HistoryModel model(nullptr, dir.path(), 2);
model.addUrl(u1, d1);
model.addUrl(u2, d2);
model.removeRows(0, 1);
......
......@@ -71,9 +71,9 @@ void SemanticInfoBackEndTest::initTestCase()
void SemanticInfoBackEndTest::init()
{
#ifdef GWENVIEW_SEMANTICINFO_BACKEND_FAKE
mBackEnd = new FakeSemanticInfoBackEnd(0, FakeSemanticInfoBackEnd::InitializeEmpty);
mBackEnd = new FakeSemanticInfoBackEnd(nullptr, FakeSemanticInfoBackEnd::InitializeEmpty);
#elif defined(GWENVIEW_SEMANTICINFO_BACKEND_BALOO)
mBackEnd = new BalooSemanticInfoBackend(0);
mBackEnd = new BalooSemanticInfoBackend(nullptr);
#endif
}
......
......@@ -38,10 +38,11 @@ using namespace Gwenview;
struct TestWindow : public QWidget
{
explicit TestWindow(QWidget* parent = 0)
explicit TestWindow(QWidget* parent = nullptr)
: QWidget(parent)
, mContainer(new SlideContainer)
, mContent(0) {
, mContent(nullptr)
{
createContent();
mMainWidget = new QTextEdit();
......
......@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
QUrl setUpRemoteTestDir(const QString& testFile)
{
QWidget* authWindow = 0;
QWidget* authWindow = nullptr;
if (qEnvironmentVariableIsEmpty("GV_REMOTE_TESTS_BASE_URL")) {
qWarning() << "Environment variable GV_REMOTE_TESTS_BASE_URL not set: remote tests disabled";
return QUrl();
......@@ -85,7 +85,7 @@ void waitForDeferredDeletes()
{
while (QCoreApplication::hasPendingEvents()) {
QCoreApplication::sendPostedEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
QCoreApplication::processEvents();
}
}
......
......@@ -39,7 +39,7 @@ using namespace Gwenview;
static void touchFile(const QString& path)
{
utime(QFile::encodeName(path).data(), 0);
utime(QFile::encodeName(path).data(), nullptr);
}
#define NEW_ROW(fileName, dateTime) QTest::newRow(fileName) << fileName << dateTime
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment