diff --git a/3rdparty/qtiocompressor/qtiocompressor.cpp b/3rdparty/qtiocompressor/qtiocompressor.cpp index ef5c7af44..50956a02b 100644 --- a/3rdparty/qtiocompressor/qtiocompressor.cpp +++ b/3rdparty/qtiocompressor/qtiocompressor.cpp @@ -117,7 +117,7 @@ QtIOCompressorPrivate::~QtIOCompressorPrivate() void QtIOCompressorPrivate::flushZlib(int flushMode) { // No input. - zlibStream.next_in = 0; + zlibStream.next_in = nullptr; zlibStream.avail_in = 0; int status; do { @@ -388,7 +388,7 @@ bool QtIOCompressor::open(OpenMode mode) if (read) { d->state = QtIOCompressorPrivate::NotReadFirstByte; d->zlibStream.avail_in = 0; - d->zlibStream.next_in = 0; + d->zlibStream.next_in = nullptr; if (d->streamFormat == QtIOCompressor::ZlibFormat) { status = inflateInit(&d->zlibStream); } else { diff --git a/3rdparty/solid-lite/backends/hal/halcdrom.cpp b/3rdparty/solid-lite/backends/hal/halcdrom.cpp index 1216641db..9719fbb16 100644 --- a/3rdparty/solid-lite/backends/hal/halcdrom.cpp +++ b/3rdparty/solid-lite/backends/hal/halcdrom.cpp @@ -174,7 +174,7 @@ bool Solid::Backends::Hal::Cdrom::callSystemEject() m_process = FstabHandling::callSystemCommand("eject", device, this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); - return m_process!=0; + return m_process!=nullptr; } void Cdrom::slotDBusReply(const QDBusMessage &/*reply*/) diff --git a/3rdparty/solid-lite/backends/hal/haldevice.cpp b/3rdparty/solid-lite/backends/hal/haldevice.cpp index 50e385cb6..c987ee309 100644 --- a/3rdparty/solid-lite/backends/hal/haldevice.cpp +++ b/3rdparty/solid-lite/backends/hal/haldevice.cpp @@ -107,7 +107,7 @@ public: udi, "org.freedesktop.Hal.Device", QDBusConnection::systemBus()), - cacheSynced(false), parent(0) { } + cacheSynced(false), parent(nullptr) { } void checkCache(const QString &key = QString()); QDBusInterface device; @@ -447,10 +447,10 @@ bool HalDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type) c QObject *HalDevice::createDeviceInterface(const Solid::DeviceInterface::Type &type) { if (!queryDeviceInterface(type)) { - return 0; + return nullptr; } - DeviceInterface *iface = 0; + DeviceInterface *iface = nullptr; switch (type) { diff --git a/3rdparty/solid-lite/backends/hal/halfstabhandling.cpp b/3rdparty/solid-lite/backends/hal/halfstabhandling.cpp index 55ff40f11..ae29a44af 100644 --- a/3rdparty/solid-lite/backends/hal/halfstabhandling.cpp +++ b/3rdparty/solid-lite/backends/hal/halfstabhandling.cpp @@ -181,7 +181,7 @@ QProcess *Solid::Backends::Hal::FstabHandling::callSystemCommand(const QString & return process; } else { delete process; - return 0; + return nullptr; } } diff --git a/3rdparty/solid-lite/backends/hal/halmanager.cpp b/3rdparty/solid-lite/backends/hal/halmanager.cpp index 912db1ec0..b5159be02 100644 --- a/3rdparty/solid-lite/backends/hal/halmanager.cpp +++ b/3rdparty/solid-lite/backends/hal/halmanager.cpp @@ -175,7 +175,7 @@ QObject *HalManager::createDevice(const QString &udi) if (deviceExists(udi)) { return new HalDevice(udi); } else { - return 0; + return nullptr; } } diff --git a/3rdparty/solid-lite/backends/hal/halstorageaccess.cpp b/3rdparty/solid-lite/backends/hal/halstorageaccess.cpp index 5a7034c21..5c2818f0f 100644 --- a/3rdparty/solid-lite/backends/hal/halstorageaccess.cpp +++ b/3rdparty/solid-lite/backends/hal/halstorageaccess.cpp @@ -329,7 +329,7 @@ bool StorageAccess::requestPassphrase() QWidget *activeWindow = QApplication::activeWindow(); uint wId = 0; - if (activeWindow!=0) { + if (activeWindow!=nullptr) { wId = (uint)activeWindow->winId(); } @@ -473,7 +473,7 @@ bool Solid::Backends::Hal::StorageAccess::callSystemMount() m_process = FstabHandling::callSystemCommand("mount", device, this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); - return m_process!=0; + return m_process!=nullptr; } bool Solid::Backends::Hal::StorageAccess::callSystemUnmount() @@ -482,7 +482,7 @@ bool Solid::Backends::Hal::StorageAccess::callSystemUnmount() m_process = FstabHandling::callSystemCommand("umount", device, this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); - return m_process!=0; + return m_process!=nullptr; } void StorageAccess::callCryptoSetup(const QString &passphrase) diff --git a/3rdparty/solid-lite/backends/shared/rootdevice.cpp b/3rdparty/solid-lite/backends/shared/rootdevice.cpp index c510b1c42..6536782ed 100644 --- a/3rdparty/solid-lite/backends/shared/rootdevice.cpp +++ b/3rdparty/solid-lite/backends/shared/rootdevice.cpp @@ -102,5 +102,5 @@ bool RootDevice::queryDeviceInterface(const Solid::DeviceInterface::Type&) const QObject* RootDevice::createDeviceInterface(const Solid::DeviceInterface::Type&) { - return 0; + return nullptr; } diff --git a/3rdparty/solid-lite/backends/shared/udevqt.h b/3rdparty/solid-lite/backends/shared/udevqt.h index d8d9db8c4..733f58611 100644 --- a/3rdparty/solid-lite/backends/shared/udevqt.h +++ b/3rdparty/solid-lite/backends/shared/udevqt.h @@ -79,8 +79,8 @@ class Client : public QObject Q_PROPERTY(QStringList watchedSubsystems READ watchedSubsystems WRITE setWatchedSubsystems) public: - Client(QObject *parent = 0); - Client(const QStringList &subsystemList, QObject *parent = 0); + Client(QObject *parent = nullptr); + Client(const QStringList &subsystemList, QObject *parent = nullptr); ~Client() override; QStringList watchedSubsystems() const; diff --git a/3rdparty/solid-lite/backends/shared/udevqtclient.cpp b/3rdparty/solid-lite/backends/shared/udevqtclient.cpp index caa382ba9..ac3ffaecb 100644 --- a/3rdparty/solid-lite/backends/shared/udevqtclient.cpp +++ b/3rdparty/solid-lite/backends/shared/udevqtclient.cpp @@ -27,7 +27,7 @@ namespace UdevQt { ClientPrivate::ClientPrivate(Client *q_) - : udev(0), monitor(0), q(q_), monitorNotifier(0) + : udev(nullptr), monitor(nullptr), q(q_), monitorNotifier(nullptr) { } @@ -68,7 +68,7 @@ void ClientPrivate::setWatchedSubsystems(const QStringList &subsystemList) QByteArray devType = subsysDevtype.mid(ix + 1).toLatin1(); udev_monitor_filter_add_match_subsystem_devtype(newM, subsystem.constData(), devType.constData()); } else { - udev_monitor_filter_add_match_subsystem_devtype(newM, subsysDevtype.toLatin1().constData(), NULL); + udev_monitor_filter_add_match_subsystem_devtype(newM, subsysDevtype.toLatin1().constData(), nullptr); } } @@ -189,7 +189,7 @@ DeviceList Client::devicesByProperty(const QString &property, const QVariant &va if (value.isValid()) { udev_enumerate_add_match_property(en, property.toLatin1().constData(), value.toString().toLatin1().constData()); } else { - udev_enumerate_add_match_property(en, property.toLatin1().constData(), NULL); + udev_enumerate_add_match_property(en, property.toLatin1().constData(), nullptr); } return d->deviceListFromEnumerate(en); @@ -216,7 +216,7 @@ Device Client::deviceByDeviceFile(const QString &deviceFile) if (stat(deviceFile.toLatin1().constData(), &sb) != 0) return Device(); - struct udev_device *ud = 0; + struct udev_device *ud = nullptr; if (S_ISBLK(sb.st_mode)) ud = udev_device_new_from_devnum(d->udev, 'b', sb.st_rdev); diff --git a/3rdparty/solid-lite/backends/shared/udevqtdevice.cpp b/3rdparty/solid-lite/backends/shared/udevqtdevice.cpp index d27327dde..57b63b978 100644 --- a/3rdparty/solid-lite/backends/shared/udevqtdevice.cpp +++ b/3rdparty/solid-lite/backends/shared/udevqtdevice.cpp @@ -74,7 +74,7 @@ QString DevicePrivate::decodePropertyValue(const QByteArray &encoded) const } Device::Device() - : d(0) + : d(nullptr) { } @@ -83,7 +83,7 @@ Device::Device(const Device &other) if (other.d) { d = new DevicePrivate(other.d->udev); } else { - d = 0; + d = nullptr; } } @@ -103,7 +103,7 @@ Device &Device::operator=(const Device &other) return *this; if (!other.d) { delete d; - d = 0; + d = nullptr; return *this; } if (!d) { @@ -117,7 +117,7 @@ Device &Device::operator=(const Device &other) bool Device::isValid() const { - return (d != 0); + return (d != nullptr); } QString Device::subsystem() const diff --git a/3rdparty/solid-lite/backends/udev/udevdevice.cpp b/3rdparty/solid-lite/backends/udev/udevdevice.cpp index 71eb5375e..5a2c24b80 100644 --- a/3rdparty/solid-lite/backends/udev/udevdevice.cpp +++ b/3rdparty/solid-lite/backends/udev/udevdevice.cpp @@ -242,7 +242,7 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type) QObject *UDevDevice::createDeviceInterface(const Solid::DeviceInterface::Type &type) { if (!queryDeviceInterface(type)) { - return 0; + return nullptr; } switch (type) { @@ -278,7 +278,7 @@ QObject *UDevDevice::createDeviceInterface(const Solid::DeviceInterface::Type &t */ default: // qFatal("Shouldn't happen"); - return 0; + return nullptr; } } diff --git a/3rdparty/solid-lite/backends/udev/udevmanager.cpp b/3rdparty/solid-lite/backends/udev/udevmanager.cpp index 6713c97be..adcdded5c 100644 --- a/3rdparty/solid-lite/backends/udev/udevmanager.cpp +++ b/3rdparty/solid-lite/backends/udev/udevmanager.cpp @@ -196,7 +196,7 @@ QObject *UDevManager::createDevice(const QString &udi_) if (d->isOfInterest(device) || QFile::exists(udi)) { return new UDevDevice(device); } - return 0; + return nullptr; } void UDevManager::slotDeviceAdded(const UdevQt::Device &device) diff --git a/3rdparty/solid-lite/backends/udisks2/dbus/manager.h b/3rdparty/solid-lite/backends/udisks2/dbus/manager.h index 0a1957bd0..45a41340f 100644 --- a/3rdparty/solid-lite/backends/udisks2/dbus/manager.h +++ b/3rdparty/solid-lite/backends/udisks2/dbus/manager.h @@ -33,7 +33,7 @@ public: { return "org.freedesktop.DBus.ObjectManager"; } public: - OrgFreedesktopDBusObjectManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + OrgFreedesktopDBusObjectManagerInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); ~OrgFreedesktopDBusObjectManagerInterface() override; diff --git a/3rdparty/solid-lite/backends/udisks2/udisksdevice.cpp b/3rdparty/solid-lite/backends/udisks2/udisksdevice.cpp index 378ee04d9..7cd71a5d7 100644 --- a/3rdparty/solid-lite/backends/udisks2/udisksdevice.cpp +++ b/3rdparty/solid-lite/backends/udisks2/udisksdevice.cpp @@ -163,10 +163,10 @@ QStringList Device::interfaces() const QObject* Device::createDeviceInterface(const Solid::DeviceInterface::Type& type) { if (!queryDeviceInterface(type)) { - return 0; + return nullptr; } - DeviceInterface *iface = 0; + DeviceInterface *iface = nullptr; switch (type) { case Solid::DeviceInterface::GenericInterface: diff --git a/3rdparty/solid-lite/backends/udisks2/udisksdevicebackend.cpp b/3rdparty/solid-lite/backends/udisks2/udisksdevicebackend.cpp index 332d09706..516d31546 100644 --- a/3rdparty/solid-lite/backends/udisks2/udisksdevicebackend.cpp +++ b/3rdparty/solid-lite/backends/udisks2/udisksdevicebackend.cpp @@ -36,7 +36,7 @@ QMap DeviceBackend::s_backends; DeviceBackend* DeviceBackend::backendForUDI(const QString& udi, bool create) { - DeviceBackend *backend = 0; + DeviceBackend *backend = nullptr; if (udi.isEmpty()) { return backend; } diff --git a/3rdparty/solid-lite/backends/udisks2/udisksmanager.cpp b/3rdparty/solid-lite/backends/udisks2/udisksmanager.cpp index b9d8bb1fa..b6c3aa5d8 100644 --- a/3rdparty/solid-lite/backends/udisks2/udisksmanager.cpp +++ b/3rdparty/solid-lite/backends/udisks2/udisksmanager.cpp @@ -96,7 +96,7 @@ QObject* Manager::createDevice(const QString& udi) } else if (deviceCache().contains(udi)) { return new Device(udi); } else { - return 0; + return nullptr; } } diff --git a/3rdparty/solid-lite/backends/udisks2/udisksstorageaccess.cpp b/3rdparty/solid-lite/backends/udisks2/udisksstorageaccess.cpp index 89df2246f..0847a0516 100644 --- a/3rdparty/solid-lite/backends/udisks2/udisksstorageaccess.cpp +++ b/3rdparty/solid-lite/backends/udisks2/udisksstorageaccess.cpp @@ -332,7 +332,7 @@ bool StorageAccess::requestPassphrase() QWidget *activeWindow = QApplication::activeWindow(); uint wId = 0; - if (activeWindow!=0) + if (activeWindow!=nullptr) wId = (uint)activeWindow->winId(); QString appId = QCoreApplication::applicationName(); diff --git a/3rdparty/solid-lite/device.cpp b/3rdparty/solid-lite/device.cpp index 66ec9d5d6..b87f0f20e 100644 --- a/3rdparty/solid-lite/device.cpp +++ b/3rdparty/solid-lite/device.cpp @@ -96,7 +96,7 @@ Solid::Device &Solid::Device::operator=(const Solid::Device &device) bool Solid::Device::isValid() const { - return d->backendObject()!=0; + return d->backendObject()!=nullptr; } QString Solid::Device::udi() const @@ -166,17 +166,17 @@ const Solid::DeviceInterface *Solid::Device::asDeviceInterface(const DeviceInter { Ifaces::Device *device = qobject_cast(d->backendObject()); - if (device!=0) + if (device!=nullptr) { DeviceInterface *iface = d->interface(type); - if (iface!=0) { + if (iface!=nullptr) { return iface; } QObject *dev_iface = device->createDeviceInterface(type); - if (dev_iface!=0) + if (dev_iface!=nullptr) { switch (type) { @@ -250,7 +250,7 @@ const Solid::DeviceInterface *Solid::Device::asDeviceInterface(const DeviceInter } } - if (iface!=0) + if (iface!=nullptr) { // Lie on the constness since we're simply doing caching here const_cast(this)->d->setInterface(type, iface); @@ -261,7 +261,7 @@ const Solid::DeviceInterface *Solid::Device::asDeviceInterface(const DeviceInter } else { - return 0; + return nullptr; } } @@ -279,13 +279,13 @@ Solid::DevicePrivate::~DevicePrivate() for (DeviceInterface *iface: m_ifaces) { delete iface->d_ptr->backendObject(); } - setBackendObject(0); + setBackendObject(nullptr); } void Solid::DevicePrivate::_k_destroyed(QObject *object) { Q_UNUSED(object); - setBackendObject(0); + setBackendObject(nullptr); } void Solid::DevicePrivate::setBackendObject(Ifaces::Device *object) diff --git a/3rdparty/solid-lite/deviceinterface.cpp b/3rdparty/solid-lite/deviceinterface.cpp index 3a8b7542c..7ee55c35e 100644 --- a/3rdparty/solid-lite/deviceinterface.cpp +++ b/3rdparty/solid-lite/deviceinterface.cpp @@ -38,13 +38,13 @@ Solid::DeviceInterface::DeviceInterface(DeviceInterfacePrivate &dd, QObject *bac Solid::DeviceInterface::~DeviceInterface() { delete d_ptr; - d_ptr = 0; + d_ptr = nullptr; } bool Solid::DeviceInterface::isValid() const { Q_D(const DeviceInterface); - return d->backendObject()!=0; + return d->backendObject()!=nullptr; } QString Solid::DeviceInterface::typeToString(Type type) @@ -117,7 +117,7 @@ QString Solid::DeviceInterface::typeDescription(Type type) } Solid::DeviceInterfacePrivate::DeviceInterfacePrivate() - : m_devicePrivate(0) + : m_devicePrivate(nullptr) { } diff --git a/3rdparty/solid-lite/devicemanager.cpp b/3rdparty/solid-lite/devicemanager.cpp index 457a4203e..b16fdb5a4 100644 --- a/3rdparty/solid-lite/devicemanager.cpp +++ b/3rdparty/solid-lite/devicemanager.cpp @@ -56,7 +56,7 @@ Solid::DeviceManagerPrivate::~DeviceManagerPrivate() { QList backends = managerBackends(); for (QObject *backend: backends) { - disconnect(backend, 0, this, 0); + disconnect(backend, nullptr, this, nullptr); } for (QtPointer dev: m_devicesMap) { @@ -76,7 +76,7 @@ QList Solid::Device::allDevices() for (QObject *backendObj: backends) { Ifaces::DeviceManager *backend = qobject_cast(backendObj); - if (backend == 0) continue; + if (backend == nullptr) continue; QStringList udis = backend->allDevices(); @@ -112,7 +112,7 @@ QList Solid::Device::listFromType(const DeviceInterface::Type &ty for (QObject *backendObj: backends) { Ifaces::DeviceManager *backend = qobject_cast(backendObj); - if (backend == 0) continue; + if (backend == nullptr) continue; if (!backend->supportedInterfaces().contains(type)) continue; QStringList udis = backend->devicesFromQuery(parentUdi, type); @@ -135,7 +135,7 @@ QList Solid::Device::listFromQuery(const Predicate &predicate, for (QObject *backendObj: backends) { Ifaces::DeviceManager *backend = qobject_cast(backendObj); - if (backend == 0) continue; + if (backend == nullptr) continue; QSet udis; if (predicate.isValid()) { @@ -186,9 +186,9 @@ void Solid::DeviceManagerPrivate::_k_deviceAdded(const QString &udi) // Ok, this one was requested somewhere was invalid // and now becomes magically valid! - if (dev && dev->backendObject() == 0) { + if (dev && dev->backendObject() == nullptr) { dev->setBackendObject(createBackendObject(udi)); - Q_ASSERT(dev->backendObject()!=0); + Q_ASSERT(dev->backendObject()!=nullptr); } } @@ -204,9 +204,9 @@ void Solid::DeviceManagerPrivate::_k_deviceRemoved(const QString &udi) // and now becomes magically invalid! if (dev) { - Q_ASSERT(dev->backendObject()!=0); - dev->setBackendObject(0); - Q_ASSERT(dev->backendObject()==0); + Q_ASSERT(dev->backendObject()!=nullptr); + dev->setBackendObject(nullptr); + Q_ASSERT(dev->backendObject()==nullptr); } } @@ -252,22 +252,22 @@ Solid::Ifaces::Device *Solid::DeviceManagerPrivate::createBackendObject(const QS for (QObject *backendObj: backends) { Ifaces::DeviceManager *backend = qobject_cast(backendObj); - if (backend == 0) continue; + if (backend == nullptr) continue; if (!udi.startsWith(backend->udiPrefix())) continue; - Ifaces::Device *iface = 0; + Ifaces::Device *iface = nullptr; QObject *object = backend->createDevice(udi); iface = qobject_cast(object); - if (iface==0) { + if (iface==nullptr) { delete object; } return iface; } - return 0; + return nullptr; } Solid::DeviceManagerStorage::DeviceManagerStorage() diff --git a/3rdparty/solid-lite/ifaces/device.h b/3rdparty/solid-lite/ifaces/device.h index 280752dd4..3383cf322 100644 --- a/3rdparty/solid-lite/ifaces/device.h +++ b/3rdparty/solid-lite/ifaces/device.h @@ -51,7 +51,7 @@ namespace Ifaces /** * Constructs a Device */ - Device(QObject *parent = 0); + Device(QObject *parent = nullptr); /** * Destruct the Device object */ diff --git a/3rdparty/solid-lite/ifaces/devicemanager.h b/3rdparty/solid-lite/ifaces/devicemanager.h index 3fc8f39e8..ae40199b0 100644 --- a/3rdparty/solid-lite/ifaces/devicemanager.h +++ b/3rdparty/solid-lite/ifaces/devicemanager.h @@ -47,7 +47,7 @@ namespace Ifaces /** * Constructs a DeviceManager */ - DeviceManager(QObject *parent = 0); + DeviceManager(QObject *parent = nullptr); /** * Destructs a DeviceManager object */ diff --git a/3rdparty/solid-lite/managerbase.cpp b/3rdparty/solid-lite/managerbase.cpp index 18fe7d6dd..001af3821 100644 --- a/3rdparty/solid-lite/managerbase.cpp +++ b/3rdparty/solid-lite/managerbase.cpp @@ -82,13 +82,13 @@ void Solid::ManagerBasePrivate::loadBackends() bool solidHalLegacyEnabled = QString::fromLocal8Bit(qgetenv("SOLID_HAL_LEGACY")).toInt()==1; if (solidHalLegacyEnabled) { - m_backends << new Solid::Backends::Hal::HalManager(0); + m_backends << new Solid::Backends::Hal::HalManager(nullptr); } else { # if defined(UDEV_FOUND) - m_backends << new Solid::Backends::UDev::UDevManager(0); + m_backends << new Solid::Backends::UDev::UDevManager(nullptr); # endif # if defined(WITH_SOLID_UDISKS2) - m_backends << new Solid::Backends::UDisks2::Manager(0) + m_backends << new Solid::Backends::UDisks2::Manager(nullptr) # else m_backends << new Solid::Backends::UDisks::UDisksManager(0) # endif diff --git a/3rdparty/solid-lite/predicate.cpp b/3rdparty/solid-lite/predicate.cpp index 813afd2dc..aeabcefb8 100644 --- a/3rdparty/solid-lite/predicate.cpp +++ b/3rdparty/solid-lite/predicate.cpp @@ -33,7 +33,7 @@ namespace Solid Private() : isValid(false), type(PropertyCheck), compOperator(Predicate::Equals), - operand1(0), operand2(0) {} + operand1(nullptr), operand2(nullptr) {} bool isValid; Type type; @@ -202,7 +202,7 @@ bool Solid::Predicate::matches(const Device &device) const { const DeviceInterface *iface = device.asDeviceInterface(d->ifaceType); - if (iface!=0) + if (iface!=nullptr) { const int index = iface->metaObject()->indexOfProperty(d->property.toLatin1()); QMetaProperty metaProp = iface->metaObject()->property(index); diff --git a/3rdparty/solid-lite/predicateparse.cpp b/3rdparty/solid-lite/predicateparse.cpp index d0fa963ee..c560e037c 100644 --- a/3rdparty/solid-lite/predicateparse.cpp +++ b/3rdparty/solid-lite/predicateparse.cpp @@ -41,7 +41,7 @@ namespace PredicateParse struct ParsingData { ParsingData() - : result(0) + : result(nullptr) {} Solid::Predicate *result; @@ -69,7 +69,7 @@ Solid::Predicate Solid::Predicate::fromString(const QString &predicate) result = Predicate(*data->result); delete data->result; } - s_parsingData->setLocalData(0); + s_parsingData->setLocalData(nullptr); return result; } @@ -83,7 +83,7 @@ void PredicateParse_setResult(void *result) void PredicateParse_errorDetected(const char* s) { qWarning("ERROR from solid predicate parser: %s", s); - s_parsingData->localData()->result = 0; + s_parsingData->localData()->result = nullptr; } void PredicateParse_destroy(void *pred) @@ -147,7 +147,7 @@ void *PredicateParse_newAnd(void *pred1, void *pred2) Solid::Predicate *p2 = (Solid::Predicate *)pred2; if (p1==data->result || p2==data->result) { - data->result = 0; + data->result = nullptr; } *result = *p1 & *p2; @@ -168,7 +168,7 @@ void *PredicateParse_newOr(void *pred1, void *pred2) Solid::Predicate *p2 = (Solid::Predicate *)pred2; if (p1==data->result || p2==data->result) { - data->result = 0; + data->result = nullptr; } *result = *p1 | *p2; diff --git a/3rdparty/solid-lite/storagevolume.cpp b/3rdparty/solid-lite/storagevolume.cpp index a4906e71f..990cf3e7f 100644 --- a/3rdparty/solid-lite/storagevolume.cpp +++ b/3rdparty/solid-lite/storagevolume.cpp @@ -83,7 +83,7 @@ Solid::Device Solid::StorageVolume::encryptedContainer() const Ifaces::StorageVolume *iface = qobject_cast(d->backendObject()); - if (iface!=0) { + if (iface!=nullptr) { return Device(iface->encryptedContainerUdi()); } else { return Device(); diff --git a/context/artistview.cpp b/context/artistview.cpp index ffe55691f..f4df3c2b2 100644 --- a/context/artistview.cpp +++ b/context/artistview.cpp @@ -94,7 +94,7 @@ static QString checkHaveArtist(const QSet &mpdArtists, const QString &a ArtistView::ArtistView(QWidget *parent) : View(parent) - , currentSimilarJob(0) + , currentSimilarJob(nullptr) { engine=ContextEngine::create(this); refreshAction = ActionCollection::get()->createAction("refreshartist", tr("Refresh Artist Information"), Icons::self()->refreshIcon); @@ -295,7 +295,7 @@ void ArtistView::handleSimilarReply() setBio(); } reply->deleteLater(); - currentSimilarJob=0; + currentSimilarJob=nullptr; } } @@ -369,7 +369,7 @@ void ArtistView::abort() engine->cancel(); if (currentSimilarJob) { currentSimilarJob->cancelAndDelete(); - currentSimilarJob=0; + currentSimilarJob=nullptr; } hideSpinner(); } diff --git a/context/contextengine.cpp b/context/contextengine.cpp index 76fc46270..e140cbd6c 100644 --- a/context/contextengine.cpp +++ b/context/contextengine.cpp @@ -33,7 +33,7 @@ ContextEngine * ContextEngine::create(QObject *parent) ContextEngine::ContextEngine(QObject *p) : QObject(p) - , job(0) + , job(nullptr) { } @@ -62,7 +62,7 @@ void ContextEngine::cancel() { if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } } @@ -70,13 +70,13 @@ NetworkJob * ContextEngine::getReply(QObject *obj) { NetworkJob *reply = qobject_cast(obj); if (!reply) { - return 0; + return nullptr; } reply->deleteLater(); if (reply!=job) { - return 0; + return nullptr; } - job=0; + job=nullptr; return reply; } diff --git a/context/contextsettings.h b/context/contextsettings.h index 45edc6f97..3467b2c38 100644 --- a/context/contextsettings.h +++ b/context/contextsettings.h @@ -33,7 +33,7 @@ class OtherSettings; class ContextSettings : public QTabWidget { Q_OBJECT public: - ContextSettings(QWidget *p=0); + ContextSettings(QWidget *p=nullptr); ~ContextSettings() override { } void load(); void save(); diff --git a/context/contextwidget.cpp b/context/contextwidget.cpp index 9d33a357e..48bbcdfcf 100644 --- a/context/contextwidget.cpp +++ b/context/contextwidget.cpp @@ -246,16 +246,16 @@ void ThinSplitter::reset() ContextWidget::ContextWidget(QWidget *parent) : QWidget(parent) , shown(false) - , job(0) + , job(nullptr) , alwaysCollapsed(false) , backdropType(PlayQueueView::BI_Cover) , darkBackground(false) , fadeValue(1.0) , isWide(false) - , stack(0) - , onlineContext(0) - , splitter(0) - , viewSelector(0) + , stack(nullptr) + , onlineContext(nullptr) + , splitter(nullptr) + , viewSelector(nullptr) { QHBoxLayout *layout=new QHBoxLayout(this); mainStack=new QStackedWidget(this); @@ -668,7 +668,7 @@ void ContextWidget::cancel() { if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } } @@ -963,13 +963,13 @@ NetworkJob * ContextWidget::getReply(QObject *obj) { NetworkJob *reply = qobject_cast(obj); if (!reply) { - return 0; + return nullptr; } reply->deleteLater(); if (reply!=job) { - return 0; + return nullptr; } - job=0; + job=nullptr; return reply; } diff --git a/context/contextwidget.h b/context/contextwidget.h index 8f1f9c44e..19ea8a92c 100644 --- a/context/contextwidget.h +++ b/context/contextwidget.h @@ -96,7 +96,7 @@ public: static const QLatin1String constCacheDir; static const QLatin1String constFanArtApiKey; - ContextWidget(QWidget *parent=0); + ContextWidget(QWidget *parent=nullptr); void readConfig(); void saveConfig(); diff --git a/context/songview.cpp b/context/songview.cpp index 8a2bdf716..50341ac87 100644 --- a/context/songview.cpp +++ b/context/songview.cpp @@ -127,13 +127,13 @@ static QString actualFile(const Song &song) SongView::SongView(QWidget *p) : View(p, QStringList() << tr("Lyrics") << tr("Information") << tr("Metadata")) - , scrollTimer(0) + , scrollTimer(nullptr) , songPos(0) , currentProvider(-1) , currentRequest(0) , mode(Mode_Display) - , job(0) - , currentProv(0) + , job(nullptr) + , currentProv(nullptr) , lyricsNeedsUpdating(true) , infoNeedsUpdating(true) , metadataNeedsUpdating(true) @@ -724,12 +724,12 @@ void SongView::abort() { if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } currentProvider=-1; if (currentProv) { currentProv->abort(); - currentProv=0; + currentProv=nullptr; text->setText(QString()); // Set lyrics file anyway - so that editing is enabled! @@ -796,7 +796,7 @@ void SongView::downloadFinished() if (reply) { reply->deleteLater(); if (job==reply) { - job=0; + job=nullptr; if (reply->ok()) { QString file=reply->property("file").toString(); if (!file.isEmpty() && file==currentSong.file) { diff --git a/context/ultimatelyrics.cpp b/context/ultimatelyrics.cpp index b979d304d..bcff4da73 100644 --- a/context/ultimatelyrics.cpp +++ b/context/ultimatelyrics.cpp @@ -126,7 +126,7 @@ UltimateLyricsProvider * UltimateLyrics::providerByName(const QString &name) con return provider; } } - return 0; + return nullptr; } UltimateLyricsProvider * UltimateLyrics::getNext(int &index) @@ -141,7 +141,7 @@ UltimateLyricsProvider * UltimateLyrics::getNext(int &index) } } } - return 0; + return nullptr; } void UltimateLyrics::load() diff --git a/context/view.cpp b/context/view.cpp index aeee08f90..1f76f4a3a 100644 --- a/context/view.cpp +++ b/context/view.cpp @@ -90,9 +90,9 @@ static TextBrowser * createView(QWidget *parent) View::View(QWidget *parent, const QStringList &views) : QWidget(parent) , needToUpdate(false) - , spinner(0) - , selector(0) - , stack(0) + , spinner(nullptr) + , selector(nullptr) + , stack(nullptr) { QVBoxLayout *layout=new QVBoxLayout(this); header=new QLabel(this); diff --git a/context/wikipediasettings.cpp b/context/wikipediasettings.cpp index 6ab0b1d2d..6fe8288ae 100644 --- a/context/wikipediasettings.cpp +++ b/context/wikipediasettings.cpp @@ -46,7 +46,7 @@ static QString localeFile() } WikipediaLoader::WikipediaLoader() - : QObject(0) + : QObject(nullptr) { thread=new Thread(metaObject()->className()); moveToThread(thread); @@ -83,9 +83,9 @@ void WikipediaLoader::load(const QByteArray &data) WikipediaSettings::WikipediaSettings(QWidget *p) : ToggleList(p) , state(Initial) - , job(0) - , spinner(0) - , loader(0) + , job(nullptr) + , spinner(nullptr) + , loader(nullptr) { label->setText(tr("Choose the wikipedia languages you want to use when searching for artist and album information.")); reload=new Action(tr("Reload"), this); @@ -151,7 +151,7 @@ void WikipediaSettings::cancel() if (job) { disconnect(job, SIGNAL(finished()), this, SLOT(parseLangs())); job->deleteLater(); - job=0; + job=nullptr; } } @@ -189,7 +189,7 @@ void WikipediaSettings::parseLangs() if (reply!=job) { return; } - job=0; + job=nullptr; QByteArray data=reply->readAll(); parseLangs(data); QFile f(localeFile()); diff --git a/db/librarydb.cpp b/db/librarydb.cpp index 035b24362..18234fbfb 100644 --- a/db/librarydb.cpp +++ b/db/librarydb.cpp @@ -498,8 +498,8 @@ LibraryDb::LibraryDb(QObject *p, const QString &name) , dbName(name) , currentVersion(0) , newVersion(0) - , db(0) - , insertSongQuery(0) + , db(nullptr) + , insertSongQuery(nullptr) { DBUG; } @@ -572,7 +572,7 @@ bool LibraryDb::init(const QString &dbFile) DBUG << (void *)db; if (!db->open()) { delete db; - db=0; + db=nullptr; DBUG << "Failed to open"; return false; } @@ -1012,7 +1012,7 @@ LibraryDb::Album LibraryDb::getRandomAlbum(const QString &genre, const QString & } else if (!genreFilter.isEmpty()) { query.addWhere("genre", genreFilter); } - if (yearFilter>0) { + if (yearFilter>nullptr) { query.addWhere("year", yearFilter); } query.exec(); @@ -1284,15 +1284,15 @@ Song LibraryDb::getSong(const QSqlQuery &query) void LibraryDb::reset() { - bool removeDb=0!=db; + bool removeDb=nullptr!=db; delete insertSongQuery; if (db) { db->close(); } delete db; - insertSongQuery=0; - db=0; + insertSongQuery=nullptr; + db=nullptr; if (removeDb) { QSqlDatabase::removeDatabase(dbName); } diff --git a/db/mpdlibrarydb.cpp b/db/mpdlibrarydb.cpp index cfaca9286..3777c481d 100644 --- a/db/mpdlibrarydb.cpp +++ b/db/mpdlibrarydb.cpp @@ -67,9 +67,9 @@ void MpdLibraryDb::removeUnusedDbs() MpdLibraryDb::MpdLibraryDb(QObject *p) : LibraryDb(p, "MPD") , loading(false) - , coverQuery(0) - , albumIdOnlyCoverQuery(0) - , artistImageQuery(0) + , coverQuery(nullptr) + , albumIdOnlyCoverQuery(nullptr) + , artistImageQuery(nullptr) { connect(MPDConnection::self(), SIGNAL(updatingLibrary(time_t)), this, SLOT(updateStarted(time_t))); connect(MPDConnection::self(), SIGNAL(librarySongs(QList*)), this, SLOT(insertSongs(QList*))); @@ -88,7 +88,7 @@ Song MpdLibraryDb::getCoverSong(const QString &artistId, const QString &albumId) { DBUG << artistId << albumId; if (0!=currentVersion && db) { - QSqlQuery *query=0; + QSqlQuery *query=nullptr; if (albumId.isEmpty()) { if (!artistImageQuery) { artistImageQuery=new QSqlQuery(*db); @@ -137,9 +137,9 @@ void MpdLibraryDb::reset() delete coverQuery; delete artistImageQuery; delete albumIdOnlyCoverQuery; - coverQuery=0; - artistImageQuery=0; - albumIdOnlyCoverQuery=0; + coverQuery=nullptr; + artistImageQuery=nullptr; + albumIdOnlyCoverQuery=nullptr; LibraryDb::reset(); } diff --git a/db/mpdlibrarydb.h b/db/mpdlibrarydb.h index 643a11cd7..cdcfcfb47 100644 --- a/db/mpdlibrarydb.h +++ b/db/mpdlibrarydb.h @@ -45,7 +45,7 @@ class MpdLibraryDb : public LibraryDb public: static void removeUnusedDbs(); - MpdLibraryDb(QObject *p=0); + MpdLibraryDb(QObject *p=nullptr); ~MpdLibraryDb() override; Song getCoverSong(const QString &artistId, const QString &albumId=QString()); diff --git a/db/onlinedb.cpp b/db/onlinedb.cpp index 4d1d2f52a..f01252d49 100644 --- a/db/onlinedb.cpp +++ b/db/onlinedb.cpp @@ -29,8 +29,8 @@ static const QString subDir("online"); OnlineDb::OnlineDb(const QString &serviceName, QObject *p) : LibraryDb(p, serviceName) - , insertCoverQuery(0) - , getCoverQuery(0) + , insertCoverQuery(nullptr) + , getCoverQuery(nullptr) { } @@ -81,8 +81,8 @@ void OnlineDb::reset() { delete insertCoverQuery; delete getCoverQuery; - insertCoverQuery=0; - getCoverQuery=0; + insertCoverQuery=nullptr; + getCoverQuery=nullptr; LibraryDb::reset(); } diff --git a/db/onlinedb.h b/db/onlinedb.h index 72a81e8e1..631293dd4 100644 --- a/db/onlinedb.h +++ b/db/onlinedb.h @@ -31,7 +31,7 @@ class OnlineDb : public LibraryDb Q_OBJECT public: - OnlineDb(const QString &serviceName, QObject *p=0); + OnlineDb(const QString &serviceName, QObject *p=nullptr); ~OnlineDb() override; bool init(const QString &dbFile) override; diff --git a/dbus/gnomemediakeys.cpp b/dbus/gnomemediakeys.cpp index e46ba75f2..55503dbc7 100644 --- a/dbus/gnomemediakeys.cpp +++ b/dbus/gnomemediakeys.cpp @@ -38,9 +38,9 @@ static const char * constMediaKeysPath = "/org/gnome/SettingsDaemon/MediaKeys"; GnomeMediaKeys::GnomeMediaKeys(QObject *p) : MultiMediaKeysInterface(p) - , daemon(0) - , mk(0) - , watcher(0) + , daemon(nullptr) + , mk(nullptr) + , watcher(nullptr) { } @@ -63,7 +63,7 @@ void GnomeMediaKeys::deactivate() disconnectDaemon(); if (watcher) { watcher->deleteLater(); - watcher=0; + watcher=nullptr; } } } @@ -91,7 +91,7 @@ void GnomeMediaKeys::releaseKeys() mk->ReleaseMediaPlayerKeys(QCoreApplication::applicationName()); disconnect(mk, SIGNAL(MediaPlayerKeyPressed(QString,QString)), this, SLOT(keyPressed(QString,QString))); mk->deleteLater(); - mk=0; + mk=nullptr; } } @@ -125,7 +125,7 @@ void GnomeMediaKeys::disconnectDaemon() if (daemon) { disconnect(daemon, SIGNAL(PluginActivated(QString)), this, SLOT(pluginActivated(QString))); daemon->deleteLater(); - daemon=0; + daemon=nullptr; } } diff --git a/devices/actiondialog.cpp b/devices/actiondialog.cpp index 81707e4b3..804529c55 100644 --- a/devices/actiondialog.cpp +++ b/devices/actiondialog.cpp @@ -77,8 +77,8 @@ ActionDialog::ActionDialog(QWidget *parent) : Dialog(parent) , spaceRequired(0) , mpdConfigured(false) - , currentDev(0) - , songDialog(0) + , currentDev(nullptr) + , songDialog(nullptr) { iCount++; setButtons(Ok|Cancel); @@ -179,7 +179,7 @@ void ActionDialog::controlInfoLabel() void ActionDialog::calcFileSize() { - Device *dev=0; + Device *dev=nullptr; int toCalc=qMin(50, songsToCalcSize.size()); for (int i=0; isetText(formatSong(currentSong, false)); } else if (Remove==mode && dirsToClean.count()) { - Device *dev=sourceUdi.isEmpty() ? 0 : DevicesModel::self()->device(sourceUdi); + Device *dev=sourceUdi.isEmpty() ? nullptr : DevicesModel::self()->device(sourceUdi); if (sourceUdi.isEmpty() || dev) { progressLabel->setText(tr("Clearing unused folders")); if (dev) { diff --git a/devices/device.cpp b/devices/device.cpp index a8cb142d6..82428025b 100644 --- a/devices/device.cpp +++ b/devices/device.cpp @@ -187,7 +187,7 @@ Device * Device::create(MusicLibraryModel *m, const QString &udi) if( ssa && (!device.parent().as() || Solid::StorageDrive::Usb!=device.parent().as()->bus()) && (!device.as() || Solid::StorageDrive::Usb!=device.as()->bus()) ) { - return 0; + return nullptr; } //HACK: ignore apple stuff until we have common MediaDeviceFactory. @@ -198,7 +198,7 @@ Device * Device::create(MusicLibraryModel *m, const QString &udi) // } } } - return 0; + return nullptr; } bool Device::fixVariousArtists(const QString &file, Song &song, bool applyFix) @@ -280,7 +280,7 @@ QTemporaryFile * Device::copySongToTemp(Song &song) if (!QFile::copy(song.file, temp->fileName())) { temp->remove(); delete temp; - temp=0; + temp=nullptr; } } return temp; @@ -303,7 +303,7 @@ Device::Device(MusicLibraryModel *m, Solid::Device &dev, bool albumArtistSupport , configured(false) , solidDev(dev) , deviceId(dev.udi()) - , update(0) + , update(nullptr) , needToFixVa(false) , jobAbortRequested(false) , transcoding(false) @@ -317,7 +317,7 @@ Device::Device(MusicLibraryModel *m, const QString &name, const QString &id) : MusicLibraryItemRoot(name) , configured(false) , deviceId(id) - , update(0) + , update(nullptr) , needToFixVa(false) , jobAbortRequested(false) , transcoding(false) @@ -369,7 +369,7 @@ void Device::applyUpdate() } } delete update; - update=0; + update=nullptr; } QModelIndex Device::index() const diff --git a/devices/device.h b/devices/device.h index 67b4ed4b0..a88fed41a 100644 --- a/devices/device.h +++ b/devices/device.h @@ -136,7 +136,7 @@ public: virtual void saveCache(); const QString & id() const override { return deviceId; } void applyUpdate(); - bool haveUpdate() const { return 0!=update; } + bool haveUpdate() const { return nullptr!=update; } int newRows() const { return update ? update->childCount() : 0; } const DeviceOptions & options() const { return opts; } void setOptions(const DeviceOptions &o) { opts=o; saveOptions(); } diff --git a/devices/devicepropertieswidget.cpp b/devices/devicepropertieswidget.cpp index 1ac6b6b02..468e287fa 100644 --- a/devices/devicepropertieswidget.cpp +++ b/devices/devicepropertieswidget.cpp @@ -79,7 +79,7 @@ class CoverNameValidator : public QValidator DevicePropertiesWidget::DevicePropertiesWidget(QWidget *parent) : QWidget(parent) - , schemeDlg(0) + , schemeDlg(nullptr) , noCoverText(tr("Don't copy covers")) , embedCoverText(tr("Embed cover within each file")) , modified(false) @@ -138,12 +138,12 @@ void DevicePropertiesWidget::update(const QString &path, const DeviceOptions &op replaceSpaces->setChecked(opts.replaceSpaces); } else { REMOVE(filenamesGroupBox) - filenameScheme=0; - vfatSafe=0; - asciiOnly=0; - ignoreThe=0; - replaceSpaces=0; - configFilename=0; + filenameScheme=nullptr; + vfatSafe=nullptr; + asciiOnly=nullptr; + ignoreThe=nullptr; + replaceSpaces=nullptr; + configFilename=nullptr; } origOpts=opts; diff --git a/devices/devicespage.cpp b/devices/devicespage.cpp index df8226ef0..90526b672 100644 --- a/devices/devicespage.cpp +++ b/devices/devicespage.cpp @@ -142,11 +142,11 @@ Device * DevicesPage::activeFsDevice() const const QModelIndexList selected = view->selectedIndexes(false); // Dont need sorted selection here... if (selected.isEmpty()) { - return 0; + return nullptr; } QString udi; - Device *activeDev=0; + Device *activeDev=nullptr; for (const QModelIndex &idx: selected) { QModelIndex index = proxy.mapToSource(idx); MusicLibraryItem *item=static_cast(index.internalPointer()); @@ -160,10 +160,10 @@ Device * DevicesPage::activeFsDevice() const if (item && MusicLibraryItem::Type_Root==item->itemType()) { Device *dev=static_cast(item); if (Device::Ums!=dev->devType() && Device::RemoteFs!=dev->devType()) { - return 0; + return nullptr; } if (activeDev) { - return 0; + return nullptr; } activeDev=dev; } diff --git a/devices/filejob.cpp b/devices/filejob.cpp index 2ba7c82fb..613e01826 100644 --- a/devices/filejob.cpp +++ b/devices/filejob.cpp @@ -36,7 +36,7 @@ GLOBAL_STATIC(FileThread, instance) FileThread::FileThread() - : thread(0) + : thread(nullptr) { } @@ -58,7 +58,7 @@ void FileThread::stop() { if (thread) { thread->stop(); - thread=0; + thread=nullptr; } } diff --git a/devices/filejob.h b/devices/filejob.h index fe330025a..76654218d 100644 --- a/devices/filejob.h +++ b/devices/filejob.h @@ -99,7 +99,7 @@ public: , deviceOpts(d) , copyOpts(co) , song(s) - , temp(0) + , temp(nullptr) , copiedCover(false) { } ~CopyJob() override; diff --git a/devices/fsdevice.cpp b/devices/fsdevice.cpp index b0be56c55..d8c0e87d8 100644 --- a/devices/fsdevice.cpp +++ b/devices/fsdevice.cpp @@ -60,7 +60,7 @@ const QLatin1String FsDevice::constDefCoverFileName("cover.jpg"); const QLatin1String FsDevice::constAutoScanKey("auto_scan"); // Cantata extension! MusicScanner::MusicScanner() - : QObject(0) + : QObject(nullptr) , stopRequested(false) , count(0) { @@ -123,7 +123,7 @@ void MusicScanner::stop() { stopRequested=true; thread->stop(); - thread=0; + thread=nullptr; } void MusicScanner::scanFolder(MusicLibraryItemRoot *library, const QString &topLevel, const QString &f, @@ -135,8 +135,8 @@ void MusicScanner::scanFolder(MusicLibraryItemRoot *library, const QString &topL if (level<4) { QDir d(f); QFileInfoList entries=d.entryInfoList(QDir::Files|QDir::NoSymLinks|QDir::Dirs|QDir::NoDotAndDotDot); - MusicLibraryItemArtist *artistItem = 0; - MusicLibraryItemAlbum *albumItem = 0; + MusicLibraryItemArtist *artistItem = nullptr; + MusicLibraryItemAlbum *albumItem = nullptr; for (const QFileInfo &info: entries) { if (stopRequested) { return; @@ -331,7 +331,7 @@ FsDevice::FsDevice(MusicLibraryModel *m, Solid::Device &dev) , state(Idle) , scanned(false) , cacheProgress(-1) - , scanner(0) + , scanner(nullptr) { } @@ -340,7 +340,7 @@ FsDevice::FsDevice(MusicLibraryModel *m, const QString &name, const QString &id) , state(Idle) , scanned(false) , cacheProgress(-1) - , scanner(0) + , scanner(nullptr) { } @@ -364,7 +364,7 @@ void FsDevice::rescan(bool full) void FsDevice::stop() { - if (0!=scanner) { + if (nullptr!=scanner) { stopScanner(); } } @@ -692,7 +692,7 @@ void FsDevice::stopScanner() disconnect(scanner, SIGNAL(savingCache(int)), this, SLOT(savingCache(int))); disconnect(scanner, SIGNAL(readingCache(int)), this, SLOT(readingCache(int))); scanner->deleteLater(); - scanner=0; + scanner=nullptr; } void FsDevice::clear() const diff --git a/devices/mountpoints.cpp b/devices/mountpoints.cpp index 72edae26c..4dd1f412e 100644 --- a/devices/mountpoints.cpp +++ b/devices/mountpoints.cpp @@ -39,7 +39,7 @@ MountPoints::MountPoints() updateMountPoints(); } else if (mounts) { mounts->deleteLater(); - mounts=0; + mounts=nullptr; } } diff --git a/devices/synccollectionwidget.cpp b/devices/synccollectionwidget.cpp index a91eec109..bb6f39d91 100644 --- a/devices/synccollectionwidget.cpp +++ b/devices/synccollectionwidget.cpp @@ -36,7 +36,7 @@ SyncCollectionWidget::SyncCollectionWidget(QWidget *parent, const QString &title) : QWidget(parent) , performedSearch(false) - , searchTimer(0) + , searchTimer(nullptr) { setupUi(this); titleLabel->setText(title); diff --git a/devices/syncdialog.cpp b/devices/syncdialog.cpp index aef7dc094..9d8555a34 100644 --- a/devices/syncdialog.cpp +++ b/devices/syncdialog.cpp @@ -99,7 +99,7 @@ int SyncDialog::instanceCount() SyncDialog::SyncDialog(QWidget *parent) : Dialog(parent, "SyncDialog", QSize(680, 680)) , state(State_Lists) - , currentDev(0) + , currentDev(nullptr) { iCount++; @@ -260,12 +260,12 @@ Device * SyncDialog::getDevice() Device *dev=DevicesModel::self()->device(devUdi); if (!dev) { MessageBox::error(isVisible() ? this : parentWidget(), tr("Device has been removed!")); - return 0; + return nullptr; } if (currentDev && dev!=currentDev) { MessageBox::error(isVisible() ? this : parentWidget(), tr("Device has been changed?")); - return 0; + return nullptr; } if (dev->isIdle()) { @@ -273,5 +273,5 @@ Device * SyncDialog::getDevice() } MessageBox::error(isVisible() ? this : parentWidget(), tr("Device is busy?")); - return 0; + return nullptr; } diff --git a/devices/transcodingjob.cpp b/devices/transcodingjob.cpp index 64b27d84c..e29c3373a 100644 --- a/devices/transcodingjob.cpp +++ b/devices/transcodingjob.cpp @@ -28,7 +28,7 @@ TranscodingJob::TranscodingJob(const Encoders::Encoder &enc, int val, const QStr : CopyJob(src, dest, d, co, s) , encoder(enc) , value(val) - , process(0) + , process(nullptr) , duration(-1) { } @@ -64,7 +64,7 @@ void TranscodingJob::stop() if (process) { process->close(); process->deleteLater(); - process=0; + process=nullptr; emit result(Device::Cancelled); } } diff --git a/devices/valueslider.h b/devices/valueslider.h index 8791861df..28d95eb31 100644 --- a/devices/valueslider.h +++ b/devices/valueslider.h @@ -31,7 +31,7 @@ class ValueSlider : public QWidget { Q_OBJECT public: - explicit ValueSlider(QWidget *parent=0); + explicit ValueSlider(QWidget *parent=nullptr); void setValues(const Encoders::Encoder &enc); void setValue(int value); diff --git a/gui/avahidiscovery.cpp b/gui/avahidiscovery.cpp index 94df4f998..e3255791d 100644 --- a/gui/avahidiscovery.cpp +++ b/gui/avahidiscovery.cpp @@ -122,14 +122,14 @@ AvahiDiscovery::AvahiDiscovery() /* create avahi client */ int error; - m_client = avahi_client_new(getAvahiPoll(), AVAHI_CLIENT_IGNORE_USER_CONFIG, clientCallback, NULL, &error); + m_client = avahi_client_new(getAvahiPoll(), AVAHI_CLIENT_IGNORE_USER_CONFIG, clientCallback, nullptr, &error); if (!m_client) { DBUG << "Failed to create client: " << avahi_strerror(error); return; } /* create avahi browser */ - m_browser = avahi_service_browser_new(m_client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, "_mpd._tcp", NULL, AVAHI_LOOKUP_USE_MULTICAST, browseCallback, m_client); + m_browser = avahi_service_browser_new(m_client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, "_mpd._tcp", nullptr, AVAHI_LOOKUP_USE_MULTICAST, browseCallback, m_client); if (!m_browser) { DBUG << "Failed to create service browser: " << avahi_strerror(avahi_client_errno(m_client)); return; diff --git a/gui/avahipoll.cpp b/gui/avahipoll.cpp index 0b69a3968..61ee24d0c 100644 --- a/gui/avahipoll.cpp +++ b/gui/avahipoll.cpp @@ -82,7 +82,7 @@ AvahiTimeout::AvahiTimeout(const struct timeval *tv, AvahiTimeoutCallback cb, vo void AvahiTimeout::updateTimeout(const struct timeval *tv) { - if (0==tv) { + if (nullptr==tv) { timer.stop(); return; } @@ -102,7 +102,7 @@ void AvahiTimeout::timeout() } AvahiWatch::AvahiWatch(int f, AvahiWatchEvent ev, AvahiWatchCallback cb, void *ud) - : notifier(0) + : notifier(nullptr) , callback(cb) , event(ev) , prevEvent(static_cast(0)) diff --git a/gui/coverdialog.cpp b/gui/coverdialog.cpp index bfda54e87..48ee6efc4 100644 --- a/gui/coverdialog.cpp +++ b/gui/coverdialog.cpp @@ -327,17 +327,17 @@ void CoverPreview::wheelEvent(QWheelEvent *event) CoverDialog::CoverDialog(QWidget *parent) : Dialog(parent, "CoverDialog") - , existing(0) + , existing(nullptr) , currentQueryProviders(0) - , preview(0) + , preview(nullptr) , saving(false) , isArtist(false) - , spinner(0) - , msgOverlay(0) + , spinner(nullptr) + , msgOverlay(nullptr) , page(0) - , menu(0) - , showAction(0) - , removeAction(0) + , menu(nullptr) + , showAction(nullptr) + , removeAction(nullptr) { Configuration cfg(objectName()); enabledProviders=cfg.get("enabledProviders", (int)Prov_All); @@ -542,7 +542,7 @@ void CoverDialog::downloadJobFinished() QImage img=QImage::fromData(data, format); if (!img.isNull()) { bool isLarge=reply->property(constThumbProperty).toString().isEmpty(); - QTemporaryFile *temp=0; + QTemporaryFile *temp=nullptr; if (isLarge || (reply->property(constThumbProperty).toString()==reply->property(constLargeProperty).toString())) { temp=new QTemporaryFile(QDir::tempPath()+"/cantata_XXXXXX."+(format ? QString(QLatin1String(format)).toLower() : "png")); @@ -563,7 +563,7 @@ void CoverDialog::downloadJobFinished() tempFiles.prepend(temp); } else { delete temp; - temp=0; + temp=nullptr; } } if (isLarge) { @@ -577,7 +577,7 @@ void CoverDialog::downloadJobFinished() } } } else { - CoverItem *item=0; + CoverItem *item=nullptr; img=cropImage(img, isArtist); if (constLastFmHost==host) { item=new LastFmCover(reply->property(constLargeProperty).toString(), url, img, list); @@ -902,7 +902,7 @@ NetworkJob * CoverDialog::downloadImage(const QString &url, DownloadType dlType) DBUG << url << dlType; if (DL_Thumbnail==dlType) { if (currentUrls.contains(url)) { - return 0; + return nullptr; } currentUrls.insert(url); } else { @@ -918,7 +918,7 @@ NetworkJob * CoverDialog::downloadImage(const QString &url, DownloadType dlType) accept(); } } - return 0; + return nullptr; } tmp->remove(); delete tmp; diff --git a/gui/covers.cpp b/gui/covers.cpp index 397ed3df5..838130c4b 100644 --- a/gui/covers.cpp +++ b/gui/covers.cpp @@ -87,7 +87,7 @@ const QLatin1String Covers::constArtistImage("artist"); const QLatin1String Covers::constComposerImage("composer"); const QString Covers::constCoverInTagPrefix=QLatin1String("{tag}"); -static const char * constExtensions[]={".jpg", ".png", 0}; +static const char * constExtensions[]={".jpg", ".png", nullptr}; static bool saveInMpdDir=true; static bool fetchCovers=true; static QString constNoCover=QLatin1String("{nocover}"); @@ -338,7 +338,7 @@ bool Covers::isPng(const QByteArray &data) const char * Covers::imageFormat(const QByteArray &data) { - return isJpg(data) ? "JPG" : (isPng(data) ? "PNG" : 0); + return isJpg(data) ? "JPG" : (isPng(data) ? "PNG" : nullptr); } QString Covers::encodeName(QString name) @@ -556,7 +556,7 @@ const QStringList & Covers::standardNames() } CoverDownloader::CoverDownloader() - : manager(0) + : manager(nullptr) { thread=new Thread(metaObject()->className()); moveToThread(thread); @@ -954,7 +954,7 @@ NetworkAccessManager * CoverDownloader::network() } CoverLocator::CoverLocator() - : timer(0) + : timer(nullptr) { thread=new Thread(metaObject()->className()); moveToThread(thread); @@ -1013,7 +1013,7 @@ void CoverLocator::locate() } CoverLoader::CoverLoader() - : timer(0) + : timer(nullptr) { thread=new Thread(metaObject()->className()); moveToThread(thread); @@ -1070,9 +1070,9 @@ void CoverLoader::load() } Covers::Covers() - : downloader(0) - , locator(0) - , loader(0) + : downloader(nullptr) + , locator(nullptr) + , loader(nullptr) { devicePixelRatio=qApp->devicePixelRatio(); cache.setMaxCost(10*1024*1024); @@ -1091,17 +1091,17 @@ void Covers::stop() disconnect(downloader, SIGNAL(composerImage(Song,QImage,QString)), this, SLOT(composerImageDownloaded(Song,QImage,QString))); disconnect(downloader, SIGNAL(cover(Song,QImage,QString)), this, SLOT(coverDownloaded(Song,QImage,QString))); downloader->stop(); - downloader=0; + downloader=nullptr; } if (locator) { disconnect(locator, SIGNAL(located(QList)), this, SLOT(located(QList))); locator->stop(); - locator=0; + locator=nullptr; } if (loader) { disconnect(loader, SIGNAL(loaded(QList)), this, SLOT(loaded(QList))); loader->stop(); - loader=0; + loader=nullptr; } #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND cleanCdda(); @@ -1125,7 +1125,7 @@ void Covers::clearScaleCache() QPixmap * Covers::getScaledCover(const Song &song, int size) { if (size<4 || song.isUnknownAlbum()) { - return 0; + return nullptr; } // DBUG_CLASS("Covers") << song.albumArtist() << song.album << song.mbAlbumId << size; QString key=cacheKey(song, size); @@ -1144,13 +1144,13 @@ QPixmap * Covers::getScaledCover(const Song &song, int size) } cacheSizes.insert(size); } - return pix && pix->width()>1 ? pix : 0; + return pix && pix->width()>1 ? pix : nullptr; } QPixmap * Covers::saveScaledCover(const QImage &img, const Song &song, int size) { if (size<4) { - return 0; + return nullptr; } if (!isOnlineServiceImage(song)) { @@ -1198,7 +1198,7 @@ QPixmap * Covers::get(const Song &song, int size, bool urgent) { VERBOSE_DBUG_CLASS("Covers") << song.albumArtist() << song.album << song.mbAlbumId() << song.composer() << song.isArtistImageRequest() << song.isComposerImageRequest() << size << urgent; QString key; - QPixmap *pix=0; + QPixmap *pix=nullptr; if (0==size) { size=22; } diff --git a/gui/currentcover.cpp b/gui/currentcover.cpp index 44ce9bf79..d054df8c1 100644 --- a/gui/currentcover.cpp +++ b/gui/currentcover.cpp @@ -116,10 +116,10 @@ QString CurrentCover::findIcon(const QStringList &names) GLOBAL_STATIC(CurrentCover, instance) CurrentCover::CurrentCover() - : QObject(0) + : QObject(nullptr) , enabled(false) , valid(false) - , timer(0) + , timer(nullptr) { img=stdImage(false); coverFileName=noCoverFileName; diff --git a/gui/customactions.cpp b/gui/customactions.cpp index 9267d2392..196879621 100644 --- a/gui/customactions.cpp +++ b/gui/customactions.cpp @@ -52,10 +52,10 @@ bool CustomActions::Command::operator<(const Command &o) const } CustomActions::CustomActions() - : Action(tr("Custom Actions"), 0) - , mainWindow(0) + : Action(tr("Custom Actions"), nullptr) + , mainWindow(nullptr) { - QMenu *m=new QMenu(0); + QMenu *m=new QMenu(nullptr); setMenu(m); Configuration cfg(metaObject()->className()); int count=cfg.get("count", 0); diff --git a/gui/customactions.h b/gui/customactions.h index 771812ef9..416f044e6 100644 --- a/gui/customactions.h +++ b/gui/customactions.h @@ -34,7 +34,7 @@ class CustomActions : public Action public: struct Command { - Command(const QString &n=QString(), const QString &c=QString(), Action *a=0) : name(n.trimmed()), cmd(c.trimmed()), act(a) { } + Command(const QString &n=QString(), const QString &c=QString(), Action *a=nullptr) : name(n.trimmed()), cmd(c.trimmed()), act(a) { } bool operator<(const Command &o) const; bool operator==(const Command &o) const { return name==o.name && cmd==o.cmd; } bool operator!=(const Command &o) const { return !(*this==o); } diff --git a/gui/customactionssettings.cpp b/gui/customactionssettings.cpp index 3592c2d45..b40e1c163 100644 --- a/gui/customactionssettings.cpp +++ b/gui/customactionssettings.cpp @@ -80,7 +80,7 @@ static inline void setResizeMode(QHeaderView *hdr, int idx, QHeaderView::ResizeM CustomActionsSettings::CustomActionsSettings(QWidget *parent) : QWidget(parent) - , dlg(0) + , dlg(nullptr) { QGridLayout *layout=new QGridLayout(this); layout->setMargin(0); diff --git a/gui/initialsettingswizard.h b/gui/initialsettingswizard.h index 03aa61325..d420984d5 100644 --- a/gui/initialsettingswizard.h +++ b/gui/initialsettingswizard.h @@ -34,7 +34,7 @@ class InitialSettingsWizard : public QWizard, public Ui::InitialSettingsWizard Q_OBJECT public: - InitialSettingsWizard(QWidget *p=0); + InitialSettingsWizard(QWidget *p=nullptr); ~InitialSettingsWizard() override; MPDConnectionDetails getDetails(); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d4f09d25f..b26a1246c 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -140,16 +140,16 @@ MainWindow::MainWindow(QWidget *parent) #ifdef ENABLE_HTTP_STREAM_PLAYBACK , httpStream(new HttpStream(this)) #endif - , currentPage(0) + , currentPage(nullptr) #ifdef QT_QTDBUS_FOUND - , mpris(0) + , mpris(nullptr) #endif - , statusTimer(0) - , playQueueSearchTimer(0) + , statusTimer(nullptr) + , playQueueSearchTimer(nullptr) #if !defined Q_OS_WIN && !defined Q_OS_MAC - , mpdAccessibilityTimer(0) + , mpdAccessibilityTimer(nullptr) #endif - , contextTimer(0) + , contextTimer(nullptr) , contextSwitchTime(0) , connectedState(CS_Init) , stopAfterCurrent(false) @@ -294,7 +294,7 @@ void MainWindow::init() addPlayQueueToStoredPlaylistAction = new Action(Icons::self()->playlistListIcon, tr("Add To Stored Playlist"), this); #ifdef ENABLE_DEVICES_SUPPORT copyToDeviceAction = new Action(StdActions::self()->copyToDeviceAction->icon(), Utils::strippedText(StdActions::self()->copyToDeviceAction->text()), this); - copyToDeviceAction->setMenu(DevicesModel::self()->menu()->duplicate(0)); + copyToDeviceAction->setMenu(DevicesModel::self()->menu()->duplicate(nullptr)); #endif cropPlayQueueAction = ActionCollection::get()->createAction("cropplaylist", tr("Crop Others")); addStreamToPlayQueueAction = ActionCollection::get()->createAction("addstreamtoplayqueue", tr("Add Stream URL")); @@ -371,7 +371,7 @@ void MainWindow::init() connectionsGroup=new QActionGroup(connectionsAction->menu()); outputsAction->setMenu(new QMenu(this)); outputsAction->setVisible(false); - addPlayQueueToStoredPlaylistAction->setMenu(PlaylistsModel::self()->menu()->duplicate(0)); + addPlayQueueToStoredPlaylistAction->setMenu(PlaylistsModel::self()->menu()->duplicate(nullptr)); playPauseTrackButton->setDefaultAction(StdActions::self()->playPauseTrackAction); stopTrackButton->setDefaultAction(StdActions::self()->stopPlaybackAction); @@ -648,7 +648,7 @@ void MainWindow::init() playQueue->setModel(&playQueueProxyModel); playQueue->addAction(playQueue->removeFromAct()); ratingAction=new Action(tr("Set Rating"), this); - ratingAction->setMenu(new QMenu(0)); + ratingAction->setMenu(new QMenu(nullptr)); for (int i=0; i<((Song::Rating_Max/Song::Rating_Step)+1); ++i) { QString text; if (0==i) { @@ -896,7 +896,7 @@ MainWindow::~MainWindow() ((isHidden() && Settings::SS_ShowMainWindow!=startupState) || (Settings::SS_HideMainWindow==startupState))); } Settings::self()->save(); - disconnect(MPDConnection::self(), 0, 0, 0); + disconnect(MPDConnection::self(), nullptr, nullptr, nullptr); if (Settings::self()->stopOnExit()) { DynamicPlaylists::self()->stop(); } @@ -1390,7 +1390,7 @@ void MainWindow::initMpris() } else if (mpris) { disconnect(mpris, SIGNAL(showMainWindow()), this, SLOT(restoreWindow())); mpris->deleteLater(); - mpris=0; + mpris=nullptr; } CurrentCover::self()->setEnabled(mpris || Settings::self()->showPopups() || 0!=Settings::self()->playQueueBackground() || Settings::self()->showCoverWidget()); #endif @@ -1441,7 +1441,7 @@ void MainWindow::readSettings() if (0==contextSwitchTime && contextTimer) { contextTimer->stop(); contextTimer->deleteLater(); - contextTimer=0; + contextTimer=nullptr; } } MPDConnection::self()->setVolumeFadeDuration(Settings::self()->stopFadeDuration()); @@ -1926,7 +1926,7 @@ void MainWindow::addToNewStoredPlaylist() { bool pq=playQueue->hasFocus(); for(;;) { - QString name = InputDialog::getText(tr("Playlist Name"), tr("Enter a name for the playlist:"), QString(), 0, this); + QString name = InputDialog::getText(tr("Playlist Name"), tr("Enter a name for the playlist:"), QString(), nullptr, this); if (name==MPDConnection::constStreamsPlayListName) { MessageBox::error(this, tr("'%1' is used to store favorite streams, please choose another name.").arg(name)); @@ -2076,7 +2076,7 @@ void MainWindow::currentTabChanged(int index) case PAGE_DEVICES: currentPage=devicesPage; break; #endif case PAGE_SEARCH: currentPage=searchPage; break; - default: currentPage=0; break; + default: currentPage=nullptr; break; } if (currentPage) { currentPage->controlActions(); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index e0a84ba67..bcf0a70c9 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -107,7 +107,7 @@ public: PAGE_CONTEXT }; - MainWindow(QWidget *parent = 0); + MainWindow(QWidget *parent = nullptr); ~MainWindow() override; int mpdVolume() const { return volumeSlider->value(); } diff --git a/gui/mediakeys.cpp b/gui/mediakeys.cpp index 50aef8f36..ccd768b79 100644 --- a/gui/mediakeys.cpp +++ b/gui/mediakeys.cpp @@ -44,7 +44,7 @@ GLOBAL_STATIC(MediaKeys, instance) MediaKeys::MediaKeys() { #ifdef QT_QTDBUS_FOUND - gnome=0; + gnome=nullptr; #endif #ifdef CANTATA_USE_QXT_MEDIAKEYS @@ -69,14 +69,14 @@ MediaKeys::~MediaKeys() void MediaKeys::start() { #ifdef QT_QTDBUS_FOUND - gnome=new GnomeMediaKeys(0); + gnome=new GnomeMediaKeys(nullptr); if (activate(gnome)) { DBUG << "Using Gnome"; return; } DBUG << "Gnome failed"; gnome->deleteLater(); - gnome=0; + gnome=nullptr; #endif #ifdef CANTATA_USE_QXT_MEDIAKEYS @@ -98,7 +98,7 @@ void MediaKeys::stop() if (gnome) { deactivate(gnome); gnome->deleteLater(); - gnome=0; + gnome=nullptr; } #endif diff --git a/gui/preferencesdialog.cpp b/gui/preferencesdialog.cpp index d2136b1f1..7ed14629c 100644 --- a/gui/preferencesdialog.cpp +++ b/gui/preferencesdialog.cpp @@ -86,7 +86,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) proxy->load(); addPage(QLatin1String("proxy"), proxy, tr("Proxy"), Icon("preferences-system-network"), tr("Proxy Settings")); #endif - shortcuts = new ShortcutsSettingsPage(0); + shortcuts = new ShortcutsSettingsPage(nullptr); addPage(QLatin1String("shortcuts"), shortcuts, tr("Shortcuts"), Icon(QStringList() << "preferences-desktop-keyboard" << "keyboard"), tr("Keyboard Shortcut Settings")); shortcuts->load(); diff --git a/gui/stdactions.cpp b/gui/stdactions.cpp index dbb6bdf13..705f2332b 100644 --- a/gui/stdactions.cpp +++ b/gui/stdactions.cpp @@ -47,12 +47,12 @@ static void setToolTip(Action *act, const QString &tt) static QMenu * priorityMenu() { - Action *prioHighestAction = new Action(QObject::tr("Highest Priority (255)"), 0); - Action *prioHighAction = new Action(QObject::tr("High Priority (200)"), 0); - Action *prioMediumAction = new Action(QObject::tr("Medium Priority (125)"), 0); - Action *prioLowAction = new Action(QObject::tr("Low Priority (50)"), 0); - Action *prioDefaultAction = new Action(QObject::tr("Default Priority (0)"), 0); - Action *prioCustomAction = new Action(QObject::tr("Custom Priority..."), 0); + Action *prioHighestAction = new Action(QObject::tr("Highest Priority (255)"), nullptr); + Action *prioHighAction = new Action(QObject::tr("High Priority (200)"), nullptr); + Action *prioMediumAction = new Action(QObject::tr("Medium Priority (125)"), nullptr); + Action *prioLowAction = new Action(QObject::tr("Low Priority (50)"), nullptr); + Action *prioDefaultAction = new Action(QObject::tr("Default Priority (0)"), nullptr); + Action *prioCustomAction = new Action(QObject::tr("Custom Priority..."), nullptr); prioHighestAction->setData(255); prioHighAction->setData(200); @@ -95,33 +95,33 @@ StdActions::StdActions() appendToPlayQueueAction->setShortcut(Qt::ControlModifier+Qt::Key_P); replacePlayQueueAction->setShortcut(Qt::ControlModifier+Qt::Key_R); - addWithPriorityAction = new Action(QObject::tr("Add With Priority"), 0); - setPriorityAction = new Action(QObject::tr("Set Priority"), 0); + addWithPriorityAction = new Action(QObject::tr("Add With Priority"), nullptr); + setPriorityAction = new Action(QObject::tr("Set Priority"), nullptr); setPriorityAction->setMenu(priorityMenu()); addWithPriorityAction->setMenu(priorityMenu()); - addToStoredPlaylistAction = new Action(Icons::self()->playlistListIcon, QObject::tr("Add To Playlist"), 0); + addToStoredPlaylistAction = new Action(Icons::self()->playlistListIcon, QObject::tr("Add To Playlist"), nullptr); #ifdef TAGLIB_FOUND organiseFilesAction = ActionCollection::get()->createAction("orgfiles", QObject::tr("Organize Files"), MonoIcon::icon(FontAwesome::folderopeno, col)); - editTagsAction = ActionCollection::get()->createAction("edittags", QObject::tr("Edit Track Information"), 0); + editTagsAction = ActionCollection::get()->createAction("edittags", QObject::tr("Edit Track Information"), nullptr); #endif #ifdef ENABLE_REPLAYGAIN_SUPPORT replaygainAction = ActionCollection::get()->createAction("replaygain", QObject::tr("ReplayGain"), MonoIcon::icon(FontAwesome::barchart, col)); #endif #ifdef ENABLE_DEVICES_SUPPORT - copyToDeviceAction = new Action(MonoIcon::icon(FontAwesome::mobile, col), QObject::tr("Copy Songs To Device"), 0); + copyToDeviceAction = new Action(MonoIcon::icon(FontAwesome::mobile, col), QObject::tr("Copy Songs To Device"), nullptr); copyToDeviceAction->setMenu(DevicesModel::self()->menu()); - deleteSongsAction = new Action(MonoIcon::icon(FontAwesome::trash, MonoIcon::constRed), QObject::tr("Delete Songs"), 0); + deleteSongsAction = new Action(MonoIcon::icon(FontAwesome::trash, MonoIcon::constRed), QObject::tr("Delete Songs"), nullptr); #endif - setCoverAction = new Action(QObject::tr("Set Image"), 0); - removeAction = new Action(Icons::self()->removeIcon, QObject::tr("Remove"), 0); + setCoverAction = new Action(QObject::tr("Set Image"), nullptr); + removeAction = new Action(Icons::self()->removeIcon, QObject::tr("Remove"), nullptr); searchAction = ActionCollection::get()->createAction("search", QObject::tr("Find"), Icons::self()->searchIcon); searchAction->setShortcut(Qt::ControlModifier+Qt::Key_F); addToStoredPlaylistAction->setMenu(PlaylistsModel::self()->menu()); QMenu *addMenu=new QMenu(); - addToPlayQueueMenuAction = new Action(QObject::tr("Add To Play Queue"), 0); + addToPlayQueueMenuAction = new Action(QObject::tr("Add To Play Queue"), nullptr); addMenu->addAction(appendToPlayQueueAction); addMenu->addAction(appendToPlayQueueAndPlayAction); addMenu->addAction(addToPlayQueueAndPlayAction); diff --git a/gui/trayitem.cpp b/gui/trayitem.cpp index 887c101e4..75fed23f8 100644 --- a/gui/trayitem.cpp +++ b/gui/trayitem.cpp @@ -72,13 +72,13 @@ TrayItem::TrayItem(MainWindow *p) : QObject(p) #ifndef Q_OS_MAC , mw(p) - , trayItem(0) - , trayItemMenu(0) + , trayItem(nullptr) + , trayItemMenu(nullptr) #ifdef QT_QTDBUS_FOUND - , notification(0) + , notification(nullptr) #endif - , connectionsAction(0) - , outputsAction(0) + , connectionsAction(nullptr) + , outputsAction(nullptr) #endif { } @@ -117,9 +117,9 @@ void TrayItem::setup() if (trayItem) { trayItem->setVisible(false); trayItem->deleteLater(); - trayItem=0; + trayItem=nullptr; trayItemMenu->deleteLater(); - trayItemMenu=0; + trayItemMenu=nullptr; } return; } @@ -146,7 +146,7 @@ void TrayItem::setup() trayItem = new QSystemTrayIcon(this); trayItem->installEventFilter(new VolumeSliderEventHandler(this)); - trayItemMenu = new QMenu(0); + trayItemMenu = new QMenu(nullptr); trayItemMenu->addAction(StdActions::self()->prevTrackAction); trayItemMenu->addAction(StdActions::self()->playPauseTrackAction); trayItemMenu->addAction(StdActions::self()->stopPlaybackAction); @@ -265,7 +265,7 @@ static void copyMenu(Action *from, Action *to) to->setVisible(from->isVisible()); if (to->isVisible()) { if (!to->menu()) { - to->setMenu(new QMenu(0)); + to->setMenu(new QMenu(nullptr)); } QMenu *m=to->menu(); m->clear(); diff --git a/gui/trayitem.h b/gui/trayitem.h index 18ddfbbc4..b3817fc18 100644 --- a/gui/trayitem.h +++ b/gui/trayitem.h @@ -52,7 +52,7 @@ public: void setIcon(const QIcon &) { } void setToolTip(const QString &, const QString &, const QString &) { } #else - bool isActive() const { return 0!=trayItem; } + bool isActive() const { return nullptr!=trayItem; } void setIcon(const QIcon &icon) { if (trayItem) { trayItem->setIcon(icon); diff --git a/http/httpserver.cpp b/http/httpserver.cpp index 7cfb98eb7..1eafbf466 100644 --- a/http/httpserver.cpp +++ b/http/httpserver.cpp @@ -60,10 +60,10 @@ GLOBAL_STATIC(HttpServer, instance) #ifdef ENABLE_HTTP_SERVER HttpServer::HttpServer() - : QObject(0) - , thread(0) - , socket(0) - , closeTimer(0) + : QObject(nullptr) + , thread(nullptr) + , socket(nullptr) + , closeTimer(nullptr) { connect(MPDConnection::self(), SIGNAL(cantataStreams(QList,bool)), this, SLOT(cantataStreams(QList,bool))); connect(MPDConnection::self(), SIGNAL(cantataStreams(QStringList)), this, SLOT(cantataStreams(QStringList))); @@ -91,7 +91,7 @@ bool HttpServer::start() DBUG << "open new socket"; quint16 prevPort=Settings::self()->httpAllocatedPort(); - bool newThread=0==thread; + bool newThread=nullptr==thread; if (newThread) { thread=new Thread("HttpServer"); } @@ -114,7 +114,7 @@ void HttpServer::stop() if (socket) { DBUG; emit terminateSocket(); - socket=0; + socket=nullptr; } } @@ -126,7 +126,7 @@ void HttpServer::readConfig() return; } - bool wasStarted=0!=socket; + bool wasStarted=nullptr!=socket; stop(); if (wasStarted) { start(); @@ -145,7 +145,7 @@ QString HttpServer::address() const bool HttpServer::isOurs(const QString &url) const { - if (0==socket || !url.startsWith(QLatin1String("http://"))) { + if (nullptr==socket || !url.startsWith(QLatin1String("http://"))) { return false; } diff --git a/http/httpsocket.cpp b/http/httpsocket.cpp index 71a87d394..192ca976f 100644 --- a/http/httpsocket.cpp +++ b/http/httpsocket.cpp @@ -184,7 +184,7 @@ static void getRange(const QStringList ¶ms, qint32 &from, qint32 &to) } HttpSocket::HttpSocket(const QString &iface, quint16 port) - : QTcpServer(0) + : QTcpServer(nullptr) , cfgInterface(iface) , terminated(false) { diff --git a/models/actionmodel.h b/models/actionmodel.h index b23506d0a..aed3d49d5 100644 --- a/models/actionmodel.h +++ b/models/actionmodel.h @@ -34,7 +34,7 @@ class ActionModel : public QAbstractItemModel Q_OBJECT public: - ActionModel(QObject *p=0) : QAbstractItemModel(p) { } + ActionModel(QObject *p=nullptr) : QAbstractItemModel(p) { } ~ActionModel() override { } QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; diff --git a/models/browsemodel.cpp b/models/browsemodel.cpp index 77b2a0c27..80d809d27 100644 --- a/models/browsemodel.cpp +++ b/models/browsemodel.cpp @@ -55,7 +55,7 @@ QStringList BrowseModel::FolderItem::allEntries(bool allowPlaylists) const BrowseModel::BrowseModel(QObject *p) : ActionModel(p) - , root(new FolderItem("/", 0)) + , root(new FolderItem("/", nullptr)) , enabled(false) , dbVersion(0) { @@ -114,7 +114,7 @@ QModelIndex BrowseModel::index(int row, int column, const QModelIndex &parent) c return QModelIndex(); } const FolderItem * p = parent.isValid() ? static_cast(parent.internalPointer()) : root; - const Item * c = rowgetChildCount() ? p->getChildren().at(row) : 0; + const Item * c = rowgetChildCount() ? p->getChildren().at(row) : nullptr; return c ? createIndex(row, column, (void *)c) : QModelIndex(); } @@ -126,7 +126,7 @@ QModelIndex BrowseModel::parent(const QModelIndex &child) const const Item * const item = static_cast(child.internalPointer()); Item * const parentItem = item->getParent(); - if (parentItem == root || 0==parentItem) { + if (parentItem == root || nullptr==parentItem) { return QModelIndex(); } diff --git a/models/browsemodel.h b/models/browsemodel.h index d6d87c8fb..a7b21fa4d 100644 --- a/models/browsemodel.h +++ b/models/browsemodel.h @@ -41,7 +41,7 @@ public: class Item { public: - Item(FolderItem *p=0) + Item(FolderItem *p=nullptr) : parent(p), row(0) { } virtual ~Item() { } @@ -61,7 +61,7 @@ public: class TrackItem : public Item { public: - TrackItem(const Song &s, FolderItem *p=0) + TrackItem(const Song &s, FolderItem *p=nullptr) : Item(p) , song(s) { } ~TrackItem() override { } @@ -83,7 +83,7 @@ public: State_Fetched }; - FolderItem(const QString &n, const QString &pth, FolderItem *p=0) + FolderItem(const QString &n, const QString &pth, FolderItem *p=nullptr) : Item(p), name(n), path(pth), state(State_Initial) { } ~FolderItem() override { } diff --git a/models/devicesmodel.cpp b/models/devicesmodel.cpp index 1039cfc0f..1b2e693e7 100644 --- a/models/devicesmodel.cpp +++ b/models/devicesmodel.cpp @@ -87,7 +87,7 @@ GLOBAL_STATIC(DevicesModel, instance) DevicesModel::DevicesModel(QObject *parent) : MusicLibraryModel(parent) - , itemMenu(0) + , itemMenu(nullptr) , enabled(false) , inhibitMenuUpdate(false) { @@ -471,7 +471,7 @@ void DevicesModel::stop() Device * DevicesModel::device(const QString &udi) { int idx=indexOf(udi); - return idx<0 ? 0 : static_cast(collections.at(idx)); + return idx<0 ? nullptr : static_cast(collections.at(idx)); } void DevicesModel::setCover(const Song &song, const QImage &img, const QString &file) @@ -581,7 +581,7 @@ void DevicesModel::deviceAdded(const QString &udi) Solid::Device device(udi); DBUG << "Solid device added udi:" << device.udi() << "product:" << device.product() << "vendor:" << device.vendor(); - Solid::StorageAccess *ssa =0; + Solid::StorageAccess *ssa =nullptr; #if defined CDDB_FOUND || defined MUSICBRAINZ5_FOUND Solid::OpticalDisc * opt = device.as(); @@ -890,7 +890,7 @@ void DevicesModel::updateItemMenu() } if (!itemMenu) { - itemMenu = new MirrorMenu(0); + itemMenu = new MirrorMenu(nullptr); } itemMenu->clear(); @@ -922,7 +922,7 @@ void DevicesModel::updateItemMenu() QMimeData * DevicesModel::mimeData(const QModelIndexList &indexes) const { - QMimeData *mimeData=0; + QMimeData *mimeData=nullptr; QStringList paths=playableUrls(indexes); if (!paths.isEmpty()) { diff --git a/models/devicesmodel.h b/models/devicesmodel.h index b9675fff5..fc922f563 100644 --- a/models/devicesmodel.h +++ b/models/devicesmodel.h @@ -46,7 +46,7 @@ public: static bool debugEnabled(); static QString fixDevicePath(const QString &path); - DevicesModel(QObject *parent = 0); + DevicesModel(QObject *parent = nullptr); ~DevicesModel() override; QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override; QModelIndex parent(const QModelIndex &index) const override; diff --git a/models/digitallyimported.cpp b/models/digitallyimported.cpp index 9eb745d95..d7526f34e 100644 --- a/models/digitallyimported.cpp +++ b/models/digitallyimported.cpp @@ -40,9 +40,9 @@ const QString DigitallyImported::constPublicValue=QLatin1String("public3"); GLOBAL_STATIC(DigitallyImported, instance) DigitallyImported::DigitallyImported() - : job(0) + : job(nullptr) , streamType(0) - , timer(0) + , timer(nullptr) { load(); } @@ -55,7 +55,7 @@ void DigitallyImported::login() { if (job) { job->deleteLater(); - job=0; + job=nullptr; } QNetworkRequest req(constAuthUrl); addAuthHeader(req); @@ -67,7 +67,7 @@ void DigitallyImported::logout() { if (job) { job->deleteLater(); - job=0; + job=nullptr; } listenHash=QString(); expires=QDateTime(); @@ -154,7 +154,7 @@ void DigitallyImported::loginResponse() if (reply!=job) { return; } - job=0; + job=nullptr; status=listenHash=QString(); const int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); diff --git a/models/mpdlibrarymodel.cpp b/models/mpdlibrarymodel.cpp index e96f0fc33..d0b846605 100644 --- a/models/mpdlibrarymodel.cpp +++ b/models/mpdlibrarymodel.cpp @@ -35,7 +35,7 @@ GLOBAL_STATIC(MpdLibraryModel, instance) #define COVERS_DBUG if (Covers::verboseDebugEnabled()) qWarning() << metaObject()->className() << QThread::currentThread()->objectName() << __FUNCTION__ MpdLibraryModel::MpdLibraryModel() - : SqlLibraryModel(new MpdLibraryDb(0), 0) + : SqlLibraryModel(new MpdLibraryDb(nullptr), nullptr) , showArtistImages(false) { connect(Covers::self(), SIGNAL(cover(Song,QImage,QString)), this, SLOT(cover(Song,QImage,QString))); @@ -195,7 +195,7 @@ void MpdLibraryModel::cover(const Song &song, const QImage &img, const QString & } switch(topLevel()) { case T_Genre: { - const Item *genre=root ? root->getChild(song.genres[0]) : 0; + const Item *genre=root ? root->getChild(song.genres[0]) : nullptr; if (genre) { const Item *artist=static_cast(genre)->getChild(song.artistOrComposer()); if (artist) { @@ -209,7 +209,7 @@ void MpdLibraryModel::cover(const Song &song, const QImage &img, const QString & break; } case T_Artist: { - const Item *artist=root ? root->getChild(song.artistOrComposer()) : 0; + const Item *artist=root ? root->getChild(song.artistOrComposer()) : nullptr; if (artist) { const Item *album=static_cast(artist)->getChild(song.albumId()); if (album) { @@ -220,7 +220,7 @@ void MpdLibraryModel::cover(const Song &song, const QImage &img, const QString & break; } case T_Album: { - const Item *album=root ? root->getChild(song.artistOrComposer()+song.albumId()) : 0; + const Item *album=root ? root->getChild(song.artistOrComposer()+song.albumId()) : nullptr; if (album) { QModelIndex idx=index(album->getRow(), 0, QModelIndex()); emit dataChanged(idx, idx); @@ -247,7 +247,7 @@ void MpdLibraryModel::artistImage(const Song &song, const QImage &img, const QSt } switch(topLevel()) { case T_Genre: { - const Item *genre=root ? root->getChild(song.genres[0]) : 0; + const Item *genre=root ? root->getChild(song.genres[0]) : nullptr; if (genre) { const Item *artist=static_cast(genre)->getChild(song.artistOrComposer()); if (artist) { @@ -258,7 +258,7 @@ void MpdLibraryModel::artistImage(const Song &song, const QImage &img, const QSt break; } case T_Artist: { - const Item *artist=root ? root->getChild(song.artistOrComposer()) : 0; + const Item *artist=root ? root->getChild(song.artistOrComposer()) : nullptr; if (artist) { QModelIndex idx=index(artist->getRow(), 0, QModelIndex()); emit dataChanged(idx, idx); diff --git a/models/mpdsearchmodel.h b/models/mpdsearchmodel.h index b2e088d7e..2e7b87d70 100644 --- a/models/mpdsearchmodel.h +++ b/models/mpdsearchmodel.h @@ -31,7 +31,7 @@ class MpdSearchModel : public SearchModel Q_OBJECT public: - MpdSearchModel(QObject *parent = 0); + MpdSearchModel(QObject *parent = nullptr); ~MpdSearchModel() override; QVariant data(const QModelIndex &index, int role) const override; @@ -49,7 +49,7 @@ private Q_SLOTS: private: void clearItems(); - const Song * toSong(const QModelIndex &index) const { return index.isValid() ? static_cast(index.internalPointer()) : 0; } + const Song * toSong(const QModelIndex &index) const { return index.isValid() ? static_cast(index.internalPointer()) : nullptr; } private: int currentId; diff --git a/models/musiclibraryitem.cpp b/models/musiclibraryitem.cpp index 8b42847f1..d7eeb3f68 100644 --- a/models/musiclibraryitem.cpp +++ b/models/musiclibraryitem.cpp @@ -65,7 +65,7 @@ MusicLibraryItem * MusicLibraryItemContainer::childItem(const QString &name) con } } - return 0; + return nullptr; } void MusicLibraryItemContainer::resetRows() diff --git a/models/musiclibraryitem.h b/models/musiclibraryitem.h index 70e5befe4..dbb82d320 100644 --- a/models/musiclibraryitem.h +++ b/models/musiclibraryitem.h @@ -46,7 +46,7 @@ public: virtual ~MusicLibraryItem() { } MusicLibraryItemContainer * parentItem() const { return m_parentItem; } - virtual MusicLibraryItem * childItem(int) const { return 0; } + virtual MusicLibraryItem * childItem(int) const { return nullptr; } virtual int childCount() const { return 0; } int row() const; void setRow(int r) const { m_row=r+1; } diff --git a/models/musiclibraryitemalbum.cpp b/models/musiclibraryitemalbum.cpp index 9b9e46c47..729d9b948 100644 --- a/models/musiclibraryitemalbum.cpp +++ b/models/musiclibraryitemalbum.cpp @@ -203,7 +203,7 @@ Song MusicLibraryItemAlbum::coverSong() const song.file=firstSong->file(); #if defined ENABLE_DEVICES_SUPPORT MusicLibraryItemRoot *root=parentItem() && parentItem()->parentItem() && MusicLibraryItem::Type_Root==parentItem()->parentItem()->itemType() - ? static_cast(parentItem()->parentItem()) : 0; + ? static_cast(parentItem()->parentItem()) : nullptr; if (root) { #ifdef ENABLE_DEVICES_SUPPORT if (root->isDevice()) { diff --git a/models/musiclibraryitemartist.cpp b/models/musiclibraryitemartist.cpp index 584a7844b..8ce7246a7 100644 --- a/models/musiclibraryitemartist.cpp +++ b/models/musiclibraryitemartist.cpp @@ -56,7 +56,7 @@ MusicLibraryItemArtist::MusicLibraryItemArtist(const Song &song, MusicLibraryIte MusicLibraryItemAlbum * MusicLibraryItemArtist::album(const Song &s, bool create) { MusicLibraryItemAlbum *albumItem=getAlbum(s.albumId()); - return albumItem ? albumItem : (create ? createAlbum(s) : 0); + return albumItem ? albumItem : (create ? createAlbum(s) : nullptr); } MusicLibraryItemAlbum * MusicLibraryItemArtist::createAlbum(const Song &s) @@ -99,7 +99,7 @@ Song MusicLibraryItemArtist::coverSong() const if (childCount()) { MusicLibraryItemAlbum *firstAlbum=static_cast(childItem(0)); - MusicLibraryItemSong *firstSong=firstAlbum ? static_cast(firstAlbum->childItem(0)) : 0; + MusicLibraryItemSong *firstSong=firstAlbum ? static_cast(firstAlbum->childItem(0)) : nullptr; if (firstSong) { song.file=firstSong->file(); @@ -122,13 +122,13 @@ MusicLibraryItemAlbum * MusicLibraryItemArtist::getAlbum(const QString &key) con { if (m_indexes.count()==m_childItems.count()) { if (m_childItems.isEmpty()) { - return 0; + return nullptr; } QHash::ConstIterator idx=m_indexes.find(key); if (m_indexes.end()==idx) { - return 0; + return nullptr; } // Check index value is within range @@ -142,7 +142,7 @@ MusicLibraryItemAlbum * MusicLibraryItemArtist::getAlbum(const QString &key) con } // Something wrong with m_indexes??? So, refresh them... - MusicLibraryItemAlbum *al=0; + MusicLibraryItemAlbum *al=nullptr; m_indexes.clear(); QList::ConstIterator it=m_childItems.constBegin(); QList::ConstIterator end=m_childItems.constEnd(); diff --git a/models/musiclibraryitemartist.h b/models/musiclibraryitemartist.h index 7ed4ad5db..4051e79fe 100644 --- a/models/musiclibraryitemartist.h +++ b/models/musiclibraryitemartist.h @@ -41,7 +41,7 @@ class MusicLibraryItemArtist : public MusicLibraryItemContainer public: static bool lessThan(const MusicLibraryItem *a, const MusicLibraryItem *b); - MusicLibraryItemArtist(const Song &song, MusicLibraryItemContainer *parent=0); + MusicLibraryItemArtist(const Song &song, MusicLibraryItemContainer *parent=nullptr); ~MusicLibraryItemArtist() override { } MusicLibraryItemAlbum * album(const Song &s, bool create=true); diff --git a/models/musiclibraryitemroot.cpp b/models/musiclibraryitemroot.cpp index 6625be489..691171e0f 100644 --- a/models/musiclibraryitemroot.cpp +++ b/models/musiclibraryitemroot.cpp @@ -45,7 +45,7 @@ MusicLibraryItemArtist * MusicLibraryItemRoot::artist(const Song &s, bool create { QString aa=songArtist(s); MusicLibraryItemArtist *artistItem=getArtist(aa); - return artistItem ? artistItem : (create ? createArtist(s) : 0); + return artistItem ? artistItem : (create ? createArtist(s) : nullptr); } MusicLibraryItemArtist * MusicLibraryItemRoot::createArtist(const Song &s, bool forceComposer) @@ -483,8 +483,8 @@ void MusicLibraryItemRoot::add(const QSet &songs) return; } - MusicLibraryItemArtist *artistItem = 0; - MusicLibraryItemAlbum *albumItem = 0; + MusicLibraryItemArtist *artistItem = nullptr; + MusicLibraryItemAlbum *albumItem = nullptr; for (const Song &s: songs) { if (s.isEmpty()) { @@ -547,7 +547,7 @@ const MusicLibraryItem * MusicLibraryItemRoot::findSong(const Song &s) const } } } - return 0; + return nullptr; } bool MusicLibraryItemRoot::songExists(const Song &s) const @@ -677,7 +677,7 @@ void MusicLibraryItemRoot::removeSongFromList(const Song &s) if (!albumItem) { return; } - MusicLibraryItem *songItem=0; + MusicLibraryItem *songItem=nullptr; int songRow=0; for (MusicLibraryItem *song: albumItem->childItems()) { if (static_cast(song)->song().file==s.file) { @@ -740,13 +740,13 @@ MusicLibraryItemArtist * MusicLibraryItemRoot::getArtist(const QString &key) con { if (m_indexes.count()==m_childItems.count()) { if (m_childItems.isEmpty()) { - return 0; + return nullptr; } QHash::ConstIterator idx=m_indexes.find(key); if (m_indexes.end()==idx) { - return 0; + return nullptr; } // Check index value is within range @@ -760,7 +760,7 @@ MusicLibraryItemArtist * MusicLibraryItemRoot::getArtist(const QString &key) con } // Something wrong with m_indexes??? So, refresh them... - MusicLibraryItemArtist *ar=0; + MusicLibraryItemArtist *ar=nullptr; m_indexes.clear(); QList::ConstIterator it=m_childItems.constBegin(); QList::ConstIterator end=m_childItems.constEnd(); diff --git a/models/musiclibraryitemroot.h b/models/musiclibraryitemroot.h index 29730048f..2087108d6 100644 --- a/models/musiclibraryitemroot.h +++ b/models/musiclibraryitemroot.h @@ -62,10 +62,10 @@ class MusicLibraryItemRoot : public MusicLibraryItemContainer { public: MusicLibraryItemRoot(const QString &name=QString(), bool albumArtistSupport=true, bool flatHierarchy=false) - : MusicLibraryItemContainer(name, 0) + : MusicLibraryItemContainer(name, nullptr) , supportsAlbumArtist(albumArtistSupport) , isFlat(flatHierarchy) - , m_model(0) { + , m_model(nullptr) { } ~MusicLibraryItemRoot() override { } @@ -83,10 +83,10 @@ public: QSet allSongs(bool revertVa=false) const; void getDetails(QSet &artists, QSet &albumArtists, QSet &composers, QSet &albums, QSet &genres); void updateSongFile(const Song &from, const Song &to); - void toXML(const QString &filename, MusicLibraryProgressMonitor *prog=0) const; - void toXML(QXmlStreamWriter &writer, MusicLibraryProgressMonitor *prog=0) const; - bool fromXML(const QString &filename, const QString &baseFolder=QString(), MusicLibraryProgressMonitor *prog=0, MusicLibraryErrorMonitor *em=0); - bool fromXML(QXmlStreamReader &reader, const QString &baseFolder=QString(), MusicLibraryProgressMonitor *prog=0, MusicLibraryErrorMonitor *em=0); + void toXML(const QString &filename, MusicLibraryProgressMonitor *prog=nullptr) const; + void toXML(QXmlStreamWriter &writer, MusicLibraryProgressMonitor *prog=nullptr) const; + bool fromXML(const QString &filename, const QString &baseFolder=QString(), MusicLibraryProgressMonitor *prog=nullptr, MusicLibraryErrorMonitor *em=nullptr); + bool fromXML(QXmlStreamReader &reader, const QString &baseFolder=QString(), MusicLibraryProgressMonitor *prog=nullptr, MusicLibraryErrorMonitor *em=nullptr); Type itemType() const override { return Type_Root; } void add(const QSet &songs); bool supportsAlbumArtistTag() const { return supportsAlbumArtist; } diff --git a/models/musiclibrarymodel.cpp b/models/musiclibrarymodel.cpp index dea9de506..0e5acf9be 100644 --- a/models/musiclibrarymodel.cpp +++ b/models/musiclibrarymodel.cpp @@ -126,7 +126,7 @@ const MusicLibraryItemRoot * MusicLibraryModel::root(const MusicLibraryItem *ite return root(item->parentItem()); } - return 0; + return nullptr; } static QString parentData(const MusicLibraryItem *i) diff --git a/models/musiclibrarymodel.h b/models/musiclibrarymodel.h index bbb1dc939..138d7be0d 100644 --- a/models/musiclibrarymodel.h +++ b/models/musiclibrarymodel.h @@ -41,7 +41,7 @@ class MusicLibraryModel : public ActionModel { Q_OBJECT public: - MusicLibraryModel(QObject *parent=0); + MusicLibraryModel(QObject *parent=nullptr); ~MusicLibraryModel() override; QModelIndex index(int, int, const QModelIndex & = QModelIndex()) const override; QModelIndex parent(const QModelIndex &) const override; diff --git a/models/musiclibraryproxymodel.h b/models/musiclibraryproxymodel.h index 927ac2f01..1e736e383 100644 --- a/models/musiclibraryproxymodel.h +++ b/models/musiclibraryproxymodel.h @@ -36,7 +36,7 @@ class MusicLibraryProxyModel : public ProxyModel Q_OBJECT public: - MusicLibraryProxyModel(QObject *parent = 0); + MusicLibraryProxyModel(QObject *parent = nullptr); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; diff --git a/models/playlistsmodel.cpp b/models/playlistsmodel.cpp index b838df527..bdbb8d121 100644 --- a/models/playlistsmodel.cpp +++ b/models/playlistsmodel.cpp @@ -70,7 +70,7 @@ GLOBAL_STATIC(PlaylistsModel, instance) PlaylistsModel::PlaylistsModel(QObject *parent) : ActionModel(parent) , multiCol(false) - , itemMenu(0) + , itemMenu(nullptr) , dropAdjust(0) { icn.addFile(":playlist.svg"); @@ -101,7 +101,7 @@ PlaylistsModel::~PlaylistsModel() { if (itemMenu) { itemMenu->deleteLater(); - itemMenu=0; + itemMenu=nullptr; } } @@ -816,7 +816,7 @@ void PlaylistsModel::playlistInfoRetrieved(const QString &name, const QList &positions) { - PlaylistItem *pl=0; + PlaylistItem *pl=nullptr; if (0==positions.count() || !(pl=getPlaylist(name))) { emit listPlaylists(); return; @@ -852,7 +852,7 @@ void PlaylistsModel::removedFromPlaylist(const QString &name, const QList &idx, quint32 pos) { - PlaylistItem *pl=0; + PlaylistItem *pl=nullptr; if (!(pl=getPlaylist(name)) || idx.count()>pl->songs.count()) { emit listPlaylists(); return; @@ -936,7 +936,7 @@ void PlaylistsModel::updateItemMenu(bool create) if (!create) { return; } - itemMenu = new MirrorMenu(0); + itemMenu = new MirrorMenu(nullptr); } itemMenu->clear(); @@ -961,7 +961,7 @@ PlaylistsModel::PlaylistItem * PlaylistsModel::getPlaylist(const QString &name) } } - return 0; + return nullptr; } void PlaylistsModel::clearPlaylists() @@ -1022,7 +1022,7 @@ PlaylistsModel::SongItem * PlaylistsModel::PlaylistItem::getSong(const Song &son } } - return 0; + return nullptr; } quint32 PlaylistsModel::PlaylistItem::totalTime() diff --git a/models/playlistsmodel.h b/models/playlistsmodel.h index ebdc318fa..08fe5b9b1 100644 --- a/models/playlistsmodel.h +++ b/models/playlistsmodel.h @@ -69,8 +69,8 @@ public: struct PlaylistItem; struct SongItem : public Item, public Song { - SongItem() : parent(0) { } - SongItem(const Song &s, PlaylistItem *p=0) : Song(s), parent(p) { } + SongItem() : parent(nullptr) { } + SongItem(const Song &s, PlaylistItem *p=nullptr) : Song(s), parent(p) { } bool isPlaylist() override { return false; } PlaylistItem *parent; }; @@ -98,7 +98,7 @@ public: static PlaylistsModel * self(); static QString headerText(int col); - PlaylistsModel(QObject *parent = 0); + PlaylistsModel(QObject *parent = nullptr); ~PlaylistsModel() override; QString name() const; QString title() const; @@ -124,7 +124,7 @@ public: QStringList mimeTypes() const override; void getPlaylists(); void clear(); - bool exists(const QString &n) { return 0!=getPlaylist(n); } + bool exists(const QString &n) { return nullptr!=getPlaylist(n); } MirrorMenu * menu(); static QString strippedText(QString s); void setMultiColumn(bool m) { multiCol=m; } diff --git a/models/playlistsproxymodel.h b/models/playlistsproxymodel.h index 7d66b1fcc..b904fae64 100644 --- a/models/playlistsproxymodel.h +++ b/models/playlistsproxymodel.h @@ -33,7 +33,7 @@ class PlaylistsProxyModel : public ProxyModel Q_OBJECT public: - PlaylistsProxyModel(QObject *parent = 0); + PlaylistsProxyModel(QObject *parent = nullptr); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; static bool compareNames(const QString &l, const QString &r) { return l.localeAwareCompare(r)<0; } bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; diff --git a/models/playqueuemodel.cpp b/models/playqueuemodel.cpp index cf3fe0a3d..8c18d0952 100644 --- a/models/playqueuemodel.cpp +++ b/models/playqueuemodel.cpp @@ -236,7 +236,7 @@ PlayQueueModel::PlayQueueModel(QObject *parent) connect(removeDuplicatesAction, SIGNAL(triggered()), this, SLOT(removeDuplicates())); shuffleAction=new Action(tr("Shuffle"), this); - shuffleAction->setMenu(new QMenu(0)); + shuffleAction->setMenu(new QMenu(nullptr)); Action *shuffleTracksAction = new Action(tr("Tracks"), shuffleAction); Action *shuffleAlbumsAction = new Action(tr("Albums"), shuffleAction); connect(shuffleTracksAction, SIGNAL(triggered()), MPDConnection::self(), SLOT(shuffle())); @@ -245,7 +245,7 @@ PlayQueueModel::PlayQueueModel(QObject *parent) shuffleAction->menu()->addAction(shuffleAlbumsAction); sortAction=new Action(tr("Sort By"), this); - sortAction->setMenu(new QMenu(0)); + sortAction->setMenu(new QMenu(nullptr)); addSortAction(tr("Artist"), constSortByArtistKey); addSortAction(tr("Album Artist"), constSortByAlbumArtistKey); addSortAction(tr("Album"), constSortByAlbumKey); diff --git a/models/playqueuemodel.h b/models/playqueuemodel.h index 6d8af2e9f..b26641b6a 100644 --- a/models/playqueuemodel.h +++ b/models/playqueuemodel.h @@ -87,7 +87,7 @@ public: static PlayQueueModel * self(); - PlayQueueModel(QObject *parent = 0); + PlayQueueModel(QObject *parent = nullptr); ~PlayQueueModel() override; QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override; QModelIndex parent(const QModelIndex &idx) const override; diff --git a/models/playqueueproxymodel.h b/models/playqueueproxymodel.h index 76fa61153..fbf279655 100644 --- a/models/playqueueproxymodel.h +++ b/models/playqueueproxymodel.h @@ -35,7 +35,7 @@ class PlayQueueProxyModel : public ProxyModel Q_OBJECT public: - PlayQueueProxyModel(QObject *parent = 0); + PlayQueueProxyModel(QObject *parent = nullptr); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; QMimeData *mimeData(const QModelIndexList &indexes) const override; diff --git a/models/proxymodel.h b/models/proxymodel.h index dbbe03b1d..cf8a0baa0 100644 --- a/models/proxymodel.h +++ b/models/proxymodel.h @@ -34,7 +34,7 @@ class QMimeData; class ProxyModel : public QSortFilterProxyModel { public: - ProxyModel(QObject *parent) : QSortFilterProxyModel(parent), isSorted(false), filterEnabled(false), filter(0) { } + ProxyModel(QObject *parent) : QSortFilterProxyModel(parent), isSorted(false), filterEnabled(false), filter(nullptr) { } ~ProxyModel() override { } bool update(const QString &text); @@ -42,7 +42,7 @@ public: void setFilterItem(void *f) { filter=f; } void setRootIndex(const QModelIndex &idx) { rootIndex=idx.isValid() ? mapToSource(idx) : idx; } bool isChildOfRoot(const QModelIndex &idx) const; - bool isEmpty() const { return filterStrings.isEmpty() && 0==filter; } + bool isEmpty() const { return filterStrings.isEmpty() && nullptr==filter; } bool enabled() const { return filterEnabled; } const QString & filterText() const { return origFilterText; } void resort(); diff --git a/models/searchmodel.h b/models/searchmodel.h index 9104c2a8c..856dc9013 100644 --- a/models/searchmodel.h +++ b/models/searchmodel.h @@ -55,7 +55,7 @@ public: static QString headerText(int col); - SearchModel(QObject *parent = 0); + SearchModel(QObject *parent = nullptr); ~SearchModel() override; QModelIndex index(int, int, const QModelIndex & = QModelIndex()) const override; QModelIndex parent(const QModelIndex &) const override; @@ -84,7 +84,7 @@ Q_SIGNALS: protected: virtual Song & fixPath(Song &s) const { return s; } void results(const QList &songs); - const Song * toSong(const QModelIndex &index) const { return index.isValid() ? static_cast(index.internalPointer()) : 0; } + const Song * toSong(const QModelIndex &index) const { return index.isValid() ? static_cast(index.internalPointer()) : nullptr; } protected: bool multiCol; diff --git a/models/searchproxymodel.h b/models/searchproxymodel.h index 5bd860846..759ef0756 100644 --- a/models/searchproxymodel.h +++ b/models/searchproxymodel.h @@ -29,7 +29,7 @@ class SearchProxyModel : public ProxyModel { public: - SearchProxyModel(QObject *parent = 0); + SearchProxyModel(QObject *parent = nullptr); bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; }; diff --git a/models/sqllibrarymodel.cpp b/models/sqllibrarymodel.cpp index 6d8f21a18..2c878e108 100644 --- a/models/sqllibrarymodel.cpp +++ b/models/sqllibrarymodel.cpp @@ -70,7 +70,7 @@ QString SqlLibraryModel::groupingStr(Type m) SqlLibraryModel::SqlLibraryModel(LibraryDb *d, QObject *p, Type top) : ActionModel(p) , tl(top) - , root(0) + , root(nullptr) , db(d) , librarySort(LibraryDb::AS_YrAlAr) , albumSort(LibraryDb::AS_AlArYr) @@ -83,7 +83,7 @@ void SqlLibraryModel::clear() { beginResetModel(); delete root; - root=0; + root=nullptr; endResetModel(); } @@ -214,7 +214,7 @@ QModelIndex SqlLibraryModel::index(int row, int column, const QModelIndex &paren return QModelIndex(); } const CollectionItem * p = parent.isValid() ? static_cast(parent.internalPointer()) : root; - const Item * c = rowgetChildCount() ? p->getChildren().at(row) : 0; + const Item * c = rowgetChildCount() ? p->getChildren().at(row) : nullptr; return c ? createIndex(row, column, (void *)c) : QModelIndex(); } @@ -226,7 +226,7 @@ QModelIndex SqlLibraryModel::parent(const QModelIndex &child) const const Item * const item = static_cast(child.internalPointer()); Item * const parentItem = item->getParent(); - if (parentItem == root || 0==parentItem) { + if (parentItem == root || nullptr==parentItem) { return QModelIndex(); } @@ -601,5 +601,5 @@ void SqlLibraryModel::CollectionItem::add(Item *i) const SqlLibraryModel::Item *SqlLibraryModel::CollectionItem::getChild(const QString &id) const { QMap::ConstIterator it=childMap.find(id); - return childMap.constEnd()==it ? 0 : it.value(); + return childMap.constEnd()==it ? nullptr : it.value(); } diff --git a/models/sqllibrarymodel.h b/models/sqllibrarymodel.h index f546c3d05..dee582500 100644 --- a/models/sqllibrarymodel.h +++ b/models/sqllibrarymodel.h @@ -52,7 +52,7 @@ public: class Item { public: - Item(Type t, CollectionItem *p=0) + Item(Type t, CollectionItem *p=nullptr) : type(t), parent(p) { } virtual ~Item() { } @@ -78,7 +78,7 @@ public: class TrackItem : public Item { public: - TrackItem(const Song &s, CollectionItem *p=0) + TrackItem(const Song &s, CollectionItem *p=nullptr) : Item(T_Track, p) { setSong(s); } ~TrackItem() override { } @@ -90,7 +90,7 @@ public: class CollectionItem : public Item { public: - CollectionItem(Type t, const QString &i, const QString &txt=QString(), const QString &sub=QString(), CollectionItem *p=0) + CollectionItem(Type t, const QString &i, const QString &txt=QString(), const QString &sub=QString(), CollectionItem *p=nullptr) : Item(t, p), id(i), text(txt), subText(sub) { } ~CollectionItem() override { qDeleteAll(children); } @@ -112,7 +112,7 @@ public: class AlbumItem : public CollectionItem { public: - AlbumItem(const QString &ar, const QString &i, const QString &txt=QString(), const QString &sub=QString(), CollectionItem *p=0) + AlbumItem(const QString &ar, const QString &i, const QString &txt=QString(), const QString &sub=QString(), CollectionItem *p=nullptr) : CollectionItem(T_Album, i, txt, sub, p), artistId(ar) { } ~AlbumItem() override { } diff --git a/models/streamsearchmodel.cpp b/models/streamsearchmodel.cpp index db680d64a..78b368b23 100644 --- a/models/streamsearchmodel.cpp +++ b/models/streamsearchmodel.cpp @@ -66,7 +66,7 @@ QModelIndex StreamSearchModel::index(int row, int column, const QModelIndex &par } const StreamsModel::CategoryItem * p = parent.isValid() ? static_cast(parent.internalPointer()) : root; - const StreamsModel::Item * c = rowchildren.count() ? p->children.at(row) : 0; + const StreamsModel::Item * c = rowchildren.count() ? p->children.at(row) : nullptr; return c ? createIndex(row, column, (void *)c) : QModelIndex(); } diff --git a/models/streamsearchmodel.h b/models/streamsearchmodel.h index d2f4bf9d3..7b2d168bd 100644 --- a/models/streamsearchmodel.h +++ b/models/streamsearchmodel.h @@ -47,7 +47,7 @@ public: NumCategories }; - StreamSearchModel(QObject *parent = 0); + StreamSearchModel(QObject *parent = nullptr); ~StreamSearchModel() override; QModelIndex index(int, int, const QModelIndex & = QModelIndex()) const override; QModelIndex parent(const QModelIndex &) const override; diff --git a/models/streamsmodel.cpp b/models/streamsmodel.cpp index c1f59a2c3..f59edfc38 100644 --- a/models/streamsmodel.cpp +++ b/models/streamsmodel.cpp @@ -142,7 +142,7 @@ StreamsModel::CategoryItem * StreamsModel::Item::getTopLevelCategory() const while (item->parent && item->parent->parent) { item=item->parent; } - return item && item->isCategory() ? static_cast(item) : 0; + return item && item->isCategory() ? static_cast(item) : nullptr; } void StreamsModel::CategoryItem::removeBookmarks() @@ -231,7 +231,7 @@ StreamsModel::CategoryItem * StreamsModel::CategoryItem::getBookmarksCategory() return static_cast(i); } } - return 0; + return nullptr; } StreamsModel::CategoryItem * StreamsModel::CategoryItem::createBookmarksCategory() @@ -491,7 +491,7 @@ NetworkJob * StreamsModel::ShoutCastCategoryItem::fetchSecondardyUrl() job->setProperty(constOrigUrlProperty, url.toString()); return job; } - return 0; + return nullptr; } void StreamsModel::DiCategoryItem::addHeaders(QNetworkRequest &req) @@ -570,7 +570,7 @@ QModelIndex StreamsModel::index(int row, int column, const QModelIndex &parent) } const CategoryItem * p = parent.isValid() ? static_cast(parent.internalPointer()) : root; - const Item * c = rowchildren.count() ? p->children.at(row) : 0; + const Item * c = rowchildren.count() ? p->children.at(row) : nullptr; return c ? createIndex(row, column, (void *)c) : QModelIndex(); } @@ -1088,7 +1088,7 @@ void StreamsModel::jobFinished() for (Item *ex: bookmarksCat->children) { if (ex->url==bm->url) { delete bm; - bm=0; + bm=nullptr; break; } } @@ -1188,7 +1188,7 @@ static StreamsModel::Item * getStream(StreamsModel::FavouritesCategoryItem *fav, } } - return 0; + return nullptr; } void StreamsModel::favouriteStreams(const QList &streams) @@ -1215,9 +1215,9 @@ void StreamsModel::favouriteStreams(const QList &streams) } else { for (qint32 i=0; ichildren.count() ? favourites->children.at(i) : 0; + Item *si=ichildren.count() ? favourites->children.at(i) : nullptr; if (!si || si->name!=s.name || si->url!=s.url) { - si=ichildren.count() ? getStream(favourites, s, i) : 0; + si=ichildren.count() ? getStream(favourites, s, i) : nullptr; if (!si) { beginInsertRows(idx, i, i); favourites->children.insert(i, new Item(s.url, s.name, favourites)); @@ -1667,8 +1667,8 @@ QList StreamsModel::parseDirbleStations(QIODevice *dev, Ca StreamsModel::Item * StreamsModel::parseRadioTimeEntry(QXmlStreamReader &doc, CategoryItem *parent, bool parseSubText) { - Item *item=0; - CategoryItem *cat=0; + Item *item=nullptr; + CategoryItem *cat=nullptr; while (!doc.atEnd()) { if (doc.isStartElement()) { QString text=doc.attributes().value("text").toString(); @@ -1730,7 +1730,7 @@ StreamsModel::Item * StreamsModel::parseSomaFmEntry(QXmlStreamReader &doc, Categ } } - return name.isEmpty() || url.isEmpty() ? 0 : new Item(url, name, parent); + return name.isEmpty() || url.isEmpty() ? nullptr : new Item(url, name, parent); } void StreamsModel::importOldFavourites() @@ -1772,7 +1772,7 @@ void StreamsModel::loadInstalledProviders() StreamsModel::CategoryItem * StreamsModel::addInstalledProvider(const QString &name, const Icon &icon, const QString &streamsFileName, bool replace) { - CategoryItem *cat=0; + CategoryItem *cat=nullptr; if (streamsFileName.endsWith(constSettingsFile)) { QFile file(streamsFileName); if (file.open(QIODevice::ReadOnly)) { @@ -1801,7 +1801,7 @@ StreamsModel::CategoryItem * StreamsModel::addInstalledProvider(const QString &n } if (!cat) { - return 0; + return nullptr; } cat->configName="x-"+name; diff --git a/models/streamsmodel.h b/models/streamsmodel.h index b0467de6b..831e3556b 100644 --- a/models/streamsmodel.h +++ b/models/streamsmodel.h @@ -50,7 +50,7 @@ public: struct Item : public Stream { - Item(const QString &u, const QString &n=QString(), CategoryItem *p=0, const QString &sub=QString()) : Stream(u, n), subText(sub), parent(p) { } + Item(const QString &u, const QString &n=QString(), CategoryItem *p=nullptr, const QString &sub=QString()) : Stream(u, n), subText(sub), parent(p) { } ~Item() override { } QString modifiedName() const; QString subText; @@ -68,7 +68,7 @@ public: Fetched }; - CategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=0, const QIcon &i=QIcon(), + CategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=nullptr, const QIcon &i=QIcon(), const QString &cn=QString(), const QString &bn=QString(), bool modName=false) : Item(u, n, p), state(Initial), isAll(false), isBookmarks(false), supportsBookmarks(false), canBookmark(false), addCatToModifiedName(modName), icon(i), cacheName(cn), @@ -82,7 +82,7 @@ public: virtual bool isSoma() const { return false; } virtual bool isListenLive() const { return false; } virtual void removeCache(); - bool isTopLevel() const { return parent && 0==parent->parent; } + bool isTopLevel() const { return parent && nullptr==parent->parent; } virtual bool canReload() const { return !cacheName.isEmpty() || isTopLevel() || !url.isEmpty(); } void removeBookmarks(); void saveBookmarks(); @@ -96,7 +96,7 @@ public: QList loadXml(const QString &fileName); virtual QList loadXml(QIODevice *dev); virtual void addHeaders(QNetworkRequest &) { } - virtual NetworkJob * fetchSecondardyUrl() { return 0; } + virtual NetworkJob * fetchSecondardyUrl() { return nullptr; } State state; bool isAll : 1; @@ -123,7 +123,7 @@ public: struct IceCastCategoryItem : public CategoryItem { - IceCastCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=0, const QIcon &i=QIcon(), + IceCastCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=nullptr, const QIcon &i=QIcon(), const QString &cn=QString(), const QString &bn=QString()) : CategoryItem(u, n, p, i, cn, bn) { } void addHeaders(QNetworkRequest &req) override; @@ -131,7 +131,7 @@ public: struct ShoutCastCategoryItem : public CategoryItem { - ShoutCastCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=0, const QIcon &i=QIcon(), + ShoutCastCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=nullptr, const QIcon &i=QIcon(), const QString &cn=QString(), const QString &bn=QString()) : CategoryItem(u, n, p, i, cn, bn) { } void addHeaders(QNetworkRequest &req) override; @@ -140,7 +140,7 @@ public: struct DirbleCategoryItem : public CategoryItem { - DirbleCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=0, const QIcon &i=QIcon(), + DirbleCategoryItem(const QString &u, const QString &n=QString(), CategoryItem *p=nullptr, const QIcon &i=QIcon(), const QString &cn=QString(), const QString &bn=QString()) : CategoryItem(u, n, p, i, cn, bn) { } }; @@ -214,7 +214,7 @@ public: static QString modifyUrl(const QString &u, bool addPrefix=true, const QString &name=QString()); // static bool validProtocol(const QString &file); - StreamsModel(QObject *parent = 0); + StreamsModel(QObject *parent = nullptr); ~StreamsModel() override; QString name() const; QString title() const; diff --git a/models/streamsproxymodel.h b/models/streamsproxymodel.h index 6ab6bd36e..b30cf538b 100644 --- a/models/streamsproxymodel.h +++ b/models/streamsproxymodel.h @@ -29,7 +29,7 @@ class StreamsProxyModel : public ProxyModel { public: - StreamsProxyModel(QObject *parent = 0); + StreamsProxyModel(QObject *parent = nullptr); bool filterAcceptsItem(const void *i, QStringList strings) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; diff --git a/mpd-interface/httpstream.cpp b/mpd-interface/httpstream.cpp index 11e85d5a9..27cfed90e 100644 --- a/mpd-interface/httpstream.cpp +++ b/mpd-interface/httpstream.cpp @@ -46,8 +46,8 @@ HttpStream::HttpStream(QObject *p) , enabled(false) , state(MPDState_Inactive) , playStateChecks(0) - , playStateCheckTimer(0) - , player(0) + , playStateCheckTimer(nullptr) + , player(nullptr) { } @@ -91,7 +91,7 @@ void HttpStream::streamUrl(const QString &url) if (player && player->property(constUrlProperty).toString()!=url) { player->stop(); player->deleteLater(); - player=0; + player=nullptr; } #endif if (!url.isEmpty() && !player) { diff --git a/mpd-interface/mpdconnection.cpp b/mpd-interface/mpdconnection.cpp index 62a480814..568ed0640 100644 --- a/mpd-interface/mpdconnection.cpp +++ b/mpd-interface/mpdconnection.cpp @@ -227,7 +227,7 @@ void MPDConnectionDetails::setDirReadable() MPDConnection::MPDConnection() : isInitialConnect(true) - , thread(0) + , thread(nullptr) , ver(0) , canUseStickers(false) , sock(this) @@ -236,14 +236,14 @@ MPDConnection::MPDConnection() , lastUpdatePlayQueueVersion(0) , state(State_Blank) , isListingMusic(false) - , reconnectTimer(0) + , reconnectTimer(nullptr) , reconnectStart(0) , stopAfterCurrent(false) , currentSongId(-1) , songPos(0) , unmuteVol(-1) , isUpdatingDb(false) - , volumeFade(0) + , volumeFade(nullptr) , fadeDuration(0) , restoreVolume(-1) { @@ -309,9 +309,9 @@ void MPDConnection::stop() if (thread) { thread->deleteTimer(connTimer); - connTimer=0; + connTimer=nullptr; thread->stop(); - thread=0; + thread=nullptr; } } @@ -495,7 +495,7 @@ void MPDConnection::reconnect() reconnectStart=0; return; } - time_t now=time(NULL); + time_t now=time(nullptr); ConnectionReturn status=connectToMPD(); switch (status) { case Success: @@ -2407,8 +2407,8 @@ void MPDConnection::determineIfaceIp() MpdSocket::MpdSocket(QObject *parent) : QObject(parent) - , tcp(0) - , local(0) + , tcp(nullptr) + , local(nullptr) { } @@ -2453,7 +2453,7 @@ void MpdSocket::deleteTcp() disconnect(tcp, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState))); disconnect(tcp, SIGNAL(readyRead()), this, SIGNAL(readyRead())); tcp->deleteLater(); - tcp=0; + tcp=nullptr; } } @@ -2463,7 +2463,7 @@ void MpdSocket::deleteLocal() disconnect(local, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)), this, SLOT(localStateChanged(QLocalSocket::LocalSocketState))); disconnect(local, SIGNAL(readyRead()), this, SIGNAL(readyRead())); local->deleteLater(); - local=0; + local=nullptr; } } diff --git a/mpd-interface/mpdconnection.h b/mpd-interface/mpdconnection.h index b4b1459e5..00a3e246d 100644 --- a/mpd-interface/mpdconnection.h +++ b/mpd-interface/mpdconnection.h @@ -114,7 +114,7 @@ public: : QAbstractSocket::UnconnectedState; } QNetworkProxy::ProxyType proxyType() const { return tcp ? tcp->proxy().type() : QNetworkProxy::NoProxy; } - bool isLocal() const { return 0!=local; } + bool isLocal() const { return nullptr!=local; } QString address() const { return tcp ? tcp->peerAddress().toString() : QString(); } QString errorString() const { return tcp ? tcp->errorString() : local ? local->errorString() : QLatin1String("No socket object?"); } QAbstractSocket::SocketError error() const { diff --git a/network/networkaccessmanager.cpp b/network/networkaccessmanager.cpp index 488427188..ec7fa30fc 100644 --- a/network/networkaccessmanager.cpp +++ b/network/networkaccessmanager.cpp @@ -51,7 +51,7 @@ NetworkJob::NetworkJob(NetworkAccessManager *p, const QUrl &u) : QObject(p) , numRedirects(0) , lastDownloadPc(0) - , job(0) + , job(nullptr) , origU(u) { QTimer::singleShot(0, this, SLOT(jobFinished())); @@ -108,7 +108,7 @@ void NetworkJob::cancelJob() job->abort(); job->close(); job->deleteLater(); - job=0; + job=nullptr; } } @@ -158,7 +158,7 @@ void NetworkJob::jobDestroyed(QObject *o) { DBUG << (void *)this << (void *)job; if (o==job) { - job=0; + job=nullptr; } } @@ -211,7 +211,7 @@ NetworkJob * NetworkAccessManager::get(const QNetworkRequest &req, int timeout) request.setRawHeader("User-Agent", userAgent); // Windows builds do not support HTTPS - unless QtNetwork is recompiled... - NetworkJob *reply=0; + NetworkJob *reply=nullptr; bool supportsSsl = false; #ifndef QT_NO_SSL supportsSsl = QSslSocket::supportsSsl(); @@ -237,7 +237,7 @@ NetworkJob * NetworkAccessManager::get(const QNetworkRequest &req, int timeout) struct FakeNetworkReply : public QNetworkReply { - FakeNetworkReply() : QNetworkReply(0) + FakeNetworkReply() : QNetworkReply(nullptr) { setError(QNetworkReply::ConnectionRefusedError, QString()); QTimer::singleShot(0, this, SIGNAL(finished())); diff --git a/network/networkaccessmanager.h b/network/networkaccessmanager.h index 16f7771d2..5a138078a 100644 --- a/network/networkaccessmanager.h +++ b/network/networkaccessmanager.h @@ -94,7 +94,7 @@ public: static void disableNetworkAccess(); static NetworkAccessManager * self(); - NetworkAccessManager(QObject *parent=0); + NetworkAccessManager(QObject *parent=nullptr); ~NetworkAccessManager() override { } NetworkJob * get(const QNetworkRequest &req, int timeout=0); diff --git a/network/networkproxyfactory.cpp b/network/networkproxyfactory.cpp index bc9fcacfe..56b733769 100644 --- a/network/networkproxyfactory.cpp +++ b/network/networkproxyfactory.cpp @@ -52,7 +52,7 @@ NetworkProxyFactory::NetworkProxyFactory() NetworkProxyFactory * NetworkProxyFactory::self() { - static NetworkProxyFactory *instance=0; + static NetworkProxyFactory *instance=nullptr; if (!instance) { instance = new NetworkProxyFactory; } diff --git a/online/onlinedbservice.cpp b/online/onlinedbservice.cpp index 58b1a4596..bcf0ac98e 100644 --- a/online/onlinedbservice.cpp +++ b/online/onlinedbservice.cpp @@ -71,7 +71,7 @@ void OnlineXmlParser::doParsing(NetworkJob *job) OnlineDbService::OnlineDbService(LibraryDb *d, QObject *p) : SqlLibraryModel(d, p, T_Genre) , lastPc(-1) - , job(0) + , job(nullptr) { connect(Covers::self(), SIGNAL(cover(Song,QImage,QString)), this, SLOT(cover(Song,QImage,QString))); } @@ -132,7 +132,7 @@ void OnlineDbService::abort() { if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } db->abortUpdate(); } @@ -143,7 +143,7 @@ void OnlineDbService::cover(const Song &song, const QImage &img, const QString & return; } - const Item *genre=root ? root->getChild(song.genres[0]) : 0; + const Item *genre=root ? root->getChild(song.genres[0]) : nullptr; if (genre) { const Item *artist=static_cast(genre)->getChild(song.artistOrComposer()); if (artist) { @@ -204,7 +204,7 @@ void OnlineDbService::downloadFinished() updateStatus(QString()); emit error(tr("Failed to download")); } - job=0; + job=nullptr; } void OnlineDbService::updateStats() diff --git a/online/onlinedbservice.h b/online/onlinedbservice.h index c8e841516..1e20406b3 100644 --- a/online/onlinedbservice.h +++ b/online/onlinedbservice.h @@ -68,7 +68,7 @@ public: void createDb(); QVariant data(const QModelIndex &index, int role) const override; bool previouslyDownloaded() const; - bool isDownloading() { return 0!=job; } + bool isDownloading() { return nullptr!=job; } void open(); void download(bool redownload); virtual OnlineXmlParser * createParser() = 0; diff --git a/online/onlinedevice.h b/online/onlinedevice.h index b4791ac6a..19d2bd20a 100644 --- a/online/onlinedevice.h +++ b/online/onlinedevice.h @@ -33,7 +33,7 @@ class OnlineDevice : public Device Q_OBJECT public: - OnlineDevice() : Device(0, QString(), QString()), lastProg(-1), overWrite(false), job(0) { } + OnlineDevice() : Device(nullptr, QString(), QString()), lastProg(-1), overWrite(false), job(nullptr) { } ~OnlineDevice() override { } bool isConnected() const override { return true; } diff --git a/online/onlinesearchservice.cpp b/online/onlinesearchservice.cpp index b9082f654..1be6f7f2c 100644 --- a/online/onlinesearchservice.cpp +++ b/online/onlinesearchservice.cpp @@ -27,7 +27,7 @@ OnlineSearchService::OnlineSearchService(QObject *p) : SearchModel(p) - , job(0) + , job(nullptr) { } @@ -67,6 +67,6 @@ void OnlineSearchService::cancel() { if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } } diff --git a/online/podcastsearchdialog.cpp b/online/podcastsearchdialog.cpp index 61f69b537..2e2dcb6bf 100644 --- a/online/podcastsearchdialog.cpp +++ b/online/podcastsearchdialog.cpp @@ -107,7 +107,7 @@ public: result[QLatin1String("artworkUrl100")].toUrl(), QString(), result[QLatin1String("collectionViewUrl")].toString(), - 0); + nullptr); } } }; @@ -134,7 +134,7 @@ public: map[QLatin1String("logo_url")].toUrl(), map[QLatin1String("description")].toString(), map[QLatin1String("website")].toString(), - 0); + nullptr); } } }; @@ -142,8 +142,8 @@ public: PodcastPage::PodcastPage(QWidget *p, const QString &n) : QWidget(p) , pageName(n) - , job(0) - , imageJob(0) + , job(nullptr) + , imageJob(nullptr) { tree = new QTreeWidget(this); tree->setItemDelegate(new BasicItemDelegate(tree)); @@ -189,7 +189,7 @@ void PodcastPage::cancel() spinner->stop(); if (job) { job->cancelAndDelete(); - job=0; + job=nullptr; } } @@ -198,7 +198,7 @@ void PodcastPage::cancelImage() imageSpinner->stop(); if (imageJob) { imageJob->cancelAndDelete(); - imageJob=0; + imageJob=nullptr; } } @@ -292,7 +292,7 @@ void PodcastPage::imageJobFinished() imageCache.insert(imageJob->property(constOrigUrlProperty).toUrl(), new QImage(img), img.byteCount()); updateText(); } - imageJob=0; + imageJob=nullptr; } void PodcastPage::jobFinished() @@ -308,8 +308,8 @@ void PodcastPage::jobFinished() if (spinner) { spinner->stop(); } - parseResonse(j->ok() ? j->actualJob() : 0); - job=0; + parseResonse(j->ok() ? j->actualJob() : nullptr); + job=nullptr; } void PodcastPage::openLink(const QUrl &url) @@ -454,10 +454,10 @@ void OpmlBrowsePage::parseResonse(QIODevice *dev) parsed=parsed.categories.at(0); } for (const OpmlParser::Category &cat: parsed.categories) { - addCategory(cat, 0); + addCategory(cat, nullptr); } for (const OpmlParser::Podcast &pod: parsed.podcasts) { - addPodcast(pod, 0); + addPodcast(pod, nullptr); } if (!isLoadingFromCache && tree->topLevelItemCount()>0) { QString cacheFile=generateCacheFileName(url, true); @@ -561,7 +561,7 @@ void PodcastUrlPage::parseResonse(QIODevice *dev) emit error(tr("Cantata only supports audio podcasts! The URL entered contains only video podcasts.")); return; } - addPodcast(ch.name, currentUrl, ch.image, ch.description, QString(), 0); + addPodcast(ch.name, currentUrl, ch.image, ch.description, QString(), nullptr); } int PodcastSearchDialog::instanceCount() @@ -660,7 +660,7 @@ void PodcastSearchDialog::msgWidgetVisible(bool v) void PodcastSearchDialog::pageChanged() { PageWidgetItem *pwi=pageWidget->currentPage(); - PodcastPage *page=pwi ? qobject_cast(pwi->widget()) : 0; + PodcastPage *page=pwi ? qobject_cast(pwi->widget()) : nullptr; rssSelected(page ? page->currentRss() : QUrl()); } diff --git a/online/podcastservice.cpp b/online/podcastservice.cpp index 98b416c75..247408a79 100644 --- a/online/podcastservice.cpp +++ b/online/podcastservice.cpp @@ -346,7 +346,7 @@ PodcastService::Episode * PodcastService::Podcast::getEpisode(const QUrl &epUrl) return episode; } } - return 0; + return nullptr; } void PodcastService::Podcast::setUnplayedCount() @@ -386,8 +386,8 @@ const Song & PodcastService::Podcast::coverSong() PodcastService::PodcastService(QObject *p) : ActionModel(p) - , downloadJob(0) - , rssUpdateTimer(0) + , downloadJob(nullptr) + , rssUpdateTimer(nullptr) { QMetaObject::invokeMethod(this, "loadAll", Qt::QueuedConnection); icn.addFile(":"+constName); @@ -595,7 +595,7 @@ Qt::ItemFlags PodcastService::flags(const QModelIndex &index) const QMimeData * PodcastService::mimeData(const QModelIndexList &indexes) const { - QMimeData *mimeData=0; + QMimeData *mimeData=nullptr; QStringList paths=filenames(indexes); if (!paths.isEmpty()) { @@ -856,7 +856,7 @@ PodcastService::Podcast * PodcastService::getPodcast(const QUrl &url) const return podcast; } } - return 0; + return nullptr; } void PodcastService::unSubscribe(Podcast *podcast) @@ -1069,7 +1069,7 @@ void PodcastService::cancelDownload() QFile::remove(partial); } updateEpisode(downloadJob->property(constRssUrlProperty).toUrl(), downloadJob->origUrl(), Episode::NotDownloading); - downloadJob=0; + downloadJob=nullptr; } } @@ -1167,7 +1167,7 @@ void PodcastService::downloadJobFinished() QFile::remove(partial); } updateEpisode(job->property(constRssUrlProperty).toUrl(), job->origUrl(), Episode::NotDownloading); - downloadJob=0; + downloadJob=nullptr; doNextDownload(); } diff --git a/online/podcastservice.h b/online/podcastservice.h index 81e434f2c..3bfa13211 100644 --- a/online/podcastservice.h +++ b/online/podcastservice.h @@ -60,7 +60,7 @@ public: QueuedForDownload = -2 }; - Episode(const QDateTime &d=QDateTime(), const QString &n=QString(), const QUrl &u=QUrl(), Podcast *p=0) + Episode(const QDateTime &d=QDateTime(), const QString &n=QString(), const QUrl &u=QUrl(), Podcast *p=nullptr) : Item(n, u), played(false), duration(0), publishedDate(d), parent(p), downloadProg(NotDownloading) { } ~Episode() override { } Song toSong() const; @@ -134,7 +134,7 @@ public: int podcastCount() const { return podcasts.count(); } void clear(); void configure(QWidget *p); - bool subscribedToUrl(const QUrl &url) { return 0!=getPodcast(url); } + bool subscribedToUrl(const QUrl &url) { return nullptr!=getPodcast(url); } void unSubscribe(Podcast *podcast); void refresh(const QModelIndexList &list); void refreshAll(); @@ -147,7 +147,7 @@ public: static QUrl fixUrl(const QUrl &orig); static bool isUrlOk(const QUrl &u) { return QLatin1String("http")==u.scheme() || QLatin1String("https")==u.scheme(); } - bool isDownloading() const { return 0!=downloadJob; } + bool isDownloading() const { return nullptr!=downloadJob; } void cancelAllDownloads(); void downloadPodcasts(Podcast *pod, const QList &episodes); void deleteDownloadedPodcasts(Podcast *pod, const QList &episodes); diff --git a/online/soundcloudservice.cpp b/online/soundcloudservice.cpp index ab8a7cbd3..cf91c14f6 100644 --- a/online/soundcloudservice.cpp +++ b/online/soundcloudservice.cpp @@ -125,6 +125,6 @@ void SoundCloudService::jobFinished() } } results(songs); - job=0; + job=nullptr; emit dataChanged(QModelIndex(), QModelIndex()); } diff --git a/playlists/dynamicplaylists.cpp b/playlists/dynamicplaylists.cpp index 8a695419b..7511b0db0 100644 --- a/playlists/dynamicplaylists.cpp +++ b/playlists/dynamicplaylists.cpp @@ -126,12 +126,12 @@ const QString constFilename=QLatin1String("FILENAME:"); DynamicPlaylists::DynamicPlaylists() : RulesPlaylists("dice", "dynamic") - , localTimer(0) + , localTimer(nullptr) , usingRemote(false) - , remoteTimer(0) + , remoteTimer(nullptr) , remotePollingEnabled(false) , statusTime(0) - , currentJob(0) + , currentJob(nullptr) , currentCommand(Unknown) { connect(this, SIGNAL(clear()), MPDConnection::self(), SLOT(clear())); diff --git a/playlists/playlistproxymodel.h b/playlists/playlistproxymodel.h index cfabee4cc..988d845f2 100644 --- a/playlists/playlistproxymodel.h +++ b/playlists/playlistproxymodel.h @@ -29,7 +29,7 @@ class PlaylistProxyModel : public ProxyModel { public: - PlaylistProxyModel(QObject *parent = 0); + PlaylistProxyModel(QObject *parent = nullptr); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; }; diff --git a/playlists/playlistrulesdialog.cpp b/playlists/playlistrulesdialog.cpp index b2fbff9f1..9e02ec535 100644 --- a/playlists/playlistrulesdialog.cpp +++ b/playlists/playlistrulesdialog.cpp @@ -137,7 +137,7 @@ static void update(QStandardItem *i, const RulesPlaylists::Rule &rule) PlaylistRulesDialog::PlaylistRulesDialog(QWidget *parent, RulesPlaylists *m) : Dialog(parent, "PlaylistRulesDialog") , rules(m) - , dlg(0) + , dlg(nullptr) { QWidget *mainWidet = new QWidget(this); setupUi(mainWidet); diff --git a/playlists/storedplaylistspage.cpp b/playlists/storedplaylistspage.cpp index 2de650822..b89122e3b 100644 --- a/playlists/storedplaylistspage.cpp +++ b/playlists/storedplaylistspage.cpp @@ -207,7 +207,7 @@ void StoredPlaylistsPage::savePlaylist() existing.append(proxy.data(proxy.index(i, 0, QModelIndex())).toString()); } - QString name = InputDialog::getText(tr("Playlist Name"), tr("Enter a name for the playlist:"), lastPlaylist, existing, 0, this); + QString name = InputDialog::getText(tr("Playlist Name"), tr("Enter a name for the playlist:"), lastPlaylist, existing, nullptr, this); if (!name.isEmpty()) { lastPlaylist=name; emit savePlaylist(name, true); @@ -225,7 +225,7 @@ void StoredPlaylistsPage::renamePlaylist() return; } QString name = static_cast(item)->name; - QString newName = InputDialog::getText(tr("Rename Playlist"), tr("Enter new name for playlist:"), name, 0, this); + QString newName = InputDialog::getText(tr("Rename Playlist"), tr("Enter new name for playlist:"), name, nullptr, this); if (!newName.isEmpty() && name!=newName) { if (PlaylistsModel::self()->exists(newName)) { @@ -279,7 +279,7 @@ void StoredPlaylistsPage::removeDuplicates() void StoredPlaylistsPage::itemDoubleClicked(const QModelIndex &index) { - if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) + if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this) || !static_cast(proxy.mapToSource(index).internalPointer())->isPlaylist()) { QModelIndexList indexes; indexes.append(index); diff --git a/scrobbling/scrobbler.cpp b/scrobbling/scrobbler.cpp index c3eb7592a..fa048fd9c 100644 --- a/scrobbling/scrobbler.cpp +++ b/scrobbling/scrobbler.cpp @@ -162,7 +162,7 @@ Scrobbler::Track::Track(const Song &s) } Scrobbler::Scrobbler() - : QObject(0) + : QObject(nullptr) , scrobblingEnabled(false) , loveIsEnabled(false) , scrobbler("Last.fm") @@ -176,8 +176,8 @@ Scrobbler::Scrobbler() , scrobbleViaMpd(false) , failedCount(0) , lastState(MPDState_Inactive) - , authJob(0) - , scrobbleJob(0) + , authJob(nullptr) + , scrobbleJob(nullptr) { hardFailTimer = new QTimer(this); hardFailTimer->setInterval(60*1000); @@ -443,7 +443,7 @@ void Scrobbler::scrobbleNowPlaying() sign(params); DBUG << currentSong.title << currentSong.artist << currentSong.albumartist << currentSong.album << currentSong.track << currentSong.length; nowPlayingSent=true; - lastNowPlaying=time(NULL); + lastNowPlaying=time(nullptr); if (fakeScrobbling) { DBUG << "MSG" << params; } else { @@ -533,7 +533,7 @@ void Scrobbler::scrobbleFinished() if (job==scrobbleJob) { QByteArray data=job->readAll(); DBUG << job->errorString() << data << songQueue.size() << lastScrobbledSongs.size(); - scrobbleJob=0; + scrobbleJob=nullptr; int errorCode=NoError; QXmlStreamReader reader(data); @@ -646,7 +646,7 @@ void Scrobbler::authResp() if (job!=authJob) { return; } - authJob=0; + authJob=nullptr; sessionKey.clear(); QByteArray data=job->readAll(); @@ -778,7 +778,7 @@ void Scrobbler::mpdStateUpdated(bool songChanged) nowPlayingTimer->pause(); break; case MPDState_Playing: { - time_t now=time(NULL); + time_t now=time(nullptr); currentSong.timestamp = now-MPDStatus::self()->timeElapsed(); DBUG << "Timestamp:" << currentSong.timestamp << "scrobbledCurrent:" << scrobbledCurrent << "nowPlayingSent:" << nowPlayingSent << "now:" << now << "lastNowPlaying:" << lastNowPlaying << "isRepeat:" << isRepeat; @@ -841,14 +841,14 @@ void Scrobbler::cancelJobs() authJob->close(); authJob->abort(); authJob->deleteLater(); - authJob=0; + authJob=nullptr; } if (scrobbleJob) { disconnect(scrobbleJob, SIGNAL(finished()), this, SLOT(scrobbleFinished())); authJob->close(); authJob->abort(); authJob->deleteLater(); - scrobbleJob=0; + scrobbleJob=nullptr; } } diff --git a/scrobbling/scrobblingsettings.cpp b/scrobbling/scrobblingsettings.cpp index 171ab92f4..f7a1adce5 100644 --- a/scrobbling/scrobblingsettings.cpp +++ b/scrobbling/scrobblingsettings.cpp @@ -68,7 +68,7 @@ ScrobblingSettings::ScrobblingSettings(QWidget *parent) } else { scrobblerName->setText(scrobbler->itemText(0)); scrobbler->setVisible(false); - scrobblerLabel->setBuddy(0); + scrobblerLabel->setBuddy(nullptr); } scrobblerName->setVisible(scrobbler->count()<2); if (firstMpdClient.isEmpty()) { diff --git a/streams/streamdialog.cpp b/streams/streamdialog.cpp index 1f4aa3182..7c0e99293 100644 --- a/streams/streamdialog.cpp +++ b/streams/streamdialog.cpp @@ -36,7 +36,7 @@ StreamDialog::StreamDialog(QWidget *parent, bool addToPlayQueue) : Dialog(parent) - , saveCheckbox(0) + , saveCheckbox(nullptr) , urlHandlers(MPDConnection::self()->urlHandlers()) { QWidget *wid = new QWidget(this); diff --git a/streams/streamfetcher.cpp b/streams/streamfetcher.cpp index fa2b41867..31c313369 100644 --- a/streams/streamfetcher.cpp +++ b/streams/streamfetcher.cpp @@ -166,7 +166,7 @@ static QString parse(const QByteArray &data) StreamFetcher::StreamFetcher(QObject *p) : QObject(p) - , job(0) + , job(nullptr) , row(0) , playQueueAction(true) , prio(0) @@ -234,7 +234,7 @@ void StreamFetcher::doNext() } if (todo.isEmpty() && !done.isEmpty()) { - job=0; + job=nullptr; emit result(done, row, playQueueAction, prio, decreasePriority); emit status(QString()); } @@ -320,6 +320,6 @@ void StreamFetcher::cancelJob() disconnect(job, SIGNAL(readyRead()), this, SLOT(dataReady())); disconnect(job, SIGNAL(finished()), this, SLOT(jobFinished())); job->cancelAndDelete(); - job=0; + job=nullptr; } } diff --git a/streams/streamproviderlistdialog.cpp b/streams/streamproviderlistdialog.cpp index 411436190..2aba1171e 100644 --- a/streams/streamproviderlistdialog.cpp +++ b/streams/streamproviderlistdialog.cpp @@ -108,9 +108,9 @@ StreamProviderListDialog::StreamProviderListDialog(StreamsSettings *parent) , installed(MonoIcon::icon(FontAwesome::check, QColor(0, 220, 0))) , updateable(MonoIcon::icon(FontAwesome::angledoubledown, QColor(0, 0, 220))) , p(parent) - , job(0) - , spinner(0) - , msgOverlay(0) + , job(nullptr) + , spinner(nullptr) + , msgOverlay(nullptr) { QWidget *wid=new QWidget(this); QBoxLayout *l=new QBoxLayout(QBoxLayout::TopToBottom, wid); @@ -149,7 +149,7 @@ StreamProviderListDialog::~StreamProviderListDialog() if (job) { disconnect(job, SIGNAL(finished()), this, SLOT(jobFinished())); job->cancelAndDelete(); - job=0; + job=nullptr; } } @@ -228,7 +228,7 @@ void StreamProviderListDialog::jobFinished() if (j!=job) { return; } - job=0; + job=nullptr; if (0==tree->topLevelItemCount()) { if (j->ok()) { @@ -297,7 +297,7 @@ void StreamProviderListDialog::readProviders(QIODevice *dev) if (url.isEmpty()) { url=constProviderBaseUrl+name+".streams.gz"; } - QTreeWidgetItem *cat=0; + QTreeWidgetItem *cat=nullptr; if (!categories.contains(currentCat)) { cat=new QTreeWidgetItem(tree, QStringList() << catName(currentCat)); cat->setFlags(Qt::ItemIsEnabled); @@ -373,7 +373,7 @@ void StreamProviderListDialog::slotButtonClicked(int button) if (job) { disconnect(job, SIGNAL(finished()), this, SLOT(jobFinished())); job->cancelAndDelete(); - job=0; + job=nullptr; } reject(); // Need to call this - if not, when dialog is closed by window X control, it is not deleted!!!! diff --git a/streams/streamspage.cpp b/streams/streamspage.cpp index 86a62abed..8655ea6ac 100644 --- a/streams/streamspage.cpp +++ b/streams/streamspage.cpp @@ -97,7 +97,7 @@ void StreamsPage::addToFavourites() StreamsBrowsePage::StreamsBrowsePage(QWidget *p) : SinglePageWidget(p) - , settings(0) + , settings(nullptr) { QColor iconCol=Utils::monoIconColor(); importAction = new Action(MonoIcon::icon(FontAwesome::arrowright, iconCol), tr("Import Streams Into Favorites"), this); @@ -307,7 +307,7 @@ void StreamsBrowsePage::addBookmark() const StreamsModel::Item *item=static_cast(proxy.mapToSource(selected.first()).internalPointer()); // TODO: In future, if other categories support bookmarking, then we will need to calculate parent here!!! - if (StreamsModel::self()->addBookmark(item->url, item->name, 0)) { + if (StreamsModel::self()->addBookmark(item->url, item->name, nullptr)) { view->showMessage(tr("Bookmark added"), constMsgDisplayTime); } else { view->showMessage(tr("Already bookmarked"), constMsgDisplayTime); @@ -502,7 +502,7 @@ void StreamsBrowsePage::doSearch() { QString text=view->searchText().trimmed(); if (!view->isSearchActive()) { - proxy.setFilterItem(0); + proxy.setFilterItem(nullptr); } proxy.update(view->isSearchActive() ? text : QString()); if (proxy.enabled() && !text.isEmpty()) { diff --git a/streams/streamssettings.cpp b/streams/streamssettings.cpp index 3783ba9e1..6d45ec1c1 100644 --- a/streams/streamssettings.cpp +++ b/streams/streamssettings.cpp @@ -60,7 +60,7 @@ static bool removeDir(const QString &d, const QStringList &types) StreamsSettings::StreamsSettings(QWidget *p) : Dialog(p, "StreamsDialog", QSize(400, 500)) - , providerDialog(0) + , providerDialog(nullptr) { setCaption(tr("Configure Streams")); QWidget *mw=new QWidget(this); @@ -336,5 +336,5 @@ QListWidgetItem * StreamsSettings::get(const QString &name) return item; } } - return 0; + return nullptr; } diff --git a/streams/tar.cpp b/streams/tar.cpp index 62fa72b0e..ce9d980ed 100644 --- a/streams/tar.cpp +++ b/streams/tar.cpp @@ -26,8 +26,8 @@ Tar::Tar(const QString &fileName) : file(fileName) - , compressor(0) - , dev(0) + , compressor(nullptr) + , dev(nullptr) { } diff --git a/support/acceleratormanager.cpp b/support/acceleratormanager.cpp index c74f86791..fa74e6681 100644 --- a/support/acceleratormanager.cpp +++ b/support/acceleratormanager.cpp @@ -124,7 +124,7 @@ private: { public: - Item() : m_widget(0), m_children(0), m_index(-1) {} + Item() : m_widget(nullptr), m_children(nullptr), m_index(-1) {} ~Item(); void addChild(Item *item); @@ -273,7 +273,7 @@ void AcceleratorManagerPrivate::traverseChildren(QWidget *widget, Item *item) // Ignore unless we have the direct parent if(qobject_cast(w->parent()) != widget) continue; - if ( !w->isVisibleTo( widget ) || (w->isTopLevel() && qobject_cast(w) == NULL) ) + if ( !w->isVisibleTo( widget ) || (w->isTopLevel() && qobject_cast(w) == nullptr) ) continue; if ( AcceleratorManagerPrivate::ignored_widgets.contains( w ) ) @@ -876,13 +876,13 @@ void PopupAccelManager::setMenuEntries(const AccelStringList &list) void PopupAccelManager::manage(QMenu *popup) { // don't add more than one manager to a popup - if (popup->findChild(QString()) == 0 ) + if (popup->findChild(QString()) == nullptr ) new PopupAccelManager(popup); } void QWidgetStackAccelManager::manage( QStackedWidget *stack ) { - if ( stack->findChild(QString()) == 0 ) + if ( stack->findChild(QString()) == nullptr ) new QWidgetStackAccelManager( stack ); } diff --git a/support/action.h b/support/action.h index 1b9d02d65..f8dbb2658 100644 --- a/support/action.h +++ b/support/action.h @@ -50,8 +50,8 @@ public: static const char * constTtForSettings; explicit Action(QObject *parent); - Action(const QString &text, QObject *parent, const QObject *receiver = 0, const char *slot = 0, const QKeySequence &shortcut = 0); - Action(const QIcon &icon, const QString &text, QObject *parent, const QObject *receiver = 0, const char *slot = 0, const QKeySequence &shortcut = 0); + Action(const QString &text, QObject *parent, const QObject *receiver = nullptr, const char *slot = nullptr, const QKeySequence &shortcut = 0); + Action(const QIcon &icon, const QString &text, QObject *parent, const QObject *receiver = nullptr, const char *slot = nullptr, const QKeySequence &shortcut = 0); QKeySequence shortcut(ShortcutTypes types = ActiveShortcut) const; void setShortcut(const QShortcut &shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut)); diff --git a/support/actioncollection.cpp b/support/actioncollection.cpp index 89935406c..5df4099ef 100644 --- a/support/actioncollection.cpp +++ b/support/actioncollection.cpp @@ -28,8 +28,8 @@ #include static const char *constProp="Category"; -static ActionCollection *coll=0; -static QWidget *mainWidget=0; +static ActionCollection *coll=nullptr; +static QWidget *mainWidget=nullptr; void ActionCollection::setMainWidget(QWidget *w) { mainWidget=w; @@ -51,7 +51,7 @@ Action * ActionCollection::createAction(const QString &name, const QString &text { Action *act = static_cast(addAction(name)); act->setText(text); - if (0!=icon) { + if (nullptr!=icon) { if ('m'==icon[0] && 'e'==icon[1] && 'd'==icon[2] && 'i'==icon[3] && 'a'==icon[4] && '-'==icon[5]) { act->setIcon(Icon::getMediaIcon(icon)); } else { @@ -104,7 +104,7 @@ void ActionCollection::clear() { } QAction *ActionCollection::action(const QString &name) const { - return _actionByName.value(name, 0); + return _actionByName.value(name, nullptr); } QList ActionCollection::actions() const { @@ -140,7 +140,7 @@ QAction *ActionCollection::addAction(const QString &name, QAction *action) { indexName = indexName.sprintf("unnamed-%p", (void *)action); // do we already have this action? - if(_actionByName.value(indexName, 0) == action) + if(_actionByName.value(indexName, nullptr) == action) return action; // or maybe another action under this name? if(QAction *oldAction = _actionByName.value(indexName)) @@ -177,7 +177,7 @@ void ActionCollection::removeAction(QAction *action) { QAction *ActionCollection::takeAction(QAction *action) { if(!unlistAction(action)) - return 0; + return nullptr; for (QWidget *widget: _associatedWidgets) { widget->removeAction(action); diff --git a/support/actioncollection.h b/support/actioncollection.h index d6202d7a1..5d22cd34c 100644 --- a/support/actioncollection.h +++ b/support/actioncollection.h @@ -42,7 +42,7 @@ public: static void setMainWidget(QWidget *w); static ActionCollection * get(); - Action * createAction(const QString &name, const QString &text, const char *icon=0, const QString &whatsThis=QString()); + Action * createAction(const QString &name, const QString &text, const char *icon=nullptr, const QString &whatsThis=QString()); Action * createAction(const QString &name, const QString &text, const QIcon &icon, const QString &whatsThis=QString()); /// Clears the entire action collection, deleting all actions. @@ -75,13 +75,13 @@ public: QAction *addAction(const QString &name, QAction *action); Action *addAction(const QString &name, Action *action); - Action *addAction(const QString &name, const QObject *receiver = 0, const char *member = 0); + Action *addAction(const QString &name, const QObject *receiver = nullptr, const char *member = nullptr); void removeAction(QAction *action); QAction *takeAction(QAction *action); /// Create new action under the given name, add it to the collection and connect its triggered(bool) signal to the specified receiver. template - ActionType *add(const QString &name, const QObject *receiver = 0, const char *member = 0) { + ActionType *add(const QString &name, const QObject *receiver = nullptr, const char *member = nullptr) { ActionType *a = new ActionType(this); if(receiver && member) connect(a, SIGNAL(triggered(bool)), receiver, member); diff --git a/support/buddylabel.cpp b/support/buddylabel.cpp index a50596e05..5db6fe84d 100644 --- a/support/buddylabel.cpp +++ b/support/buddylabel.cpp @@ -47,7 +47,7 @@ BuddyLabel::BuddyLabel(QWidget *p, QWidget *b) bool BuddyLabel::event(QEvent *e) { if (QEvent::Shortcut==e->type()) { - mouseReleaseEvent(0); + mouseReleaseEvent(nullptr); e->accept(); return true; } else { diff --git a/support/buddylabel.h b/support/buddylabel.h index a787d2120..199a7e193 100644 --- a/support/buddylabel.h +++ b/support/buddylabel.h @@ -29,8 +29,8 @@ class BuddyLabel : public QLabel { public: - BuddyLabel(const QString &text, QWidget *p, QWidget *b=0); - BuddyLabel(QWidget *p, QWidget *b=0); + BuddyLabel(const QString &text, QWidget *p, QWidget *b=nullptr); + BuddyLabel(QWidget *p, QWidget *b=nullptr); ~BuddyLabel() override { } protected: diff --git a/support/combobox.cpp b/support/combobox.cpp index 94a892552..8f273e429 100644 --- a/support/combobox.cpp +++ b/support/combobox.cpp @@ -63,7 +63,7 @@ void ComboBox::showPopup() QStyleOptionComboBox opt; initStyleOption(&opt); toggleState=false; - bool hack=0!=style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this, 0); + bool hack=0!=style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this, nullptr); if (hack && count()>(maxPopupItemCount-2)) { toggleState=!isEditable(); diff --git a/support/configdialog.cpp b/support/configdialog.cpp index d1926292a..4ac5199ce 100644 --- a/support/configdialog.cpp +++ b/support/configdialog.cpp @@ -287,7 +287,7 @@ void ConfigDialog::setH(int h) QWidget * ConfigDialog::getPage(const QString &id) const { if (!pages.contains(id)) { - return 0; + return nullptr; } #ifdef __APPLE__ diff --git a/support/dialog.cpp b/support/dialog.cpp index 4dcf2b937..ce2e0169d 100644 --- a/support/dialog.cpp +++ b/support/dialog.cpp @@ -40,8 +40,8 @@ Dialog::Dialog(QWidget *parent, const QString &name, const QSize &defSize) : QDialog(parent) , defButton(0) , buttonTypes(0) - , mw(0) - , buttonBox(0) + , mw(nullptr) + , buttonBox(nullptr) , shown(false) { if (!name.isEmpty()) { @@ -390,7 +390,7 @@ void Dialog::create() QAbstractButton *Dialog::getButton(ButtonCode button) { QDialogButtonBox::StandardButton mapped=mapType(button); - QAbstractButton *b=QDialogButtonBox::NoButton==mapped ? 0 : buttonBox->button(mapped); + QAbstractButton *b=QDialogButtonBox::NoButton==mapped ? nullptr : buttonBox->button(mapped); if (!b && userButtons.contains(button)) { b=userButtons[button]; } diff --git a/support/fancytabwidget.cpp b/support/fancytabwidget.cpp index d6d47c997..762e3672b 100644 --- a/support/fancytabwidget.cpp +++ b/support/fancytabwidget.cpp @@ -242,7 +242,7 @@ FancyTabBar::FancyTabBar(QWidget *parent, bool text, int iSize, Pos pos) setMouseTracking(true); // Needed for hover events triggerTimer.setSingleShot(true); - QBoxLayout* layout=0; + QBoxLayout* layout=nullptr; if (Side!=pos) { setMinimumHeight(tabSizeHint().height()); @@ -473,12 +473,12 @@ void FancyTabBar::setCurrentIndex(int index) FancyTabWidget::FancyTabWidget(QWidget *parent) : QWidget(parent) , styleSetting(0) - , tabBar(NULL) + , tabBar(nullptr) , stack_(new QStackedWidget(this)) , sideWidget(new QWidget) , sideLayout(new QVBoxLayout) , topLayout(new QVBoxLayout) - , menu(0) + , menu(nullptr) , proxyStyle(new FancyTabProxyStyle) { sideLayout->setSpacing(0); @@ -576,7 +576,7 @@ void FancyTabWidget::setStyle(int s) } // Remove previous tab bar delete tabBar; - tabBar = NULL; + tabBar = nullptr; // use_background_ = false; // Create new tab bar diff --git a/support/flattoolbutton.h b/support/flattoolbutton.h index f328d9789..ccb2baab9 100644 --- a/support/flattoolbutton.h +++ b/support/flattoolbutton.h @@ -33,7 +33,7 @@ public: explicit FlatToolButton(QWidget *parent = 0); void paintEvent(QPaintEvent *e); #else - explicit FlatToolButton(QWidget *parent = 0) : QToolButton(parent) { setAutoRaise(true); } + explicit FlatToolButton(QWidget *parent = nullptr) : QToolButton(parent) { setAutoRaise(true); } #endif }; diff --git a/support/gtkstyle.cpp b/support/gtkstyle.cpp index 5cf3f9f46..e9f39d31b 100644 --- a/support/gtkstyle.cpp +++ b/support/gtkstyle.cpp @@ -76,7 +76,7 @@ void GtkStyle::drawSelection(const QStyleOptionViewItem &opt, QPainter *painter, styleOpt.state|=QStyle::State_Selected|QStyle::State_Enabled|QStyle::State_Active; styleOpt.viewItemPosition = QStyleOptionViewItem::OnlyOne; styleOpt.rect=QRect(0, 0, opt.rect.width(), opt.rect.height()); - QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &styleOpt, &p, 0); + QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &styleOpt, &p, nullptr); p.end(); cache.insert(key, pix, pix->width()*pix->height()); } diff --git a/support/icon.cpp b/support/icon.cpp index 71f4cd82a..82cd48d0f 100644 --- a/support/icon.cpp +++ b/support/icon.cpp @@ -56,7 +56,7 @@ int Icon::dlgIconSize() static int size=-1; if (-1==size) { - QMessageBox *box=new QMessageBox(0); + QMessageBox *box=new QMessageBox(nullptr); box->setVisible(false); box->setIcon(QMessageBox::Information); box->ensurePolished(); diff --git a/support/inputdialog.cpp b/support/inputdialog.cpp index aceb6f5a7..93687ab91 100644 --- a/support/inputdialog.cpp +++ b/support/inputdialog.cpp @@ -81,7 +81,7 @@ void InputDialog::addExtraWidget(QWidget *w) void InputDialog::init(int type, const QString &caption, const QString &labelText) { - extra = 0; + extra = nullptr; setButtons(Ok|Cancel); QWidget *wid=new QWidget(this); QVBoxLayout *layout=new QVBoxLayout(wid); diff --git a/support/inputdialog.h b/support/inputdialog.h index 4c565d5be..d6eb7e432 100644 --- a/support/inputdialog.h +++ b/support/inputdialog.h @@ -41,13 +41,13 @@ public: InputDialog(const QString &caption, const QString &label, int value, int minValue, int maxValue, int step, QWidget *parent); static QString getText(const QString &caption, const QString &label, QLineEdit::EchoMode echoMode, const QString &value=QString(), - const QStringList &options=QStringList(), bool *ok=0, QWidget *parent=0); + const QStringList &options=QStringList(), bool *ok=nullptr, QWidget *parent=nullptr); static int getInteger(const QString &caption, const QString &label, int value=0, int minValue=INT_MIN, int maxValue=INT_MAX, - int step=1, int base=10, bool *ok=0, QWidget *parent=0); + int step=1, int base=10, bool *ok=nullptr, QWidget *parent=nullptr); static QString getText(const QString &caption, const QString &label, const QString &value=QString(), - const QStringList &options=QStringList(), bool *ok=0, QWidget *parent=0) { + const QStringList &options=QStringList(), bool *ok=nullptr, QWidget *parent=nullptr) { return getText(caption, label, QLineEdit::Normal, value, options, ok, parent); } @@ -60,7 +60,7 @@ public: return getText(caption, label, QLineEdit::Normal, value, QStringList(), ok, parent); } - static QString getPassword(const QString &value=QString(), bool *ok=0, QWidget *parent=0) { + static QString getPassword(const QString &value=QString(), bool *ok=nullptr, QWidget *parent=nullptr) { return getText(tr("Password"), tr("Please enter password:"), QLineEdit::Password, value, QStringList(), ok, parent); } diff --git a/support/keysequencewidget.cpp b/support/keysequencewidget.cpp index b790f0625..539fa560a 100644 --- a/support/keysequencewidget.cpp +++ b/support/keysequencewidget.cpp @@ -163,7 +163,7 @@ void KeySequenceButton::keyReleaseEvent(QKeyEvent *e) KeySequenceWidget::KeySequenceWidget(QWidget *parent) : QWidget(parent), - _shortcutsModel(0), + _shortcutsModel(nullptr), _isRecording(false), _modifierKeys(0) { diff --git a/support/keysequencewidget.h b/support/keysequencewidget.h index 4cd40dc1d..81f322a32 100644 --- a/support/keysequencewidget.h +++ b/support/keysequencewidget.h @@ -44,7 +44,7 @@ class KeySequenceWidget : public QWidget { Q_OBJECT public: - KeySequenceWidget(QWidget *parent = 0); + KeySequenceWidget(QWidget *parent = nullptr); void setModel(ShortcutsModel *model); @@ -95,7 +95,7 @@ class KeySequenceButton : public QPushButton { Q_OBJECT public: - explicit KeySequenceButton(KeySequenceWidget *d, QWidget *parent = 0); + explicit KeySequenceButton(KeySequenceWidget *d, QWidget *parent = nullptr); protected: bool event(QEvent *event) override; diff --git a/support/kmessagewidget.cpp b/support/kmessagewidget.cpp index 41445f056..3b3d8e44f 100644 --- a/support/kmessagewidget.cpp +++ b/support/kmessagewidget.cpp @@ -260,7 +260,7 @@ void KMsgWidget::setMessageType(KMsgWidget::MessageType type) .arg(bg2.name()) .arg(border.name()) // DefaultFrameWidth returns the size of the external margin + border width. We know our border is 1px, so we subtract this from the frame normal QStyle FrameWidth to get our margin - .arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this) -1) + .arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this) -1) .arg(fg.name()) ); } diff --git a/support/kmessagewidget.h b/support/kmessagewidget.h index c4ccb371c..f8595385c 100644 --- a/support/kmessagewidget.h +++ b/support/kmessagewidget.h @@ -108,9 +108,9 @@ public: /** * Constructs a KMsgWidget with the specified parent. */ - explicit KMsgWidget(QWidget *parent = 0); + explicit KMsgWidget(QWidget *parent = nullptr); - explicit KMsgWidget(const QString &text, QWidget *parent = 0); + explicit KMsgWidget(const QString &text, QWidget *parent = nullptr); ~KMsgWidget() override; diff --git a/support/lineedit.h b/support/lineedit.h index 5cf29fed8..0586c61ee 100644 --- a/support/lineedit.h +++ b/support/lineedit.h @@ -29,7 +29,7 @@ class LineEdit : public QLineEdit { public: - LineEdit(QWidget *parent = 0) : QLineEdit(parent) { setClearButtonEnabled(true); } + LineEdit(QWidget *parent = nullptr) : QLineEdit(parent) { setClearButtonEnabled(true); } void setReadOnly(bool e); }; diff --git a/support/pagewidget.cpp b/support/pagewidget.cpp index 31a1c848e..0d6b60eb0 100644 --- a/support/pagewidget.cpp +++ b/support/pagewidget.cpp @@ -265,7 +265,7 @@ PageWidgetItem::PageWidgetItem(QWidget *p, const QString &header, const QIcon &i { QBoxLayout *layout=new QBoxLayout(QBoxLayout::TopToBottom, this); if (showHeader) { - QBoxLayout *titleLayout=new QBoxLayout(QBoxLayout::LeftToRight, 0); + QBoxLayout *titleLayout=new QBoxLayout(QBoxLayout::LeftToRight, nullptr); titleLayout->addWidget(new QLabel(""+header+"", this)); titleLayout->addItem(new QSpacerItem(16, 16, QSizePolicy::Expanding, QSizePolicy::Minimum)); diff --git a/support/shortcutsmodel.h b/support/shortcutsmodel.h index 689c70be8..fe97f96b5 100644 --- a/support/shortcutsmodel.h +++ b/support/shortcutsmodel.h @@ -42,7 +42,7 @@ public: IsConfigurableRole }; - ShortcutsModel(const QHash &actionCollections, QObject *parent = 0); + ShortcutsModel(const QHash &actionCollections, QObject *parent = nullptr); ~ShortcutsModel() override; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; @@ -79,7 +79,7 @@ signals: private: struct Item { - inline Item() : row(-1), parentItem(0), collection(0), action(0) { } + inline Item() : row(-1), parentItem(nullptr), collection(nullptr), action(nullptr) { } inline ~Item() { qDeleteAll(actionItems); } int row; Item *parentItem; diff --git a/support/shortcutssettingswidget.h b/support/shortcutssettingswidget.h index 06f5fcd04..06000df4b 100644 --- a/support/shortcutssettingswidget.h +++ b/support/shortcutssettingswidget.h @@ -30,7 +30,7 @@ class ShortcutsModel; class ShortcutsFilter : public QSortFilterProxyModel { Q_OBJECT public: - ShortcutsFilter(QObject *parent = 0); + ShortcutsFilter(QObject *parent = nullptr); public Q_SLOTS: void setFilterString(const QString &filterString); @@ -45,7 +45,7 @@ private: class ShortcutsSettingsWidget : public QWidget, private Ui::ShortcutsSettingsWidget { Q_OBJECT public: - ShortcutsSettingsWidget(const QHash &actionCollections, QWidget *parent = 0); + ShortcutsSettingsWidget(const QHash &actionCollections, QWidget *parent = nullptr); inline bool hasDefaults() const { return true; } QTreeView * view(); diff --git a/support/spinner.cpp b/support/spinner.cpp index ef8169621..15184f923 100644 --- a/support/spinner.cpp +++ b/support/spinner.cpp @@ -31,8 +31,8 @@ #include Spinner::Spinner(QObject *p, bool inMiddle) - : QWidget(0) - , timer(0) + : QWidget(nullptr) + , timer(nullptr) , space(Utils::scaleForDpi(4)) , value(0) , active(false) diff --git a/support/thread.h b/support/thread.h index 6d46287fe..9139fe23d 100644 --- a/support/thread.h +++ b/support/thread.h @@ -58,7 +58,7 @@ class Thread : public QThread { Q_OBJECT public: - Thread(const QString &name, QObject *p=0); + Thread(const QString &name, QObject *p=nullptr); ~Thread() override; // Make QThread::msleep accessible! @@ -66,7 +66,7 @@ public: void run() override; - QTimer * createTimer(QObject *parent=0); + QTimer * createTimer(QObject *parent=nullptr); void deleteTimer(QTimer *timer); public Q_SLOTS: diff --git a/support/utils.cpp b/support/utils.cpp index bab94f113..72259fdb0 100644 --- a/support/utils.cpp +++ b/support/utils.cpp @@ -811,7 +811,7 @@ void Utils::clearOldCache(const QString &sub, int maxAge) void Utils::touchFile(const QString &fileName) { - ::utime(QFile::encodeName(fileName).constData(), 0); + ::utime(QFile::encodeName(fileName).constData(), nullptr); } double Utils::smallFontFactor(const QFont &f) @@ -872,7 +872,7 @@ bool Utils::limitedHeight(QWidget *w) void Utils::resizeWindow(QWidget *w, bool preserveWidth, bool preserveHeight) { - QWidget *window=w ? w->window() : 0; + QWidget *window=w ? w->window() : nullptr; if (window) { QSize was=window->size(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); diff --git a/tags/filetyperesolver.cpp b/tags/filetyperesolver.cpp index 967bb8b39..61fce4a36 100644 --- a/tags/filetyperesolver.cpp +++ b/tags/filetyperesolver.cpp @@ -51,7 +51,7 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName, bool readProperties, TagLib::AudioProperties::ReadStyle propertiesStyle) const { - TagLib::File* result = 0; + TagLib::File* result = nullptr; QString fn = QFile::decodeName(fileName); QString suffix = QFileInfo(fn).suffix(); @@ -105,7 +105,7 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName, if (result && !result->isValid()) { delete result; - result = 0; + result = nullptr; } return result; diff --git a/tags/tageditor.cpp b/tags/tageditor.cpp index 0206d08b5..dfe13282f 100644 --- a/tags/tageditor.cpp +++ b/tags/tageditor.cpp @@ -122,8 +122,8 @@ TagEditor::TagEditor(QWidget *parent, const QList &songs, , saving(false) , composerSupport(false) , commentSupport(false) - , readRatingsAct(0) - , writeRatingsAct(0) + , readRatingsAct(nullptr) + , writeRatingsAct(nullptr) { iCount++; bool ratingsSupport=false; @@ -1118,7 +1118,7 @@ bool TagEditor::applyUpdates() DeviceOptions opts; QString udi; #ifdef ENABLE_DEVICES_SUPPORT - Device * dev=0; + Device * dev=nullptr; if (!deviceUdi.isEmpty()) { dev=getDevice(deviceUdi, this); if (!dev) { @@ -1279,17 +1279,17 @@ Device * TagEditor::getDevice(const QString &udi, QWidget *p) if (!dev) { MessageBox::error(p ? p : this, tr("Device has been removed!")); reject(); - return 0; + return nullptr; } if (!dev->isConnected()) { MessageBox::error(p ? p : this, tr("Device is not connected.")); reject(); - return 0; + return nullptr; } if (!dev->isIdle()) { MessageBox::error(p ? p : this, tr("Device is busy?")); reject(); - return 0; + return nullptr; } return dev; } diff --git a/tags/taghelperiface.cpp b/tags/taghelperiface.cpp index a74883ffb..0b418d6ed 100644 --- a/tags/taghelperiface.cpp +++ b/tags/taghelperiface.cpp @@ -48,10 +48,10 @@ TagHelperIface::TagHelperIface() : msgStatus(true) , dataSize(0) , awaitingResponse(false) - , thread(0) - , proc(0) - , server(0) - , sock(0) + , thread(nullptr) + , proc(nullptr) + , server(nullptr) + , sock(nullptr) { qRegisterMetaType("QAbstractSocket::SocketError"); thread=new Thread(metaObject()->className()); @@ -68,7 +68,7 @@ void TagHelperIface::stop() sema.acquire(); DBUG << "Stop thread"; thread->stop(); - thread=0; + thread=nullptr; } } @@ -359,13 +359,13 @@ void TagHelperIface::stopHelper() sock->flush(); sock->close(); sock->deleteLater(); - sock=0; + sock=nullptr; } if (server) { DBUG << "Server" << (void *)server; server->close(); server->deleteLater(); - server=0; + server=nullptr; } if (proc) { disconnect(proc, SIGNAL(finished(int)), this, SLOT(helperClosed())); @@ -375,7 +375,7 @@ void TagHelperIface::stopHelper() proc->waitForFinished(10); } proc->deleteLater(); - proc=0; + proc=nullptr; } setStatus(false); } diff --git a/tags/tags.cpp b/tags/tags.cpp index 1aa277e00..a1b8f9677 100644 --- a/tags/tags.cpp +++ b/tags/tags.cpp @@ -266,7 +266,7 @@ static void setTxxxTag(TagLib::ID3v2::Tag *tag, const std::string &tagName, cons static void setRva2Tag(TagLib::ID3v2::Tag *tag, const std::string &tagName, double gain, double peak) { - TagLib::ID3v2::RelativeVolumeFrame *frame = NULL; + TagLib::ID3v2::RelativeVolumeFrame *frame = nullptr; TagLib::ID3v2::FrameList frameList = tag->frameList("RVA2"); TagLib::ID3v2::FrameList::ConstIterator it = frameList.begin(); for (; it != frameList.end(); ++it) { @@ -456,7 +456,7 @@ static bool updateID3v2Tag(TagLib::ID3v2::Tag *tag, const char *tagName, const Q } } else { TagLib::ID3v2::TextIdentificationFrame *frame=frameList.isEmpty() - ? 0 : dynamic_cast(frameList.front()); + ? nullptr : dynamic_cast(frameList.front()); if (!frame) { frame = new TagLib::ID3v2::TextIdentificationFrame(tagName); @@ -540,7 +540,7 @@ static bool writeID3v2Tags(TagLib::ID3v2::Tag *tag, const Song &from, const Song if (rating>-1) { int old=-1; - readID3v2Tags(tag, 0, 0, 0, 0, &old); + readID3v2Tags(tag, nullptr, nullptr, nullptr, nullptr, &old); if (old!=rating) { while (clearTxxxTag(tag, "FMPS_RATING")); setTxxxTag(tag, "FMPS_RATING", convertFromCantataRating(rating)); @@ -669,7 +669,7 @@ static bool writeAPETags(TagLib::APE::Tag *tag, const Song &from, const Song &to if (rating>-1) { int old=-1; - readAPETags(tag, 0, 0, 0, &old); + readAPETags(tag, nullptr, nullptr, nullptr, &old); if (old!=rating) { tag->addValue("FMPS_RATING", convertFromCantataRating(rating)); changed=true; @@ -845,7 +845,7 @@ static bool writeVorbisCommentTags(TagLib::Ogg::XiphComment *tag, const Song &fr if (rating>-1) { int old=-1; - readVorbisCommentTags(tag, 0, 0, 0, 0, &old); + readVorbisCommentTags(tag, nullptr, nullptr, nullptr, nullptr, &old); if (old!=rating) { tag->addField("FMPS_RATING", convertFromCantataRating(rating)); changed=true; @@ -986,7 +986,7 @@ static bool writeMP4Tags(TagLib::MP4::Tag *tag, const Song &from, const Song &to if (rating>-1) { int old=-1; - readMP4Tags(tag, 0, 0, 0, 0, &old); + readMP4Tags(tag, nullptr, nullptr, nullptr, nullptr, &old); if (old!=rating) { TagLib::MP4::ItemListMap &map = tag->itemListMap(); map["----:com.apple.iTunes:FMPS_Rating"] = TagLib::MP4::Item(TagLib::StringList(convertFromCantataRating(rating))); @@ -1077,7 +1077,7 @@ static bool writeASFTags(TagLib::ASF::Tag *tag, const Song &from, const Song &to if (rating>-1) { int old=-1; - readASFTags(tag, 0, &old); + readASFTags(tag, nullptr, &old); if (old!=rating) { tag->addAttribute("FMPS/Rating", TagLib::String(convertFromCantataRating(rating))); changed=true; @@ -1310,7 +1310,7 @@ Song read(const QString &fileName) return song; } - readTags(fileref, &song, 0, 0, 0, 0); + readTags(fileref, &song, nullptr, nullptr, nullptr, nullptr); song.file=fileName; song.time=fileref.audioProperties() ? fileref.audioProperties()->length() : 0; return song; @@ -1324,7 +1324,7 @@ QImage readImage(const QString &fileName) return img; } - readTags(fileref, 0, 0, &img, 0, 0); + readTags(fileref, nullptr, nullptr, &img, nullptr, nullptr); return img; } @@ -1336,7 +1336,7 @@ QString readLyrics(const QString &fileName) return lyrics; } - readTags(fileref, 0, 0, 0, &lyrics, 0); + readTags(fileref, nullptr, nullptr, nullptr, &lyrics, nullptr); return lyrics; } @@ -1406,7 +1406,7 @@ ReplayGain readReplaygain(const QString &fileName) } ReplayGain rg; - readTags(fileref, 0, &rg, 0, 0, 0); + readTags(fileref, nullptr, &rg, nullptr, nullptr, nullptr); return rg; } @@ -1459,7 +1459,7 @@ int readRating(const QString &fileName) int rating=-1; TagLib::FileRef fileref = getFileRef(fileName); if (!fileref.isNull()) { - readTags(fileref, 0, 0, 0, 0, &rating); + readTags(fileref, nullptr, nullptr, nullptr, nullptr, &rating); } return rating; } diff --git a/tags/trackorganiser.cpp b/tags/trackorganiser.cpp index 126d89ba4..1334d79ca 100644 --- a/tags/trackorganiser.cpp +++ b/tags/trackorganiser.cpp @@ -56,7 +56,7 @@ int TrackOrganiser::instanceCount() TrackOrganiser::TrackOrganiser(QWidget *parent) : SongDialog(parent, "TrackOrganiser", QSize(800, 500)) - , schemeDlg(0) + , schemeDlg(nullptr) , autoSkip(false) , paused(false) , updated(false) @@ -371,7 +371,7 @@ void TrackOrganiser::renameFile() QDir sArtistDir(sDir); sArtistDir.cdUp(); QDir dDir(Utils::getDir(dest)); #ifdef ENABLE_DEVICES_SUPPORT - Device *dev=deviceUdi.isEmpty() ? 0 : getDevice(); + Device *dev=deviceUdi.isEmpty() ? nullptr : getDevice(); if (sDir.absolutePath()!=dDir.absolutePath()) { Device::moveDir(sDir.absolutePath(), dDir.absolutePath(), musicFolder, dev ? dev->coverFile() : QString(Covers::albumFileName(s)+QLatin1String(".jpg"))); @@ -546,17 +546,17 @@ Device * TrackOrganiser::getDevice(QWidget *p) if (!dev) { MessageBox::error(p ? p : this, tr("Device has been removed!")); reject(); - return 0; + return nullptr; } if (!dev->isConnected()) { MessageBox::error(p ? p : this, tr("Device is not connected.")); reject(); - return 0; + return nullptr; } if (!dev->isIdle()) { MessageBox::error(p ? p : this, tr("Device is busy?")); reject(); - return 0; + return nullptr; } return dev; } diff --git a/tags/trackorganiser.h b/tags/trackorganiser.h index 0869811ca..3d2ca0736 100644 --- a/tags/trackorganiser.h +++ b/tags/trackorganiser.h @@ -67,7 +67,7 @@ private: void slotButtonClicked(int button) override; void readOptions(); #ifdef ENABLE_DEVICES_SUPPORT - Device * getDevice(QWidget *p=0); + Device * getDevice(QWidget *p=nullptr); #endif void doUpdate(); void finish(bool ok); diff --git a/widgets/actionitemdelegate.cpp b/widgets/actionitemdelegate.cpp index e4041718a..ed70adf20 100644 --- a/widgets/actionitemdelegate.cpp +++ b/widgets/actionitemdelegate.cpp @@ -168,13 +168,13 @@ QAction * ActionItemDelegate::getAction(const QModelIndex &index) const { QList actions=index.data(Cantata::Role_Actions).value >(); if (actions.isEmpty()) { - return 0; + return nullptr; } QAbstractItemView *view=(QAbstractItemView *)parent(); bool rtl = QApplication::isRightToLeft(); QListView *lv=qobject_cast(view); - GroupedView *gv=lv ? 0 : qobject_cast(view); + GroupedView *gv=lv ? nullptr : qobject_cast(view); ActionPos actionPos=gv ? AP_HBottom : (lv && QListView::ListMode!=lv->viewMode() && (index.child(0, 0).isValid() || index.model()->canFetchMore(index)) ? AP_VTop : AP_HMiddle); QRect rect = view->visualRect(index); rect.moveTo(view->viewport()->mapToGlobal(QPoint(rect.x(), rect.y()))); @@ -210,5 +210,5 @@ QAction * ActionItemDelegate::getAction(const QModelIndex &index) const ActionItemDelegate::adjustActionRect(rtl, actionPos, actionRect, iconSize); } - return 0; + return nullptr; } diff --git a/widgets/actionlabel.cpp b/widgets/actionlabel.cpp index dfbf66cbc..9c0178d6a 100644 --- a/widgets/actionlabel.cpp +++ b/widgets/actionlabel.cpp @@ -81,7 +81,7 @@ ActionLabel::~ActionLabel() if (0==--theUsageCount) { for (int i=0; i -static Action *action=0; +static Action *action=nullptr; GenreCombo::GenreCombo(QWidget *p) : ComboBox(p) @@ -37,7 +37,7 @@ GenreCombo::GenreCombo(QWidget *p) setEditable(false); setFocusPolicy(Qt::NoFocus); if (!action) { - action=ActionCollection::get()->createAction("genrefilter", tr("Filter On Genre"), 0); + action=ActionCollection::get()->createAction("genrefilter", tr("Filter On Genre"), nullptr); action->setShortcut(Qt::ControlModifier+Qt::Key_G); } addAction(action); diff --git a/widgets/groupedview.cpp b/widgets/groupedview.cpp index 2b70f2393..d97656f36 100644 --- a/widgets/groupedview.cpp +++ b/widgets/groupedview.cpp @@ -188,7 +188,7 @@ static QString streamText(const Song &song, const QString &trackTitle, bool useN GroupedViewDelegate::GroupedViewDelegate(GroupedView *p) : ActionItemDelegate(p) , view(p) - , ratingPainter(0) + , ratingPainter(nullptr) { } diff --git a/widgets/groupedview.h b/widgets/groupedview.h index bfe4cd39f..d37db09fd 100644 --- a/widgets/groupedview.h +++ b/widgets/groupedview.h @@ -69,7 +69,7 @@ public: static int iconSize(); static void drawPlayState(QPainter *painter, const QStyleOptionViewItem &option, const QRect &r, int state); - GroupedView(QWidget *parent=0, bool isPlayQueue=false); + GroupedView(QWidget *parent=nullptr, bool isPlayQueue=false); ~GroupedView() override; void setModel(QAbstractItemModel *model) override; diff --git a/widgets/itemview.cpp b/widgets/itemview.cpp index b45d821e7..68ce99cde 100644 --- a/widgets/itemview.cpp +++ b/widgets/itemview.cpp @@ -110,7 +110,7 @@ bool KeyEventHandler::eventFilter(QObject *obj, QEvent *event) } ViewEventHandler::ViewEventHandler(ActionItemDelegate *d, QAbstractItemView *v) - : KeyEventHandler(v, 0) + : KeyEventHandler(v, nullptr) , delegate(d) { } @@ -382,7 +382,7 @@ public: opt.direction=QApplication::layoutDirection(); opt.fontMetrics=textMetrics; - QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter, 0L); + QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter, nullptr); } if (drawBgnd && mouseOver) { @@ -405,7 +405,7 @@ class TreeDelegate : public ListDelegate { public: TreeDelegate(QAbstractItemView *p) - : ListDelegate(0, p) + : ListDelegate(nullptr, p) , simpleStyle(true) , treeView(p) { @@ -587,7 +587,7 @@ QString ItemView::modeStr(Mode m) static const char *constPageProp="page"; static const char *constAlwaysShowProp="always"; -static Action *backAction=0; +static Action *backAction=nullptr; static const QLatin1String constZoomKey("gridZoom"); const QLatin1String ItemView::constSearchActiveKey("searchActive"); @@ -601,14 +601,14 @@ static const double constZoomStep = 0.25; ItemView::ItemView(QWidget *p) : QWidget(p) - , searchTimer(0) - , itemModel(0) + , searchTimer(nullptr) + , itemModel(nullptr) , currentLevel(0) , mode(Mode_SimpleTree) - , groupedView(0) - , tableView(0) - , spinner(0) - , msgOverlay(0) + , groupedView(nullptr) + , tableView(nullptr) + , spinner(nullptr) + , msgOverlay(nullptr) , performedSearch(false) , searchResetLevel(0) , openFirstLevelAfterSearch(false) @@ -742,7 +742,7 @@ void ItemView::allowTableView(TableView *v) tableView->setParent(stackedWidget); stackedWidget->addWidget(tableView); tableView->setProperty(constPageProp, stackedWidget->count()-1); - ViewEventHandler *viewHandler=new ViewEventHandler(0, tableView); + ViewEventHandler *viewHandler=new ViewEventHandler(nullptr, tableView); tableView->installFilter(viewHandler); connect(tableView, SIGNAL(itemsSelected(bool)), this, SIGNAL(itemsSelected(bool))); connect(tableView, SIGNAL(itemActivated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &))); @@ -799,13 +799,13 @@ void ItemView::setMode(Mode m) mode=m; int stackIndex=0; if (usingTreeView()) { - listView->setModel(0); + listView->setModel(nullptr); if (groupedView) { - groupedView->setModel(0); + groupedView->setModel(nullptr); } if (tableView) { tableView->saveHeader(); - tableView->setModel(0); + tableView->setModel(nullptr); } treeView->setModel(itemModel); treeView->setHidden(false); @@ -816,11 +816,11 @@ void ItemView::setMode(Mode m) } treeView->reset(); } else if (Mode_GroupedTree==mode) { - treeView->setModel(0); - listView->setModel(0); + treeView->setModel(nullptr); + listView->setModel(nullptr); if (tableView) { tableView->saveHeader(); - tableView->setModel(0); + tableView->setModel(nullptr); } groupedView->setHidden(false); treeView->setHidden(true); @@ -831,10 +831,10 @@ void ItemView::setMode(Mode m) stackIndex=groupedView->property(constPageProp).toInt(); } else if (Mode_Table==mode) { int w=view()->width(); - treeView->setModel(0); - listView->setModel(0); + treeView->setModel(nullptr); + listView->setModel(nullptr); if (groupedView) { - groupedView->setModel(0); + groupedView->setModel(nullptr); } tableView->setHidden(false); treeView->setHidden(true); @@ -847,13 +847,13 @@ void ItemView::setMode(Mode m) stackIndex=tableView->property(constPageProp).toInt(); } else { stackIndex=1; - treeView->setModel(0); + treeView->setModel(nullptr); if (groupedView) { - groupedView->setModel(0); + groupedView->setModel(nullptr); } if (tableView) { tableView->saveHeader(); - tableView->setModel(0); + tableView->setModel(nullptr); } listView->setModel(itemModel); goToTop(); @@ -1372,8 +1372,8 @@ void ItemView::setExpanded(const QModelIndex &idx, bool exp) QAction * ItemView::getAction(const QModelIndex &index) { QAbstractItemDelegate *abs=view()->itemDelegate(); - ActionItemDelegate *d=abs ? qobject_cast(abs) : 0; - return d ? d->getAction(index) : 0; + ActionItemDelegate *d=abs ? qobject_cast(abs) : nullptr; + return d ? d->getAction(index) : nullptr; } void ItemView::itemClicked(const QModelIndex &index) diff --git a/widgets/itemview.h b/widgets/itemview.h index 7b7874c11..afed485a3 100644 --- a/widgets/itemview.h +++ b/widgets/itemview.h @@ -45,7 +45,7 @@ class KeyEventHandler : public QObject { Q_OBJECT public: - KeyEventHandler(QAbstractItemView *v, QAction *a=0); + KeyEventHandler(QAbstractItemView *v, QAction *a=nullptr); void setDeleteAction(QAction *a) { deleteAct=a; } Q_SIGNALS: void backspacePressed(); @@ -96,7 +96,7 @@ public: static const QLatin1String constStartClosedKey; static const QLatin1String constSearchCategoryKey; - ItemView(QWidget *p=0); + ItemView(QWidget *p=nullptr); ~ItemView() override; void alwaysShowHeader(); diff --git a/widgets/listview.cpp b/widgets/listview.cpp index 31ba5a144..b95b6fa5f 100644 --- a/widgets/listview.cpp +++ b/widgets/listview.cpp @@ -37,8 +37,8 @@ ListView::ListView(QWidget *parent) : QListView(parent) - , eventFilter(0) - , menu(0) + , eventFilter(nullptr) + , menu(nullptr) , zoomLevel(1.0) { setDragEnabled(true); diff --git a/widgets/listview.h b/widgets/listview.h index 62d428a4c..27a40e631 100644 --- a/widgets/listview.h +++ b/widgets/listview.h @@ -36,7 +36,7 @@ class ListView : public QListView Q_OBJECT public: - ListView(QWidget *parent=0); + ListView(QWidget *parent=nullptr); ~ListView() override; void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override; diff --git a/widgets/menubutton.h b/widgets/menubutton.h index 2410c8196..283f48d9f 100644 --- a/widgets/menubutton.h +++ b/widgets/menubutton.h @@ -30,7 +30,7 @@ class MenuButton : public ToolButton { Q_OBJECT public: - explicit MenuButton(QWidget *parent = 0); + explicit MenuButton(QWidget *parent = nullptr); void controlState(); void setAlignedMenu(QMenu *m); void addSeparator(); diff --git a/widgets/messageoverlay.cpp b/widgets/messageoverlay.cpp index 9bf4cba6b..5b766ec3e 100644 --- a/widgets/messageoverlay.cpp +++ b/widgets/messageoverlay.cpp @@ -31,8 +31,8 @@ #include MessageOverlay::MessageOverlay(QObject *p) - : QWidget(0) - , timer(0) + : QWidget(nullptr) + , timer(nullptr) #ifdef Q_OS_MAC , closeOnLeft(true) #else diff --git a/widgets/multipagewidget.h b/widgets/multipagewidget.h index 1e7af7e63..39fd5fdda 100644 --- a/widgets/multipagewidget.h +++ b/widgets/multipagewidget.h @@ -41,7 +41,7 @@ class MultiPageWidget : public StackedPageWidget struct Entry { - Entry(SelectorButton *b=0, QWidget *p=0) : btn(b), page(p) { } + Entry(SelectorButton *b=nullptr, QWidget *p=nullptr) : btn(b), page(p) { } SelectorButton *btn; QWidget *page; }; diff --git a/widgets/notelabel.h b/widgets/notelabel.h index 1b9b7f34d..140e984cc 100644 --- a/widgets/notelabel.h +++ b/widgets/notelabel.h @@ -33,7 +33,7 @@ class NoteLabel : public QWidget Q_OBJECT public: static void setText(QLabel *l, const QString &text); - NoteLabel(QWidget *parent=0); + NoteLabel(QWidget *parent=nullptr); void setText(const QString &text) { setText(label, text); } void appendText(const QString &text) { label->setText(label->text()+text); } QString text() const { return label->text(); } @@ -46,7 +46,7 @@ class UrlNoteLabel : public QWidget { Q_OBJECT public: - UrlNoteLabel(QWidget *parent=0); + UrlNoteLabel(QWidget *parent=nullptr); void setText(const QString &text) { NoteLabel::setText(label, text); } void appendText(const QString &text) { label->setText(label->text()+text); } QString text() const { return label->text(); } @@ -59,14 +59,14 @@ private: class PlainNoteLabel : public StateLabel { public: - PlainNoteLabel(QWidget *parent=0); + PlainNoteLabel(QWidget *parent=nullptr); void setText(const QString &text) { NoteLabel::setText(this, text); } }; class PlainUrlNoteLabel : public UrlLabel { public: - PlainUrlNoteLabel(QWidget *parent=0); + PlainUrlNoteLabel(QWidget *parent=nullptr); void setText(const QString &text) { NoteLabel::setText(this, text); } }; diff --git a/widgets/nowplayingwidget.cpp b/widgets/nowplayingwidget.cpp index f2a575240..a36f98cf5 100644 --- a/widgets/nowplayingwidget.cpp +++ b/widgets/nowplayingwidget.cpp @@ -250,7 +250,7 @@ void PosSlider::setRange(int min, int max) NowPlayingWidget::NowPlayingWidget(QWidget *p) : QWidget(p) - , timer(0) + , timer(nullptr) , lastVal(0) , pollCount(0) { @@ -271,8 +271,8 @@ NowPlayingWidget::NowPlayingWidget(QWidget *p) infoLabel->setFont(small); slider->setOrientation(Qt::Horizontal); QBoxLayout *layout=new QBoxLayout(QBoxLayout::TopToBottom, this); - QBoxLayout *topLayout=new QBoxLayout(QBoxLayout::LeftToRight, 0); - QBoxLayout *botLayout=new QBoxLayout(QBoxLayout::LeftToRight, 0); + QBoxLayout *topLayout=new QBoxLayout(QBoxLayout::LeftToRight, nullptr); + QBoxLayout *botLayout=new QBoxLayout(QBoxLayout::LeftToRight, nullptr); int space=Utils::layoutSpacing(this); int pad=qMax(space, Utils::scaleForDpi(8)); #ifdef Q_OS_MAC diff --git a/widgets/playqueueview.cpp b/widgets/playqueueview.cpp index ebb53df23..6c973d2e5 100644 --- a/widgets/playqueueview.cpp +++ b/widgets/playqueueview.cpp @@ -100,10 +100,10 @@ void PlayQueueGroupedView::paintEvent(QPaintEvent *e) PlayQueueView::PlayQueueView(QWidget *parent) : QStackedWidget(parent) , mode(ItemView::Mode_Count) - , groupedView(0) - , treeView(0) - , spinner(0) - , msgOverlay(0) + , groupedView(nullptr) + , treeView(nullptr) + , spinner(nullptr) + , msgOverlay(nullptr) , backgroundImageType(BI_None) , fadeValue(1.0) , backgroundOpacity(15) @@ -219,12 +219,12 @@ void PlayQueueView::setMode(ItemView::Mode m) break; } - QAbstractItemModel *model=0; + QAbstractItemModel *model=nullptr; QList actions; if (ItemView::Mode_Count!=mode) { QAbstractItemView *v=view(); model=v->model(); - v->setModel(0); + v->setModel(nullptr); actions=v->actions(); } diff --git a/widgets/playqueueview.h b/widgets/playqueueview.h index f03ca8d12..bccd7bf9d 100644 --- a/widgets/playqueueview.h +++ b/widgets/playqueueview.h @@ -78,7 +78,7 @@ public: BI_Custom }; - PlayQueueView(QWidget *parent=0); + PlayQueueView(QWidget *parent=nullptr); ~PlayQueueView() override; void readConfig(); diff --git a/widgets/ratingwidget.h b/widgets/ratingwidget.h index 72b4a6e4f..59b3cc49d 100644 --- a/widgets/ratingwidget.h +++ b/widgets/ratingwidget.h @@ -52,7 +52,7 @@ class RatingWidget : public QWidget public: - RatingWidget(QWidget *parent = 0); + RatingWidget(QWidget *parent = nullptr); QSize sizeHint() const override { return rp.size(); } int value() const { return val; } diff --git a/widgets/searchwidget.cpp b/widgets/searchwidget.cpp index daeee4580..db078385f 100644 --- a/widgets/searchwidget.cpp +++ b/widgets/searchwidget.cpp @@ -53,7 +53,7 @@ private: SearchWidget::SearchWidget(QWidget *p) : QWidget(p) - , cat(0) + , cat(nullptr) , widgetIsActive(false) { QHBoxLayout *l=new QHBoxLayout(this); @@ -95,7 +95,7 @@ void SearchWidget::setPermanent() setFocus(); closeButton->setVisible(false); closeButton->deleteLater(); - closeButton=0; + closeButton=nullptr; layout()->setSpacing(0); } diff --git a/widgets/selectorlabel.cpp b/widgets/selectorlabel.cpp index 526a89081..ee1f2d004 100644 --- a/widgets/selectorlabel.cpp +++ b/widgets/selectorlabel.cpp @@ -32,7 +32,7 @@ SelectorLabel::SelectorLabel(QWidget *p) : QLabel(p) , current(0) , useArrow(false) - , menu(0) + , menu(nullptr) { setAttribute(Qt::WA_Hover, true); menu=new QMenu(this); @@ -136,13 +136,13 @@ QString SelectorLabel::itemData(int index) const QAction * SelectorLabel::action(int index) const { if (!menu) { - return 0; + return nullptr; } QList actions=menu->actions(); if (index>=actions.count()) { - return 0; + return nullptr; } return actions.at(index); } diff --git a/widgets/servicestatuslabel.cpp b/widgets/servicestatuslabel.cpp index 5105a0b79..be9ee87bb 100644 --- a/widgets/servicestatuslabel.cpp +++ b/widgets/servicestatuslabel.cpp @@ -51,7 +51,7 @@ void ServiceStatusLabel::setStatus(bool on) ? palette().highlight().color().name() : palette().color(QPalette::Disabled, QPalette::WindowText).name(); - int margin=style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); + int margin=style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this); if (margin<2) { margin=2; } diff --git a/widgets/singlepagewidget.cpp b/widgets/singlepagewidget.cpp index 0549c6510..477d1ce7f 100644 --- a/widgets/singlepagewidget.cpp +++ b/widgets/singlepagewidget.cpp @@ -48,7 +48,7 @@ static QString viewTypeString(ItemView::Mode mode) SinglePageWidget::SinglePageWidget(QWidget *p) : QWidget(p) , btnFlags(0) - , refreshAction(0) + , refreshAction(nullptr) { QGridLayout *layout=new QGridLayout(this); view=new ItemView(this); diff --git a/widgets/sizegrip.h b/widgets/sizegrip.h index d282ecd24..c674fa977 100644 --- a/widgets/sizegrip.h +++ b/widgets/sizegrip.h @@ -29,7 +29,7 @@ class SizeGrip : public QWidget { public: - explicit SizeGrip(QWidget *parent = 0); + explicit SizeGrip(QWidget *parent = nullptr); }; #endif diff --git a/widgets/sizewidget.h b/widgets/sizewidget.h index af399dcb2..694925c85 100644 --- a/widgets/sizewidget.h +++ b/widgets/sizewidget.h @@ -29,7 +29,7 @@ class SizeWidget : public QWidget { public: - explicit SizeWidget(QWidget *parent = 0); + explicit SizeWidget(QWidget *parent = nullptr); void paintEvent(QPaintEvent *e) override; }; diff --git a/widgets/spacerwidget.h b/widgets/spacerwidget.h index 3abddde2d..a47bf5e5e 100644 --- a/widgets/spacerwidget.h +++ b/widgets/spacerwidget.h @@ -29,7 +29,7 @@ class SpacerWidget : public QWidget { public: - SpacerWidget(QWidget *parent = 0); + SpacerWidget(QWidget *parent = nullptr); ~SpacerWidget() override { } }; diff --git a/widgets/statelabel.h b/widgets/statelabel.h index e20b1ea5a..a860c54bc 100644 --- a/widgets/statelabel.h +++ b/widgets/statelabel.h @@ -29,7 +29,7 @@ class StateLabel : public BuddyLabel { public: - StateLabel(QWidget *parent=0) + StateLabel(QWidget *parent=nullptr) : BuddyLabel(parent) , on(false) { } diff --git a/widgets/stretchheaderview.h b/widgets/stretchheaderview.h index c6e9f87f5..026b93e92 100644 --- a/widgets/stretchheaderview.h +++ b/widgets/stretchheaderview.h @@ -24,7 +24,7 @@ class StretchHeaderView : public QHeaderView { Q_OBJECT public: - StretchHeaderView(Qt::Orientation orientation, QWidget* parent = 0); + StretchHeaderView(Qt::Orientation orientation, QWidget* parent = nullptr); typedef double ColumnWidthType; diff --git a/widgets/tableview.cpp b/widgets/tableview.cpp index 647b4bcdd..5d5d84e97 100644 --- a/widgets/tableview.cpp +++ b/widgets/tableview.cpp @@ -37,7 +37,7 @@ class TableViewItemDelegate : public BasicItemDelegate { public: - TableViewItemDelegate(QObject *p, int rc) : BasicItemDelegate(p), ratingCol(rc), ratingPainter(0) { } + TableViewItemDelegate(QObject *p, int rc) : BasicItemDelegate(p), ratingCol(rc), ratingPainter(nullptr) { } ~TableViewItemDelegate() override { delete ratingPainter; } void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { @@ -82,7 +82,7 @@ public: TableView::TableView(const QString &cfgGroup, QWidget *parent, bool menuAlwaysAllowed) : TreeView(parent, menuAlwaysAllowed) - , menu(0) + , menu(nullptr) , configGroup(cfgGroup) , menuIsForCol(-1) { diff --git a/widgets/tableview.h b/widgets/tableview.h index d05730ba4..3c599bb40 100644 --- a/widgets/tableview.h +++ b/widgets/tableview.h @@ -31,7 +31,7 @@ class TableView : public TreeView Q_OBJECT public: - TableView(const QString &cfgGroup, QWidget *parent=0, bool menuAlwaysAllowed=false); + TableView(const QString &cfgGroup, QWidget *parent=nullptr, bool menuAlwaysAllowed=false); ~TableView() override { } void setModel(QAbstractItemModel *m) override; void initHeader(); diff --git a/widgets/titlewidget.cpp b/widgets/titlewidget.cpp index 9c9df9a5a..b3e21f11d 100644 --- a/widgets/titlewidget.cpp +++ b/widgets/titlewidget.cpp @@ -46,10 +46,10 @@ TitleWidget::TitleWidget(QWidget *p) : QWidget(p) , pressed(false) , underMouse(false) - , controls(0) + , controls(nullptr) { QGridLayout *layout=new QGridLayout(this); - QVBoxLayout *textLayout=new QVBoxLayout(0); + QVBoxLayout *textLayout=new QVBoxLayout(nullptr); image=new QLabel(this); mainText=new SqueezedTextLabel(this); subText=new SqueezedTextLabel(this); diff --git a/widgets/toolbutton.h b/widgets/toolbutton.h index dd12b42d8..0cdbf96ad 100644 --- a/widgets/toolbutton.h +++ b/widgets/toolbutton.h @@ -31,7 +31,7 @@ class QMenu; class ToolButton : public QToolButton { public: - explicit ToolButton(QWidget *parent = 0); + explicit ToolButton(QWidget *parent = nullptr); QSize sizeHint() const override; void setMenu(QMenu *m); void paintEvent(QPaintEvent *e) override; diff --git a/widgets/treeview.cpp b/widgets/treeview.cpp index e51918278..87ff7395e 100644 --- a/widgets/treeview.cpp +++ b/widgets/treeview.cpp @@ -84,7 +84,7 @@ bool TreeView::getForceSingleClick() TreeView::TreeView(QWidget *parent, bool menuAlwaysAllowed) : QTreeView(parent) - , eventFilter(0) + , eventFilter(nullptr) , forceSingleColumn(false) , alwaysAllowMenu(menuAlwaysAllowed) { diff --git a/widgets/treeview.h b/widgets/treeview.h index 62c2b208a..088f7c1c2 100644 --- a/widgets/treeview.h +++ b/widgets/treeview.h @@ -42,7 +42,7 @@ public: static QModelIndexList sortIndexes(const QModelIndexList &list); static void drag(Qt::DropActions supportedActions, QAbstractItemView *view, const QModelIndexList &items); - TreeView(QWidget *parent=0, bool menuAlwaysAllowed=false); + TreeView(QWidget *parent=nullptr, bool menuAlwaysAllowed=false); ~TreeView() override; void setPageDefaults(); diff --git a/widgets/volumeslider.cpp b/widgets/volumeslider.cpp index 46f71d295..0b2ccbf67 100644 --- a/widgets/volumeslider.cpp +++ b/widgets/volumeslider.cpp @@ -67,8 +67,8 @@ VolumeSlider::VolumeSlider(QWidget *p) , lineWidth(0) , down(false) , fadingStop(false) - , muteAction(0) - , menu(0) + , muteAction(nullptr) + , menu(nullptr) { widthStep=4; setRange(0, 100); diff --git a/widgets/volumeslider.h b/widgets/volumeslider.h index 608906334..e2d3f4688 100644 --- a/widgets/volumeslider.h +++ b/widgets/volumeslider.h @@ -39,7 +39,7 @@ class VolumeSlider : public QSlider public: static QColor clampColor(const QColor &col); - VolumeSlider(QWidget *p=0); + VolumeSlider(QWidget *p=nullptr); ~VolumeSlider() override { } void initActions(); diff --git a/widgets/wizardpage.h b/widgets/wizardpage.h index 04f72ba29..b6646b8a1 100644 --- a/widgets/wizardpage.h +++ b/widgets/wizardpage.h @@ -32,7 +32,7 @@ class Icon; class WizardPage : public QWizardPage { public: - WizardPage(QWidget *parent = 0) : QWizardPage(parent) { } + WizardPage(QWidget *parent = nullptr) : QWizardPage(parent) { } ~WizardPage() override { } void setBackground(const Icon &i);