Replace 0 with nullptr

This commit is contained in:
Jonas Kvinge
2020-06-14 17:02:47 +02:00
parent ef34dce4dc
commit 2fbdb29ebc
19 changed files with 62 additions and 63 deletions

View File

@@ -335,7 +335,7 @@ static void input_data_mixed_int16_max (const guint8 * _in, double * out, guint
static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info) { static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info) {
GstFastSpectrum *spectrum = GST_FASTSPECTRUM (base); GstFastSpectrum *spectrum = GST_FASTSPECTRUM (base);
GstFastSpectrumInputData input_data = NULL; GstFastSpectrumInputData input_data = nullptr;
g_mutex_lock (&spectrum->lock); g_mutex_lock (&spectrum->lock);
switch (GST_AUDIO_INFO_FORMAT (info)) { switch (GST_AUDIO_INFO_FORMAT (info)) {

View File

@@ -386,7 +386,7 @@ void BlockAnalyzer::drawBackground() {
QPainter p(&background_); QPainter p(&background_);
if (p.paintEngine() == 0) return; if (!p.paintEngine()) return;
for (int x = 0; (uint)x < columns_; ++x) for (int x = 0; (uint)x < columns_; ++x)
for (int y = 0; (uint)y < rows_; ++y) for (int y = 0; (uint)y < rows_; ++y)

View File

@@ -119,8 +119,8 @@ void SCollection::Exit() {
wait_for_exit_ << backend_ << watcher_; wait_for_exit_ << backend_ << watcher_;
disconnect(backend_, 0, watcher_, 0); disconnect(backend_, nullptr, watcher_, nullptr);
disconnect(watcher_, 0, backend_, 0); disconnect(watcher_, nullptr, backend_, nullptr);
connect(backend_, SIGNAL(ExitFinished()), this, SLOT(ExitReceived())); connect(backend_, SIGNAL(ExitFinished()), this, SLOT(ExitReceived()));
connect(watcher_, SIGNAL(ExitFinished()), this, SLOT(ExitReceived())); connect(watcher_, SIGNAL(ExitFinished()), this, SLOT(ExitReceived()));
@@ -132,7 +132,7 @@ void SCollection::Exit() {
void SCollection::ExitReceived() { void SCollection::ExitReceived() {
QObject *obj = static_cast<QObject*>(sender()); QObject *obj = static_cast<QObject*>(sender());
disconnect(obj, 0, this, 0); disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully exited."; qLog(Debug) << obj << "successfully exited.";
wait_for_exit_.removeAll(obj); wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) emit ExitFinished(); if (wait_for_exit_.isEmpty()) emit ExitFinished();

View File

@@ -155,7 +155,7 @@ QString CollectionFilterWidget::group_by(const int number) { return group_by() +
void CollectionFilterWidget::UpdateGroupByActions() { void CollectionFilterWidget::UpdateGroupByActions() {
if (group_by_group_) { if (group_by_group_) {
disconnect(group_by_group_, 0, 0, 0); disconnect(group_by_group_, nullptr, nullptr, nullptr);
delete group_by_group_; delete group_by_group_;
} }
@@ -264,11 +264,11 @@ void CollectionFilterWidget::FocusOnFilter(QKeyEvent *event) {
void CollectionFilterWidget::SetCollectionModel(CollectionModel *model) { void CollectionFilterWidget::SetCollectionModel(CollectionModel *model) {
if (model_) { if (model_) {
disconnect(model_, 0, this, 0); disconnect(model_, nullptr, this, nullptr);
disconnect(model_, 0, group_by_dialog_.get(), 0); disconnect(model_, nullptr, group_by_dialog_.get(), nullptr);
disconnect(group_by_dialog_.get(), 0, model_, 0); disconnect(group_by_dialog_.get(), nullptr, model_, nullptr);
for (QAction *action : filter_ages_.keys()) { for (QAction *action : filter_ages_.keys()) {
disconnect(action, &QAction::triggered, model_, 0); disconnect(action, &QAction::triggered, model_, nullptr);
} }
} }

View File

@@ -278,7 +278,7 @@ void Application::Exit() {
void Application::ExitReceived() { void Application::ExitReceived() {
QObject *obj = static_cast<QObject*>(sender()); QObject *obj = static_cast<QObject*>(sender());
disconnect(obj, 0, this, 0); disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully exited."; qLog(Debug) << obj << "successfully exited.";

View File

@@ -118,34 +118,34 @@ void CommandlineOptions::RemoveArg(const QString &starts_with, int count) {
bool CommandlineOptions::Parse() { bool CommandlineOptions::Parse() {
static const struct option kOptions[] = { static const struct option kOptions[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, nullptr, 'h'},
{"play", no_argument, 0, 'p'}, {"play", no_argument, nullptr, 'p'},
{"play-pause", no_argument, 0, 't'}, {"play-pause", no_argument, nullptr, 't'},
{"pause", no_argument, 0, 'u'}, {"pause", no_argument, nullptr, 'u'},
{"stop", no_argument, 0, 's'}, {"stop", no_argument, nullptr, 's'},
{"stop-after-current", no_argument, 0, 'q'}, {"stop-after-current", no_argument, nullptr, 'q'},
{"previous", no_argument, 0, 'r'}, {"previous", no_argument, nullptr, 'r'},
{"next", no_argument, 0, 'f'}, {"next", no_argument, nullptr, 'f'},
{"volume", required_argument, 0, 'v'}, {"volume", required_argument, nullptr, 'v'},
{"volume-up", no_argument, 0, VolumeUp}, {"volume-up", no_argument, nullptr, VolumeUp},
{"volume-down", no_argument, 0, VolumeDown}, {"volume-down", no_argument, nullptr, VolumeDown},
{"volume-increase-by", required_argument, 0, VolumeIncreaseBy}, {"volume-increase-by", required_argument, nullptr, VolumeIncreaseBy},
{"volume-decrease-by", required_argument, 0, VolumeDecreaseBy}, {"volume-decrease-by", required_argument, nullptr, VolumeDecreaseBy},
{"seek-to", required_argument, 0, SeekTo}, {"seek-to", required_argument, nullptr, SeekTo},
{"seek-by", required_argument, 0, SeekBy}, {"seek-by", required_argument, nullptr, SeekBy},
{"restart-or-previous", no_argument, 0, RestartOrPrevious}, {"restart-or-previous", no_argument, nullptr, RestartOrPrevious},
{"create", required_argument, 0, 'c'}, {"create", required_argument, nullptr, 'c'},
{"append", no_argument, 0, 'a'}, {"append", no_argument, nullptr, 'a'},
{"load", no_argument, 0, 'l'}, {"load", no_argument, nullptr, 'l'},
{"play-track", required_argument, 0, 'k'}, {"play-track", required_argument, nullptr, 'k'},
{"show-osd", no_argument, 0, 'o'}, {"show-osd", no_argument, nullptr, 'o'},
{"toggle-pretty-osd", no_argument, 0, 'y'}, {"toggle-pretty-osd", no_argument, nullptr, 'y'},
{"language", required_argument, 0, 'g'}, {"language", required_argument, nullptr, 'g'},
{"quiet", no_argument, 0, Quiet}, {"quiet", no_argument, nullptr, Quiet},
{"verbose", no_argument, 0, Verbose}, {"verbose", no_argument, nullptr, Verbose},
{"log-levels", required_argument, 0, LogLevels}, {"log-levels", required_argument, nullptr, LogLevels},
{"version", no_argument, 0, Version}, {"version", no_argument, nullptr, Version},
{0, 0, 0, 0}}; {nullptr, 0, nullptr, 0}};
// Parse the arguments // Parse the arguments
bool ok = false; bool ok = false;

View File

@@ -42,7 +42,7 @@ const char *Screensaver::kKdeService = "org.kde.ScreenSaver";
const char *Screensaver::kKdePath = "/ScreenSaver/"; const char *Screensaver::kKdePath = "/ScreenSaver/";
const char *Screensaver::kKdeInterface = "org.freedesktop.ScreenSaver"; const char *Screensaver::kKdeInterface = "org.freedesktop.ScreenSaver";
Screensaver *Screensaver::screensaver_ = 0; Screensaver *Screensaver::screensaver_ = nullptr;
Screensaver *Screensaver::GetScreensaver() { Screensaver *Screensaver::GetScreensaver() {
if (!screensaver_) { if (!screensaver_) {

View File

@@ -657,7 +657,7 @@ const char *EnumToString(const QMetaObject &meta, const char *name, int value) {
if (index == -1) return "[UnknownEnum]"; if (index == -1) return "[UnknownEnum]";
QMetaEnum metaenum = meta.enumerator(index); QMetaEnum metaenum = meta.enumerator(index);
const char *result = metaenum.valueToKey(value); const char *result = metaenum.valueToKey(value);
if (result == 0) return "[UnknownEnumValue]"; if (!result) return "[UnknownEnumValue]";
return result; return result;
} }

View File

@@ -416,7 +416,7 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov
if (reply->error() == QNetworkReply::NoError) { if (reply->error() == QNetworkReply::NoError) {
// Try to load the image // Try to load the image
QImage image; QImage image;
if (image.load(reply, 0)) { if (image.load(reply, nullptr)) {
QPair<QImage, QImage> images = ScaleAndPad(task.options, image); QPair<QImage, QImage> images = ScaleAndPad(task.options, image);
emit AlbumCoverLoaded(task.id, AlbumCoverLoaderResult(task.type, cover_url, image, images.first, images.second, task.art_updated)); emit AlbumCoverLoaded(task.id, AlbumCoverLoaderResult(task.type, cover_url, image, images.first, images.second, task.art_updated));
return; return;

View File

@@ -206,7 +206,7 @@ void DeviceManager::CloseBackend() {
void DeviceManager::BackendClosed() { void DeviceManager::BackendClosed() {
QObject *obj = static_cast<QObject*>(sender()); QObject *obj = static_cast<QObject*>(sender());
disconnect(obj, 0, this, 0); disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully closed."; qLog(Debug) << obj << "successfully closed.";
wait_for_exit_.removeAll(obj); wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) emit ExitFinished(); if (wait_for_exit_.isEmpty()) emit ExitFinished();
@@ -218,7 +218,7 @@ void DeviceManager::ListerClosed() {
DeviceLister *lister = static_cast<DeviceLister*>(sender()); DeviceLister *lister = static_cast<DeviceLister*>(sender());
if (!lister) return; if (!lister) return;
disconnect(lister, 0, this, 0); disconnect(lister, nullptr, this, nullptr);
qLog(Debug) << lister << "successfully closed."; qLog(Debug) << lister << "successfully closed.";
wait_for_exit_.removeAll(lister); wait_for_exit_.removeAll(lister);

View File

@@ -93,8 +93,8 @@ void FilesystemDevice::Close() {
wait_for_exit_ << backend_ << watcher_; wait_for_exit_ << backend_ << watcher_;
disconnect(backend_, 0, watcher_, 0); disconnect(backend_, nullptr, watcher_, nullptr);
disconnect(watcher_, 0, backend_, 0); disconnect(watcher_, nullptr, backend_, nullptr);
connect(backend_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished())); connect(backend_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished()));
connect(watcher_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished())); connect(watcher_, SIGNAL(ExitFinished()), this, SLOT(ExitFinished()));
@@ -107,7 +107,7 @@ void FilesystemDevice::ExitFinished() {
QObject *obj = static_cast<QObject*>(sender()); QObject *obj = static_cast<QObject*>(sender());
if (!obj) return; if (!obj) return;
disconnect(obj, 0, this, 0); disconnect(obj, nullptr, this, nullptr);
qLog(Debug) << obj << "successfully exited."; qLog(Debug) << obj << "successfully exited.";
wait_for_exit_.removeAll(obj); wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) { if (wait_for_exit_.isEmpty()) {

View File

@@ -211,7 +211,7 @@ void GstEngine::Stop(const bool stop_after) {
// Check if we started a fade out. If it isn't finished yet and the user pressed stop, we cancel the fader and just stop the playback. // Check if we started a fade out. If it isn't finished yet and the user pressed stop, we cancel the fader and just stop the playback.
if (is_fading_out_to_pause_) { if (is_fading_out_to_pause_) {
disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), 0, 0); disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
is_fading_out_to_pause_ = false; is_fading_out_to_pause_ = false;
has_faded_out_ = true; has_faded_out_ = true;
@@ -233,7 +233,7 @@ void GstEngine::Pause() {
// Check if we started a fade out. If it isn't finished yet and the user pressed play, we inverse the fader and resume the playback. // Check if we started a fade out. If it isn't finished yet and the user pressed play, we inverse the fader and resume the playback.
if (is_fading_out_to_pause_) { if (is_fading_out_to_pause_) {
disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), 0, 0); disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false); current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false);
is_fading_out_to_pause_ = false; is_fading_out_to_pause_ = false;
has_faded_out_ = false; has_faded_out_ = false;
@@ -264,7 +264,7 @@ void GstEngine::Unpause() {
// Check if we faded out last time. If yes, fade in no matter what the settings say. // Check if we faded out last time. If yes, fade in no matter what the settings say.
// If we pause with fadeout, deactivate fadeout and resume playback, the player would be muted if not faded in. // If we pause with fadeout, deactivate fadeout and resume playback, the player would be muted if not faded in.
if (has_faded_out_) { if (has_faded_out_) {
disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), 0, 0); disconnect(current_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false); current_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Forward, QTimeLine::EaseInOutCurve, false);
has_faded_out_ = false; has_faded_out_ = false;
} }
@@ -713,7 +713,7 @@ void GstEngine::StartFadeout() {
if (is_fading_out_to_pause_) return; if (is_fading_out_to_pause_) return;
fadeout_pipeline_ = current_pipeline_; fadeout_pipeline_ = current_pipeline_;
disconnect(fadeout_pipeline_.get(), 0, 0, 0); disconnect(fadeout_pipeline_.get(), nullptr, nullptr, nullptr);
fadeout_pipeline_->RemoveAllBufferConsumers(); fadeout_pipeline_->RemoveAllBufferConsumers();
fadeout_pipeline_->StartFader(fadeout_duration_nanosec_, QTimeLine::Backward); fadeout_pipeline_->StartFader(fadeout_duration_nanosec_, QTimeLine::Backward);
@@ -724,7 +724,7 @@ void GstEngine::StartFadeout() {
void GstEngine::StartFadeoutPause() { void GstEngine::StartFadeoutPause() {
fadeout_pause_pipeline_ = current_pipeline_; fadeout_pause_pipeline_ = current_pipeline_;
disconnect(fadeout_pause_pipeline_.get(), SIGNAL(FaderFinished()), 0, 0); disconnect(fadeout_pause_pipeline_.get(), SIGNAL(FaderFinished()), nullptr, nullptr);
fadeout_pause_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QTimeLine::EaseInOutCurve, false); fadeout_pause_pipeline_->StartFader(fadeout_pause_duration_nanosec_, QTimeLine::Backward, QTimeLine::EaseInOutCurve, false);
if (fadeout_pipeline_ && fadeout_pipeline_->state() == GST_STATE_PLAYING) { if (fadeout_pipeline_ && fadeout_pipeline_->state() == GST_STATE_PLAYING) {

View File

@@ -54,7 +54,7 @@ void InternetServices::RemoveService(InternetService *service) {
if (!services_.contains(service->source())) return; if (!services_.contains(service->source())) return;
services_.remove(service->source()); services_.remove(service->source());
disconnect(service, 0, this, 0); disconnect(service, nullptr, this, nullptr);
qLog(Debug) << "Removed internet service" << service->name(); qLog(Debug) << "Removed internet service" << service->name();

View File

@@ -40,8 +40,8 @@ OrganiseErrorDialog::OrganiseErrorDialog(QWidget *parent) : QDialog(parent), ui_
ui_->setupUi(this); ui_->setupUi(this);
const int icon_size = style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this); const int icon_size = style()->pixelMetric(QStyle::PM_MessageBoxIconSize, nullptr, this);
QIcon icon = style()->standardIcon(QStyle::SP_MessageBoxCritical, 0, this); QIcon icon = style()->standardIcon(QStyle::SP_MessageBoxCritical, nullptr, this);
ui_->icon->setPixmap(icon.pixmap(icon_size)); ui_->icon->setPixmap(icon.pixmap(icon_size));

View File

@@ -88,8 +88,8 @@ PlaylistTabBar::PlaylistTabBar(QWidget *parent)
void PlaylistTabBar::SetActions(QAction *new_playlist, QAction *load_playlist) { void PlaylistTabBar::SetActions(QAction *new_playlist, QAction *load_playlist) {
menu_->insertAction(0, new_playlist); menu_->insertAction(nullptr, new_playlist);
menu_->insertAction(0, load_playlist); menu_->insertAction(nullptr, load_playlist);
new_ = new_playlist; new_ = new_playlist;

View File

@@ -34,8 +34,7 @@
namespace PlaylistUndoCommands { namespace PlaylistUndoCommands {
Base::Base(Playlist* playlist) : QUndoCommand(0), playlist_(playlist) {} Base::Base(Playlist* playlist) : QUndoCommand(nullptr), playlist_(playlist) {}
InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList &items, int pos, bool enqueue, bool enqueue_next) InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList &items, int pos, bool enqueue, bool enqueue_next)
: Base(playlist), : Base(playlist),

View File

@@ -57,7 +57,7 @@ void ScrobblerServices::RemoveService(ScrobblerService *service) {
{ {
QMutexLocker locker(&mutex_); QMutexLocker locker(&mutex_);
scrobbler_services_.remove(service->name()); scrobbler_services_.remove(service->name());
disconnect(service, 0, this, 0); disconnect(service, nullptr, this, nullptr);
} }
qLog(Debug) << "Unregistered scrobbler service" << service->name(); qLog(Debug) << "Unregistered scrobbler service" << service->name();

View File

@@ -737,10 +737,10 @@ void TidalRequest::SongsReplyReceived(QNetworkReply *reply, const int limit_requ
--songs_requests_active_; --songs_requests_active_;
if (type_ == QueryType_SearchSongs && fetchalbums_) { if (type_ == QueryType_SearchSongs && fetchalbums_) {
AlbumsReceived(reply, 0, limit_requested, offset_requested, (offset_requested == 0)); AlbumsReceived(reply, QString(), limit_requested, offset_requested, (offset_requested == 0));
} }
else { else {
SongsReceived(reply, 0, 0, limit_requested, offset_requested, (offset_requested == 0)); SongsReceived(reply, QString(), QString(), limit_requested, offset_requested, (offset_requested == 0));
} }
} }

View File

@@ -68,7 +68,7 @@ class FancyTabBar: public QTabBar {
QMap<int, QWidget*> spacers; QMap<int, QWidget*> spacers;
public: public:
explicit FancyTabBar(QWidget* parent=0) : QTabBar(parent) { explicit FancyTabBar(QWidget *parent = nullptr) : QTabBar(parent) {
setMouseTracking(true); setMouseTracking(true);
} }