From 71893e4847033c324c8765c7d26ed888d883fdee Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 6 Feb 2014 16:49:49 +0100 Subject: [PATCH] Use nullptr instead of NULL everywhere. --- ext/clementine-spotifyblob/main.cpp | 2 +- ext/clementine-spotifyblob/mediapipeline.cpp | 32 ++++---- ext/clementine-spotifyblob/spotifyclient.cpp | 18 ++-- ext/clementine-tagreader/main.cpp | 2 +- ext/libclementine-common/core/logging.cpp | 12 +-- .../core/messagehandler.cpp | 6 +- ext/libclementine-tagreader/tagreader.cpp | 40 ++++----- src/analyzers/analyzer.cpp | 2 +- src/analyzers/analyzerbase.cpp | 2 +- src/analyzers/analyzercontainer.cpp | 8 +- src/analyzers/glanalyzer2.cpp | 4 +- src/analyzers/glanalyzer3.cpp | 4 +- src/core/application.cpp | 48 +++++------ src/core/backgroundstreams.cpp | 2 +- src/core/commandlineoptions.cpp | 2 +- src/core/crashreporting.cpp | 8 +- src/core/database.cpp | 8 +- src/core/deletefiles.cpp | 2 +- src/core/globalshortcuts.cpp | 4 +- src/core/gnomeglobalshortcutbackend.cpp | 2 +- src/core/mergedproxymodel.cpp | 8 +- src/core/mpris1.cpp | 6 +- src/core/network.cpp | 4 +- src/core/networkproxyfactory.cpp | 2 +- src/core/organise.cpp | 2 +- src/core/player.cpp | 4 +- src/core/song.cpp | 2 +- src/core/songloader.cpp | 24 +++--- src/core/tagreaderclient.cpp | 2 +- src/core/utilities.cpp | 4 +- src/devices/cddadevice.cpp | 14 ++-- src/devices/cddalister.cpp | 2 +- src/devices/connecteddevice.cpp | 4 +- src/devices/devicelister.cpp | 2 +- src/devices/devicemanager.cpp | 10 +-- src/devices/deviceproperties.cpp | 2 +- src/devices/deviceview.cpp | 12 +-- src/devices/giolister.cpp | 40 ++++----- src/devices/gpoddevice.cpp | 20 ++--- src/devices/gpodloader.cpp | 6 +- src/devices/mtpconnection.cpp | 6 +- src/devices/mtpdevice.cpp | 8 +- src/devices/mtploader.cpp | 5 +- src/engines/gstengine.cpp | 12 +-- src/engines/gstenginepipeline.cpp | 82 ++++++++++--------- src/globalsearch/globalsearch.cpp | 4 +- src/globalsearch/globalsearchmodel.cpp | 2 +- src/globalsearch/globalsearchview.cpp | 6 +- .../groovesharksearchprovider.cpp | 2 +- src/globalsearch/searchprovider.cpp | 2 +- src/globalsearch/soundcloudsearchprovider.cpp | 2 +- src/globalsearch/spotifysearchprovider.cpp | 8 +- src/internet/cloudfileservice.cpp | 2 +- src/internet/digitallyimportedservicebase.cpp | 2 +- src/internet/digitallyimportedurlhandler.cpp | 2 +- src/internet/dropboxauthenticator.cpp | 2 +- src/internet/groovesharkservice.cpp | 70 ++++++++-------- src/internet/icecastmodel.cpp | 4 +- src/internet/icecastservice.cpp | 6 +- src/internet/internetmodel.cpp | 12 +-- src/internet/internetservice.cpp | 8 +- src/internet/internetviewcontainer.cpp | 12 +-- src/internet/jamendoservice.cpp | 10 +-- src/internet/lastfmservice.cpp | 16 ++-- src/internet/magnatunedownloaddialog.cpp | 4 +- src/internet/magnatuneservice.cpp | 10 +-- src/internet/savedradio.cpp | 4 +- src/internet/somafmservice.cpp | 4 +- src/internet/somafmurlhandler.cpp | 2 +- src/internet/soundcloudservice.cpp | 6 +- src/internet/spotifyblobdownloader.cpp | 4 +- src/internet/spotifyserver.cpp | 2 +- src/internet/spotifyservice.cpp | 28 +++---- src/internet/subsonicservice.cpp | 10 +-- src/internet/ubuntuoneauthenticator.cpp | 2 +- src/library/library.cpp | 8 +- src/library/libraryfilterwidget.cpp | 2 +- src/library/librarymodel.cpp | 18 ++-- src/library/libraryview.cpp | 8 +- src/library/librarywatcher.cpp | 4 +- src/main.cpp | 6 +- src/moodbar/moodbarcontroller.cpp | 2 +- src/moodbar/moodbaritemdelegate.cpp | 2 +- src/moodbar/moodbarpipeline.cpp | 25 +++--- src/moodbar/moodbarproxystyle.cpp | 6 +- src/musicbrainz/chromaprinter.cpp | 30 +++---- src/musicbrainz/tagfetcher.cpp | 4 +- src/networkremote/networkremotehelper.cpp | 4 +- src/networkremote/outgoingdatacreator.cpp | 2 +- src/networkremote/tinysvcmdns.cpp | 4 +- src/networkremote/zeroconf.cpp | 4 +- src/playlist/playlist.cpp | 8 +- src/playlist/playlistcontainer.cpp | 10 +-- src/playlist/playlistfilterparser.cpp | 2 +- src/playlist/playlistitem.cpp | 4 +- src/playlist/playlistlistcontainer.cpp | 4 +- src/playlist/playlistlistmodel.cpp | 2 +- src/playlist/playlistmanager.cpp | 10 +-- src/playlist/playlisttabbar.cpp | 2 +- src/playlist/playlistview.cpp | 8 +- src/playlist/queue.cpp | 2 +- src/playlist/queuemanager.cpp | 6 +- src/playlist/songloaderinserter.cpp | 4 +- src/playlistparsers/playlistparser.cpp | 4 +- src/podcasts/gpoddersearchpage.cpp | 2 +- src/podcasts/gpoddertoptagsmodel.cpp | 2 +- src/podcasts/gpoddertoptagspage.cpp | 2 +- src/podcasts/podcastdownloader.cpp | 6 +- src/podcasts/podcastinfowidget.cpp | 4 +- src/podcasts/podcastservice.cpp | 6 +- src/smartplaylists/generator.cpp | 4 +- src/smartplaylists/querywizardplugin.cpp | 2 +- src/smartplaylists/searchpreview.cpp | 4 +- src/smartplaylists/searchtermwidget.cpp | 12 +-- src/songinfo/songinfobase.cpp | 2 +- src/songinfo/songinfoview.cpp | 2 +- src/transcoder/transcoder.cpp | 32 ++++---- src/transcoder/transcoderoptionsdialog.cpp | 2 +- src/ui/addstreamdialog.cpp | 2 +- src/ui/albumcoverchoicecontroller.cpp | 12 +-- src/ui/albumcovermanager.cpp | 6 +- src/ui/albumcovermanagerlist.cpp | 4 +- src/ui/albumcoversearcher.cpp | 2 +- src/ui/edittagdialog.cpp | 2 +- src/ui/mainwindow.cpp | 10 +-- src/ui/qtsystemtrayicon.cpp | 14 ++-- src/ui/ripcd.cpp | 2 +- src/ui/settingsdialog.cpp | 2 +- src/ui/standarditemiconloader.cpp | 2 +- src/ui/windows7thumbbar.cpp | 8 +- src/visualisations/projectmvisualisation.cpp | 2 +- src/visualisations/visualisationcontainer.cpp | 4 +- src/visualisations/visualisationselector.cpp | 2 +- src/widgets/fancytabwidget.cpp | 6 +- src/widgets/fileview.cpp | 4 +- src/widgets/nowplayingwidget.cpp | 8 +- src/widgets/prettyimage.cpp | 2 +- src/widgets/trackslider.cpp | 2 +- 138 files changed, 559 insertions(+), 553 deletions(-) diff --git a/ext/clementine-spotifyblob/main.cpp b/ext/clementine-spotifyblob/main.cpp index 7d8f61729..238049e04 100644 --- a/ext/clementine-spotifyblob/main.cpp +++ b/ext/clementine-spotifyblob/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char** argv) { logging::Init(); - gst_init(NULL, NULL); + gst_init(nullptr, nullptr); const QStringList arguments(a.arguments()); diff --git a/ext/clementine-spotifyblob/mediapipeline.cpp b/ext/clementine-spotifyblob/mediapipeline.cpp index 38c3541ee..859fd28ab 100644 --- a/ext/clementine-spotifyblob/mediapipeline.cpp +++ b/ext/clementine-spotifyblob/mediapipeline.cpp @@ -28,8 +28,8 @@ MediaPipeline::MediaPipeline(int port, quint64 length_msec) : port_(port), length_msec_(length_msec), accepting_data_(true), - pipeline_(NULL), - appsrc_(NULL), + pipeline_(nullptr), + appsrc_(nullptr), byte_rate_(1), offset_bytes_(0) { @@ -49,15 +49,15 @@ bool MediaPipeline::Init(int sample_rate, int channels) { pipeline_ = gst_pipeline_new("pipeline"); // Create elements - appsrc_ = GST_APP_SRC(gst_element_factory_make("appsrc", NULL)); - GstElement* gdppay = gst_element_factory_make("gdppay", NULL); - tcpsink_ = gst_element_factory_make("tcpclientsink", NULL); + appsrc_ = GST_APP_SRC(gst_element_factory_make("appsrc", nullptr)); + GstElement* gdppay = gst_element_factory_make("gdppay", nullptr); + tcpsink_ = gst_element_factory_make("tcpclientsink", nullptr); if (!pipeline_ || !appsrc_ || !tcpsink_) { - if (pipeline_) { gst_object_unref(GST_OBJECT(pipeline_)); pipeline_ = NULL; } - if (appsrc_) { gst_object_unref(GST_OBJECT(appsrc_)); appsrc_ = NULL; } + if (pipeline_) { gst_object_unref(GST_OBJECT(pipeline_)); pipeline_ = nullptr; } + if (appsrc_) { gst_object_unref(GST_OBJECT(appsrc_)); appsrc_ = nullptr; } if (gdppay) { gst_object_unref(GST_OBJECT(gdppay)); } - if (tcpsink_) { gst_object_unref(GST_OBJECT(tcpsink_)); tcpsink_ = NULL; } + if (tcpsink_) { gst_object_unref(GST_OBJECT(tcpsink_)); tcpsink_ = nullptr; } return false; } @@ -65,22 +65,22 @@ bool MediaPipeline::Init(int sample_rate, int channels) { gst_bin_add(GST_BIN(pipeline_), GST_ELEMENT(appsrc_)); gst_bin_add(GST_BIN(pipeline_), gdppay); gst_bin_add(GST_BIN(pipeline_), tcpsink_); - gst_element_link_many(GST_ELEMENT(appsrc_), gdppay, tcpsink_, NULL); + gst_element_link_many(GST_ELEMENT(appsrc_), gdppay, tcpsink_, nullptr); // Set the sink's port - g_object_set(G_OBJECT(tcpsink_), "host", "127.0.0.1", NULL); - g_object_set(G_OBJECT(tcpsink_), "port", port_, NULL); + g_object_set(G_OBJECT(tcpsink_), "host", "127.0.0.1", nullptr); + g_object_set(G_OBJECT(tcpsink_), "port", port_, nullptr); // Try to send 5 seconds of audio in advance to initially fill Clementine's // buffer. - g_object_set(G_OBJECT(tcpsink_), "ts-offset", qint64(-5 * kNsecPerSec), NULL); + g_object_set(G_OBJECT(tcpsink_), "ts-offset", qint64(-5 * kNsecPerSec), nullptr); // We know the time of each buffer - g_object_set(G_OBJECT(appsrc_), "format", GST_FORMAT_TIME, NULL); + g_object_set(G_OBJECT(appsrc_), "format", GST_FORMAT_TIME, nullptr); // Spotify only pushes data to us every 100ms, so keep the appsrc half full // to prevent tiny stalls. - g_object_set(G_OBJECT(appsrc_), "min-percent", 50, NULL); + g_object_set(G_OBJECT(appsrc_), "min-percent", 50, nullptr); // Set callbacks for when to start/stop pushing data GstAppSrcCallbacks callbacks; @@ -88,7 +88,7 @@ bool MediaPipeline::Init(int sample_rate, int channels) { callbacks.need_data = NeedDataCallback; callbacks.seek_data = SeekDataCallback; - gst_app_src_set_callbacks(appsrc_, &callbacks, this, NULL); + gst_app_src_set_callbacks(appsrc_, &callbacks, this, nullptr); #if Q_BYTE_ORDER == Q_BIG_ENDIAN const int endianness = G_BIG_ENDIAN; @@ -104,7 +104,7 @@ bool MediaPipeline::Init(int sample_rate, int channels) { "depth", G_TYPE_INT, 16, "rate", G_TYPE_INT, sample_rate, "channels", G_TYPE_INT, channels, - NULL); + nullptr); gst_app_src_set_caps(appsrc_, caps); gst_caps_unref(caps); diff --git a/ext/clementine-spotifyblob/spotifyclient.cpp b/ext/clementine-spotifyblob/spotifyclient.cpp index e89ef0991..751d3f8e8 100644 --- a/ext/clementine-spotifyblob/spotifyclient.cpp +++ b/ext/clementine-spotifyblob/spotifyclient.cpp @@ -38,10 +38,10 @@ const int SpotifyClient::kWaveHeaderSize = 44; SpotifyClient::SpotifyClient(QObject* parent) - : AbstractMessageHandler(NULL, parent), + : AbstractMessageHandler(nullptr, parent), api_key_(QByteArray::fromBase64(kSpotifyApiKey)), protocol_socket_(new QTcpSocket(this)), - session_(NULL), + session_(nullptr), events_timer_(new QTimer(this)) { SetDevice(protocol_socket_); @@ -328,7 +328,7 @@ void SpotifyClient::Login(const pb::spotify::LoginRequest& req) { req.username().c_str(), req.password().c_str(), true, // Remember the password. - NULL); + nullptr); } } @@ -389,7 +389,7 @@ void SpotifyClient::SendPlaylistList() { sp_playlistcontainer* container = sp_session_playlistcontainer(session_); if (!container) { - qLog(Warning) << "sp_session_playlistcontainer returned NULL"; + qLog(Warning) << "sp_session_playlistcontainer returned nullptr"; return; } @@ -432,7 +432,7 @@ void SpotifyClient::SendPlaylistList() { } sp_playlist* SpotifyClient::GetPlaylist(pb::spotify::PlaylistType type, int user_index) { - sp_playlist* playlist = NULL; + sp_playlist* playlist = nullptr; switch (type) { case pb::spotify::Inbox: playlist = sp_session_inbox_create(session_); @@ -499,7 +499,7 @@ void SpotifyClient::PlaylistStateChangedForLoadPlaylist(sp_playlist* pl, void* u // Find this playlist's pending load object int pending_load_index = -1; - PendingLoadPlaylist* pending_load = NULL; + PendingLoadPlaylist* pending_load = nullptr; for (int i=0 ; ipending_load_playlists_.count() ; ++i) { if (me->pending_load_playlists_[i].playlist_ == pl) { pending_load_index = i; @@ -710,7 +710,7 @@ void SpotifyClient::OfflineStatusUpdatedCallback(sp_session* session) { SpotifyClient* me = reinterpret_cast(sp_session_userdata(session)); sp_playlistcontainer* container = sp_session_playlistcontainer(session); if (!container) { - qLog(Warning) << "sp_session_playlistcontainer returned NULL"; + qLog(Warning) << "sp_session_playlistcontainer returned nullptr"; return; } @@ -884,7 +884,7 @@ void SpotifyClient::TryImageAgain(sp_image* image) { // Find the pending request for this image int index = -1; - PendingImageRequest* req = NULL; + PendingImageRequest* req = nullptr; for (int i=0 ; i* sClassLevels = NULL; -static QIODevice* sNullDevice = NULL; +static QMap* sClassLevels = nullptr; +static QIODevice* sNullDevice = nullptr; const char* kDefaultLogLevels = "GstEnginePipeline:2,*:3"; static const char* kMessageHandlerMagic = "__logging_message__"; static const int kMessageHandlerMagicLength = strlen(kMessageHandlerMagic); -static QtMsgHandler sOriginalMessageHandler = NULL; +static QtMsgHandler sOriginalMessageHandler = nullptr; void GLog(const char* domain, int level, const char* message, void* user_data) { @@ -152,7 +152,7 @@ QString ParsePrettyFunction(const char * pretty_function) { QDebug CreateLogger(Level level, const QString& class_name, int line) { // Map the level to a string - const char* level_name = NULL; + const char* level_name = nullptr; switch (level) { case Level_Debug: level_name = " DEBUG "; break; case Level_Info: level_name = " INFO "; break; @@ -193,8 +193,8 @@ QString CXXDemangle(const QString& mangled_function) { int status; char* demangled_function = abi::__cxa_demangle( mangled_function.toAscii().constData(), - NULL, - NULL, + nullptr, + nullptr, &status); if (status == 0) { QString ret = QString::fromAscii(demangled_function); diff --git a/ext/libclementine-common/core/messagehandler.cpp b/ext/libclementine-common/core/messagehandler.cpp index e21fc2974..d0de5297e 100644 --- a/ext/libclementine-common/core/messagehandler.cpp +++ b/ext/libclementine-common/core/messagehandler.cpp @@ -27,9 +27,9 @@ _MessageHandlerBase::_MessageHandlerBase(QIODevice* device, QObject* parent) : QObject(parent), - device_(NULL), - flush_abstract_socket_(NULL), - flush_local_socket_(NULL), + device_(nullptr), + flush_abstract_socket_(nullptr), + flush_local_socket_(nullptr), reading_protobuf_(false), expected_length_(0), is_device_closed_(false) { diff --git a/ext/libclementine-tagreader/tagreader.cpp b/ext/libclementine-tagreader/tagreader.cpp index 62e5f631f..475a2385a 100644 --- a/ext/libclementine-tagreader/tagreader.cpp +++ b/ext/libclementine-tagreader/tagreader.cpp @@ -129,10 +129,10 @@ void TagReader::ReadFile(const QString& filename, TagLib::Tag* tag = fileref->tag(); if (tag) { - Decode(tag->title(), NULL, song->mutable_title()); - Decode(tag->artist(), NULL, song->mutable_artist()); // TPE1 - Decode(tag->album(), NULL, song->mutable_album()); - Decode(tag->genre(), NULL, song->mutable_genre()); + Decode(tag->title(), nullptr, song->mutable_title()); + Decode(tag->artist(), nullptr, song->mutable_artist()); // TPE1 + Decode(tag->album(), nullptr, song->mutable_album()); + Decode(tag->genre(), nullptr, song->mutable_genre()); song->set_year(tag->year()); song->set_track(tag->track()); song->set_valid(true); @@ -145,7 +145,7 @@ void TagReader::ReadFile(const QString& filename, // apart, so we keep specific behavior for some formats by adding another // "else if" block below. if (TagLib::Ogg::XiphComment* tag = dynamic_cast(fileref->file()->tag())) { - ParseOggTag(tag->fieldListMap(), NULL, &disc, &compilation, song); + ParseOggTag(tag->fieldListMap(), nullptr, &disc, &compilation, song); } if (TagLib::MPEG::File* file = dynamic_cast(fileref->file())) { @@ -159,15 +159,15 @@ void TagReader::ReadFile(const QString& filename, song->set_bpm(TStringToQString(map["TBPM"].front()->toString()).trimmed().toFloat()); if (!map["TCOM"].isEmpty()) - Decode(map["TCOM"].front()->toString(), NULL, song->mutable_composer()); + Decode(map["TCOM"].front()->toString(), nullptr, song->mutable_composer()); if (!map["TIT1"].isEmpty()) // content group - Decode(map["TIT1"].front()->toString(), NULL, song->mutable_grouping()); + Decode(map["TIT1"].front()->toString(), nullptr, song->mutable_grouping()); // Skip TPE1 (which is the artist) here because we already fetched it if (!map["TPE2"].isEmpty()) // non-standard: Apple, Microsoft - Decode(map["TPE2"].front()->toString(), NULL, song->mutable_albumartist()); + Decode(map["TPE2"].front()->toString(), nullptr, song->mutable_albumartist()); if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed(); @@ -181,7 +181,7 @@ void TagReader::ReadFile(const QString& filename, dynamic_cast(map["COMM"][i]); if (frame && TStringToQString(frame->description()) != "iTunNORM") { - Decode(frame->text(), NULL, song->mutable_comment()); + Decode(frame->text(), nullptr, song->mutable_comment()); break; } } @@ -218,14 +218,14 @@ void TagReader::ReadFile(const QString& filename, } } else if (TagLib::FLAC::File* file = dynamic_cast(fileref->file())) { if ( file->xiphComment() ) { - ParseOggTag(file->xiphComment()->fieldListMap(), NULL, &disc, &compilation, song); + ParseOggTag(file->xiphComment()->fieldListMap(), nullptr, &disc, &compilation, song); #ifdef TAGLIB_HAS_FLAC_PICTURELIST if (!file->pictureList().isEmpty()) { song->set_art_automatic(kEmbeddedCover); } #endif } - Decode(tag->comment(), NULL, song->mutable_comment()); + Decode(tag->comment(), nullptr, song->mutable_comment()); } else if (TagLib::MP4::File* file = dynamic_cast(fileref->file())) { if (file->tag()) { TagLib::MP4::Tag* mp4_tag = file->tag(); @@ -236,7 +236,7 @@ void TagReader::ReadFile(const QString& filename, if (it != items.end()) { TagLib::StringList album_artists = it->second.toStringList(); if (!album_artists.isEmpty()) { - Decode(album_artists.front(), NULL, song->mutable_albumartist()); + Decode(album_artists.front(), nullptr, song->mutable_albumartist()); } } @@ -269,12 +269,12 @@ void TagReader::ReadFile(const QString& filename, } if(items.contains("\251wrt")) { - Decode(items["\251wrt"].toStringList().toString(", "), NULL, song->mutable_composer()); + Decode(items["\251wrt"].toStringList().toString(", "), nullptr, song->mutable_composer()); } if(items.contains("\251grp")) { - Decode(items["\251grp"].toStringList().toString(" "), NULL, song->mutable_grouping()); + Decode(items["\251grp"].toStringList().toString(" "), nullptr, song->mutable_grouping()); } - Decode(mp4_tag->comment(), NULL, song->mutable_comment()); + Decode(mp4_tag->comment(), nullptr, song->mutable_comment()); } } #ifdef TAGLIB_WITH_ASF @@ -310,7 +310,7 @@ void TagReader::ReadFile(const QString& filename, } #endif else if (tag) { - Decode(tag->comment(), NULL, song->mutable_comment()); + Decode(tag->comment(), nullptr, song->mutable_comment()); } if (!disc.isEmpty()) { @@ -575,7 +575,7 @@ bool TagReader::SaveFile(const QString& filename, if (ret) { // Linux: inotify doesn't seem to notice the change to the file unless we // change the timestamps as well. (this is what touch does) - utimensat(0, QFile::encodeName(filename).constData(), NULL, 0); + utimensat(0, QFile::encodeName(filename).constData(), nullptr, 0); } #endif // Q_OS_LINUX @@ -632,7 +632,7 @@ bool TagReader::SaveSongStatisticsToFile(const QString& filename, if (ret) { // Linux: inotify doesn't seem to notice the change to the file unless we // change the timestamps as well. (this is what touch does) - utimensat(0, QFile::encodeName(filename).constData(), NULL, 0); + utimensat(0, QFile::encodeName(filename).constData(), nullptr, 0); } #endif // Q_OS_LINUX return ret; @@ -685,7 +685,7 @@ bool TagReader::SaveSongRatingToFile(const QString& filename, if (ret) { // Linux: inotify doesn't seem to notice the change to the file unless we // change the timestamps as well. (this is what touch does) - utimensat(0, QFile::encodeName(filename).constData(), NULL, 0); + utimensat(0, QFile::encodeName(filename).constData(), nullptr, 0); } #endif // Q_OS_LINUX return ret; @@ -944,7 +944,7 @@ bool TagReader::ReadCloudFile(const QUrl& download_url, #endif // HAVE_GOOGLE_DRIVE TagLib::ID3v2::PopularimeterFrame* TagReader::GetPOPMFrameFromTag(TagLib::ID3v2::Tag* tag) { - TagLib::ID3v2::PopularimeterFrame* frame = NULL; + TagLib::ID3v2::PopularimeterFrame* frame = nullptr; const TagLib::ID3v2::FrameListMap& map = tag->frameListMap(); if (!map["POPM"].isEmpty()) { diff --git a/src/analyzers/analyzer.cpp b/src/analyzers/analyzer.cpp index 986bd74fd..1a6e1dda1 100644 --- a/src/analyzers/analyzer.cpp +++ b/src/analyzers/analyzer.cpp @@ -4,7 +4,7 @@ AnalyzerBase::AnalyzerBase(QWidget* parent) : QGLWidget(parent), - engine_(NULL) { + engine_(nullptr) { } void AnalyzerBase::set_engine(Engine::Base* engine) { diff --git a/src/analyzers/analyzerbase.cpp b/src/analyzers/analyzerbase.cpp index 523c063f1..b4e12b91b 100644 --- a/src/analyzers/analyzerbase.cpp +++ b/src/analyzers/analyzerbase.cpp @@ -48,7 +48,7 @@ Analyzer::Base::Base( QWidget *parent, uint scopeSize ) : QWidget( parent ) , m_timeout( 40 ) // msec , m_fht( new FHT(scopeSize) ) - , m_engine(NULL) + , m_engine(nullptr) , m_lastScope(512) , new_frame_(false) , is_playing_(false) diff --git a/src/analyzers/analyzercontainer.cpp b/src/analyzers/analyzercontainer.cpp index 445f5315f..e3478a3b8 100644 --- a/src/analyzers/analyzercontainer.cpp +++ b/src/analyzers/analyzercontainer.cpp @@ -48,11 +48,11 @@ AnalyzerContainer::AnalyzerContainer(QWidget *parent) group_framerate_(new QActionGroup(this)), mapper_(new QSignalMapper(this)), mapper_framerate_(new QSignalMapper(this)), - visualisation_action_(NULL), + visualisation_action_(nullptr), double_click_timer_(new QTimer(this)), ignore_next_click_(false), - current_analyzer_(NULL), - engine_(NULL) + current_analyzer_(nullptr), + engine_(nullptr) { QHBoxLayout* layout = new QHBoxLayout(this); setLayout(layout); @@ -135,7 +135,7 @@ void AnalyzerContainer::SetEngine(EngineBase* engine) { void AnalyzerContainer::DisableAnalyzer() { delete current_analyzer_; - current_analyzer_ = NULL; + current_analyzer_ = nullptr; Save(); } diff --git a/src/analyzers/glanalyzer2.cpp b/src/analyzers/glanalyzer2.cpp index 6f3d1c83a..00c3095e4 100644 --- a/src/analyzers/glanalyzer2.cpp +++ b/src/analyzers/glanalyzer2.cpp @@ -90,7 +90,7 @@ void GLAnalyzer2::resizeGL( int w, int h ) // Get current timestamp. timeval tv; - gettimeofday( &tv, NULL ); + gettimeofday( &tv, nullptr ); show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; } @@ -145,7 +145,7 @@ void GLAnalyzer2::paintGL() { // Compute the dT since the last call to paintGL and update timings timeval tv; - gettimeofday( &tv, NULL ); + gettimeofday( &tv, nullptr ); double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; diff --git a/src/analyzers/glanalyzer3.cpp b/src/analyzers/glanalyzer3.cpp index cc7ce4c7f..0892f4d88 100644 --- a/src/analyzers/glanalyzer3.cpp +++ b/src/analyzers/glanalyzer3.cpp @@ -190,7 +190,7 @@ void GLAnalyzer3::resizeGL( int w, int h ) // Get current timestamp. timeval tv; - gettimeofday( &tv, NULL ); + gettimeofday( &tv, nullptr ); show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; } @@ -203,7 +203,7 @@ void GLAnalyzer3::analyze( const Scope &s ) { // compute the dTime since the last call timeval tv; - gettimeofday( &tv, NULL ); + gettimeofday( &tv, nullptr ); double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; show.dT = currentTime - show.timeStamp; show.timeStamp = currentTime; diff --git a/src/core/application.cpp b/src/core/application.cpp index 45d96b749..60238a63e 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -48,28 +48,28 @@ bool Application::kIsPortable = false; Application::Application(QObject* parent) : QObject(parent), - tag_reader_client_(NULL), - database_(NULL), - album_cover_loader_(NULL), - playlist_backend_(NULL), - podcast_backend_(NULL), - appearance_(NULL), - cover_providers_(NULL), - task_manager_(NULL), - player_(NULL), - playlist_manager_(NULL), - current_art_loader_(NULL), - global_search_(NULL), - internet_model_(NULL), - library_(NULL), - device_manager_(NULL), - podcast_updater_(NULL), - podcast_downloader_(NULL), - gpodder_sync_(NULL), - moodbar_loader_(NULL), - moodbar_controller_(NULL), - network_remote_(NULL), - network_remote_helper_(NULL) + tag_reader_client_(nullptr), + database_(nullptr), + album_cover_loader_(nullptr), + playlist_backend_(nullptr), + podcast_backend_(nullptr), + appearance_(nullptr), + cover_providers_(nullptr), + task_manager_(nullptr), + player_(nullptr), + playlist_manager_(nullptr), + current_art_loader_(nullptr), + global_search_(nullptr), + internet_model_(nullptr), + library_(nullptr), + device_manager_(nullptr), + podcast_updater_(nullptr), + podcast_downloader_(nullptr), + gpodder_sync_(nullptr), + moodbar_loader_(nullptr), + moodbar_controller_(nullptr), + network_remote_(nullptr), + network_remote_helper_(nullptr) { tag_reader_client_ = new TagReaderClient(this); MoveToNewThread(tag_reader_client_); @@ -125,7 +125,7 @@ Application::~Application() { // It's important that the device manager is deleted before the database. // Deleting the database deletes all objects that have been created in its // thread, including some device library backends. - delete device_manager_; device_manager_ = NULL; + delete device_manager_; device_manager_ = nullptr; foreach (QObject* object, objects_in_threads_) { object->deleteLater(); @@ -150,7 +150,7 @@ void Application::MoveToNewThread(QObject* object) { } void Application::MoveToThread(QObject* object, QThread* thread) { - object->setParent(NULL); + object->setParent(nullptr); object->moveToThread(thread); objects_in_threads_ << object; } diff --git a/src/core/backgroundstreams.cpp b/src/core/backgroundstreams.cpp index 347b95908..a61ee3744 100644 --- a/src/core/backgroundstreams.cpp +++ b/src/core/backgroundstreams.cpp @@ -158,7 +158,7 @@ void BackgroundStreams::StreamActionDestroyed() { foreach (Stream* stream, streams_.values()) { if (stream->action == action) { - stream->action = NULL; + stream->action = nullptr; } } } diff --git a/src/core/commandlineoptions.cpp b/src/core/commandlineoptions.cpp index 9d7ab9231..ae24a19fb 100644 --- a/src/core/commandlineoptions.cpp +++ b/src/core/commandlineoptions.cpp @@ -138,7 +138,7 @@ bool CommandlineOptions::Parse() { // Parse the arguments bool ok = false; forever { - int c = getopt_long(argc_, argv_, "hptusrfv:alk:oyg:", kOptions, NULL); + int c = getopt_long(argc_, argv_, "hptusrfv:alk:oyg:", kOptions, nullptr); // End of the options if (c == -1) diff --git a/src/core/crashreporting.cpp b/src/core/crashreporting.cpp index a6995d522..fb761e139 100644 --- a/src/core/crashreporting.cpp +++ b/src/core/crashreporting.cpp @@ -38,13 +38,13 @@ const char* CrashSender::kUploadURL = "http://crashes.clementine-player.org/getuploadurl"; const char* CrashReporting::kSendCrashReportOption = "--send-crash-report"; -char* CrashReporting::sPath = NULL; +char* CrashReporting::sPath = nullptr; #if defined(HAVE_BREAKPAD) and defined(Q_OS_LINUX) CrashReporting::CrashReporting() : handler_(new google_breakpad::ExceptionHandler( - QDir::tempPath().toLocal8Bit().constData(), NULL, + QDir::tempPath().toLocal8Bit().constData(), nullptr, CrashReporting::Handler, this, true)) { } @@ -90,7 +90,7 @@ bool CrashReporting::Handler(const char* dump_path, if (sPath) { // We know the path to clementine, so exec it again to prompt the user to // upload the report. - const char* argv[] = {sPath, kSendCrashReportOption, dump_path, minidump_id, NULL}; + const char* argv[] = {sPath, kSendCrashReportOption, dump_path, minidump_id, nullptr}; sys_execv(sPath, argv); } @@ -102,7 +102,7 @@ CrashSender::CrashSender(const QString& path) : network_(new QNetworkAccessManager(this)), path_(path), file_(new QFile(path_, this)), - progress_(NULL) { + progress_(nullptr) { } bool CrashSender::Start() { diff --git a/src/core/database.cpp b/src/core/database.cpp index a5ad6294e..a8183dce9 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -85,7 +85,7 @@ struct sqlite3_tokenizer_cursor { /* Tokenizer implementations will typically add additional fields */ }; -sqlite3_tokenizer_module* Database::sFTSTokenizer = NULL; +sqlite3_tokenizer_module* Database::sFTSTokenizer = nullptr; int Database::FTSCreate(int argc, const char* const* argv, sqlite3_tokenizer** tokenizer) { @@ -643,11 +643,11 @@ void Database::BackupFile(const QString& filename) { QString dest_filename = QString("%1.bak").arg(filename); const int task_id = app_->task_manager()->StartTask(tr("Backing up database")); - sqlite3* source_connection = NULL; - sqlite3* dest_connection = NULL; + sqlite3* source_connection = nullptr; + sqlite3* dest_connection = nullptr; BOOST_SCOPE_EXIT((source_connection)(dest_connection)(task_id)(app_)) { - // Harmless to call sqlite3_close() with a NULL pointer. + // Harmless to call sqlite3_close() with a nullptr pointer. sqlite3_close(source_connection); sqlite3_close(dest_connection); app_->task_manager()->SetTaskFinished(task_id); diff --git a/src/core/deletefiles.cpp b/src/core/deletefiles.cpp index 8a65e34ac..45db3f260 100644 --- a/src/core/deletefiles.cpp +++ b/src/core/deletefiles.cpp @@ -29,7 +29,7 @@ const int DeleteFiles::kBatchSize = 50; DeleteFiles::DeleteFiles(TaskManager* task_manager, std::shared_ptr storage) - : thread_(NULL), + : thread_(nullptr), task_manager_(task_manager), storage_(storage), started_(false), diff --git a/src/core/globalshortcuts.cpp b/src/core/globalshortcuts.cpp index d758fca78..42bec58d7 100644 --- a/src/core/globalshortcuts.cpp +++ b/src/core/globalshortcuts.cpp @@ -35,8 +35,8 @@ const char* GlobalShortcuts::kSettingsGroup = "Shortcuts"; GlobalShortcuts::GlobalShortcuts(QWidget *parent) : QWidget(parent), - gnome_backend_(NULL), - system_backend_(NULL), + gnome_backend_(nullptr), + system_backend_(nullptr), use_gnome_(false), rating_signals_mapper_(new QSignalMapper(this)) { diff --git a/src/core/gnomeglobalshortcutbackend.cpp b/src/core/gnomeglobalshortcutbackend.cpp index 7c3bcf67e..9bd68a3ee 100644 --- a/src/core/gnomeglobalshortcutbackend.cpp +++ b/src/core/gnomeglobalshortcutbackend.cpp @@ -39,7 +39,7 @@ const char* GnomeGlobalShortcutBackend::kGsdInterface = "org.gnome.SettingsDaemo GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent) : GlobalShortcutBackend(parent), - interface_(NULL), + interface_(nullptr), is_connected_(false) { } diff --git a/src/core/mergedproxymodel.cpp b/src/core/mergedproxymodel.cpp index 42b4c3cb8..9219e2366 100644 --- a/src/core/mergedproxymodel.cpp +++ b/src/core/mergedproxymodel.cpp @@ -28,7 +28,7 @@ std::size_t hash_value(const QModelIndex& index) { MergedProxyModel::MergedProxyModel(QObject* parent) : QAbstractProxyModel(parent), - resetting_model_(NULL) + resetting_model_(nullptr) { } @@ -85,7 +85,7 @@ void MergedProxyModel::RemoveSubModel(const QModelIndex &source_parent) { resetting_model_ = submodel; beginRemoveRows(proxy_parent, 0, std::numeric_limits::max() - 1); endRemoveRows(); - resetting_model_ = NULL; + resetting_model_ = nullptr; // Delete all the mappings that reference the submodel MappingContainer::index::type::iterator it = @@ -167,7 +167,7 @@ void MergedProxyModel::SubModelReset() { resetting_model_ = submodel; beginRemoveRows(proxy_parent, 0, std::numeric_limits::max() - 1); endRemoveRows(); - resetting_model_ = NULL; + resetting_model_ = nullptr; // Delete all the mappings that reference the submodel MappingContainer::index::type::iterator it = @@ -449,7 +449,7 @@ QAbstractItemModel* MergedProxyModel::GetModel(const QModelIndex& source_index) if (submodel == const_model) return submodel; } - return NULL; + return nullptr; } void MergedProxyModel::DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right) { diff --git a/src/core/mpris1.cpp b/src/core/mpris1.cpp index 368e284ed..56f330320 100644 --- a/src/core/mpris1.cpp +++ b/src/core/mpris1.cpp @@ -41,9 +41,9 @@ Mpris1::Mpris1(Application* app, QObject* parent, const QString& dbus_service_name) : QObject(parent), dbus_service_name_(dbus_service_name), - root_(NULL), - player_(NULL), - tracklist_(NULL) + root_(nullptr), + player_(nullptr), + tracklist_(nullptr) { qDBusRegisterMetaType(); qDBusRegisterMetaType(); diff --git a/src/core/network.cpp b/src/core/network.cpp index a5c0f143d..4015b8b20 100644 --- a/src/core/network.cpp +++ b/src/core/network.cpp @@ -27,7 +27,7 @@ #include "utilities.h" QMutex ThreadSafeNetworkDiskCache::sMutex; -QNetworkDiskCache* ThreadSafeNetworkDiskCache::sCache = NULL; +QNetworkDiskCache* ThreadSafeNetworkDiskCache::sCache = nullptr; ThreadSafeNetworkDiskCache::ThreadSafeNetworkDiskCache(QObject* parent) { @@ -169,7 +169,7 @@ void NetworkTimeouts::timerEvent(QTimerEvent* e) { RedirectFollower::RedirectFollower(QNetworkReply* first_reply, int max_redirects) - : QObject(NULL), + : QObject(nullptr), current_reply_(first_reply), redirects_remaining_(max_redirects) { ConnectReply(first_reply); diff --git a/src/core/networkproxyfactory.cpp b/src/core/networkproxyfactory.cpp index ffe7a73e7..095462b0a 100644 --- a/src/core/networkproxyfactory.cpp +++ b/src/core/networkproxyfactory.cpp @@ -8,7 +8,7 @@ #include -NetworkProxyFactory* NetworkProxyFactory::sInstance = NULL; +NetworkProxyFactory* NetworkProxyFactory::sInstance = nullptr; const char* NetworkProxyFactory::kSettingsGroup = "Proxy"; NetworkProxyFactory::NetworkProxyFactory() diff --git a/src/core/organise.cpp b/src/core/organise.cpp index 0d03c2e2a..b46583b2f 100644 --- a/src/core/organise.cpp +++ b/src/core/organise.cpp @@ -40,7 +40,7 @@ Organise::Organise(TaskManager* task_manager, std::shared_ptr destination, const OrganiseFormat &format, bool copy, bool overwrite, const NewSongInfoList& songs_info, bool eject_after) - : thread_(NULL), + : thread_(nullptr), task_manager_(task_manager), transcoder_(new Transcoder(this)), destination_(destination), diff --git a/src/core/player.cpp b/src/core/player.cpp index 915f7f95f..86990b115 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -43,7 +43,7 @@ using std::shared_ptr; Player::Player(Application* app, QObject* parent) : PlayerInterface(parent), app_(app), - lastfm_(NULL), + lastfm_(nullptr), engine_(new GstEngine(app_->task_manager())), stream_change_type_(Engine::First), last_state_(Engine::Empty), @@ -611,7 +611,7 @@ void Player::UnregisterUrlHandler(UrlHandler* handler) { const UrlHandler* Player::HandlerForUrl(const QUrl& url) const { QMap::const_iterator it = url_handlers_.constFind(url.scheme()); if (it == url_handlers_.constEnd()) { - return NULL; + return nullptr; } return *it; } diff --git a/src/core/song.cpp b/src/core/song.cpp index 6bbf022ac..0dfce9995 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -717,7 +717,7 @@ void Song::InitFromLastFM(const lastfm::Track& track) { track->composer = strdup(d->composer_.toUtf8().constData()); track->genre = strdup(d->genre_.toUtf8().constData()); track->title = strdup(d->title_.toUtf8().constData()); - track->date = NULL; + track->date = nullptr; track->filename = strdup(d->basefilename_.toUtf8().constData()); diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 83433e568..57c83a0fe 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -66,7 +66,7 @@ SongLoader::SongLoader(LibraryBackendInterface* library, timeout_(kDefaultTimeout), state_(WaitingForType), success_(false), - parser_(NULL), + parser_(nullptr), is_podcast_(false), library_(library), player_(player) @@ -129,8 +129,8 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) { SongLoader::Result SongLoader::LoadAudioCD() { #ifdef HAVE_AUDIOCD // Create gstreamer cdda element - GstElement* cdda = gst_element_make_from_uri (GST_URI_SRC, "cdda://", NULL); - if (cdda == NULL) { + GstElement* cdda = gst_element_make_from_uri (GST_URI_SRC, "cdda://", nullptr); + if (cdda == nullptr) { qLog(Error) << "Error while creating CDDA GstElement"; return Error; } @@ -180,9 +180,9 @@ SongLoader::Result SongLoader::LoadAudioCD() { GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe), GST_CLOCK_TIME_NONE, GST_MESSAGE_TAG); - GstTagList *tags = NULL; + GstTagList *tags = nullptr; gst_message_parse_tag (msg, &tags); - char *string_mb = NULL; + char *string_mb = nullptr; if (gst_tag_list_get_string (tags, GST_TAG_CDDA_MUSICBRAINZ_DISCID, &string_mb)) { QString musicbrainz_discid(string_mb); qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid; @@ -463,22 +463,22 @@ SongLoader::Result SongLoader::LoadRemote() { // Create the pipeline - it gets unreffed if it goes out of scope std::shared_ptr pipeline( - gst_pipeline_new(NULL), std::bind(&gst_object_unref, _1)); + gst_pipeline_new(nullptr), std::bind(&gst_object_unref, _1)); // Create the source element automatically based on the URL GstElement* source = gst_element_make_from_uri( - GST_URI_SRC, url_.toEncoded().constData(), NULL); + GST_URI_SRC, url_.toEncoded().constData(), nullptr); if (!source) { qLog(Warning) << "Couldn't create gstreamer source element for" << url_.toString(); return Error; } // Create the other elements and link them up - GstElement* typefind = gst_element_factory_make("typefind", NULL); - GstElement* fakesink = gst_element_factory_make("fakesink", NULL); + GstElement* typefind = gst_element_factory_make("typefind", nullptr); + GstElement* fakesink = gst_element_factory_make("fakesink", nullptr); - gst_bin_add_many(GST_BIN(pipeline.get()), source, typefind, fakesink, NULL); - gst_element_link_many(source, typefind, fakesink, NULL); + gst_bin_add_many(GST_BIN(pipeline.get()), source, typefind, fakesink, nullptr); + gst_element_link_many(source, typefind, fakesink, nullptr); // Connect callbacks GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline.get())); @@ -650,7 +650,7 @@ void SongLoader::MagicReady() { if (parser_->name() == "ASX/INI" && url_.scheme() == "http") { // This is actually a weird MS-WMSP stream. Changing the protocol to MMS from // HTTP makes it playable. - parser_ = NULL; + parser_ = nullptr; url_.setScheme("mms"); StopTypefindAsync(true); } diff --git a/src/core/tagreaderclient.cpp b/src/core/tagreaderclient.cpp index f043287b9..61f082ecd 100644 --- a/src/core/tagreaderclient.cpp +++ b/src/core/tagreaderclient.cpp @@ -26,7 +26,7 @@ const char* TagReaderClient::kWorkerExecutableName = "clementine-tagreader"; -TagReaderClient* TagReaderClient::sInstance = NULL; +TagReaderClient* TagReaderClient::sInstance = nullptr; TagReaderClient::TagReaderClient(QObject* parent) : QObject(parent), diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index 2fb9afcfa..6fce75387 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -175,7 +175,7 @@ quint64 FileSystemCapacity(const QString& path) { #elif defined(Q_OS_WIN32) _ULARGE_INTEGER ret; if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), - NULL, &ret, NULL) != 0) + nullptr, &ret, nullptr) != 0) return ret.QuadPart; #endif @@ -190,7 +190,7 @@ quint64 FileSystemFreeSpace(const QString& path) { #elif defined(Q_OS_WIN32) _ULARGE_INTEGER ret; if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), - &ret, NULL, NULL) != 0) + &ret, nullptr, nullptr) != 0) return ret.QuadPart; #endif diff --git a/src/devices/cddadevice.cpp b/src/devices/cddadevice.cpp index 7e4239919..637022174 100644 --- a/src/devices/cddadevice.cpp +++ b/src/devices/cddadevice.cpp @@ -29,8 +29,8 @@ CddaDevice::CddaDevice(const QUrl& url, DeviceLister* lister, Application* app, int database_id, bool first_time) : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), - cdda_(NULL), - cdio_(NULL) + cdda_(nullptr), + cdio_(nullptr) { } @@ -43,12 +43,12 @@ void CddaDevice::Init() { QMutexLocker locker(&mutex_init_); song_count_ = 0; // Reset song count, in case it was already set cdio_ = cdio_open (url_.path().toLocal8Bit().constData(), DRIVER_DEVICE); - if (cdio_ == NULL) { + if (cdio_ == nullptr) { return; } // Create gstreamer cdda element - cdda_ = gst_element_make_from_uri (GST_URI_SRC, "cdda://", NULL); - if (cdda_ == NULL) { + cdda_ = gst_element_make_from_uri (GST_URI_SRC, "cdda://", nullptr); + if (cdda_ == nullptr) { model_->Reset(); return; } @@ -106,9 +106,9 @@ void CddaDevice::Init() { GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe), GST_CLOCK_TIME_NONE, GST_MESSAGE_TAG); - GstTagList *tags = NULL; + GstTagList *tags = nullptr; gst_message_parse_tag (msg, &tags); - char *string_mb = NULL; + char *string_mb = nullptr; if (gst_tag_list_get_string (tags, GST_TAG_CDDA_MUSICBRAINZ_DISCID, &string_mb)) { QString musicbrainz_discid(string_mb); qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid; diff --git a/src/devices/cddalister.cpp b/src/devices/cddalister.cpp index e4aa68724..7b82d512c 100644 --- a/src/devices/cddalister.cpp +++ b/src/devices/cddalister.cpp @@ -105,7 +105,7 @@ void CddaLister::Init() { qLog(Debug) << "No CD devices found"; return; } - for (; *devices != NULL; ++devices) { + for (; *devices != nullptr; ++devices) { QString device(*devices); QFileInfo device_info(device); if (device_info.isSymLink()) { diff --git a/src/devices/connecteddevice.cpp b/src/devices/connecteddevice.cpp index 56bb714da..e294417c9 100644 --- a/src/devices/connecteddevice.cpp +++ b/src/devices/connecteddevice.cpp @@ -39,8 +39,8 @@ ConnectedDevice::ConnectedDevice(const QUrl& url, DeviceLister* lister, unique_id_(unique_id), database_id_(database_id), manager_(manager), - backend_(NULL), - model_(NULL), + backend_(nullptr), + model_(nullptr), song_count_(0) { qLog(Info) << "connected" << url << unique_id << first_time; diff --git a/src/devices/devicelister.cpp b/src/devices/devicelister.cpp index 054d69510..fb00d8ca7 100644 --- a/src/devices/devicelister.cpp +++ b/src/devices/devicelister.cpp @@ -29,7 +29,7 @@ #endif DeviceLister::DeviceLister() - : thread_(NULL) + : thread_(nullptr) { } diff --git a/src/devices/devicemanager.cpp b/src/devices/devicemanager.cpp index e4e041755..09706b435 100644 --- a/src/devices/devicemanager.cpp +++ b/src/devices/devicemanager.cpp @@ -109,7 +109,7 @@ void DeviceManager::DeviceInfo::InitFromDb(const DeviceDatabaseBackend::Device& QStringList unique_ids = dev.unique_id_.split(','); foreach (const QString& id, unique_ids) { - backends_ << Backend(NULL, id); + backends_ << Backend(nullptr, id); } } @@ -149,7 +149,7 @@ void DeviceManager::DeviceInfo::LoadIcon(const QVariantList& icons, const QStrin const DeviceManager::DeviceInfo::Backend* DeviceManager::DeviceInfo::BestBackend() const { int best_priority = -1; - const Backend* ret = NULL; + const Backend* ret = nullptr; for (int i=0 ; ipriority() > best_priority) { @@ -470,7 +470,7 @@ void DeviceManager::PhysicalDeviceRemoved(const QString &id) { // Keep the structure around, but just "disconnect" it for (int backend_index = 0 ; backend_index < info.backends_.count() ; ++backend_index) { if (info.backends_[backend_index].unique_id_ == id) { - info.backends_[backend_index].lister_ = NULL; + info.backends_[backend_index].lister_ = nullptr; break; } } @@ -563,7 +563,7 @@ std::shared_ptr DeviceManager::Connect(int row) { // was "ipod" or "mtp" then the user compiled out support and the device // won't work properly. if (url.scheme() == "mtp" || url.scheme() == "gphoto2") { - if (QMessageBox::critical(NULL, tr("This device will not work properly"), + if (QMessageBox::critical(nullptr, tr("This device will not work properly"), tr("This is an MTP device, but you compiled Clementine without libmtp support.") + " " + tr("If you continue, this device will work slowly and songs copied to it may not work."), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) @@ -571,7 +571,7 @@ std::shared_ptr DeviceManager::Connect(int row) { } if (url.scheme() == "ipod") { - if (QMessageBox::critical(NULL, tr("This device will not work properly"), + if (QMessageBox::critical(nullptr, tr("This device will not work properly"), tr("This is an iPod, but you compiled Clementine without libgpod support.") + " " + tr("If you continue, this device will work slowly and songs copied to it may not work."), QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) diff --git a/src/devices/deviceproperties.cpp b/src/devices/deviceproperties.cpp index 80bca6e9c..68e52b225 100644 --- a/src/devices/deviceproperties.cpp +++ b/src/devices/deviceproperties.cpp @@ -35,7 +35,7 @@ DeviceProperties::DeviceProperties(QWidget *parent) : QDialog(parent), ui_(new Ui_DeviceProperties), - manager_(NULL), + manager_(nullptr), updating_formats_(false) { ui_->setupUi(this); diff --git a/src/devices/deviceview.cpp b/src/devices/deviceview.cpp index 342ce936a..2e8190880 100644 --- a/src/devices/deviceview.cpp +++ b/src/devices/deviceview.cpp @@ -146,12 +146,12 @@ void DeviceItemDelegate::paint(QPainter* p, const QStyleOptionViewItem& opt, con DeviceView::DeviceView(QWidget* parent) : AutoExpandingTreeView(parent), - app_(NULL), - merged_model_(NULL), - sort_model_(NULL), + app_(nullptr), + merged_model_(nullptr), + sort_model_(nullptr), properties_dialog_(new DeviceProperties), - device_menu_(NULL), - library_menu_(NULL) + device_menu_(nullptr), + library_menu_(nullptr) { setItemDelegate(new DeviceItemDelegate(this)); SetExpandOnReset(false); @@ -167,7 +167,7 @@ DeviceView::~DeviceView() { } void DeviceView::SetApplication(Application* app) { - Q_ASSERT(app_ == NULL); + Q_ASSERT(app_ == nullptr); app_ = app; connect(app_->device_manager(), SIGNAL(DeviceConnected(int)), SLOT(DeviceConnected(int))); diff --git a/src/devices/giolister.cpp b/src/devices/giolister.cpp index 504bbbc7c..3c116d470 100644 --- a/src/devices/giolister.cpp +++ b/src/devices/giolister.cpp @@ -58,7 +58,7 @@ bool GioLister::DeviceInfo::is_suitable() const { template void OperationFinished(F f, GObject *object, GAsyncResult *result) { T* obj = reinterpret_cast(object); - GError* error = NULL; + GError* error = nullptr; f(obj, result, &error); @@ -371,8 +371,8 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) { // Do a sanity check to make sure the root is actually this mount - when a // device is unmounted GIO sends a changed signal before the removed signal, // and we end up reading information about the / filesystem by mistake. - GError* error = NULL; - GMount* actual_mount = g_file_find_enclosing_mount(root, NULL, &error); + GError* error = nullptr; + GMount* actual_mount = g_file_find_enclosing_mount(root, nullptr, &error); if (error || !actual_mount) { g_error_free(error); invalid_enclosing_mount = true; @@ -381,10 +381,10 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) { } // Query the filesystem info for size, free space, and type - error = NULL; + error = nullptr; GFileInfo* info = g_file_query_filesystem_info(root, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE "," - G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, NULL, &error); + G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, nullptr, &error); if (error) { qLog(Warning) << error->message; g_error_free(error); @@ -401,9 +401,9 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) { // Query the file's info for a filesystem ID // Only afc devices (that I know of) give reliably unique IDs if (filesystem_type == "afc") { - error = NULL; + error = nullptr; info = g_file_query_info(root, G_FILE_ATTRIBUTE_ID_FILESYSTEM, - G_FILE_QUERY_INFO_NONE, NULL, &error); + G_FILE_QUERY_INFO_NONE, nullptr, &error); if (error) { qLog(Warning) << error->message; g_error_free(error); @@ -489,10 +489,10 @@ void GioLister::UnmountDevice(const QString &id) { g_volume_eject_with_operation( info.volume, G_MOUNT_UNMOUNT_NONE, - NULL, - NULL, + nullptr, + nullptr, (GAsyncReadyCallback) VolumeEjectFinished, - NULL); + nullptr); g_object_unref(info.volume); return; } @@ -502,18 +502,18 @@ void GioLister::UnmountDevice(const QString &id) { g_mount_eject_with_operation( info.mount, G_MOUNT_UNMOUNT_NONE, - NULL, - NULL, + nullptr, + nullptr, (GAsyncReadyCallback) MountEjectFinished, - NULL); + nullptr); } else if (g_mount_can_unmount(info.mount)) { g_mount_unmount_with_operation( info.mount, G_MOUNT_UNMOUNT_NONE, - NULL, - NULL, + nullptr, + nullptr, (GAsyncReadyCallback) MountUnmountFinished, - NULL); + nullptr); } } @@ -527,9 +527,9 @@ void GioLister::UpdateDeviceFreeSpace(const QString& id) { GFile* root = g_mount_get_root(device_info.mount); - GError* error = NULL; + GError* error = nullptr; GFileInfo* info = g_file_query_filesystem_info( - root, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &error); + root, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, nullptr, &error); if (error) { qLog(Warning) << error->message; g_error_free(error); @@ -571,7 +571,7 @@ void GioLister::DoMountDevice(const QString& id, int request_id) { return; } - g_volume_mount(info.volume, G_MOUNT_MOUNT_NONE, NULL, NULL, - VolumeMountFinished, NULL); + g_volume_mount(info.volume, G_MOUNT_MOUNT_NONE, nullptr, nullptr, + VolumeMountFinished, nullptr); emit DeviceMounted(id, request_id, true); } diff --git a/src/devices/gpoddevice.cpp b/src/devices/gpoddevice.cpp index cc3aa6598..8460c5f41 100644 --- a/src/devices/gpoddevice.cpp +++ b/src/devices/gpoddevice.cpp @@ -37,8 +37,8 @@ GPodDevice::GPodDevice( int database_id, bool first_time) : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), loader_thread_(new QThread(this)), - loader_(NULL), - db_(NULL) + loader_(nullptr), + db_(nullptr) { } @@ -66,7 +66,7 @@ void GPodDevice::LoadFinished(Itdb_iTunesDB* db) { db_wait_cond_.wakeAll(); loader_->deleteLater(); - loader_ = NULL; + loader_ = nullptr; } bool GPodDevice::StartCopy(QList* supported_filetypes) { @@ -113,7 +113,7 @@ bool GPodDevice::CopyToStorage(const CopyJob& job) { Itdb_Track* track = AddTrackToITunesDb(job.metadata_); // Copy the file - GError* error = NULL; + GError* error = nullptr; itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_) .toLocal8Bit().constData(), &error); if (error) { @@ -139,7 +139,7 @@ bool GPodDevice::CopyToStorage(const CopyJob& job) { void GPodDevice::WriteDatabase(bool success) { if (success) { // Write the itunes database - GError* error = NULL; + GError* error = nullptr; itdb_write(db_, &error); if (error) { qLog(Error) << "writing database failed:" << error->message; @@ -167,7 +167,7 @@ void GPodDevice::FinishCopy(bool success) { } void GPodDevice::StartDelete() { - StartCopy(NULL); + StartCopy(nullptr); } bool GPodDevice::RemoveTrackFromITunesDb(const QString& path, const QString& relative_to) { @@ -178,8 +178,8 @@ bool GPodDevice::RemoveTrackFromITunesDb(const QString& path, const QString& rel ipod_filename.replace('/', ':'); // Find the track in the itdb, identify it by its filename - Itdb_Track* track = NULL; - for (GList* tracks = db_->tracks ; tracks != NULL ; tracks = tracks->next) { + Itdb_Track* track = nullptr; + for (GList* tracks = db_->tracks ; tracks != nullptr ; tracks = tracks->next) { Itdb_Track* t = static_cast(tracks->data); if (t->ipod_path == ipod_filename) { @@ -188,13 +188,13 @@ bool GPodDevice::RemoveTrackFromITunesDb(const QString& path, const QString& rel } } - if (track == NULL) { + if (track == nullptr) { qLog(Warning) << "Couldn't find song" << path << "in iTunesDB"; return false; } // Remove the track from all playlists - for (GList* playlists = db_->playlists ; playlists != NULL ; playlists = playlists->next) { + for (GList* playlists = db_->playlists ; playlists != nullptr ; playlists = playlists->next) { Itdb_Playlist* playlist = static_cast(playlists->data); if (itdb_playlist_contains_track(playlist, track)) { diff --git a/src/devices/gpodloader.cpp b/src/devices/gpodloader.cpp index 9faa44be5..742c24ac8 100644 --- a/src/devices/gpodloader.cpp +++ b/src/devices/gpodloader.cpp @@ -30,7 +30,7 @@ GPodLoader::GPodLoader( const QString& mount_point, TaskManager* task_manager, LibraryBackend* backend, std::shared_ptr device) - : QObject(NULL), + : QObject(nullptr), device_(device), mount_point_(mount_point), type_(Song::Type_Unknown), @@ -48,7 +48,7 @@ void GPodLoader::LoadDatabase() { emit TaskStarted(task_id); // Load the iTunes database - GError* error = NULL; + GError* error = nullptr; Itdb_iTunesDB* db = itdb_parse( QDir::toNativeSeparators(mount_point_).toLocal8Bit(), &error); @@ -71,7 +71,7 @@ void GPodLoader::LoadDatabase() { ? QDir::fromNativeSeparators(mount_point_) : path_prefix_; SongList songs; - for (GList* tracks = db->tracks ; tracks != NULL ; tracks = tracks->next) { + for (GList* tracks = db->tracks ; tracks != nullptr ; tracks = tracks->next) { Itdb_Track* track = static_cast(tracks->data); Song song; diff --git a/src/devices/mtpconnection.cpp b/src/devices/mtpconnection.cpp index 4a34386ed..2aba31c28 100644 --- a/src/devices/mtpconnection.cpp +++ b/src/devices/mtpconnection.cpp @@ -22,7 +22,7 @@ #include MtpConnection::MtpConnection(const QUrl& url) - : device_(NULL) + : device_(nullptr) { QString hostname = url.host(); // Parse the URL @@ -53,14 +53,14 @@ MtpConnection::MtpConnection(const QUrl& url) // Get a list of devices from libmtp and figure out which one is ours int count = 0; - LIBMTP_raw_device_t* raw_devices = NULL; + LIBMTP_raw_device_t* raw_devices = nullptr; LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(&raw_devices, &count); if (err != LIBMTP_ERROR_NONE) { qLog(Warning) << "MTP error:" << err; return; } - LIBMTP_raw_device_t* raw_device = NULL; + LIBMTP_raw_device_t* raw_device = nullptr; for (int i=0 ; ideleteLater(); - loader_ = NULL; + loader_ = nullptr; db_busy_.unlock(); } @@ -147,7 +147,7 @@ void MtpDevice::FinishCopy(bool success) { } void MtpDevice::StartDelete() { - StartCopy(NULL); + StartCopy(nullptr); } bool MtpDevice::DeleteFromStorage(const DeleteJob& job) { @@ -187,7 +187,7 @@ bool MtpDevice::GetSupportedFiletypes(QList* ret) { } bool MtpDevice::GetSupportedFiletypes(QList* ret, LIBMTP_mtpdevice_t* device) { - uint16_t* list = NULL; + uint16_t* list = nullptr; uint16_t length = 0; if (LIBMTP_Get_Supported_Filetypes(device, &list, &length) diff --git a/src/devices/mtploader.cpp b/src/devices/mtploader.cpp index abb4329b4..99cfcc2c9 100644 --- a/src/devices/mtploader.cpp +++ b/src/devices/mtploader.cpp @@ -28,7 +28,7 @@ MtpLoader::MtpLoader( const QUrl& url, TaskManager* task_manager, LibraryBackend* backend, std::shared_ptr device) - : QObject(NULL), + : QObject(nullptr), device_(device), url_(url), task_manager_(task_manager), @@ -61,7 +61,8 @@ bool MtpLoader::TryLoad() { // Load the list of songs on the device SongList songs; - LIBMTP_track_t* tracks = LIBMTP_Get_Tracklisting_With_Callback(dev.device(), NULL, NULL); + LIBMTP_track_t* tracks = LIBMTP_Get_Tracklisting_With_Callback( + dev.device(), nullptr, nullptr); while (tracks) { LIBMTP_track_t* track = tracks; diff --git a/src/engines/gstengine.cpp b/src/engines/gstengine.cpp index e1eb46944..36e2728ee 100644 --- a/src/engines/gstengine.cpp +++ b/src/engines/gstengine.cpp @@ -69,7 +69,7 @@ GstEngine::GstEngine(TaskManager* task_manager) : Engine::Base(), task_manager_(task_manager), buffering_task_id_(-1), - latest_buffer_(NULL), + latest_buffer_(nullptr), equalizer_enabled_(false), stereo_balance_(0.0f), rg_enabled_(false), @@ -106,7 +106,7 @@ bool GstEngine::Init() { } void GstEngine::InitialiseGstreamer() { - gst_init(NULL, NULL); + gst_init(nullptr, nullptr); #ifdef HAVE_MOODBAR gstmoodbar_register_static(); @@ -181,14 +181,14 @@ void GstEngine::AddBufferToScope(GstBuffer* buf, int pipeline_id) { return; } - if (latest_buffer_ != NULL) { + if (latest_buffer_ != nullptr) { gst_buffer_unref(latest_buffer_); } latest_buffer_ = buf; } const Engine::Scope& GstEngine::scope() { - if (latest_buffer_ != NULL) { + if (latest_buffer_ != nullptr) { UpdateScope(); } @@ -218,7 +218,7 @@ void GstEngine::UpdateScope() { memcpy(dest, source, bytes); gst_buffer_unref(latest_buffer_); - latest_buffer_ = NULL; + latest_buffer_ = nullptr; } void GstEngine::StartPreloading(const QUrl& url, bool force_stop_at_end, @@ -619,7 +619,7 @@ GstElement* GstEngine::CreateElement(const QString& factoryName, GstElement* bin emit Error(QString("GStreamer could not create the element: %1. " "Please make sure that you have installed all necessary GStreamer plugins (e.g. OGG and MP3)").arg( factoryName ) ); gst_object_unref(GST_OBJECT(bin)); - return NULL; + return nullptr; } if (bin) diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index 21eb614b7..67c47b1c0 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -138,7 +138,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(GstElement* new_bin) { } bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { - GstElement* new_bin = NULL; + GstElement* new_bin = nullptr; if (url.scheme() == "spotify") { new_bin = gst_bin_new("spotify_bin"); @@ -151,8 +151,8 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { // Pick a port number const int port = Utilities::PickUnusedPort(); - g_object_set(G_OBJECT(src), "host", "127.0.0.1", NULL); - g_object_set(G_OBJECT(src), "port", port, NULL); + g_object_set(G_OBJECT(src), "host", "127.0.0.1", nullptr); + g_object_set(G_OBJECT(src), "port", port, nullptr); // Link the elements gst_element_link(src, gdp); @@ -166,7 +166,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { InternetModel::Service()->server()->StartPlaybackLater(url.toString(), port); } else { new_bin = engine_->CreateElement("uridecodebin"); - g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), NULL); + g_object_set(G_OBJECT(new_bin), "uri", url.toEncoded().constData(), nullptr); CHECKED_GCONNECT(G_OBJECT(new_bin), "drained", &SourceDrainedCallback, this); CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this); CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, this); @@ -176,7 +176,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { } GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) { - GError* error = NULL; + GError* error = nullptr; GstElement* bin = gst_parse_bin_from_description(pipeline, TRUE, &error); if (error) { @@ -188,7 +188,7 @@ GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) { qLog(Warning) << message; emit Error(id(), message, domain, code); - return NULL; + return nullptr; } else { return bin; } @@ -222,7 +222,7 @@ bool GstEnginePipeline::Init() { return false; if (GstEngine::DoesThisSinkSupportChangingTheOutputDeviceToAUserEditableString(sink_) && !device_.isEmpty()) - g_object_set(G_OBJECT(audiosink_), "device", device_.toUtf8().constData(), NULL); + g_object_set(G_OBJECT(audiosink_), "device", device_.toUtf8().constData(), nullptr); // Create all the other elements GstElement *tee, *probe_queue, *probe_converter, *probe_sink, *audio_queue, @@ -269,9 +269,9 @@ bool GstEnginePipeline::Init() { } // Set replaygain settings - g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, NULL); - g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), NULL); - g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), NULL); + g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr); + g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr); + g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr); } // Create a pad on the outside of the audiobin and connect it to the pad of @@ -288,10 +288,10 @@ bool GstEnginePipeline::Init() { gst_object_unref(pad); // Configure the fakesink properly - g_object_set(G_OBJECT(probe_sink), "sync", TRUE, NULL); + g_object_set(G_OBJECT(probe_sink), "sync", TRUE, nullptr); // Set the equalizer bands - g_object_set(G_OBJECT(equalizer_), "num-bands", 10, NULL); + g_object_set(G_OBJECT(equalizer_), "num-bands", 10, nullptr); int last_band_frequency = 0; for (int i=0 ; i 0) { - g_object_set(G_OBJECT(queue_), "use-buffering", true, NULL); + g_object_set(G_OBJECT(queue_), "use-buffering", true, nullptr); } gst_element_link(queue_, audioconvert_); @@ -331,12 +331,12 @@ bool GstEnginePipeline::Init() { GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw-int", "width", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, true, - NULL); + nullptr); GstCaps* caps32 = gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 32, - NULL); + nullptr); if (mono_playback_) { - gst_caps_set_simple(caps32, "channels", G_TYPE_INT, 1, NULL); + gst_caps_set_simple(caps32, "channels", G_TYPE_INT, 1, nullptr); } // Link the elements with special caps @@ -351,13 +351,13 @@ bool GstEnginePipeline::Init() { // Link replaygain elements if enabled. if (rg_enabled_) { - gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, NULL); + gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, nullptr); } // Link everything else. gst_element_link(probe_queue, probe_converter); gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, - volume_, audioscale_, convert, audiosink_, NULL); + volume_, audioscale_, convert, audiosink_, nullptr); // Add probes and handlers. gst_pad_add_buffer_probe(gst_element_get_static_pad(probe_converter, "src"), G_CALLBACK(HandoffCallback), this); @@ -420,7 +420,8 @@ bool GstEnginePipeline::InitFromUrl(const QUrl &url, qint64 end_nanosec) { GstEnginePipeline::~GstEnginePipeline() { if (pipeline_) { - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), NULL, NULL); + gst_bus_set_sync_handler( + gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), nullptr, nullptr); g_source_remove(bus_cb_id_); gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(GST_OBJECT(pipeline_)); @@ -509,7 +510,7 @@ void GstEnginePipeline::StreamStatusMessageReceived(GstMessage* msg) { memset(&callbacks, 0, sizeof(callbacks)); callbacks.enter_thread = TaskEnterCallback; - gst_task_set_thread_callbacks(task, &callbacks, this, NULL); + gst_task_set_thread_callbacks(task, &callbacks, this, nullptr); } } } @@ -565,7 +566,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage* msg) { } void GstEnginePipeline::TagMessageReceived(GstMessage* msg) { - GstTagList* taglist = NULL; + GstTagList* taglist = nullptr; gst_message_parse_tag(msg, &taglist); Engine::SimpleMetaBundle bundle; @@ -585,7 +586,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage* msg) { } QString GstEnginePipeline::ParseTag(GstTagList* list, const char* tag) const { - gchar* data = NULL; + gchar* data = nullptr; bool success = gst_tag_list_get_string(list, tag, &data); QString ret; @@ -735,7 +736,8 @@ bool GstEnginePipeline::EventHandoffCallback(GstPad*, GstEvent* e, gpointer self // The segment start time is used to calculate the proper offset of data // buffers from the start of the stream gint64 start = 0; - gst_event_parse_new_segment(e, NULL, NULL, NULL, &start, NULL, NULL); + gst_event_parse_new_segment( + e, nullptr, nullptr, nullptr, &start, nullptr, nullptr); instance->segment_start_ = start; instance->segment_start_received_ = true; @@ -761,7 +763,7 @@ void GstEnginePipeline::SourceDrainedCallback(GstURIDecodeBin* bin, gpointer sel void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *pspec, gpointer self) { GstEnginePipeline* instance = reinterpret_cast(self); GstElement* element; - g_object_get(bin, "source", &element, NULL); + g_object_get(bin, "source", &element, nullptr); if (!element) { return; } @@ -772,7 +774,7 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps // documentation, this might be added in the future). Despite that, for now // we include device inside URL: we decompose it during Init and set device // here, when this callback is called. - g_object_set(element, "device", instance->source_device().toLocal8Bit().constData(), NULL); + g_object_set(element, "device", instance->source_device().toLocal8Bit().constData(), nullptr); } if (g_object_class_find_property(G_OBJECT_GET_CLASS(element), "extra-headers") && instance->url().host().contains("grooveshark")) { @@ -781,8 +783,8 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps // Maybe it could be usefull in some other cases, but for now, I prefer to // keep this grooveshark specific. GstStructure* headers; - headers = gst_structure_new("extra-headers", "Range", G_TYPE_STRING, "bytes=0-", NULL); - g_object_set(element, "extra-headers", headers, NULL); + headers = gst_structure_new("extra-headers", "Range", G_TYPE_STRING, "bytes=0-", nullptr); + g_object_set(element, "extra-headers", headers, nullptr); gst_structure_free(headers); } @@ -794,8 +796,8 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps "Authorization", G_TYPE_STRING, instance->url().fragment().toAscii().data(), - NULL); - g_object_set(element, "extra-headers", headers, NULL); + nullptr); + g_object_set(element, "extra-headers", headers, nullptr); gst_structure_free(headers); } @@ -803,7 +805,7 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps QString user_agent = QString("%1 %2").arg( QCoreApplication::applicationName(), QCoreApplication::applicationVersion()); - g_object_set(element, "user-agent", user_agent.toUtf8().constData(), NULL); + g_object_set(element, "user-agent", user_agent.toUtf8().constData(), nullptr); } } @@ -906,7 +908,7 @@ void GstEnginePipeline::UpdateEqualizer() { gain *= 0.12; GstObject* band = gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), i); - g_object_set(G_OBJECT(band), "gain", gain, NULL); + g_object_set(G_OBJECT(band), "gain", gain, nullptr); g_object_unref(G_OBJECT(band)); } @@ -915,12 +917,12 @@ void GstEnginePipeline::UpdateEqualizer() { if (eq_enabled_) preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0 - g_object_set(G_OBJECT(equalizer_preamp_), "volume", preamp, NULL); + g_object_set(G_OBJECT(equalizer_preamp_), "volume", preamp, nullptr); } void GstEnginePipeline::UpdateStereoBalance() { if (stereo_panorama_) { - g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, NULL); + g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr); } } @@ -936,7 +938,7 @@ void GstEnginePipeline::SetVolumeModifier(qreal mod) { void GstEnginePipeline::UpdateVolume() { float vol = double(volume_percent_) * 0.01 * volume_modifier_; - g_object_set(G_OBJECT(volume_), "volume", vol, NULL); + g_object_set(G_OBJECT(volume_), "volume", vol, nullptr); } void GstEnginePipeline::StartFader(qint64 duration_nanosec, diff --git a/src/globalsearch/globalsearch.cpp b/src/globalsearch/globalsearch.cpp index 4131b1570..b3c2912ae 100644 --- a/src/globalsearch/globalsearch.cpp +++ b/src/globalsearch/globalsearch.cpp @@ -254,7 +254,7 @@ void GlobalSearch::AlbumArtLoaded(quint64 id, const QImage& image) { return; int orig_id = cover_loader_tasks_.take(id); - HandleLoadedArt(orig_id, image, NULL); + HandleLoadedArt(orig_id, image, nullptr); } void GlobalSearch::HandleLoadedArt(int id, const QImage& image, SearchProvider* provider) { @@ -283,7 +283,7 @@ MimeData* GlobalSearch::LoadTracks(const SearchProvider::ResultList& results) { // possible to combine different providers. Just take the results from a // single provider. if (results.isEmpty()) { - return NULL; + return nullptr; } SearchProvider* first_provider = results[0].provider_; diff --git a/src/globalsearch/globalsearchmodel.cpp b/src/globalsearch/globalsearchmodel.cpp index 4408fa4c3..ca0aa6e58 100644 --- a/src/globalsearch/globalsearchmodel.cpp +++ b/src/globalsearch/globalsearchmodel.cpp @@ -24,7 +24,7 @@ GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent) : QStandardItemModel(parent), engine_(engine), - proxy_(NULL), + proxy_(nullptr), use_pretty_covers_(true), artist_icon_(":/icons/22x22/x-clementine-artist.png"), album_icon_(":/icons/22x22/x-clementine-album.png") diff --git a/src/globalsearch/globalsearchview.cpp b/src/globalsearch/globalsearchview.cpp index 9b38847aa..7314e588a 100644 --- a/src/globalsearch/globalsearchview.cpp +++ b/src/globalsearch/globalsearchview.cpp @@ -52,7 +52,7 @@ GlobalSearchView::GlobalSearchView(Application* app, QWidget* parent) app_(app), engine_(app_->global_search()), ui_(new Ui_GlobalSearchView), - context_menu_(NULL), + context_menu_(nullptr), last_search_id_(0), front_model_(new GlobalSearchModel(engine_, this)), back_model_(new GlobalSearchModel(engine_, this)), @@ -358,7 +358,7 @@ void GlobalSearchView::ArtLoaded(int id, const QPixmap& pixmap) { MimeData* GlobalSearchView::SelectedMimeData() { if (!ui_->results->selectionModel()) - return NULL; + return nullptr; // Get all selected model indexes QModelIndexList indexes = ui_->results->selectionModel()->selectedRows(); @@ -377,7 +377,7 @@ MimeData* GlobalSearchView::SelectedMimeData() { // Still got nothing? Give up. if (indexes.isEmpty()) { - return NULL; + return nullptr; } // Get items for these indexes diff --git a/src/globalsearch/groovesharksearchprovider.cpp b/src/globalsearch/groovesharksearchprovider.cpp index 0661ac207..2c1ee44ee 100644 --- a/src/globalsearch/groovesharksearchprovider.cpp +++ b/src/globalsearch/groovesharksearchprovider.cpp @@ -26,7 +26,7 @@ GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, QObject* parent) : SearchProvider(app, parent), - service_(NULL) + service_(nullptr) { } diff --git a/src/globalsearch/searchprovider.cpp b/src/globalsearch/searchprovider.cpp index 51d55413a..428355234 100644 --- a/src/globalsearch/searchprovider.cpp +++ b/src/globalsearch/searchprovider.cpp @@ -126,7 +126,7 @@ void SearchProvider::LoadArtAsync(int id, const Result& result) { } MimeData* SearchProvider::LoadTracks(const ResultList& results) { - MimeData* mime_data = NULL; + MimeData* mime_data = nullptr; if (mime_data_contains_urls_only()) { mime_data = new MimeData; diff --git a/src/globalsearch/soundcloudsearchprovider.cpp b/src/globalsearch/soundcloudsearchprovider.cpp index d79525814..5af8f456f 100644 --- a/src/globalsearch/soundcloudsearchprovider.cpp +++ b/src/globalsearch/soundcloudsearchprovider.cpp @@ -26,7 +26,7 @@ SoundCloudSearchProvider::SoundCloudSearchProvider(Application* app, QObject* parent) : SearchProvider(app, parent), - service_(NULL) + service_(nullptr) { } diff --git a/src/globalsearch/spotifysearchprovider.cpp b/src/globalsearch/spotifysearchprovider.cpp index 5f955c27b..3e08aa529 100644 --- a/src/globalsearch/spotifysearchprovider.cpp +++ b/src/globalsearch/spotifysearchprovider.cpp @@ -33,8 +33,8 @@ const int kSearchAlbumLimit = 20; SpotifySearchProvider::SpotifySearchProvider(Application* app, QObject* parent) : SearchProvider(app, parent), - server_(NULL), - service_(NULL) + server_(nullptr), + service_(nullptr) { Init("Spotify", "spotify", QIcon(":icons/32x32/spotify.png"), WantsDelayedQueries | WantsSerialisedArtQueries | ArtIsProbablyRemote | @@ -49,7 +49,7 @@ SpotifyServer* SpotifySearchProvider::server() { service_ = InternetModel::Service(); if (service_->login_state() != SpotifyService::LoginState_LoggedIn) - return NULL; + return nullptr; server_ = service_->server(); connect(server_, SIGNAL(SearchResults(pb::spotify::SearchResponse)), @@ -66,7 +66,7 @@ SpotifyServer* SpotifySearchProvider::server() { } void SpotifySearchProvider::ServerDestroyed() { - server_ = NULL; + server_ = nullptr; } void SpotifySearchProvider::SearchAsync(int id, const QString& query) { diff --git a/src/internet/cloudfileservice.cpp b/src/internet/cloudfileservice.cpp index 4b7c7232c..55cb1ab7a 100644 --- a/src/internet/cloudfileservice.cpp +++ b/src/internet/cloudfileservice.cpp @@ -25,7 +25,7 @@ CloudFileService::CloudFileService( const QIcon& icon, SettingsDialog::Page settings_page) : InternetService(service_name, app, parent, parent), - root_(NULL), + root_(nullptr), network_(new NetworkAccessManager(this)), library_sort_model_(new QSortFilterProxyModel(this)), playlist_manager_(app->playlist_manager()), diff --git a/src/internet/digitallyimportedservicebase.cpp b/src/internet/digitallyimportedservicebase.cpp index 4ef5086bc..3e363afbc 100644 --- a/src/internet/digitallyimportedservicebase.cpp +++ b/src/internet/digitallyimportedservicebase.cpp @@ -56,7 +56,7 @@ DigitallyImportedServiceBase::DigitallyImportedServiceBase( url_handler_(new DigitallyImportedUrlHandler(app, this)), basic_audio_type_(1), premium_audio_type_(2), - root_(NULL), + root_(nullptr), saved_channels_(kSettingsGroup, api_service_name, kStreamsCacheDurationSecs), api_client_(new DigitallyImportedClient(api_service_name, this)) { diff --git a/src/internet/digitallyimportedurlhandler.cpp b/src/internet/digitallyimportedurlhandler.cpp index 24b05665f..651097148 100644 --- a/src/internet/digitallyimportedurlhandler.cpp +++ b/src/internet/digitallyimportedurlhandler.cpp @@ -79,7 +79,7 @@ void DigitallyImportedUrlHandler::LoadPlaylistFinished(QIODevice* device) { CancelTask(); // Try to parse the playlist - PlaylistParser parser(NULL); + PlaylistParser parser(nullptr); QList songs = parser.LoadFromDevice(device); qLog(Info) << "Loading station finished, got" << songs.count() << "songs"; diff --git a/src/internet/dropboxauthenticator.cpp b/src/internet/dropboxauthenticator.cpp index 2cbda3d81..ce3239df6 100644 --- a/src/internet/dropboxauthenticator.cpp +++ b/src/internet/dropboxauthenticator.cpp @@ -133,7 +133,7 @@ QByteArray DropboxAuthenticator::GenerateAuthorisationHeader( QList params; params << Param("oauth_consumer_key", kAppKey) << Param("oauth_signature_method", "PLAINTEXT") - << Param("oauth_timestamp", QString::number(time(NULL))) + << Param("oauth_timestamp", QString::number(time(nullptr))) << Param("oauth_nonce", QString::number(qrand())) << Param("oauth_signature", signature); if (!token.isNull()) { diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index ba5234c44..d700d7e88 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -87,29 +87,29 @@ GroovesharkService::GroovesharkService(Application* app, InternetModel *parent) : InternetService(kServiceName, app, parent, parent), url_handler_(new GroovesharkUrlHandler(this, this)), next_pending_search_id_(0), - root_(NULL), - search_(NULL), - popular_month_(NULL), - popular_today_(NULL), - stations_(NULL), - grooveshark_radio_(NULL), - favorites_(NULL), - library_(NULL), - playlists_parent_(NULL), - subscribed_playlists_parent_(NULL), + root_(nullptr), + search_(nullptr), + popular_month_(nullptr), + popular_today_(nullptr), + stations_(nullptr), + grooveshark_radio_(nullptr), + favorites_(nullptr), + library_(nullptr), + playlists_parent_(nullptr), + subscribed_playlists_parent_(nullptr), network_(new NetworkAccessManager(this)), - context_menu_(NULL), - create_playlist_(NULL), - delete_playlist_(NULL), - rename_playlist_(NULL), - remove_from_playlist_(NULL), - remove_from_favorites_(NULL), - remove_from_library_(NULL), - get_url_to_share_song_(NULL), - get_url_to_share_playlist_(NULL), + context_menu_(nullptr), + create_playlist_(nullptr), + delete_playlist_(nullptr), + rename_playlist_(nullptr), + remove_from_playlist_(nullptr), + remove_from_favorites_(nullptr), + remove_from_library_(nullptr), + get_url_to_share_song_(nullptr), + get_url_to_share_playlist_(nullptr), search_box_(new SearchBoxWidget(this)), search_delay_(new QTimer(this)), - last_search_reply_(NULL), + last_search_reply_(nullptr), api_key_(QByteArray::fromBase64(kApiSecret)), login_state_(LoginState_OtherError), task_popular_id_(0), @@ -170,7 +170,7 @@ void GroovesharkService::ShowConfig() { QWidget* GroovesharkService::HeaderWidget() const { if (IsLoggedIn()) return search_box_; - return NULL; + return nullptr; } void GroovesharkService::Search(const QString& text, bool now) { @@ -405,7 +405,7 @@ void GroovesharkService::Authenticated(QNetworkReply* reply) { login_state_ = LoginState_NoPremium; } if (!error.isEmpty()) { - QMessageBox::warning(NULL, tr("Grooveshark login error"), error, QMessageBox::Close); + QMessageBox::warning(nullptr, tr("Grooveshark login error"), error, QMessageBox::Close); ResetSessionId(); emit LoginFinished(false); return; @@ -430,17 +430,17 @@ void GroovesharkService::RemoveItems() { root_->removeRows(0, root_->rowCount()); // 'search', 'favorites', 'popular', ... items were root's children, and have // been deleted: we should update these now invalid pointers - search_ = NULL; - popular_month_ = NULL; - popular_today_ = NULL; - library_ = NULL; - favorites_ = NULL; - subscribed_playlists_parent_ = NULL; - stations_ = NULL; - grooveshark_radio_ = NULL; - playlists_parent_ = NULL; + search_ = nullptr; + popular_month_ = nullptr; + popular_today_ = nullptr; + library_ = nullptr; + favorites_ = nullptr; + subscribed_playlists_parent_ = nullptr; + stations_ = nullptr; + grooveshark_radio_ = nullptr; + playlists_parent_ = nullptr; playlists_.clear(); - subscribed_playlists_parent_ = NULL; + subscribed_playlists_parent_ = nullptr; subscribed_playlists_.clear(); pending_retrieve_playlists_.clear(); } @@ -1014,7 +1014,7 @@ GeneratorPtr GroovesharkService::CreateGenerator(QStandardItem* item) { if (item == grooveshark_radio_) { if (last_artists_ids_.isEmpty()) { - QMessageBox::warning(NULL, tr("Error"), + QMessageBox::warning(nullptr, tr("Error"), tr("To start Grooveshark radio, you should first listen to a few other Grooveshark songs")); return ret; } @@ -1240,7 +1240,7 @@ void GroovesharkService::RefreshPlaylist(int playlist_id) { } void GroovesharkService::CreateNewPlaylist() { - QString name = QInputDialog::getText(NULL, + QString name = QInputDialog::getText(nullptr, tr("Create a new Grooveshark playlist"), tr("Name"), QLineEdit::Normal); @@ -1333,7 +1333,7 @@ void GroovesharkService::RenamePlaylist(int playlist_id) { return; } const QString& old_name = playlists_[playlist_id].name_; - QString new_name = QInputDialog::getText(NULL, + QString new_name = QInputDialog::getText(nullptr, tr("Rename \"%1\" playlist").arg(old_name), tr("Name"), QLineEdit::Normal, diff --git a/src/internet/icecastmodel.cpp b/src/internet/icecastmodel.cpp index b1732d188..5954c365d 100644 --- a/src/internet/icecastmodel.cpp +++ b/src/internet/icecastmodel.cpp @@ -200,7 +200,7 @@ QStringList IcecastModel::mimeTypes() const { QMimeData* IcecastModel::mimeData(const QModelIndexList& indexes) const { if (indexes.isEmpty()) - return NULL; + return nullptr; SongMimeData* data = new SongMimeData; QList urls; @@ -216,7 +216,7 @@ QMimeData* IcecastModel::mimeData(const QModelIndexList& indexes) const { if (data->songs.isEmpty()) { delete data; - return NULL; + return nullptr; } data->setUrls(urls); diff --git a/src/internet/icecastservice.cpp b/src/internet/icecastservice.cpp index 00e83ac6f..50ca8445b 100644 --- a/src/internet/icecastservice.cpp +++ b/src/internet/icecastservice.cpp @@ -52,9 +52,9 @@ const char* IcecastService::kHomepage = "http://dir.xiph.org/"; IcecastService::IcecastService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), network_(new NetworkAccessManager(this)), - context_menu_(NULL), - backend_(NULL), - model_(NULL), + context_menu_(nullptr), + backend_(nullptr), + model_(nullptr), filter_(new IcecastFilterWidget(0)), load_directory_task_id_(0) { diff --git a/src/internet/internetmodel.cpp b/src/internet/internetmodel.cpp index 289f591e0..9b01a7dfc 100644 --- a/src/internet/internetmodel.cpp +++ b/src/internet/internetmodel.cpp @@ -61,7 +61,7 @@ using smart_playlists::Generator; using smart_playlists::GeneratorMimeData; using smart_playlists::GeneratorPtr; -QMap* InternetModel::sServices = NULL; +QMap* InternetModel::sServices = nullptr; InternetModel::InternetModel(Application* app, QObject* parent) : QStandardItemModel(parent), @@ -162,7 +162,7 @@ void InternetModel::ServiceDeleted() { InternetService* InternetModel::ServiceByName(const QString& name) { if (sServices->contains(name)) return sServices->value(name); - return NULL; + return nullptr; } InternetService* InternetModel::ServiceForItem(const QStandardItem* item) const { @@ -178,7 +178,7 @@ InternetService* InternetModel::ServiceForIndex(const QModelIndex& index) const } current_index = current_index.parent(); } - return NULL; + return nullptr; } Qt::ItemFlags InternetModel::flags(const QModelIndex& index) const { @@ -230,7 +230,7 @@ QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const { indexes[0].data(Role_PlayBehaviour).toInt() == PlayBehaviour_DoubleClickAction) { InternetModel::ServiceForIndex(indexes[0])->ItemDoubleClicked(itemFromIndex(indexes[0])); - return NULL; + return nullptr; } if (indexes.count() == 1 && @@ -238,7 +238,7 @@ QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const { GeneratorPtr generator = InternetModel::ServiceForIndex(indexes[0])->CreateGenerator(itemFromIndex(indexes[0])); if (!generator) - return NULL; + return nullptr; GeneratorMimeData* data = new GeneratorMimeData(generator); data->setData(LibraryModel::kSmartPlaylistsMimeType, QByteArray()); data->name_for_new_playlist_ = this->data(indexes.first()).toString(); @@ -271,7 +271,7 @@ QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const { } if (urls.isEmpty()) - return NULL; + return nullptr; InternetMimeData* data = new InternetMimeData(this); data->setUrls(urls); diff --git a/src/internet/internetservice.cpp b/src/internet/internetservice.cpp index b809f3ffb..31d5bfd49 100644 --- a/src/internet/internetservice.cpp +++ b/src/internet/internetservice.cpp @@ -31,10 +31,10 @@ InternetService::InternetService(const QString& name, Application* app, app_(app), model_(model), name_(name), - append_to_playlist_(NULL), - replace_playlist_(NULL), - open_in_new_playlist_(NULL), - separator_(NULL) + append_to_playlist_(nullptr), + replace_playlist_(nullptr), + open_in_new_playlist_(nullptr), + separator_(nullptr) { } diff --git a/src/internet/internetviewcontainer.cpp b/src/internet/internetviewcontainer.cpp index 206c995aa..1a731bbbb 100644 --- a/src/internet/internetviewcontainer.cpp +++ b/src/internet/internetviewcontainer.cpp @@ -32,9 +32,9 @@ const int InternetViewContainer::kAnimationDuration = 500; InternetViewContainer::InternetViewContainer(QWidget *parent) : QWidget(parent), ui_(new Ui_InternetViewContainer), - app_(NULL), - current_service_(NULL), - current_header_(NULL) + app_(nullptr), + current_service_(nullptr), + current_header_(nullptr) { ui_->setupUi(this); @@ -96,8 +96,8 @@ void InternetViewContainer::Collapsed(const QModelIndex& index) { if (app_->internet_model()->merged_model()->mapToSource(index).model() == app_->internet_model() && index.data(InternetModel::Role_Type) == InternetModel::Type_Service) { SetHeaderVisible(current_header_, false); - current_service_ = NULL; - current_header_ = NULL; + current_service_ = nullptr; + current_header_ = nullptr; } } @@ -133,7 +133,7 @@ void InternetViewContainer::FocusOnFilter(QKeyEvent* event) { void InternetViewContainer::SetHeaderHeight(int height) { QTimeLine* animation = qobject_cast(sender()); - QWidget* header = NULL; + QWidget* header = nullptr; foreach (QWidget* h, headers_.keys()) { if (headers_[h].animation_ == animation) { header = h; diff --git a/src/internet/jamendoservice.cpp b/src/internet/jamendoservice.cpp index 325b800c2..c968909dd 100644 --- a/src/internet/jamendoservice.cpp +++ b/src/internet/jamendoservice.cpp @@ -73,12 +73,12 @@ const int JamendoService::kApproxDatabaseSize = 300000; JamendoService::JamendoService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), network_(new NetworkAccessManager(this)), - context_menu_(NULL), - library_backend_(NULL), - library_filter_(NULL), - library_model_(NULL), + context_menu_(nullptr), + library_backend_(nullptr), + library_filter_(nullptr), + library_model_(nullptr), library_sort_model_(new QSortFilterProxyModel(this)), - search_provider_(NULL), + search_provider_(nullptr), load_database_task_id_(0), total_song_count_(0), accepted_download_(false) { diff --git a/src/internet/lastfmservice.cpp b/src/internet/lastfmservice.cpp index b8c2c6730..756dd661f 100644 --- a/src/internet/lastfmservice.cpp +++ b/src/internet/lastfmservice.cpp @@ -86,19 +86,19 @@ const int LastFMService::kFriendsCacheDurationSecs = 60 * 60 * 24; // 1 day LastFMService::LastFMService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), url_handler_(new LastFMUrlHandler(this, this)), - scrobbler_(NULL), + scrobbler_(nullptr), already_scrobbled_(false), station_dialog_(new LastFMStationDialog), context_menu_(new QMenu), initial_tune_(false), tune_task_id_(0), scrobbling_enabled_(false), - root_item_(NULL), - artist_list_(NULL), - tag_list_(NULL), - custom_list_(NULL), - friends_list_(NULL), - neighbours_list_(NULL), + root_item_(nullptr), + artist_list_(nullptr), + tag_list_(nullptr), + custom_list_(nullptr), + friends_list_(nullptr), + neighbours_list_(nullptr), friend_names_(kSettingsGroup, "friend_names", kFriendsCacheDurationSecs), connection_problems_(false) { @@ -330,7 +330,7 @@ void LastFMService::AuthenticateReplyFinished(QNetworkReply* reply) { // Invalidate the scrobbler - it will get recreated later delete scrobbler_; - scrobbler_ = NULL; + scrobbler_ = nullptr; emit AuthenticationComplete(true, QString()); } diff --git a/src/internet/magnatunedownloaddialog.cpp b/src/internet/magnatunedownloaddialog.cpp index edf645223..d8d92aca7 100644 --- a/src/internet/magnatunedownloaddialog.cpp +++ b/src/internet/magnatunedownloaddialog.cpp @@ -44,7 +44,7 @@ MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service, ui_(new Ui_MagnatuneDownloadDialog), service_(service), network_(new NetworkAccessManager(this)), - current_reply_(NULL), + current_reply_(nullptr), next_row_(0) { ui_->setupUi(this); @@ -230,7 +230,7 @@ void MagnatuneDownloadDialog::ShowError(const QString &message) { } void MagnatuneDownloadDialog::AllFinished(bool error) { - current_reply_ = NULL; + current_reply_ = nullptr; if (error) ui_->button_box->button(QDialogButtonBox::Ok)->show(); diff --git a/src/internet/magnatuneservice.cpp b/src/internet/magnatuneservice.cpp index 78c343bd4..fe661be2f 100644 --- a/src/internet/magnatuneservice.cpp +++ b/src/internet/magnatuneservice.cpp @@ -67,11 +67,11 @@ const char* MagnatuneService::kDownloadUrl = "http://download.magnatune.com/buy/ MagnatuneService::MagnatuneService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), url_handler_(new MagnatuneUrlHandler(this, this)), - context_menu_(NULL), - root_(NULL), - library_backend_(NULL), - library_model_(NULL), - library_filter_(NULL), + context_menu_(nullptr), + root_(nullptr), + library_backend_(nullptr), + library_model_(nullptr), + library_filter_(nullptr), library_sort_model_(new QSortFilterProxyModel(this)), load_database_task_id_(0), membership_(Membership_None), diff --git a/src/internet/savedradio.cpp b/src/internet/savedradio.cpp index d94ba561a..478250c9b 100644 --- a/src/internet/savedradio.cpp +++ b/src/internet/savedradio.cpp @@ -32,8 +32,8 @@ const char* SavedRadio::kSettingsGroup = "SavedRadio"; SavedRadio::SavedRadio(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), - context_menu_(NULL), - root_(NULL) + context_menu_(nullptr), + root_(nullptr) { LoadStreams(); diff --git a/src/internet/somafmservice.cpp b/src/internet/somafmservice.cpp index 5e3487619..899866ac8 100644 --- a/src/internet/somafmservice.cpp +++ b/src/internet/somafmservice.cpp @@ -56,8 +56,8 @@ SomaFMServiceBase::SomaFMServiceBase( : InternetService(name, app, parent, parent), url_scheme_(name.toLower().remove(' ')), url_handler_(new SomaFMUrlHandler(app, this, this)), - root_(NULL), - context_menu_(NULL), + root_(nullptr), + context_menu_(nullptr), network_(new NetworkAccessManager(this)), streams_(name, "streams", kStreamsCacheDurationSecs), name_(name), diff --git a/src/internet/somafmurlhandler.cpp b/src/internet/somafmurlhandler.cpp index 07f4c3a70..062ff45a1 100644 --- a/src/internet/somafmurlhandler.cpp +++ b/src/internet/somafmurlhandler.cpp @@ -76,7 +76,7 @@ void SomaFMUrlHandler::LoadPlaylistFinished() { } // Parse the playlist - PlaylistParser parser(NULL); + PlaylistParser parser(nullptr); QList songs = parser.LoadFromDevice(reply); qLog(Info) << "Loading station finished, got" << songs.count() << "songs"; diff --git a/src/internet/soundcloudservice.cpp b/src/internet/soundcloudservice.cpp index ae0cef802..8ebf2379b 100644 --- a/src/internet/soundcloudservice.cpp +++ b/src/internet/soundcloudservice.cpp @@ -57,10 +57,10 @@ typedef QPair Param; SoundCloudService::SoundCloudService(Application* app, InternetModel *parent) : InternetService(kServiceName, app, parent, parent), - root_(NULL), - search_(NULL), + root_(nullptr), + search_(nullptr), network_(new NetworkAccessManager(this)), - context_menu_(NULL), + context_menu_(nullptr), search_box_(new SearchBoxWidget(this)), search_delay_(new QTimer(this)), next_pending_search_id_(0) { diff --git a/src/internet/spotifyblobdownloader.cpp b/src/internet/spotifyblobdownloader.cpp index 2dbe7d70a..9827d6557 100644 --- a/src/internet/spotifyblobdownloader.cpp +++ b/src/internet/spotifyblobdownloader.cpp @@ -55,7 +55,7 @@ SpotifyBlobDownloader::~SpotifyBlobDownloader() { } bool SpotifyBlobDownloader::Prompt() { - QMessageBox::StandardButton ret = QMessageBox::question(NULL, + QMessageBox::StandardButton ret = QMessageBox::question(nullptr, tr("Spotify plugin not installed"), tr("An additional plugin is required to use Spotify in Clementine. Would you like to download and install it now?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); @@ -212,7 +212,7 @@ void SpotifyBlobDownloader::ShowError(const QString& message) { } qLog(Warning) << message; - QMessageBox::warning(NULL, tr("Error downloading Spotify plugin"), message, + QMessageBox::warning(nullptr, tr("Error downloading Spotify plugin"), message, QMessageBox::Close); deleteLater(); } diff --git a/src/internet/spotifyserver.cpp b/src/internet/spotifyserver.cpp index ecd48bea3..3728b2449 100644 --- a/src/internet/spotifyserver.cpp +++ b/src/internet/spotifyserver.cpp @@ -26,7 +26,7 @@ #include SpotifyServer::SpotifyServer(QObject* parent) - : AbstractMessageHandler(NULL, parent), + : AbstractMessageHandler(nullptr, parent), server_(new QTcpServer(this)), logged_in_(false) { diff --git a/src/internet/spotifyservice.cpp b/src/internet/spotifyservice.cpp index 543744ed3..e3f623121 100644 --- a/src/internet/spotifyservice.cpp +++ b/src/internet/spotifyservice.cpp @@ -43,15 +43,15 @@ const int SpotifyService::kSearchDelayMsec = 400; SpotifyService::SpotifyService(Application* app, InternetModel* parent) : InternetService(kServiceName, app, parent, parent), - server_(NULL), - blob_process_(NULL), - root_(NULL), - search_(NULL), - starred_(NULL), - inbox_(NULL), - toplist_(NULL), + server_(nullptr), + blob_process_(nullptr), + root_(nullptr), + search_(nullptr), + starred_(nullptr), + inbox_(nullptr), + toplist_(nullptr), login_task_id_(0), - context_menu_(NULL), + context_menu_(nullptr), search_box_(new SearchBoxWidget(this)), search_delay_(new QTimer(this)), login_state_(LoginState_OtherError), @@ -181,7 +181,7 @@ void SpotifyService::LoginCompleted(bool success, const QString& error, } if (show_error_dialog) { - QMessageBox::warning(NULL, tr("Spotify login error"), error_copy, QMessageBox::Close); + QMessageBox::warning(nullptr, tr("Spotify login error"), error_copy, QMessageBox::Close); } } else { login_state_ = LoginState_LoggedIn; @@ -197,7 +197,7 @@ void SpotifyService::LoginCompleted(bool success, const QString& error, void SpotifyService::BlobProcessError(QProcess::ProcessError error) { qLog(Error) << "Spotify blob process failed:" << error; blob_process_->deleteLater(); - blob_process_ = NULL; + blob_process_ = nullptr; if (login_task_id_) { app_->task_manager()->SetTaskFinished(login_task_id_); @@ -449,7 +449,7 @@ QStandardItem* SpotifyService::PlaylistBySpotifyIndex(int index) const { return item; } } - return NULL; + return nullptr; } void SpotifyService::UserPlaylistLoaded(const pb::spotify::LoadPlaylistResponse& response) { @@ -515,7 +515,7 @@ PlaylistItem::Options SpotifyService::playlistitem_options() const { QWidget* SpotifyService::HeaderWidget() const { if (IsLoggedIn()) return search_box_; - return NULL; + return nullptr; } void SpotifyService::EnsureMenuCreated() { @@ -719,8 +719,8 @@ void SpotifyService::ShowConfig() { void SpotifyService::Logout() { delete server_; delete blob_process_; - server_ = NULL; - blob_process_ = NULL; + server_ = nullptr; + blob_process_ = nullptr; login_state_ = LoginState_OtherError; diff --git a/src/internet/subsonicservice.cpp b/src/internet/subsonicservice.cpp index 31582a65c..bb9443d9c 100644 --- a/src/internet/subsonicservice.cpp +++ b/src/internet/subsonicservice.cpp @@ -41,11 +41,11 @@ SubsonicService::SubsonicService(Application* app, InternetModel* parent) url_handler_(new SubsonicUrlHandler(this, this)), scanner_(new SubsonicLibraryScanner(this, this)), load_database_task_id_(0), - context_menu_(NULL), - root_(NULL), - library_backend_(NULL), - library_model_(NULL), - library_filter_(NULL), + context_menu_(nullptr), + root_(nullptr), + library_backend_(nullptr), + library_model_(nullptr), + library_filter_(nullptr), library_sort_model_(new QSortFilterProxyModel(this)), total_song_count_(0), login_state_(LoginState_OtherError), diff --git a/src/internet/ubuntuoneauthenticator.cpp b/src/internet/ubuntuoneauthenticator.cpp index 8091fd0af..9a62460a9 100644 --- a/src/internet/ubuntuoneauthenticator.cpp +++ b/src/internet/ubuntuoneauthenticator.cpp @@ -85,7 +85,7 @@ QByteArray UbuntuOneAuthenticator::GenerateAuthorisationHeader( const QString& token, const QString& token_secret) { typedef QPair Param; - QString timestamp = QString::number(time(NULL)); + QString timestamp = QString::number(time(nullptr)); QList parameters; parameters << Param("oauth_nonce", QString::number(qrand())) << Param("oauth_timestamp", timestamp) diff --git a/src/library/library.cpp b/src/library/library.cpp index 308ce7233..e77f22a56 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -37,10 +37,10 @@ const char* Library::kFtsTable = "songs_fts"; Library::Library(Application* app, QObject *parent) : QObject(parent), app_(app), - backend_(NULL), - model_(NULL), - watcher_(NULL), - watcher_thread_(NULL) + backend_(nullptr), + model_(nullptr), + watcher_(nullptr), + watcher_thread_(nullptr) { backend_ = new LibraryBackend; backend()->moveToThread(app->database()->thread()); diff --git a/src/library/libraryfilterwidget.cpp b/src/library/libraryfilterwidget.cpp index 3f866149b..37c3aec2b 100644 --- a/src/library/libraryfilterwidget.cpp +++ b/src/library/libraryfilterwidget.cpp @@ -33,7 +33,7 @@ LibraryFilterWidget::LibraryFilterWidget(QWidget *parent) : QWidget(parent), ui_(new Ui_LibraryFilterWidget), - model_(NULL), + model_(nullptr), group_by_dialog_(new GroupByDialog), filter_delay_(new QTimer(this)), filter_applies_to_model_(true), diff --git a/src/library/librarymodel.cpp b/src/library/librarymodel.cpp index 011a4466d..9a1240aaf 100644 --- a/src/library/librarymodel.cpp +++ b/src/library/librarymodel.cpp @@ -174,7 +174,7 @@ void LibraryModel::SongsDiscovered(const SongList& songs) { // Special case: if the song is a compilation and the current GroupBy // level is Artists, then we want the Various Artists node :( if (IsArtistGroupBy(type) && song.is_compilation()) { - if (container->compilation_artist_node_ == NULL) + if (container->compilation_artist_node_ == nullptr) CreateCompilationArtistNode(true, container); container = container->compilation_artist_node_; } else { @@ -242,7 +242,7 @@ LibraryItem* LibraryModel::CreateCompilationArtistNode(bool signal, LibraryItem* parent->compilation_artist_node_ = new LibraryItem(LibraryItem::Type_Container, parent); - parent->compilation_artist_node_->compilation_artist_node_ = NULL; + parent->compilation_artist_node_->compilation_artist_node_ = nullptr; parent->compilation_artist_node_->key = tr("Various artists"); parent->compilation_artist_node_->sort_text = " various"; parent->compilation_artist_node_->container_level = parent->container_level + 1; @@ -378,7 +378,7 @@ void LibraryModel::SongsDeleted(const SongList& songs) { // Special case the Various Artists node if (IsCompilationArtistNode(node)) - node->parent->compilation_artist_node_ = NULL; + node->parent->compilation_artist_node_ = nullptr; else container_nodes_[node->container_level].remove(node->key); @@ -702,10 +702,10 @@ void LibraryModel::BeginReset() { container_nodes_[2].clear(); divider_nodes_.clear(); pending_art_.clear(); - smart_playlist_node_ = NULL; + smart_playlist_node_ = nullptr; root_ = new LibraryItem(this); - root_->compilation_artist_node_ = NULL; + root_->compilation_artist_node_ = nullptr; root_->lazy_loaded = false; // Smart playlists? @@ -833,7 +833,7 @@ LibraryItem* LibraryModel::InitItem(GroupBy type, bool signal, LibraryItem *pare // Initialise the item depending on what type it's meant to be LibraryItem* item = new LibraryItem(item_type, parent); - item->compilation_artist_node_ = NULL; + item->compilation_artist_node_ = nullptr; item->container_level = container_level; return item; } @@ -1072,13 +1072,13 @@ QStringList LibraryModel::mimeTypes() const { QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const { if (indexes.isEmpty()) - return NULL; + return nullptr; // Special case: a smart playlist was dragged if (IndexToItem(indexes.first())->type == LibraryItem::Type_SmartPlaylist) { GeneratorPtr generator = CreateGenerator(indexes.first()); if (!generator) - return NULL; + return nullptr; GeneratorMimeData* data = new GeneratorMimeData(generator); data->setData(kSmartPlaylistsMimeType, QByteArray()); @@ -1248,7 +1248,7 @@ void LibraryModel::CreateSmartPlaylists() { void LibraryModel::ItemFromSmartPlaylist(const QSettings& s, bool notify) const { LibraryItem* item = new LibraryItem(LibraryItem::Type_SmartPlaylist, - notify ? NULL : smart_playlist_node_); + notify ? nullptr : smart_playlist_node_); item->display_text = tr(qPrintable(s.value("name").toString())); item->sort_text = item->display_text; item->key = s.value("type").toString(); diff --git a/src/library/libraryview.cpp b/src/library/libraryview.cpp index 297212837..b4976463d 100644 --- a/src/library/libraryview.cpp +++ b/src/library/libraryview.cpp @@ -165,11 +165,11 @@ bool LibraryItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view, LibraryView::LibraryView(QWidget* parent) : AutoExpandingTreeView(parent), - app_(NULL), - filter_(NULL), + app_(nullptr), + filter_(nullptr), total_song_count_(-1), nomusic_(":nomusic.png"), - context_menu_(NULL), + context_menu_(nullptr), is_in_keyboard_search_(false) { setItemDelegate(new LibraryItemDelegate(this)); @@ -296,7 +296,7 @@ void LibraryView::ReloadSettings() { s.beginGroup(kSettingsGroup); SetAutoOpen(s.value("auto_open", true).toBool()); - if (app_ != NULL) { + if (app_ != nullptr) { app_->library_model()->set_pretty_covers(s.value("pretty_covers", true).toBool()); app_->library_model()->set_show_dividers(s.value("show_dividers", true).toBool()); } diff --git a/src/library/librarywatcher.cpp b/src/library/librarywatcher.cpp index 4a421a840..7867cb5e5 100644 --- a/src/library/librarywatcher.cpp +++ b/src/library/librarywatcher.cpp @@ -49,8 +49,8 @@ const char* LibraryWatcher::kSettingsGroup = "LibraryWatcher"; LibraryWatcher::LibraryWatcher(QObject* parent) : QObject(parent), - backend_(NULL), - task_manager_(NULL), + backend_(nullptr), + task_manager_(nullptr), fs_watcher_(FileSystemWatcherInterface::Create(this)), stop_requested_(false), scan_on_startup_(true), diff --git a/src/main.cpp b/src/main.cpp index cd7bcc2f1..bc2f8bba2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,7 +137,7 @@ void IncreaseFDLimit() { // getrlimit() lies about the hard limit so we have to check sysctl. int max_fd = 0; size_t len = sizeof(max_fd); - sysctlbyname("kern.maxfilesperproc", &max_fd, &len, NULL, 0); + sysctlbyname("kern.maxfilesperproc", &max_fd, &len, nullptr, 0); limit.rlim_cur = max_fd; int ret = setrlimit(RLIMIT_NOFILE, &limit); @@ -309,14 +309,14 @@ int main(int argc, char *argv[]) { // Initialise logging logging::Init(); logging::SetLevels(options.log_levels()); - g_log_set_default_handler(reinterpret_cast(&logging::GLog), NULL); + g_log_set_default_handler(reinterpret_cast(&logging::GLog), nullptr); // Output the version, so when people attach log output to bug reports they // don't have to tell us which version they're using. qLog(Info) << "Clementine" << CLEMENTINE_VERSION_DISPLAY; // Seed the random number generators. - time_t t = time(NULL); + time_t t = time(nullptr); srand(t); qsrand(t); diff --git a/src/moodbar/moodbarcontroller.cpp b/src/moodbar/moodbarcontroller.cpp index eb97af365..6241edca1 100644 --- a/src/moodbar/moodbarcontroller.cpp +++ b/src/moodbar/moodbarcontroller.cpp @@ -35,7 +35,7 @@ MoodbarController::MoodbarController(Application* app, QObject* parent) void MoodbarController::CurrentSongChanged(const Song& song) { QByteArray data; - MoodbarPipeline* pipeline = NULL; + MoodbarPipeline* pipeline = nullptr; const MoodbarLoader::Result result = app_->moodbar_loader()->Load(song.url(), &data, &pipeline); diff --git a/src/moodbar/moodbaritemdelegate.cpp b/src/moodbar/moodbaritemdelegate.cpp index cb5826c42..4a52d3315 100644 --- a/src/moodbar/moodbaritemdelegate.cpp +++ b/src/moodbar/moodbaritemdelegate.cpp @@ -119,7 +119,7 @@ void MoodbarItemDelegate::StartLoadingData(const QUrl& url, Data* data) { // Load a mood file for this song and generate some colors from it QByteArray bytes; - MoodbarPipeline* pipeline = NULL; + MoodbarPipeline* pipeline = nullptr; switch (app_->moodbar_loader()->Load(url, &bytes, &pipeline)) { case MoodbarLoader::CannotLoad: data->state_ = Data::State_CannotLoad; diff --git a/src/moodbar/moodbarpipeline.cpp b/src/moodbar/moodbarpipeline.cpp index 835e52e79..6937233bf 100644 --- a/src/moodbar/moodbarpipeline.cpp +++ b/src/moodbar/moodbarpipeline.cpp @@ -28,10 +28,10 @@ bool MoodbarPipeline::sIsAvailable = false; MoodbarPipeline::MoodbarPipeline(const QUrl& local_filename) - : QObject(NULL), + : QObject(nullptr), local_filename_(local_filename), - pipeline_(NULL), - convert_element_(NULL), + pipeline_(nullptr), + convert_element_(nullptr), success_(false) { } @@ -61,7 +61,7 @@ bool MoodbarPipeline::IsAvailable() { } GstElement* MoodbarPipeline::CreateElement(const QString& factory_name) { - GstElement* ret = gst_element_factory_make(factory_name.toAscii().constData(), NULL); + GstElement* ret = gst_element_factory_make(factory_name.toAscii().constData(), nullptr); if (ret) { gst_bin_add(GST_BIN(pipeline_), ret); @@ -90,21 +90,21 @@ void MoodbarPipeline::Start() { GstElement* appsink = CreateElement("appsink"); if (!decodebin || !convert_element_ || !fftwspectrum || !moodbar || !appsink) { - pipeline_ = NULL; + pipeline_ = nullptr; emit Finished(false); return; } // Join them together - gst_element_link_many(convert_element_, fftwspectrum, moodbar, appsink, NULL); + gst_element_link_many(convert_element_, fftwspectrum, moodbar, appsink, nullptr); // Set properties - g_object_set(decodebin, "uri", local_filename_.toEncoded().constData(), NULL); + g_object_set(decodebin, "uri", local_filename_.toEncoded().constData(), nullptr); g_object_set(fftwspectrum, "def-size", 2048, "def-step", 1024, - "hiquality", true, NULL); + "hiquality", true, nullptr); g_object_set(moodbar, "height", 1, - "max-width", 1000, NULL); + "max-width", 1000, nullptr); // Connect signals CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this); @@ -115,7 +115,7 @@ void MoodbarPipeline::Start() { memset(&callbacks, 0, sizeof(callbacks)); callbacks.new_buffer = NewBufferCallback; - gst_app_sink_set_callbacks(reinterpret_cast(appsink), &callbacks, this, NULL); + gst_app_sink_set_callbacks(reinterpret_cast(appsink), &callbacks, this, nullptr); // Start playing gst_element_set_state(pipeline_, GST_STATE_PLAYING); @@ -187,9 +187,10 @@ void MoodbarPipeline::Cleanup() { Q_ASSERT(QThread::currentThread() != qApp->thread()); if (pipeline_) { - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), NULL, NULL); + gst_bus_set_sync_handler( + gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), nullptr,nullptr); gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(pipeline_); - pipeline_ = NULL; + pipeline_ = nullptr; } } diff --git a/src/moodbar/moodbarproxystyle.cpp b/src/moodbar/moodbarproxystyle.cpp index 4014c763d..10d98ead1 100644 --- a/src/moodbar/moodbarproxystyle.cpp +++ b/src/moodbar/moodbarproxystyle.cpp @@ -44,9 +44,9 @@ MoodbarProxyStyle::MoodbarProxyStyle(Application* app, QSlider* slider) fade_timeline_(new QTimeLine(1000, this)), moodbar_colors_dirty_(true), moodbar_pixmap_dirty_(true), - context_menu_(NULL), - show_moodbar_action_(NULL), - style_action_group_(NULL) + context_menu_(nullptr), + show_moodbar_action_(nullptr), + style_action_group_(nullptr) { slider->setStyle(this); slider->installEventFilter(this); diff --git a/src/musicbrainz/chromaprinter.cpp b/src/musicbrainz/chromaprinter.cpp index ea1ae2f33..6a0a6a60a 100644 --- a/src/musicbrainz/chromaprinter.cpp +++ b/src/musicbrainz/chromaprinter.cpp @@ -35,8 +35,8 @@ static const int kDecodeChannels = 1; Chromaprinter::Chromaprinter(const QString& filename) : filename_(filename), - event_loop_(NULL), - convert_element_(NULL), + event_loop_(nullptr), + convert_element_(nullptr), finishing_(false) { } @@ -82,8 +82,8 @@ QString Chromaprinter::CreateFingerprint() { convert_element_ = convert; // Connect the elements - gst_element_link_many(src, decode, NULL); - gst_element_link_many(convert, resample, NULL); + gst_element_link_many(src, decode, nullptr); + gst_element_link_many(convert, resample, nullptr); // Chromaprint expects mono floats at a sample rate of 11025Hz. GstCaps* caps = gst_caps_new_simple( @@ -91,19 +91,19 @@ QString Chromaprinter::CreateFingerprint() { "width", G_TYPE_INT, 16, "channels", G_TYPE_INT, kDecodeChannels, "rate", G_TYPE_INT, kDecodeRate, - NULL); + nullptr); gst_element_link_filtered(resample, sink, caps); gst_caps_unref(caps); GstAppSinkCallbacks callbacks; memset(&callbacks, 0, sizeof(callbacks)); callbacks.new_buffer = NewBufferCallback; - gst_app_sink_set_callbacks(reinterpret_cast(sink), &callbacks, this, NULL); - g_object_set(G_OBJECT(sink), "sync", FALSE, NULL); - g_object_set(G_OBJECT(sink), "emit-signals", TRUE, NULL); + gst_app_sink_set_callbacks(reinterpret_cast(sink), &callbacks, this, nullptr); + g_object_set(G_OBJECT(sink), "sync", FALSE, nullptr); + g_object_set(G_OBJECT(sink), "emit-signals", TRUE, nullptr); // Set the filename - g_object_set(src, "location", filename_.toUtf8().constData(), NULL); + g_object_set(src, "location", filename_.toUtf8().constData(), nullptr); // Connect signals CHECKED_GCONNECT(decode, "new-decoded-pad", &NewPadCallback, this); @@ -130,12 +130,12 @@ QString Chromaprinter::CreateFingerprint() { chromaprint_feed(chromaprint, reinterpret_cast(data.data()), data.size() / 2); chromaprint_finish(chromaprint); - void* fprint = NULL; + void* fprint = nullptr; int size = 0; int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size); QByteArray fingerprint; if (ret == 1) { - void* encoded = NULL; + void* encoded = nullptr; int encoded_size = 0; chromaprint_encode_fingerprint( fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT, &encoded, &encoded_size, 1); @@ -151,9 +151,11 @@ QString Chromaprinter::CreateFingerprint() { qLog(Debug) << "Decode time:" << decode_time << "Codegen time:" << codegen_time; // Cleanup - callbacks.new_buffer = NULL; - gst_app_sink_set_callbacks(reinterpret_cast(sink), &callbacks, this, NULL); - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), NULL, NULL); + callbacks.new_buffer = nullptr; + gst_app_sink_set_callbacks( + reinterpret_cast(sink), &callbacks, this, nullptr); + gst_bus_set_sync_handler( + gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), nullptr, nullptr); g_source_remove(bus_callback_id); gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(pipeline_); diff --git a/src/musicbrainz/tagfetcher.cpp b/src/musicbrainz/tagfetcher.cpp index 983665889..0c9991618 100644 --- a/src/musicbrainz/tagfetcher.cpp +++ b/src/musicbrainz/tagfetcher.cpp @@ -29,7 +29,7 @@ TagFetcher::TagFetcher(QObject* parent) : QObject(parent), - fingerprint_watcher_(NULL), + fingerprint_watcher_(nullptr), acoustid_client_(new AcoustidClient(this)), musicbrainz_client_(new MusicBrainzClient(this)) { @@ -61,7 +61,7 @@ void TagFetcher::Cancel() { fingerprint_watcher_->cancel(); delete fingerprint_watcher_; - fingerprint_watcher_ = NULL; + fingerprint_watcher_ = nullptr; } acoustid_client_->CancelAll(); diff --git a/src/networkremote/networkremotehelper.cpp b/src/networkremote/networkremotehelper.cpp index 27a5a63ac..8df9013db 100644 --- a/src/networkremote/networkremotehelper.cpp +++ b/src/networkremote/networkremotehelper.cpp @@ -20,7 +20,7 @@ #include "networkremote.h" #include "networkremotehelper.h" -NetworkRemoteHelper* NetworkRemoteHelper::sInstance = NULL; +NetworkRemoteHelper* NetworkRemoteHelper::sInstance = nullptr; NetworkRemoteHelper::NetworkRemoteHelper(Application* app) : app_(app) @@ -56,7 +56,7 @@ void NetworkRemoteHelper::ReloadSettings() { NetworkRemoteHelper* NetworkRemoteHelper::Instance() { if (!sInstance) { // normally he shouldn't go here. Only for safety - return NULL; + return nullptr; } return sInstance; } diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index d816d0992..eaed5a2e6 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -127,7 +127,7 @@ SongInfoProvider* OutgoingDataCreator::ProviderByName(const QString& name) const return provider; } } - return NULL; + return nullptr; } void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) { diff --git a/src/networkremote/tinysvcmdns.cpp b/src/networkremote/tinysvcmdns.cpp index ab496f3cb..3c438178a 100644 --- a/src/networkremote/tinysvcmdns.cpp +++ b/src/networkremote/tinysvcmdns.cpp @@ -75,7 +75,7 @@ void TinySVCMDNS::PublishInternal( // Some pointless text, so tinymDNS publishes the service correctly. const char* txt[] = { "cat=nyan", - NULL + nullptr }; foreach(mdnsd* mdnsd, mdnsd_) { @@ -84,7 +84,7 @@ void TinySVCMDNS::PublishInternal( name.constData(), QString(type + ".local").toUtf8().constData(), port, - NULL, + nullptr, txt); } } diff --git a/src/networkremote/zeroconf.cpp b/src/networkremote/zeroconf.cpp index 2d901c34f..a67c810c0 100644 --- a/src/networkremote/zeroconf.cpp +++ b/src/networkremote/zeroconf.cpp @@ -16,7 +16,7 @@ #include -Zeroconf* Zeroconf::sInstance = NULL; +Zeroconf* Zeroconf::sInstance = nullptr; Zeroconf::~Zeroconf() { @@ -42,7 +42,7 @@ QByteArray Zeroconf::TruncateName(const QString& name) { QTextCodec* codec = QTextCodec::codecForName("UTF-8"); QByteArray truncated_utf8; foreach (QChar c, name) { - QByteArray rendered = codec->fromUnicode(&c, 1, NULL); + QByteArray rendered = codec->fromUnicode(&c, 1, nullptr); if (truncated_utf8.size() + rendered.size() >= 63) { break; } diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index e5525bd28..5799b688a 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -114,7 +114,7 @@ Playlist::Playlist(PlaylistBackend* backend, scrobble_point_(-1), lastfm_status_(LastFM_New), have_incremented_playcount_(false), - playlist_sequence_(NULL), + playlist_sequence_(nullptr), ignore_sorting_(false), undo_stack_(new QUndoStack(this)), special_type_(special_type) @@ -718,7 +718,7 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action, int ro // Get the list of rows that were moved QList source_rows; - Playlist* source_playlist = NULL; + Playlist* source_playlist = nullptr; qint64 pid = 0; qint64 own_pid = QCoreApplication::applicationPid(); @@ -1116,7 +1116,7 @@ void Playlist::UpdateItems(const SongList& songs) { QMimeData* Playlist::mimeData(const QModelIndexList& indexes) const { if (indexes.isEmpty()) - return NULL; + return nullptr; // We only want one index per row, but we can't just take column 0 because // the user might have hidden it. @@ -1377,7 +1377,7 @@ void Playlist::ItemsLoaded() { GeneratorPtr gen = Generator::Create(p.dynamic_type); if (gen) { // Hack: can't think of a better way to get the right backend - LibraryBackend* backend = NULL; + LibraryBackend* backend = nullptr; if (p.dynamic_backend == library_->songs_table()) backend = library_; else if (p.dynamic_backend == MagnatuneService::kSongsTable) diff --git a/src/playlist/playlistcontainer.cpp b/src/playlist/playlistcontainer.cpp index fe9a48bd7..4ef863718 100644 --- a/src/playlist/playlistcontainer.cpp +++ b/src/playlist/playlistcontainer.cpp @@ -40,14 +40,14 @@ const int PlaylistContainer::kFilterDelayPlaylistSizeThreshold = 5000; PlaylistContainer::PlaylistContainer(QWidget *parent) : QWidget(parent), ui_(new Ui_PlaylistContainer), - manager_(NULL), - undo_(NULL), - redo_(NULL), - playlist_(NULL), + manager_(nullptr), + undo_(nullptr), + redo_(nullptr), + playlist_(nullptr), starting_up_(true), tab_bar_visible_(false), tab_bar_animation_(new QTimeLine(500, this)), - no_matches_label_(NULL), + no_matches_label_(nullptr), filter_timer_(new QTimer(this)) { ui_->setupUi(this); diff --git a/src/playlist/playlistfilterparser.cpp b/src/playlist/playlistfilterparser.cpp index f4ee69090..d4dadadab 100644 --- a/src/playlist/playlistfilterparser.cpp +++ b/src/playlist/playlistfilterparser.cpp @@ -431,7 +431,7 @@ FilterTree* FilterParser::createSearchTermTreeNode( } // here comes a mess :/ // well, not that much of a mess, but so many options -_- - SearchTermComparator* cmp = NULL; + SearchTermComparator* cmp = nullptr; if (prefix == "!=" || prefix == "<>") { cmp = new NeComparator(search); } else if (!col.isEmpty() && columns_.contains(col) && diff --git a/src/playlist/playlistitem.cpp b/src/playlist/playlistitem.cpp index b8c24e0f5..cbd803cc0 100644 --- a/src/playlist/playlistitem.cpp +++ b/src/playlist/playlistitem.cpp @@ -48,7 +48,7 @@ PlaylistItem* PlaylistItem::NewFromType(const QString& type) { return new InternetPlaylistItem("Internet"); qLog(Warning) << "Invalid PlaylistItem type:" << type; - return NULL; + return nullptr; } PlaylistItem* PlaylistItem::NewFromSongsTable(const QString& table, const Song& song) { @@ -60,7 +60,7 @@ PlaylistItem* PlaylistItem::NewFromSongsTable(const QString& table, const Song& return new JamendoPlaylistItem(song); qLog(Warning) << "Invalid PlaylistItem songs table:" << table; - return NULL; + return nullptr; } void PlaylistItem::BindToQuery(QSqlQuery* query) const { diff --git a/src/playlist/playlistlistcontainer.cpp b/src/playlist/playlistlistcontainer.cpp index 267afdec0..468647d28 100644 --- a/src/playlist/playlistlistcontainer.cpp +++ b/src/playlist/playlistlistcontainer.cpp @@ -55,9 +55,9 @@ public: PlaylistListContainer::PlaylistListContainer(QWidget* parent) : QWidget(parent), - app_(NULL), + app_(nullptr), ui_(new Ui_PlaylistListContainer), - menu_(NULL), + menu_(nullptr), action_new_folder_(new QAction(this)), action_remove_(new QAction(this)), action_save_playlist_(new QAction(this)), diff --git a/src/playlist/playlistlistmodel.cpp b/src/playlist/playlistlistmodel.cpp index acfb9dda3..8d96528e7 100644 --- a/src/playlist/playlistlistmodel.cpp +++ b/src/playlist/playlistlistmodel.cpp @@ -127,7 +127,7 @@ QStandardItem* PlaylistListModel::FolderByPath(const QString& path) { const QStringList parts = path.split('/', QString::SkipEmptyParts); foreach (const QString& part, parts) { - QStandardItem* matching_child = NULL; + QStandardItem* matching_child = nullptr; const int child_count = parent->rowCount(); for (int i=0 ; idefault_filter(); filename = QFileDialog::getSaveFileName( - NULL, tr("Save playlist", "Title of the playlist save dialog."), filename, + nullptr, tr("Save playlist", "Title of the playlist save dialog."), filename, parser()->filters(), &default_filter); if (filename.isNull()) diff --git a/src/playlist/playlisttabbar.cpp b/src/playlist/playlisttabbar.cpp index 48c16698c..4f5b898d0 100644 --- a/src/playlist/playlisttabbar.cpp +++ b/src/playlist/playlisttabbar.cpp @@ -40,7 +40,7 @@ const char* PlaylistTabBar::kSettingsGroup = "PlaylistTabBar"; PlaylistTabBar::PlaylistTabBar(QWidget *parent) : QTabBar(parent), - manager_(NULL), + manager_(nullptr), menu_(new QMenu(this)), menu_index_(-1), suppress_current_changed_(false), diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index e3e97782b..b29b35b61 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -99,9 +99,9 @@ void PlaylistProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt PlaylistView::PlaylistView(QWidget *parent) : QTreeView(parent), - app_(NULL), + app_(nullptr), style_(new PlaylistProxyStyle(style())), - playlist_(NULL), + playlist_(nullptr), header_(new PlaylistHeader(Qt::Horizontal, this, this)), setting_initial_header_layout_(false), upgrading_from_qheaderview_(false), @@ -116,7 +116,7 @@ PlaylistView::PlaylistView(QWidget *parent) glow_enabled_(true), currently_glowing_(false), glow_intensity_step_(0), - rating_delegate_(NULL), + rating_delegate_(nullptr), inhibit_autoscroll_timer_(new QTimer(this)), inhibit_autoscroll_(false), currently_autoscrolling_(false), @@ -982,7 +982,7 @@ void PlaylistView::dropEvent(QDropEvent *event) { } void PlaylistView::PlaylistDestroyed() { - playlist_ = NULL; + playlist_ = nullptr; // We'll get a SetPlaylist() soon } diff --git a/src/playlist/queue.cpp b/src/playlist/queue.cpp index 691402dd2..c7783bfd4 100644 --- a/src/playlist/queue.cpp +++ b/src/playlist/queue.cpp @@ -269,7 +269,7 @@ bool Queue::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, } else if (data->hasFormat(Playlist::kRowsMimetype)) { // Dragged from the playlist - Playlist* playlist = NULL; + Playlist* playlist = nullptr; QList source_rows; QDataStream stream(data->data(Playlist::kRowsMimetype)); stream.readRawData(reinterpret_cast(&playlist), sizeof(playlist)); diff --git a/src/playlist/queuemanager.cpp b/src/playlist/queuemanager.cpp index 63b513093..319feec50 100644 --- a/src/playlist/queuemanager.cpp +++ b/src/playlist/queuemanager.cpp @@ -29,8 +29,8 @@ QueueManager::QueueManager(QWidget *parent) : QDialog(parent), ui_(new Ui_QueueManager), - playlists_(NULL), - current_playlist_(NULL) + playlists_(nullptr), + current_playlist_(nullptr) { ui_->setupUi(this); ui_->list->setItemDelegate(new QueuedItemDelegate(this, 0)); @@ -150,6 +150,6 @@ void QueueManager::UpdateButtonState() { } void QueueManager::PlaylistDestroyed() { - current_playlist_ = NULL; + current_playlist_ = nullptr; // We'll get another CurrentPlaylistChanged() soon } diff --git a/src/playlist/songloaderinserter.cpp b/src/playlist/songloaderinserter.cpp index 2a22738ec..bdc99ec7f 100644 --- a/src/playlist/songloaderinserter.cpp +++ b/src/playlist/songloaderinserter.cpp @@ -27,7 +27,7 @@ SongLoaderInserter::SongLoaderInserter(TaskManager* task_manager, LibraryBackendInterface* library, const Player* player) : task_manager_(task_manager), - destination_(NULL), + destination_(nullptr), row_(-1), play_now_(true), enqueue_(false), @@ -107,7 +107,7 @@ void SongLoaderInserter::LoadAudioCD(Playlist *destination, } void SongLoaderInserter::DestinationDestroyed() { - destination_ = NULL; + destination_ = nullptr; } void SongLoaderInserter::AudioCDTagsLoaded(bool success) { diff --git a/src/playlistparsers/playlistparser.cpp b/src/playlistparsers/playlistparser.cpp index 5b2f59dab..cb998c462 100644 --- a/src/playlistparsers/playlistparser.cpp +++ b/src/playlistparsers/playlistparser.cpp @@ -89,7 +89,7 @@ ParserBase* PlaylistParser::ParserForExtension(const QString& suffix) const { if (p->file_extensions().contains(suffix)) return p; } - return NULL; + return nullptr; } ParserBase* PlaylistParser::ParserForMagic(const QByteArray& data, @@ -99,7 +99,7 @@ ParserBase* PlaylistParser::ParserForMagic(const QByteArray& data, p->TryMagic(data)) return p; } - return NULL; + return nullptr; } SongList PlaylistParser::LoadFromFile(const QString& filename) const { diff --git a/src/podcasts/gpoddersearchpage.cpp b/src/podcasts/gpoddersearchpage.cpp index bf9f430e6..024d72692 100644 --- a/src/podcasts/gpoddersearchpage.cpp +++ b/src/podcasts/gpoddersearchpage.cpp @@ -73,7 +73,7 @@ void GPodderSearchPage::SearchFailed(mygpo::PodcastListPtr list) { model()->clear(); if (QMessageBox::warning( - NULL, tr("Failed to fetch podcasts"), + nullptr, tr("Failed to fetch podcasts"), tr("There was a problem communicating with gpodder.net"), QMessageBox::Retry | QMessageBox::Close, QMessageBox::Retry) != QMessageBox::Retry) { diff --git a/src/podcasts/gpoddertoptagsmodel.cpp b/src/podcasts/gpoddertoptagsmodel.cpp index af41f7e2d..9a4ec569e 100644 --- a/src/podcasts/gpoddertoptagsmodel.cpp +++ b/src/podcasts/gpoddertoptagsmodel.cpp @@ -106,7 +106,7 @@ void GPodderTopTagsModel::PodcastsOfTagFailed(const QModelIndex& parent, } if (QMessageBox::warning( - NULL, tr("Failed to fetch podcasts"), + nullptr, tr("Failed to fetch podcasts"), tr("There was a problem communicating with gpodder.net"), QMessageBox::Retry | QMessageBox::Close, QMessageBox::Retry) != QMessageBox::Retry) { diff --git a/src/podcasts/gpoddertoptagspage.cpp b/src/podcasts/gpoddertoptagspage.cpp index 1fda03164..47c24b357 100644 --- a/src/podcasts/gpoddertoptagspage.cpp +++ b/src/podcasts/gpoddertoptagspage.cpp @@ -73,7 +73,7 @@ void GPodderTopTagsPage::TagListFailed(mygpo::TagListPtr list) { done_initial_load_ = false; if (QMessageBox::warning( - NULL, tr("Failed to fetch directory"), + nullptr, tr("Failed to fetch directory"), tr("There was a problem communicating with gpodder.net"), QMessageBox::Retry | QMessageBox::Close, QMessageBox::Retry) != QMessageBox::Retry) { diff --git a/src/podcasts/podcastdownloader.cpp b/src/podcasts/podcastdownloader.cpp index be281a0f7..4b5127fd9 100644 --- a/src/podcasts/podcastdownloader.cpp +++ b/src/podcasts/podcastdownloader.cpp @@ -37,7 +37,7 @@ const char* PodcastDownloader::kSettingsGroup = "Podcasts"; const int PodcastDownloader::kAutoDeleteCheckIntervalMsec = 15 * 60 * kMsecPerSec; // 15 minutes struct PodcastDownloader::Task { - Task() : file(NULL) {} + Task() : file(nullptr) {} ~Task() { delete file; } PodcastEpisode episode; @@ -52,7 +52,7 @@ PodcastDownloader::PodcastDownloader(Application* app, QObject* parent) disallowed_filename_characters_("[^a-zA-Z0-9_~ -]"), auto_download_(false), delete_after_secs_(0), - current_task_(NULL), + current_task_(nullptr), last_progress_signal_(0), auto_delete_timer_(new QTimer(this)) { @@ -211,7 +211,7 @@ void PodcastDownloader::StartDownloading(Task* task) { } void PodcastDownloader::NextTask() { - current_task_ = NULL; + current_task_ = nullptr; if (!queued_tasks_.isEmpty()) { StartDownloading(queued_tasks_.dequeue()); diff --git a/src/podcasts/podcastinfowidget.cpp b/src/podcasts/podcastinfowidget.cpp index 2669aad14..8ac024859 100644 --- a/src/podcasts/podcastinfowidget.cpp +++ b/src/podcasts/podcastinfowidget.cpp @@ -23,7 +23,7 @@ PodcastInfoWidget::PodcastInfoWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_PodcastInfoWidget), - app_(NULL), + app_(nullptr), image_id_(0) { ui_->setupUi(this); @@ -56,7 +56,7 @@ void PodcastInfoWidget::SetApplication(Application* app) { namespace { template - void SetText(const QString& value, T* label, QLabel* buddy_label = NULL) { + void SetText(const QString& value, T* label, QLabel* buddy_label = nullptr) { const bool visible = !value.isEmpty(); label->setVisible(visible); diff --git a/src/podcasts/podcastservice.cpp b/src/podcasts/podcastservice.cpp index 72d92c643..c05ef0f26 100644 --- a/src/podcasts/podcastservice.cpp +++ b/src/podcasts/podcastservice.cpp @@ -44,7 +44,7 @@ const char* PodcastService::kSettingsGroup = "Podcasts"; class PodcastSortProxyModel : public QSortFilterProxyModel { public: - PodcastSortProxyModel(QObject* parent = NULL); + PodcastSortProxyModel(QObject* parent = nullptr); protected: bool lessThan(const QModelIndex& left, const QModelIndex& right) const; @@ -58,8 +58,8 @@ PodcastService::PodcastService(Application* app, InternetModel* parent) backend_(app->podcast_backend()), model_(new PodcastServiceModel(this)), proxy_(new PodcastSortProxyModel(this)), - context_menu_(NULL), - root_(NULL), + context_menu_(nullptr), + root_(nullptr), organise_dialog_(new OrganiseDialog(app_->task_manager())) { icon_loader_->SetModel(model_); diff --git a/src/smartplaylists/generator.cpp b/src/smartplaylists/generator.cpp index 17385b47a..58cb864b1 100644 --- a/src/smartplaylists/generator.cpp +++ b/src/smartplaylists/generator.cpp @@ -29,8 +29,8 @@ const int Generator::kDefaultDynamicHistory = 5; const int Generator::kDefaultDynamicFuture = 15; Generator::Generator() - : QObject(NULL), - backend_(NULL) + : QObject(nullptr), + backend_(nullptr) { } diff --git a/src/smartplaylists/querywizardplugin.cpp b/src/smartplaylists/querywizardplugin.cpp index 2bc4f5b6d..a5dd900b1 100644 --- a/src/smartplaylists/querywizardplugin.cpp +++ b/src/smartplaylists/querywizardplugin.cpp @@ -74,7 +74,7 @@ public: QueryWizardPlugin::QueryWizardPlugin(Application* app, LibraryBackend* library, QObject* parent) : WizardPlugin(app, library, parent), - search_page_(NULL), + search_page_(nullptr), previous_scrollarea_max_(0) { } diff --git a/src/smartplaylists/searchpreview.cpp b/src/smartplaylists/searchpreview.cpp index d16db4c25..78e2fc662 100644 --- a/src/smartplaylists/searchpreview.cpp +++ b/src/smartplaylists/searchpreview.cpp @@ -34,7 +34,7 @@ typedef QFutureWatcher FutureWatcher; SearchPreview::SearchPreview(QWidget *parent) : QWidget(parent), ui_(new Ui_SmartPlaylistSearchPreview), - model_(NULL) + model_(nullptr) { ui_->setupUi(this); @@ -59,7 +59,7 @@ void SearchPreview::set_application(Application* app) { void SearchPreview::set_library(LibraryBackend* backend) { backend_ = backend; - model_ = new Playlist(NULL, NULL, backend_, -1, QString(), false, this); + model_ = new Playlist(nullptr, NULL, backend_, -1, QString(), false, this); ui_->tree->setModel(model_); ui_->tree->SetPlaylist(model_); ui_->tree->SetItemDelegates(backend_); diff --git a/src/smartplaylists/searchtermwidget.cpp b/src/smartplaylists/searchtermwidget.cpp index b12c4ff6e..e17a8bbf4 100644 --- a/src/smartplaylists/searchtermwidget.cpp +++ b/src/smartplaylists/searchtermwidget.cpp @@ -66,7 +66,7 @@ SearchTermWidget::SearchTermWidget(LibraryBackend* library, QWidget* parent) : QWidget(parent), ui_(new Ui_SmartPlaylistSearchTermWidget), library_(library), - overlay_(NULL), + overlay_(nullptr), animation_(new QPropertyAnimation(this, "overlay_opacity", this)), active_(true), initialized_(false), @@ -142,14 +142,14 @@ void SearchTermWidget::FieldChanged(int index) { } // Show the correct value editor - QWidget* page = NULL; + QWidget* page = nullptr; switch (type) { case SearchTerm::Type_Time: page = ui_->page_time; break; case SearchTerm::Type_Number: page = ui_->page_number; break; case SearchTerm::Type_Date: page = ui_->page_date; break; case SearchTerm::Type_Rating: page = ui_->page_rating; break; case SearchTerm::Type_Text: page = ui_->page_text; break; - case SearchTerm::Type_Invalid: page = NULL; break; + case SearchTerm::Type_Invalid: page = nullptr; break; } ui_->value_stack->setCurrentWidget(page); @@ -164,7 +164,7 @@ void SearchTermWidget::FieldChanged(int index) { break; default: - ui_->value_text->setCompleter(NULL); + ui_->value_text->setCompleter(nullptr); } emit Changed(); @@ -174,7 +174,7 @@ void SearchTermWidget::OpChanged(int index) { // We need to change the page only in the following case if ((ui_->value_stack->currentWidget() == ui_->page_date) || (ui_->value_stack->currentWidget() == ui_->page_date_numeric) || (ui_->value_stack->currentWidget() == ui_->page_date_relative)) { - QWidget* page = NULL; + QWidget* page = nullptr; if (index == 4 || index == 5) { page = ui_->page_date_numeric; } else if (index == 6) { @@ -190,7 +190,7 @@ void SearchTermWidget::OpChanged(int index) { void SearchTermWidget::SetActive(bool active) { active_ = active; delete overlay_; - overlay_ = NULL; + overlay_ = nullptr; if (!active) { overlay_ = new Overlay(this); diff --git a/src/songinfo/songinfobase.cpp b/src/songinfo/songinfobase.cpp index b243e97a9..71a7329f2 100644 --- a/src/songinfo/songinfobase.cpp +++ b/src/songinfo/songinfobase.cpp @@ -34,7 +34,7 @@ SongInfoBase::SongInfoBase(QWidget* parent) current_request_id_(-1), scroll_area_(new QScrollArea), container_(new QVBoxLayout), - section_container_(NULL), + section_container_(nullptr), fader_(new WidgetFadeHelper(this, 1000)), dirty_(false) { diff --git a/src/songinfo/songinfoview.cpp b/src/songinfo/songinfoview.cpp index a5de1e308..42790b0db 100644 --- a/src/songinfo/songinfoview.cpp +++ b/src/songinfo/songinfoview.cpp @@ -145,7 +145,7 @@ SongInfoProvider* SongInfoView::ProviderByName(const QString& name) const { return provider; } } - return NULL; + return nullptr; } namespace { diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 478190a22..3750273b9 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -85,7 +85,7 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, const QString& mime_type, GstElement* bin) { if (mime_type.isEmpty()) - return NULL; + return nullptr; // HACK: Force ffmux_mp4 because it doesn't set any useful src caps if (mime_type == "audio/mp4") { @@ -141,7 +141,7 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, gst_caps_unref(target_caps); if (suitable_elements_.isEmpty()) - return NULL; + return nullptr; // Sort by rank qSort(suitable_elements_); @@ -165,11 +165,11 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type, GstElement* id3v2 = CreateElement("id3v2mux", mp3bin); if (!lame || !xing || !id3v2) { - return NULL; + return nullptr; } // Link the elements together - gst_element_link_many(lame, xing, id3v2, NULL); + gst_element_link_many(lame, xing, id3v2, nullptr); // Link the bin's ghost pads to the elements on each end GstPad* pad = gst_element_get_static_pad(lame, "sink"); @@ -439,15 +439,15 @@ bool Transcoder::StartJob(const Job &job) { // Join them together gst_element_link(src, decode); if (codec && muxer) - gst_element_link_many(convert, resample, codec, muxer, sink, NULL); + gst_element_link_many(convert, resample, codec, muxer, sink, nullptr); else if (codec) - gst_element_link_many(convert, resample, codec, sink, NULL); + gst_element_link_many(convert, resample, codec, sink, nullptr); else if (muxer) - gst_element_link_many(convert, resample, muxer, sink, NULL); + gst_element_link_many(convert, resample, muxer, sink, nullptr); // Set properties - g_object_set(src, "location", job.input.toUtf8().constData(), NULL); - g_object_set(sink, "location", job.output.toUtf8().constData(), NULL); + g_object_set(src, "location", job.input.toUtf8().constData(), nullptr); + g_object_set(sink, "location", job.output.toUtf8().constData(), nullptr); // Set callbacks state->convert_element_ = convert; @@ -496,7 +496,7 @@ bool Transcoder::event(QEvent* e) { // Remove event handlers from the gstreamer pipeline so they don't get // called after the pipeline is shutting down gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE( - finished_event->state_->pipeline_)), NULL, NULL); + finished_event->state_->pipeline_)), nullptr, nullptr); g_source_remove(finished_event->state_->bus_callback_id_); // Remove it from the list - this will also destroy the GStreamer pipeline @@ -526,13 +526,13 @@ void Transcoder::Cancel() { // Remove event handlers from the gstreamer pipeline so they don't get // called after the pipeline is shutting down gst_bus_set_sync_handler(gst_pipeline_get_bus( - GST_PIPELINE(state->pipeline_)), NULL, NULL); + GST_PIPELINE(state->pipeline_)), nullptr, nullptr); g_source_remove(state->bus_callback_id_); // Stop the pipeline if (gst_element_set_state(state->pipeline_, GST_STATE_NULL) == GST_STATE_CHANGE_ASYNC) { // Wait for it to finish stopping... - gst_element_get_state(state->pipeline_, NULL, NULL, GST_CLOCK_TIME_NONE); + gst_element_get_state(state->pipeline_, nullptr, nullptr, GST_CLOCK_TIME_NONE); } // Remove the job, this destroys the GStreamer pipeline too @@ -578,11 +578,11 @@ void Transcoder::SetElementProperties(const QString& name, GObject* object) { LogLine(QString("Setting %1 property: %2 = %3").arg(name, property->name, value.toString())); switch (property->value_type) { - case G_TYPE_DOUBLE: g_object_set(object, property->name, value.toDouble(), NULL); break; - case G_TYPE_FLOAT: g_object_set(object, property->name, value.toFloat(), NULL); break; - case G_TYPE_BOOLEAN: g_object_set(object, property->name, value.toInt(), NULL); break; + case G_TYPE_DOUBLE: g_object_set(object, property->name, value.toDouble(), nullptr); break; + case G_TYPE_FLOAT: g_object_set(object, property->name, value.toFloat(), nullptr); break; + case G_TYPE_BOOLEAN: g_object_set(object, property->name, value.toInt(), nullptr); break; case G_TYPE_INT: - default: g_object_set(object, property->name, value.toInt(), NULL); break; + default: g_object_set(object, property->name, value.toInt(), nullptr); break; } } diff --git a/src/transcoder/transcoderoptionsdialog.cpp b/src/transcoder/transcoderoptionsdialog.cpp index bcf8419c4..8f9143a70 100644 --- a/src/transcoder/transcoderoptionsdialog.cpp +++ b/src/transcoder/transcoderoptionsdialog.cpp @@ -28,7 +28,7 @@ TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget* parent) : QDialog(parent), ui_(new Ui_TranscoderOptionsDialog), - options_(NULL) + options_(nullptr) { ui_->setupUi(this); diff --git a/src/ui/addstreamdialog.cpp b/src/ui/addstreamdialog.cpp index 6e47ec370..17abca7d5 100644 --- a/src/ui/addstreamdialog.cpp +++ b/src/ui/addstreamdialog.cpp @@ -30,7 +30,7 @@ const char* AddStreamDialog::kSettingsGroup = "AddStreamDialog"; AddStreamDialog::AddStreamDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_AddStreamDialog), - saved_radio_(NULL) + saved_radio_(nullptr) { ui_->setupUi(this); diff --git a/src/ui/albumcoverchoicecontroller.cpp b/src/ui/albumcoverchoicecontroller.cpp index a648268e9..a4a66270b 100644 --- a/src/ui/albumcoverchoicecontroller.cpp +++ b/src/ui/albumcoverchoicecontroller.cpp @@ -46,15 +46,15 @@ const char* AlbumCoverChoiceController::kSaveImageFileFilter = const char* AlbumCoverChoiceController::kAllFilesFilter = QT_TR_NOOP("All files (*)"); -QSet* AlbumCoverChoiceController::sImageExtensions = NULL; +QSet* AlbumCoverChoiceController::sImageExtensions = nullptr; AlbumCoverChoiceController::AlbumCoverChoiceController(QWidget* parent) : QWidget(parent), - app_(NULL), - cover_searcher_(NULL), - cover_fetcher_(NULL), - save_file_dialog_(NULL), - cover_from_url_dialog_(NULL) + app_(nullptr), + cover_searcher_(nullptr), + cover_fetcher_(nullptr), + save_file_dialog_(nullptr), + cover_from_url_dialog_(nullptr) { cover_from_file_ = new QAction(IconLoader::Load("document-open"), tr("Load cover from disk..."), this); cover_to_file_ = new QAction(IconLoader::Load("document-save"), tr("Save cover to disk..."), this); diff --git a/src/ui/albumcovermanager.cpp b/src/ui/albumcovermanager.cpp index 43112cca3..0e56e2341 100644 --- a/src/ui/albumcovermanager.cpp +++ b/src/ui/albumcovermanager.cpp @@ -62,8 +62,8 @@ AlbumCoverManager::AlbumCoverManager(Application* app, app_(app), album_cover_choice_controller_(new AlbumCoverChoiceController(this)), cover_fetcher_(new AlbumCoverFetcher(app_->cover_providers(), this, network)), - cover_searcher_(NULL), - cover_export_(NULL), + cover_searcher_(nullptr), + cover_export_(nullptr), cover_exporter_(new AlbumCoverExporter(this)), artist_icon_(IconLoader::Load("x-clementine-artist")), all_artists_icon_(IconLoader::Load("x-clementine-album")), @@ -700,7 +700,7 @@ SongList AlbumCoverManager::GetSongsInAlbums(const QModelIndexList& indexes) con SongMimeData* AlbumCoverManager::GetMimeDataForAlbums(const QModelIndexList& indexes) const { SongList songs = GetSongsInAlbums(indexes); if (songs.isEmpty()) - return NULL; + return nullptr; SongMimeData* data = new SongMimeData; data->backend = library_backend_; diff --git a/src/ui/albumcovermanagerlist.cpp b/src/ui/albumcovermanagerlist.cpp index faa671f51..bc3b9120f 100644 --- a/src/ui/albumcovermanagerlist.cpp +++ b/src/ui/albumcovermanagerlist.cpp @@ -28,7 +28,7 @@ AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent) : QListWidget(parent), - manager_(NULL) + manager_(nullptr) { } @@ -40,7 +40,7 @@ QMimeData* AlbumCoverManagerList::mimeData(const QList items) } if (songs.isEmpty()) - return NULL; + return nullptr; // Get URLs from the songs QList urls; diff --git a/src/ui/albumcoversearcher.cpp b/src/ui/albumcoversearcher.cpp index 7c42f2cb2..ef6204a3b 100644 --- a/src/ui/albumcoversearcher.cpp +++ b/src/ui/albumcoversearcher.cpp @@ -96,7 +96,7 @@ AlbumCoverSearcher::AlbumCoverSearcher(const QIcon& no_cover_icon, app_(app), model_(new QStandardItemModel(this)), no_cover_icon_(no_cover_icon), - fetcher_(NULL), + fetcher_(nullptr), id_(0) { setWindowModality(Qt::WindowModal); diff --git a/src/ui/edittagdialog.cpp b/src/ui/edittagdialog.cpp index 2eabf8770..f44fa7cc9 100644 --- a/src/ui/edittagdialog.cpp +++ b/src/ui/edittagdialog.cpp @@ -536,7 +536,7 @@ void EditTagDialog::ResetField() { Song* EditTagDialog::GetFirstSelected() { const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes(); if (sel.isEmpty()) - return NULL; + return nullptr; return &data_[sel.first().row()].original_; } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index e7063e0fb..7445db88e 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -169,7 +169,7 @@ MainWindow::MainWindow(Application* app, tray_icon_(tray_icon), osd_(osd), global_shortcuts_(new GlobalShortcuts(this)), - remote_(NULL), + remote_(nullptr), global_search_view_(new GlobalSearchView(app_, this)), library_view_(new LibraryViewContainer(this)), file_view_(new FileView(this)), @@ -182,8 +182,8 @@ MainWindow::MainWindow(Application* app, equalizer_(new Equalizer), organise_dialog_(new OrganiseDialog(app_->task_manager())), playlist_menu_(new QMenu(this)), - playlist_add_to_another_(NULL), - playlistitem_actions_separator_(NULL), + playlist_add_to_another_(nullptr), + playlistitem_actions_separator_(nullptr), library_sort_model_(new QSortFilterProxyModel(this)), track_position_timer_(new QTimer(this)), was_maximized_(false), @@ -582,7 +582,7 @@ MainWindow::MainWindow(Application* app, << ui_->action_play_pause << ui_->action_stop << ui_->action_next_track - << NULL // spacer + << nullptr // spacer << ui_->action_love << ui_->action_ban); @@ -1428,7 +1428,7 @@ void MainWindow::PlaylistRightClick(const QPoint& global_pos, const QModelIndex& } //if it isn't the first time we right click, we need to remove the menu previously created - if (playlist_add_to_another_ != NULL) { + if (playlist_add_to_another_ != nullptr) { playlist_menu_->removeAction(playlist_add_to_another_); delete playlist_add_to_another_; } diff --git a/src/ui/qtsystemtrayicon.cpp b/src/ui/qtsystemtrayicon.cpp index 75e40b715..904376be3 100644 --- a/src/ui/qtsystemtrayicon.cpp +++ b/src/ui/qtsystemtrayicon.cpp @@ -32,12 +32,12 @@ QtSystemTrayIcon::QtSystemTrayIcon(QObject* parent) : SystemTrayIcon(parent), tray_(new QSystemTrayIcon(this)), menu_(new QMenu), - action_play_pause_(NULL), - action_stop_(NULL), - action_stop_after_this_track_(NULL), - action_mute_(NULL), - action_love_(NULL), - action_ban_(NULL) + action_play_pause_(nullptr), + action_stop_(nullptr), + action_stop_after_this_track_(nullptr), + action_mute_(nullptr), + action_love_(nullptr), + action_ban_(nullptr) { QIcon theme_icon = IconLoader::Load("clementine-panel"); QIcon theme_icon_grey = IconLoader::Load("clementine-panel-grey"); @@ -238,7 +238,7 @@ void QtSystemTrayIcon::SetNowPlaying(const Song& song, const QString& image_path return; #endif - int columns = image_path == NULL ? 1 : 2; + int columns = image_path == nullptr ? 1 : 2; QString clone = pattern_; diff --git a/src/ui/ripcd.cpp b/src/ui/ripcd.cpp index 60f0f665e..34d55aad0 100644 --- a/src/ui/ripcd.cpp +++ b/src/ui/ripcd.cpp @@ -117,7 +117,7 @@ RipCD::RipCD(QWidget* parent) : setWindowTitle(tr("Rip CD")); AddDestinationDirectory(QDir::homePath()); - cdio_ = cdio_open(NULL, DRIVER_UNKNOWN); + cdio_ = cdio_open(nullptr, DRIVER_UNKNOWN); if(!cdio_) { qLog(Error) << "Failed to read CD drive"; return; diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index dc0d84f1a..fca7c5074 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -118,7 +118,7 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams, QWi app_(app), model_(app_->library_model()->directory_model()), gst_engine_(qobject_cast(app_->player()->engine())), - song_info_view_(NULL), + song_info_view_(nullptr), streams_(streams), global_search_(app_->global_search()), appearance_(app_->appearance()), diff --git a/src/ui/standarditemiconloader.cpp b/src/ui/standarditemiconloader.cpp index 62efe300e..bc592fbbc 100644 --- a/src/ui/standarditemiconloader.cpp +++ b/src/ui/standarditemiconloader.cpp @@ -26,7 +26,7 @@ StandardItemIconLoader::StandardItemIconLoader(AlbumCoverLoader* cover_loader, QObject* parent) : QObject(parent), cover_loader_(cover_loader), - model_(NULL) + model_(nullptr) { cover_options_.desired_height_ = 16; diff --git a/src/ui/windows7thumbbar.cpp b/src/ui/windows7thumbbar.cpp index 9233af53e..4cc11c8c3 100644 --- a/src/ui/windows7thumbbar.cpp +++ b/src/ui/windows7thumbbar.cpp @@ -37,7 +37,7 @@ Windows7ThumbBar::Windows7ThumbBar(QWidget* widget) : QObject(widget), widget_(widget), button_created_message_id_(0), - taskbar_list_(NULL) + taskbar_list_(nullptr) { } @@ -93,13 +93,13 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) { if (taskbar_list_) { qLog(Debug) << "Releasing old taskbar list"; reinterpret_cast(taskbar_list_)->Release(); - taskbar_list_ = NULL; + taskbar_list_ = nullptr; } // Copied from win7 SDK shobjidl.h static const GUID CLSID_ITaskbarList ={ 0x56FDF344,0xFD6D,0x11d0,{0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90}}; // Create the taskbar list - hr = CoCreateInstance(CLSID_ITaskbarList, NULL, CLSCTX_ALL, + hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**) &taskbar_list_); if (hr != S_OK) { qLog(Warning) << "Error creating the ITaskbarList3 interface" << hex << DWORD (hr); @@ -111,7 +111,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG* msg) { if (hr != S_OK) { qLog(Warning) << "Error initialising taskbar list" << hex << DWORD (hr); taskbar_list->Release(); - taskbar_list_ = NULL; + taskbar_list_ = nullptr; return; } diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index 49ecf7452..798b19179 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -127,7 +127,7 @@ void ProjectMVisualisation::InitProjectM() { if (font_path.isNull()) { qWarning("ProjectM presets could not be found, search path was:\n %s", paths.join("\n ").toLocal8Bit().constData()); - QMessageBox::warning(NULL, tr("Missing projectM presets"), + QMessageBox::warning(nullptr, tr("Missing projectM presets"), tr("Clementine could not load any projectM visualisations. Check that you have installed Clementine properly.")); } } diff --git a/src/visualisations/visualisationcontainer.cpp b/src/visualisations/visualisationcontainer.cpp index c4d1ced44..14711c445 100644 --- a/src/visualisations/visualisationcontainer.cpp +++ b/src/visualisations/visualisationcontainer.cpp @@ -50,11 +50,11 @@ const int VisualisationContainer::kDefaultTextureSize = 512; VisualisationContainer::VisualisationContainer(QWidget *parent) : QGraphicsView(parent), initialised_(false), - engine_(NULL), + engine_(nullptr), vis_(new ProjectMVisualisation(this)), overlay_(new VisualisationOverlay), selector_(new VisualisationSelector(this)), - overlay_proxy_(NULL), + overlay_proxy_(nullptr), menu_(new QMenu(this)), fps_(kDefaultFps), size_(kDefaultTextureSize) diff --git a/src/visualisations/visualisationselector.cpp b/src/visualisations/visualisationselector.cpp index c8ddc87d8..b352e9b62 100644 --- a/src/visualisations/visualisationselector.cpp +++ b/src/visualisations/visualisationselector.cpp @@ -32,7 +32,7 @@ VisualisationSelector::VisualisationSelector(QWidget *parent) : QDialog(parent), ui_(new Ui_VisualisationSelector), - vis_(NULL) + vis_(nullptr) { ui_->setupUi(this); diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 56038e9be..f89c5aa60 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -503,13 +503,13 @@ private: FancyTabWidget::FancyTabWidget(QWidget* parent) : QWidget(parent), mode_(Mode_None), - tab_bar_(NULL), + tab_bar_(nullptr), stack_(new QStackedLayout), side_widget_(new QWidget), side_layout_(new QVBoxLayout), top_layout_(new QVBoxLayout), use_background_(false), - menu_(NULL), + menu_(nullptr), proxy_style_(new FancyTabProxyStyle) { side_layout_->setSpacing(0); @@ -605,7 +605,7 @@ void FancyTabWidget::AddBottomWidget(QWidget* widget) { void FancyTabWidget::SetMode(Mode mode) { // Remove previous tab bar delete tab_bar_; - tab_bar_ = NULL; + tab_bar_ = nullptr; use_background_ = false; diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index 6a62a2e56..121eed017 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -37,9 +37,9 @@ const char* FileView::kFileFilter = "*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma FileView::FileView(QWidget* parent) : QWidget(parent), ui_(new Ui_FileView), - model_(NULL), + model_(nullptr), undo_stack_(new QUndoStack(this)), - task_manager_(NULL), + task_manager_(nullptr), storage_(new FilesystemMusicStorage("/")) { ui_->setupUi(this); diff --git a/src/widgets/nowplayingwidget.cpp b/src/widgets/nowplayingwidget.cpp index 13d62e861..7b3ebc4a5 100644 --- a/src/widgets/nowplayingwidget.cpp +++ b/src/widgets/nowplayingwidget.cpp @@ -60,21 +60,21 @@ const int NowPlayingWidget::kTopBorder = 4; NowPlayingWidget::NowPlayingWidget(QWidget* parent) : QWidget(parent), - app_(NULL), + app_(nullptr), album_cover_choice_controller_(new AlbumCoverChoiceController(this)), mode_(SmallSongDetails), menu_(new QMenu(this)), - above_statusbar_action_(NULL), + above_statusbar_action_(nullptr), visible_(false), small_ideal_height_(0), show_hide_animation_(new QTimeLine(500, this)), fade_animation_(new QTimeLine(1000, this)), details_(new QTextDocument(this)), previous_track_opacity_(0.0), - bask_in_his_glory_action_(NULL), + bask_in_his_glory_action_(nullptr), downloading_covers_(false), aww_(false), - kittens_(NULL), + kittens_(nullptr), pending_kitten_(0) { // Load settings diff --git a/src/widgets/prettyimage.cpp b/src/widgets/prettyimage.cpp index 56c938076..adca4360c 100644 --- a/src/widgets/prettyimage.cpp +++ b/src/widgets/prettyimage.cpp @@ -49,7 +49,7 @@ PrettyImage::PrettyImage(const QUrl& url, QNetworkAccessManager* network, network_(network), state_(State_WaitingForLazyLoad), url_(url), - menu_(NULL) + menu_(nullptr) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index feb6e6db3..eab53cbc2 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -31,7 +31,7 @@ const char* TrackSlider::kSettingsGroup = "MainWindow"; TrackSlider::TrackSlider(QWidget* parent) : QWidget(parent), ui_(new Ui_TrackSlider), - moodbar_style_(NULL), + moodbar_style_(nullptr), setting_value_(false), show_remaining_time_(true), slider_maximum_value_(0)