Use nullptr instead of NULL everywhere.

This commit is contained in:
John Maguire 2014-02-06 16:49:49 +01:00
parent d309d4ab27
commit 71893e4847
138 changed files with 559 additions and 553 deletions

View File

@ -35,7 +35,7 @@ int main(int argc, char** argv) {
logging::Init(); logging::Init();
gst_init(NULL, NULL); gst_init(nullptr, nullptr);
const QStringList arguments(a.arguments()); const QStringList arguments(a.arguments());

View File

@ -28,8 +28,8 @@ MediaPipeline::MediaPipeline(int port, quint64 length_msec)
: port_(port), : port_(port),
length_msec_(length_msec), length_msec_(length_msec),
accepting_data_(true), accepting_data_(true),
pipeline_(NULL), pipeline_(nullptr),
appsrc_(NULL), appsrc_(nullptr),
byte_rate_(1), byte_rate_(1),
offset_bytes_(0) offset_bytes_(0)
{ {
@ -49,15 +49,15 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
pipeline_ = gst_pipeline_new("pipeline"); pipeline_ = gst_pipeline_new("pipeline");
// Create elements // Create elements
appsrc_ = GST_APP_SRC(gst_element_factory_make("appsrc", NULL)); appsrc_ = GST_APP_SRC(gst_element_factory_make("appsrc", nullptr));
GstElement* gdppay = gst_element_factory_make("gdppay", NULL); GstElement* gdppay = gst_element_factory_make("gdppay", nullptr);
tcpsink_ = gst_element_factory_make("tcpclientsink", NULL); tcpsink_ = gst_element_factory_make("tcpclientsink", nullptr);
if (!pipeline_ || !appsrc_ || !tcpsink_) { if (!pipeline_ || !appsrc_ || !tcpsink_) {
if (pipeline_) { gst_object_unref(GST_OBJECT(pipeline_)); pipeline_ = NULL; } if (pipeline_) { gst_object_unref(GST_OBJECT(pipeline_)); pipeline_ = nullptr; }
if (appsrc_) { gst_object_unref(GST_OBJECT(appsrc_)); appsrc_ = NULL; } if (appsrc_) { gst_object_unref(GST_OBJECT(appsrc_)); appsrc_ = nullptr; }
if (gdppay) { gst_object_unref(GST_OBJECT(gdppay)); } 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; 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_), GST_ELEMENT(appsrc_));
gst_bin_add(GST_BIN(pipeline_), gdppay); gst_bin_add(GST_BIN(pipeline_), gdppay);
gst_bin_add(GST_BIN(pipeline_), tcpsink_); 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 // Set the sink's port
g_object_set(G_OBJECT(tcpsink_), "host", "127.0.0.1", NULL); g_object_set(G_OBJECT(tcpsink_), "host", "127.0.0.1", nullptr);
g_object_set(G_OBJECT(tcpsink_), "port", port_, NULL); g_object_set(G_OBJECT(tcpsink_), "port", port_, nullptr);
// Try to send 5 seconds of audio in advance to initially fill Clementine's // Try to send 5 seconds of audio in advance to initially fill Clementine's
// buffer. // 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 // 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 // Spotify only pushes data to us every 100ms, so keep the appsrc half full
// to prevent tiny stalls. // 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 // Set callbacks for when to start/stop pushing data
GstAppSrcCallbacks callbacks; GstAppSrcCallbacks callbacks;
@ -88,7 +88,7 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
callbacks.need_data = NeedDataCallback; callbacks.need_data = NeedDataCallback;
callbacks.seek_data = SeekDataCallback; 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 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
const int endianness = G_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, "depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, sample_rate, "rate", G_TYPE_INT, sample_rate,
"channels", G_TYPE_INT, channels, "channels", G_TYPE_INT, channels,
NULL); nullptr);
gst_app_src_set_caps(appsrc_, caps); gst_app_src_set_caps(appsrc_, caps);
gst_caps_unref(caps); gst_caps_unref(caps);

View File

@ -38,10 +38,10 @@ const int SpotifyClient::kWaveHeaderSize = 44;
SpotifyClient::SpotifyClient(QObject* parent) SpotifyClient::SpotifyClient(QObject* parent)
: AbstractMessageHandler<pb::spotify::Message>(NULL, parent), : AbstractMessageHandler<pb::spotify::Message>(nullptr, parent),
api_key_(QByteArray::fromBase64(kSpotifyApiKey)), api_key_(QByteArray::fromBase64(kSpotifyApiKey)),
protocol_socket_(new QTcpSocket(this)), protocol_socket_(new QTcpSocket(this)),
session_(NULL), session_(nullptr),
events_timer_(new QTimer(this)) { events_timer_(new QTimer(this)) {
SetDevice(protocol_socket_); SetDevice(protocol_socket_);
@ -328,7 +328,7 @@ void SpotifyClient::Login(const pb::spotify::LoginRequest& req) {
req.username().c_str(), req.username().c_str(),
req.password().c_str(), req.password().c_str(),
true, // Remember the password. true, // Remember the password.
NULL); nullptr);
} }
} }
@ -389,7 +389,7 @@ void SpotifyClient::SendPlaylistList() {
sp_playlistcontainer* container = sp_session_playlistcontainer(session_); sp_playlistcontainer* container = sp_session_playlistcontainer(session_);
if (!container) { if (!container) {
qLog(Warning) << "sp_session_playlistcontainer returned NULL"; qLog(Warning) << "sp_session_playlistcontainer returned nullptr";
return; return;
} }
@ -432,7 +432,7 @@ void SpotifyClient::SendPlaylistList() {
} }
sp_playlist* SpotifyClient::GetPlaylist(pb::spotify::PlaylistType type, int user_index) { sp_playlist* SpotifyClient::GetPlaylist(pb::spotify::PlaylistType type, int user_index) {
sp_playlist* playlist = NULL; sp_playlist* playlist = nullptr;
switch (type) { switch (type) {
case pb::spotify::Inbox: case pb::spotify::Inbox:
playlist = sp_session_inbox_create(session_); 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 // Find this playlist's pending load object
int pending_load_index = -1; int pending_load_index = -1;
PendingLoadPlaylist* pending_load = NULL; PendingLoadPlaylist* pending_load = nullptr;
for (int i=0 ; i<me->pending_load_playlists_.count() ; ++i) { for (int i=0 ; i<me->pending_load_playlists_.count() ; ++i) {
if (me->pending_load_playlists_[i].playlist_ == pl) { if (me->pending_load_playlists_[i].playlist_ == pl) {
pending_load_index = i; pending_load_index = i;
@ -710,7 +710,7 @@ void SpotifyClient::OfflineStatusUpdatedCallback(sp_session* session) {
SpotifyClient* me = reinterpret_cast<SpotifyClient*>(sp_session_userdata(session)); SpotifyClient* me = reinterpret_cast<SpotifyClient*>(sp_session_userdata(session));
sp_playlistcontainer* container = sp_session_playlistcontainer(session); sp_playlistcontainer* container = sp_session_playlistcontainer(session);
if (!container) { if (!container) {
qLog(Warning) << "sp_session_playlistcontainer returned NULL"; qLog(Warning) << "sp_session_playlistcontainer returned nullptr";
return; return;
} }
@ -884,7 +884,7 @@ void SpotifyClient::TryImageAgain(sp_image* image) {
// Find the pending request for this image // Find the pending request for this image
int index = -1; int index = -1;
PendingImageRequest* req = NULL; PendingImageRequest* req = nullptr;
for (int i=0 ; i<pending_image_requests_.count() ; ++i) { for (int i=0 ; i<pending_image_requests_.count() ; ++i) {
if (pending_image_requests_[i].image_ == image) { if (pending_image_requests_[i].image_ == image) {
index = i; index = i;
@ -975,7 +975,7 @@ void SpotifyClient::BrowseToplist(const pb::spotify::BrowseToplistRequest& req)
session_, session_,
SP_TOPLIST_TYPE_TRACKS, // TODO: Support albums and artists. SP_TOPLIST_TYPE_TRACKS, // TODO: Support albums and artists.
SP_TOPLIST_REGION_EVERYWHERE, // TODO: Support other regions. SP_TOPLIST_REGION_EVERYWHERE, // TODO: Support other regions.
NULL, nullptr,
&ToplistBrowseComplete, &ToplistBrowseComplete,
this); this);
pending_toplist_browses_[browse] = req; pending_toplist_browses_[browse] = req;

View File

@ -39,7 +39,7 @@ int main(int argc, char** argv) {
// Seed random number generator // Seed random number generator
timeval time; timeval time;
gettimeofday(&time,NULL); gettimeofday(&time,nullptr);
qsrand((time.tv_sec * 1000) + (time.tv_usec / 1000)); qsrand((time.tv_sec * 1000) + (time.tv_usec / 1000));
logging::Init(); logging::Init();

View File

@ -37,14 +37,14 @@
namespace logging { namespace logging {
static Level sDefaultLevel = Level_Debug; static Level sDefaultLevel = Level_Debug;
static QMap<QString, Level>* sClassLevels = NULL; static QMap<QString, Level>* sClassLevels = nullptr;
static QIODevice* sNullDevice = NULL; static QIODevice* sNullDevice = nullptr;
const char* kDefaultLogLevels = "GstEnginePipeline:2,*:3"; const char* kDefaultLogLevels = "GstEnginePipeline:2,*:3";
static const char* kMessageHandlerMagic = "__logging_message__"; static const char* kMessageHandlerMagic = "__logging_message__";
static const int kMessageHandlerMagicLength = strlen(kMessageHandlerMagic); 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) { 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) { QDebug CreateLogger(Level level, const QString& class_name, int line) {
// Map the level to a string // Map the level to a string
const char* level_name = NULL; const char* level_name = nullptr;
switch (level) { switch (level) {
case Level_Debug: level_name = " DEBUG "; break; case Level_Debug: level_name = " DEBUG "; break;
case Level_Info: level_name = " INFO "; break; case Level_Info: level_name = " INFO "; break;
@ -193,8 +193,8 @@ QString CXXDemangle(const QString& mangled_function) {
int status; int status;
char* demangled_function = abi::__cxa_demangle( char* demangled_function = abi::__cxa_demangle(
mangled_function.toAscii().constData(), mangled_function.toAscii().constData(),
NULL, nullptr,
NULL, nullptr,
&status); &status);
if (status == 0) { if (status == 0) {
QString ret = QString::fromAscii(demangled_function); QString ret = QString::fromAscii(demangled_function);

View File

@ -27,9 +27,9 @@
_MessageHandlerBase::_MessageHandlerBase(QIODevice* device, QObject* parent) _MessageHandlerBase::_MessageHandlerBase(QIODevice* device, QObject* parent)
: QObject(parent), : QObject(parent),
device_(NULL), device_(nullptr),
flush_abstract_socket_(NULL), flush_abstract_socket_(nullptr),
flush_local_socket_(NULL), flush_local_socket_(nullptr),
reading_protobuf_(false), reading_protobuf_(false),
expected_length_(0), expected_length_(0),
is_device_closed_(false) { is_device_closed_(false) {

View File

@ -129,10 +129,10 @@ void TagReader::ReadFile(const QString& filename,
TagLib::Tag* tag = fileref->tag(); TagLib::Tag* tag = fileref->tag();
if (tag) { if (tag) {
Decode(tag->title(), NULL, song->mutable_title()); Decode(tag->title(), nullptr, song->mutable_title());
Decode(tag->artist(), NULL, song->mutable_artist()); // TPE1 Decode(tag->artist(), nullptr, song->mutable_artist()); // TPE1
Decode(tag->album(), NULL, song->mutable_album()); Decode(tag->album(), nullptr, song->mutable_album());
Decode(tag->genre(), NULL, song->mutable_genre()); Decode(tag->genre(), nullptr, song->mutable_genre());
song->set_year(tag->year()); song->set_year(tag->year());
song->set_track(tag->track()); song->set_track(tag->track());
song->set_valid(true); 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 // apart, so we keep specific behavior for some formats by adding another
// "else if" block below. // "else if" block below.
if (TagLib::Ogg::XiphComment* tag = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) { if (TagLib::Ogg::XiphComment* tag = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
ParseOggTag(tag->fieldListMap(), NULL, &disc, &compilation, song); ParseOggTag(tag->fieldListMap(), nullptr, &disc, &compilation, song);
} }
if (TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) { if (TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
@ -159,15 +159,15 @@ void TagReader::ReadFile(const QString& filename,
song->set_bpm(TStringToQString(map["TBPM"].front()->toString()).trimmed().toFloat()); song->set_bpm(TStringToQString(map["TBPM"].front()->toString()).trimmed().toFloat());
if (!map["TCOM"].isEmpty()) 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 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 // Skip TPE1 (which is the artist) here because we already fetched it
if (!map["TPE2"].isEmpty()) // non-standard: Apple, Microsoft 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()) if (!map["TCMP"].isEmpty())
compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed(); compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed();
@ -181,7 +181,7 @@ void TagReader::ReadFile(const QString& filename,
dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]); dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]);
if (frame && TStringToQString(frame->description()) != "iTunNORM") { if (frame && TStringToQString(frame->description()) != "iTunNORM") {
Decode(frame->text(), NULL, song->mutable_comment()); Decode(frame->text(), nullptr, song->mutable_comment());
break; break;
} }
} }
@ -218,14 +218,14 @@ void TagReader::ReadFile(const QString& filename,
} }
} else if (TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) { } else if (TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) {
if ( file->xiphComment() ) { if ( file->xiphComment() ) {
ParseOggTag(file->xiphComment()->fieldListMap(), NULL, &disc, &compilation, song); ParseOggTag(file->xiphComment()->fieldListMap(), nullptr, &disc, &compilation, song);
#ifdef TAGLIB_HAS_FLAC_PICTURELIST #ifdef TAGLIB_HAS_FLAC_PICTURELIST
if (!file->pictureList().isEmpty()) { if (!file->pictureList().isEmpty()) {
song->set_art_automatic(kEmbeddedCover); song->set_art_automatic(kEmbeddedCover);
} }
#endif #endif
} }
Decode(tag->comment(), NULL, song->mutable_comment()); Decode(tag->comment(), nullptr, song->mutable_comment());
} else if (TagLib::MP4::File* file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) { } else if (TagLib::MP4::File* file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
if (file->tag()) { if (file->tag()) {
TagLib::MP4::Tag* mp4_tag = file->tag(); TagLib::MP4::Tag* mp4_tag = file->tag();
@ -236,7 +236,7 @@ void TagReader::ReadFile(const QString& filename,
if (it != items.end()) { if (it != items.end()) {
TagLib::StringList album_artists = it->second.toStringList(); TagLib::StringList album_artists = it->second.toStringList();
if (!album_artists.isEmpty()) { 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")) { 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")) { 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 #ifdef TAGLIB_WITH_ASF
@ -310,7 +310,7 @@ void TagReader::ReadFile(const QString& filename,
} }
#endif #endif
else if (tag) { else if (tag) {
Decode(tag->comment(), NULL, song->mutable_comment()); Decode(tag->comment(), nullptr, song->mutable_comment());
} }
if (!disc.isEmpty()) { if (!disc.isEmpty()) {
@ -575,7 +575,7 @@ bool TagReader::SaveFile(const QString& filename,
if (ret) { if (ret) {
// Linux: inotify doesn't seem to notice the change to the file unless we // Linux: inotify doesn't seem to notice the change to the file unless we
// change the timestamps as well. (this is what touch does) // 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 #endif // Q_OS_LINUX
@ -632,7 +632,7 @@ bool TagReader::SaveSongStatisticsToFile(const QString& filename,
if (ret) { if (ret) {
// Linux: inotify doesn't seem to notice the change to the file unless we // Linux: inotify doesn't seem to notice the change to the file unless we
// change the timestamps as well. (this is what touch does) // 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 #endif // Q_OS_LINUX
return ret; return ret;
@ -685,7 +685,7 @@ bool TagReader::SaveSongRatingToFile(const QString& filename,
if (ret) { if (ret) {
// Linux: inotify doesn't seem to notice the change to the file unless we // Linux: inotify doesn't seem to notice the change to the file unless we
// change the timestamps as well. (this is what touch does) // 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 #endif // Q_OS_LINUX
return ret; return ret;
@ -944,7 +944,7 @@ bool TagReader::ReadCloudFile(const QUrl& download_url,
#endif // HAVE_GOOGLE_DRIVE #endif // HAVE_GOOGLE_DRIVE
TagLib::ID3v2::PopularimeterFrame* TagReader::GetPOPMFrameFromTag(TagLib::ID3v2::Tag* tag) { 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(); const TagLib::ID3v2::FrameListMap& map = tag->frameListMap();
if (!map["POPM"].isEmpty()) { if (!map["POPM"].isEmpty()) {

View File

@ -4,7 +4,7 @@
AnalyzerBase::AnalyzerBase(QWidget* parent) AnalyzerBase::AnalyzerBase(QWidget* parent)
: QGLWidget(parent), : QGLWidget(parent),
engine_(NULL) { engine_(nullptr) {
} }
void AnalyzerBase::set_engine(Engine::Base* engine) { void AnalyzerBase::set_engine(Engine::Base* engine) {

View File

@ -48,7 +48,7 @@ Analyzer::Base::Base( QWidget *parent, uint scopeSize )
: QWidget( parent ) : QWidget( parent )
, m_timeout( 40 ) // msec , m_timeout( 40 ) // msec
, m_fht( new FHT(scopeSize) ) , m_fht( new FHT(scopeSize) )
, m_engine(NULL) , m_engine(nullptr)
, m_lastScope(512) , m_lastScope(512)
, new_frame_(false) , new_frame_(false)
, is_playing_(false) , is_playing_(false)

View File

@ -48,11 +48,11 @@ AnalyzerContainer::AnalyzerContainer(QWidget *parent)
group_framerate_(new QActionGroup(this)), group_framerate_(new QActionGroup(this)),
mapper_(new QSignalMapper(this)), mapper_(new QSignalMapper(this)),
mapper_framerate_(new QSignalMapper(this)), mapper_framerate_(new QSignalMapper(this)),
visualisation_action_(NULL), visualisation_action_(nullptr),
double_click_timer_(new QTimer(this)), double_click_timer_(new QTimer(this)),
ignore_next_click_(false), ignore_next_click_(false),
current_analyzer_(NULL), current_analyzer_(nullptr),
engine_(NULL) engine_(nullptr)
{ {
QHBoxLayout* layout = new QHBoxLayout(this); QHBoxLayout* layout = new QHBoxLayout(this);
setLayout(layout); setLayout(layout);
@ -135,7 +135,7 @@ void AnalyzerContainer::SetEngine(EngineBase* engine) {
void AnalyzerContainer::DisableAnalyzer() { void AnalyzerContainer::DisableAnalyzer() {
delete current_analyzer_; delete current_analyzer_;
current_analyzer_ = NULL; current_analyzer_ = nullptr;
Save(); Save();
} }

View File

@ -90,7 +90,7 @@ void GLAnalyzer2::resizeGL( int w, int h )
// Get current timestamp. // Get current timestamp.
timeval tv; timeval tv;
gettimeofday( &tv, NULL ); gettimeofday( &tv, nullptr );
show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; 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 // Compute the dT since the last call to paintGL and update timings
timeval tv; timeval tv;
gettimeofday( &tv, NULL ); gettimeofday( &tv, nullptr );
double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;
show.dT = currentTime - show.timeStamp; show.dT = currentTime - show.timeStamp;
show.timeStamp = currentTime; show.timeStamp = currentTime;

View File

@ -190,7 +190,7 @@ void GLAnalyzer3::resizeGL( int w, int h )
// Get current timestamp. // Get current timestamp.
timeval tv; timeval tv;
gettimeofday( &tv, NULL ); gettimeofday( &tv, nullptr );
show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; 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 // compute the dTime since the last call
timeval tv; timeval tv;
gettimeofday( &tv, NULL ); gettimeofday( &tv, nullptr );
double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0; double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;
show.dT = currentTime - show.timeStamp; show.dT = currentTime - show.timeStamp;
show.timeStamp = currentTime; show.timeStamp = currentTime;

View File

@ -48,28 +48,28 @@ bool Application::kIsPortable = false;
Application::Application(QObject* parent) Application::Application(QObject* parent)
: QObject(parent), : QObject(parent),
tag_reader_client_(NULL), tag_reader_client_(nullptr),
database_(NULL), database_(nullptr),
album_cover_loader_(NULL), album_cover_loader_(nullptr),
playlist_backend_(NULL), playlist_backend_(nullptr),
podcast_backend_(NULL), podcast_backend_(nullptr),
appearance_(NULL), appearance_(nullptr),
cover_providers_(NULL), cover_providers_(nullptr),
task_manager_(NULL), task_manager_(nullptr),
player_(NULL), player_(nullptr),
playlist_manager_(NULL), playlist_manager_(nullptr),
current_art_loader_(NULL), current_art_loader_(nullptr),
global_search_(NULL), global_search_(nullptr),
internet_model_(NULL), internet_model_(nullptr),
library_(NULL), library_(nullptr),
device_manager_(NULL), device_manager_(nullptr),
podcast_updater_(NULL), podcast_updater_(nullptr),
podcast_downloader_(NULL), podcast_downloader_(nullptr),
gpodder_sync_(NULL), gpodder_sync_(nullptr),
moodbar_loader_(NULL), moodbar_loader_(nullptr),
moodbar_controller_(NULL), moodbar_controller_(nullptr),
network_remote_(NULL), network_remote_(nullptr),
network_remote_helper_(NULL) network_remote_helper_(nullptr)
{ {
tag_reader_client_ = new TagReaderClient(this); tag_reader_client_ = new TagReaderClient(this);
MoveToNewThread(tag_reader_client_); MoveToNewThread(tag_reader_client_);
@ -125,7 +125,7 @@ Application::~Application() {
// It's important that the device manager is deleted before the database. // It's important that the device manager is deleted before the database.
// Deleting the database deletes all objects that have been created in its // Deleting the database deletes all objects that have been created in its
// thread, including some device library backends. // thread, including some device library backends.
delete device_manager_; device_manager_ = NULL; delete device_manager_; device_manager_ = nullptr;
foreach (QObject* object, objects_in_threads_) { foreach (QObject* object, objects_in_threads_) {
object->deleteLater(); object->deleteLater();
@ -150,7 +150,7 @@ void Application::MoveToNewThread(QObject* object) {
} }
void Application::MoveToThread(QObject* object, QThread* thread) { void Application::MoveToThread(QObject* object, QThread* thread) {
object->setParent(NULL); object->setParent(nullptr);
object->moveToThread(thread); object->moveToThread(thread);
objects_in_threads_ << object; objects_in_threads_ << object;
} }

View File

@ -158,7 +158,7 @@ void BackgroundStreams::StreamActionDestroyed() {
foreach (Stream* stream, streams_.values()) { foreach (Stream* stream, streams_.values()) {
if (stream->action == action) { if (stream->action == action) {
stream->action = NULL; stream->action = nullptr;
} }
} }
} }

View File

@ -138,7 +138,7 @@ bool CommandlineOptions::Parse() {
// Parse the arguments // Parse the arguments
bool ok = false; bool ok = false;
forever { 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 // End of the options
if (c == -1) if (c == -1)

View File

@ -38,13 +38,13 @@
const char* CrashSender::kUploadURL = "http://crashes.clementine-player.org/getuploadurl"; const char* CrashSender::kUploadURL = "http://crashes.clementine-player.org/getuploadurl";
const char* CrashReporting::kSendCrashReportOption = "--send-crash-report"; const char* CrashReporting::kSendCrashReportOption = "--send-crash-report";
char* CrashReporting::sPath = NULL; char* CrashReporting::sPath = nullptr;
#if defined(HAVE_BREAKPAD) and defined(Q_OS_LINUX) #if defined(HAVE_BREAKPAD) and defined(Q_OS_LINUX)
CrashReporting::CrashReporting() CrashReporting::CrashReporting()
: handler_(new google_breakpad::ExceptionHandler( : handler_(new google_breakpad::ExceptionHandler(
QDir::tempPath().toLocal8Bit().constData(), NULL, QDir::tempPath().toLocal8Bit().constData(), nullptr,
CrashReporting::Handler, this, true)) { CrashReporting::Handler, this, true)) {
} }
@ -90,7 +90,7 @@ bool CrashReporting::Handler(const char* dump_path,
if (sPath) { if (sPath) {
// We know the path to clementine, so exec it again to prompt the user to // We know the path to clementine, so exec it again to prompt the user to
// upload the report. // 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); sys_execv(sPath, argv);
} }
@ -102,7 +102,7 @@ CrashSender::CrashSender(const QString& path)
: network_(new QNetworkAccessManager(this)), : network_(new QNetworkAccessManager(this)),
path_(path), path_(path),
file_(new QFile(path_, this)), file_(new QFile(path_, this)),
progress_(NULL) { progress_(nullptr) {
} }
bool CrashSender::Start() { bool CrashSender::Start() {

View File

@ -85,7 +85,7 @@ struct sqlite3_tokenizer_cursor {
/* Tokenizer implementations will typically add additional fields */ /* 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) { 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); QString dest_filename = QString("%1.bak").arg(filename);
const int task_id = app_->task_manager()->StartTask(tr("Backing up database")); const int task_id = app_->task_manager()->StartTask(tr("Backing up database"));
sqlite3* source_connection = NULL; sqlite3* source_connection = nullptr;
sqlite3* dest_connection = NULL; sqlite3* dest_connection = nullptr;
BOOST_SCOPE_EXIT((source_connection)(dest_connection)(task_id)(app_)) { 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(source_connection);
sqlite3_close(dest_connection); sqlite3_close(dest_connection);
app_->task_manager()->SetTaskFinished(task_id); app_->task_manager()->SetTaskFinished(task_id);

View File

@ -29,7 +29,7 @@ const int DeleteFiles::kBatchSize = 50;
DeleteFiles::DeleteFiles(TaskManager* task_manager, DeleteFiles::DeleteFiles(TaskManager* task_manager,
std::shared_ptr<MusicStorage> storage) std::shared_ptr<MusicStorage> storage)
: thread_(NULL), : thread_(nullptr),
task_manager_(task_manager), task_manager_(task_manager),
storage_(storage), storage_(storage),
started_(false), started_(false),

View File

@ -35,8 +35,8 @@ const char* GlobalShortcuts::kSettingsGroup = "Shortcuts";
GlobalShortcuts::GlobalShortcuts(QWidget *parent) GlobalShortcuts::GlobalShortcuts(QWidget *parent)
: QWidget(parent), : QWidget(parent),
gnome_backend_(NULL), gnome_backend_(nullptr),
system_backend_(NULL), system_backend_(nullptr),
use_gnome_(false), use_gnome_(false),
rating_signals_mapper_(new QSignalMapper(this)) rating_signals_mapper_(new QSignalMapper(this))
{ {

View File

@ -39,7 +39,7 @@ const char* GnomeGlobalShortcutBackend::kGsdInterface = "org.gnome.SettingsDaemo
GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent) GnomeGlobalShortcutBackend::GnomeGlobalShortcutBackend(GlobalShortcuts* parent)
: GlobalShortcutBackend(parent), : GlobalShortcutBackend(parent),
interface_(NULL), interface_(nullptr),
is_connected_(false) is_connected_(false)
{ {
} }

View File

@ -28,7 +28,7 @@ std::size_t hash_value(const QModelIndex& index) {
MergedProxyModel::MergedProxyModel(QObject* parent) MergedProxyModel::MergedProxyModel(QObject* parent)
: QAbstractProxyModel(parent), : QAbstractProxyModel(parent),
resetting_model_(NULL) resetting_model_(nullptr)
{ {
} }
@ -85,7 +85,7 @@ void MergedProxyModel::RemoveSubModel(const QModelIndex &source_parent) {
resetting_model_ = submodel; resetting_model_ = submodel;
beginRemoveRows(proxy_parent, 0, std::numeric_limits<int>::max() - 1); beginRemoveRows(proxy_parent, 0, std::numeric_limits<int>::max() - 1);
endRemoveRows(); endRemoveRows();
resetting_model_ = NULL; resetting_model_ = nullptr;
// Delete all the mappings that reference the submodel // Delete all the mappings that reference the submodel
MappingContainer::index<tag_by_pointer>::type::iterator it = MappingContainer::index<tag_by_pointer>::type::iterator it =
@ -167,7 +167,7 @@ void MergedProxyModel::SubModelReset() {
resetting_model_ = submodel; resetting_model_ = submodel;
beginRemoveRows(proxy_parent, 0, std::numeric_limits<int>::max() - 1); beginRemoveRows(proxy_parent, 0, std::numeric_limits<int>::max() - 1);
endRemoveRows(); endRemoveRows();
resetting_model_ = NULL; resetting_model_ = nullptr;
// Delete all the mappings that reference the submodel // Delete all the mappings that reference the submodel
MappingContainer::index<tag_by_pointer>::type::iterator it = MappingContainer::index<tag_by_pointer>::type::iterator it =
@ -449,7 +449,7 @@ QAbstractItemModel* MergedProxyModel::GetModel(const QModelIndex& source_index)
if (submodel == const_model) if (submodel == const_model)
return submodel; return submodel;
} }
return NULL; return nullptr;
} }
void MergedProxyModel::DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right) { void MergedProxyModel::DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right) {

View File

@ -41,9 +41,9 @@ Mpris1::Mpris1(Application* app, QObject* parent,
const QString& dbus_service_name) const QString& dbus_service_name)
: QObject(parent), : QObject(parent),
dbus_service_name_(dbus_service_name), dbus_service_name_(dbus_service_name),
root_(NULL), root_(nullptr),
player_(NULL), player_(nullptr),
tracklist_(NULL) tracklist_(nullptr)
{ {
qDBusRegisterMetaType<DBusStatus>(); qDBusRegisterMetaType<DBusStatus>();
qDBusRegisterMetaType<Version>(); qDBusRegisterMetaType<Version>();

View File

@ -27,7 +27,7 @@
#include "utilities.h" #include "utilities.h"
QMutex ThreadSafeNetworkDiskCache::sMutex; QMutex ThreadSafeNetworkDiskCache::sMutex;
QNetworkDiskCache* ThreadSafeNetworkDiskCache::sCache = NULL; QNetworkDiskCache* ThreadSafeNetworkDiskCache::sCache = nullptr;
ThreadSafeNetworkDiskCache::ThreadSafeNetworkDiskCache(QObject* parent) { ThreadSafeNetworkDiskCache::ThreadSafeNetworkDiskCache(QObject* parent) {
@ -169,7 +169,7 @@ void NetworkTimeouts::timerEvent(QTimerEvent* e) {
RedirectFollower::RedirectFollower(QNetworkReply* first_reply, int max_redirects) RedirectFollower::RedirectFollower(QNetworkReply* first_reply, int max_redirects)
: QObject(NULL), : QObject(nullptr),
current_reply_(first_reply), current_reply_(first_reply),
redirects_remaining_(max_redirects) { redirects_remaining_(max_redirects) {
ConnectReply(first_reply); ConnectReply(first_reply);

View File

@ -8,7 +8,7 @@
#include <stdlib.h> #include <stdlib.h>
NetworkProxyFactory* NetworkProxyFactory::sInstance = NULL; NetworkProxyFactory* NetworkProxyFactory::sInstance = nullptr;
const char* NetworkProxyFactory::kSettingsGroup = "Proxy"; const char* NetworkProxyFactory::kSettingsGroup = "Proxy";
NetworkProxyFactory::NetworkProxyFactory() NetworkProxyFactory::NetworkProxyFactory()

View File

@ -40,7 +40,7 @@ Organise::Organise(TaskManager* task_manager,
std::shared_ptr<MusicStorage> destination, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat &format, bool copy, bool overwrite, const OrganiseFormat &format, bool copy, bool overwrite,
const NewSongInfoList& songs_info, bool eject_after) const NewSongInfoList& songs_info, bool eject_after)
: thread_(NULL), : thread_(nullptr),
task_manager_(task_manager), task_manager_(task_manager),
transcoder_(new Transcoder(this)), transcoder_(new Transcoder(this)),
destination_(destination), destination_(destination),

View File

@ -43,7 +43,7 @@ using std::shared_ptr;
Player::Player(Application* app, QObject* parent) Player::Player(Application* app, QObject* parent)
: PlayerInterface(parent), : PlayerInterface(parent),
app_(app), app_(app),
lastfm_(NULL), lastfm_(nullptr),
engine_(new GstEngine(app_->task_manager())), engine_(new GstEngine(app_->task_manager())),
stream_change_type_(Engine::First), stream_change_type_(Engine::First),
last_state_(Engine::Empty), last_state_(Engine::Empty),
@ -611,7 +611,7 @@ void Player::UnregisterUrlHandler(UrlHandler* handler) {
const UrlHandler* Player::HandlerForUrl(const QUrl& url) const { const UrlHandler* Player::HandlerForUrl(const QUrl& url) const {
QMap<QString, UrlHandler*>::const_iterator it = url_handlers_.constFind(url.scheme()); QMap<QString, UrlHandler*>::const_iterator it = url_handlers_.constFind(url.scheme());
if (it == url_handlers_.constEnd()) { if (it == url_handlers_.constEnd()) {
return NULL; return nullptr;
} }
return *it; return *it;
} }

View File

@ -717,7 +717,7 @@ void Song::InitFromLastFM(const lastfm::Track& track) {
track->composer = strdup(d->composer_.toUtf8().constData()); track->composer = strdup(d->composer_.toUtf8().constData());
track->genre = strdup(d->genre_.toUtf8().constData()); track->genre = strdup(d->genre_.toUtf8().constData());
track->title = strdup(d->title_.toUtf8().constData()); track->title = strdup(d->title_.toUtf8().constData());
track->date = NULL; track->date = nullptr;
track->filename = strdup(d->basefilename_.toUtf8().constData()); track->filename = strdup(d->basefilename_.toUtf8().constData());

View File

@ -66,7 +66,7 @@ SongLoader::SongLoader(LibraryBackendInterface* library,
timeout_(kDefaultTimeout), timeout_(kDefaultTimeout),
state_(WaitingForType), state_(WaitingForType),
success_(false), success_(false),
parser_(NULL), parser_(nullptr),
is_podcast_(false), is_podcast_(false),
library_(library), library_(library),
player_(player) player_(player)
@ -129,8 +129,8 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) {
SongLoader::Result SongLoader::LoadAudioCD() { SongLoader::Result SongLoader::LoadAudioCD() {
#ifdef HAVE_AUDIOCD #ifdef HAVE_AUDIOCD
// Create gstreamer cdda element // Create gstreamer cdda element
GstElement* cdda = gst_element_make_from_uri (GST_URI_SRC, "cdda://", NULL); GstElement* cdda = gst_element_make_from_uri (GST_URI_SRC, "cdda://", nullptr);
if (cdda == NULL) { if (cdda == nullptr) {
qLog(Error) << "Error while creating CDDA GstElement"; qLog(Error) << "Error while creating CDDA GstElement";
return Error; return Error;
} }
@ -180,9 +180,9 @@ SongLoader::Result SongLoader::LoadAudioCD() {
GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe), GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe),
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE,
GST_MESSAGE_TAG); GST_MESSAGE_TAG);
GstTagList *tags = NULL; GstTagList *tags = nullptr;
gst_message_parse_tag (msg, &tags); 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)) { if (gst_tag_list_get_string (tags, GST_TAG_CDDA_MUSICBRAINZ_DISCID, &string_mb)) {
QString musicbrainz_discid(string_mb); QString musicbrainz_discid(string_mb);
qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid; 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 // Create the pipeline - it gets unreffed if it goes out of scope
std::shared_ptr<GstElement> pipeline( std::shared_ptr<GstElement> 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 // Create the source element automatically based on the URL
GstElement* source = gst_element_make_from_uri( GstElement* source = gst_element_make_from_uri(
GST_URI_SRC, url_.toEncoded().constData(), NULL); GST_URI_SRC, url_.toEncoded().constData(), nullptr);
if (!source) { if (!source) {
qLog(Warning) << "Couldn't create gstreamer source element for" << url_.toString(); qLog(Warning) << "Couldn't create gstreamer source element for" << url_.toString();
return Error; return Error;
} }
// Create the other elements and link them up // Create the other elements and link them up
GstElement* typefind = gst_element_factory_make("typefind", NULL); GstElement* typefind = gst_element_factory_make("typefind", nullptr);
GstElement* fakesink = gst_element_factory_make("fakesink", NULL); GstElement* fakesink = gst_element_factory_make("fakesink", nullptr);
gst_bin_add_many(GST_BIN(pipeline.get()), source, typefind, fakesink, NULL); gst_bin_add_many(GST_BIN(pipeline.get()), source, typefind, fakesink, nullptr);
gst_element_link_many(source, typefind, fakesink, NULL); gst_element_link_many(source, typefind, fakesink, nullptr);
// Connect callbacks // Connect callbacks
GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline.get())); 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") { if (parser_->name() == "ASX/INI" && url_.scheme() == "http") {
// This is actually a weird MS-WMSP stream. Changing the protocol to MMS from // This is actually a weird MS-WMSP stream. Changing the protocol to MMS from
// HTTP makes it playable. // HTTP makes it playable.
parser_ = NULL; parser_ = nullptr;
url_.setScheme("mms"); url_.setScheme("mms");
StopTypefindAsync(true); StopTypefindAsync(true);
} }

View File

@ -26,7 +26,7 @@
const char* TagReaderClient::kWorkerExecutableName = "clementine-tagreader"; const char* TagReaderClient::kWorkerExecutableName = "clementine-tagreader";
TagReaderClient* TagReaderClient::sInstance = NULL; TagReaderClient* TagReaderClient::sInstance = nullptr;
TagReaderClient::TagReaderClient(QObject* parent) TagReaderClient::TagReaderClient(QObject* parent)
: QObject(parent), : QObject(parent),

View File

@ -175,7 +175,7 @@ quint64 FileSystemCapacity(const QString& path) {
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
_ULARGE_INTEGER ret; _ULARGE_INTEGER ret;
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(),
NULL, &ret, NULL) != 0) nullptr, &ret, nullptr) != 0)
return ret.QuadPart; return ret.QuadPart;
#endif #endif
@ -190,7 +190,7 @@ quint64 FileSystemFreeSpace(const QString& path) {
#elif defined(Q_OS_WIN32) #elif defined(Q_OS_WIN32)
_ULARGE_INTEGER ret; _ULARGE_INTEGER ret;
if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(), if (GetDiskFreeSpaceEx(QDir::toNativeSeparators(path).toLocal8Bit().constData(),
&ret, NULL, NULL) != 0) &ret, nullptr, nullptr) != 0)
return ret.QuadPart; return ret.QuadPart;
#endif #endif

View File

@ -29,8 +29,8 @@ CddaDevice::CddaDevice(const QUrl& url, DeviceLister* lister,
Application* app, Application* app,
int database_id, bool first_time) int database_id, bool first_time)
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
cdda_(NULL), cdda_(nullptr),
cdio_(NULL) cdio_(nullptr)
{ {
} }
@ -43,12 +43,12 @@ void CddaDevice::Init() {
QMutexLocker locker(&mutex_init_); QMutexLocker locker(&mutex_init_);
song_count_ = 0; // Reset song count, in case it was already set song_count_ = 0; // Reset song count, in case it was already set
cdio_ = cdio_open (url_.path().toLocal8Bit().constData(), DRIVER_DEVICE); cdio_ = cdio_open (url_.path().toLocal8Bit().constData(), DRIVER_DEVICE);
if (cdio_ == NULL) { if (cdio_ == nullptr) {
return; return;
} }
// Create gstreamer cdda element // Create gstreamer cdda element
cdda_ = gst_element_make_from_uri (GST_URI_SRC, "cdda://", NULL); cdda_ = gst_element_make_from_uri (GST_URI_SRC, "cdda://", nullptr);
if (cdda_ == NULL) { if (cdda_ == nullptr) {
model_->Reset(); model_->Reset();
return; return;
} }
@ -106,9 +106,9 @@ void CddaDevice::Init() {
GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe), GstMessage *msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipe),
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE,
GST_MESSAGE_TAG); GST_MESSAGE_TAG);
GstTagList *tags = NULL; GstTagList *tags = nullptr;
gst_message_parse_tag (msg, &tags); 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)) { if (gst_tag_list_get_string (tags, GST_TAG_CDDA_MUSICBRAINZ_DISCID, &string_mb)) {
QString musicbrainz_discid(string_mb); QString musicbrainz_discid(string_mb);
qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid; qLog(Info) << "MusicBrainz discid: " << musicbrainz_discid;

View File

@ -105,7 +105,7 @@ void CddaLister::Init() {
qLog(Debug) << "No CD devices found"; qLog(Debug) << "No CD devices found";
return; return;
} }
for (; *devices != NULL; ++devices) { for (; *devices != nullptr; ++devices) {
QString device(*devices); QString device(*devices);
QFileInfo device_info(device); QFileInfo device_info(device);
if (device_info.isSymLink()) { if (device_info.isSymLink()) {

View File

@ -39,8 +39,8 @@ ConnectedDevice::ConnectedDevice(const QUrl& url, DeviceLister* lister,
unique_id_(unique_id), unique_id_(unique_id),
database_id_(database_id), database_id_(database_id),
manager_(manager), manager_(manager),
backend_(NULL), backend_(nullptr),
model_(NULL), model_(nullptr),
song_count_(0) song_count_(0)
{ {
qLog(Info) << "connected" << url << unique_id << first_time; qLog(Info) << "connected" << url << unique_id << first_time;

View File

@ -29,7 +29,7 @@
#endif #endif
DeviceLister::DeviceLister() DeviceLister::DeviceLister()
: thread_(NULL) : thread_(nullptr)
{ {
} }

View File

@ -109,7 +109,7 @@ void DeviceManager::DeviceInfo::InitFromDb(const DeviceDatabaseBackend::Device&
QStringList unique_ids = dev.unique_id_.split(','); QStringList unique_ids = dev.unique_id_.split(',');
foreach (const QString& id, unique_ids) { 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 { const DeviceManager::DeviceInfo::Backend* DeviceManager::DeviceInfo::BestBackend() const {
int best_priority = -1; int best_priority = -1;
const Backend* ret = NULL; const Backend* ret = nullptr;
for (int i=0 ; i<backends_.count() ; ++i) { for (int i=0 ; i<backends_.count() ; ++i) {
if (backends_[i].lister_ && backends_[i].lister_->priority() > best_priority) { if (backends_[i].lister_ && backends_[i].lister_->priority() > best_priority) {
@ -470,7 +470,7 @@ void DeviceManager::PhysicalDeviceRemoved(const QString &id) {
// Keep the structure around, but just "disconnect" it // Keep the structure around, but just "disconnect" it
for (int backend_index = 0 ; backend_index < info.backends_.count() ; ++backend_index) { for (int backend_index = 0 ; backend_index < info.backends_.count() ; ++backend_index) {
if (info.backends_[backend_index].unique_id_ == id) { if (info.backends_[backend_index].unique_id_ == id) {
info.backends_[backend_index].lister_ = NULL; info.backends_[backend_index].lister_ = nullptr;
break; break;
} }
} }
@ -563,7 +563,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
// was "ipod" or "mtp" then the user compiled out support and the device // was "ipod" or "mtp" then the user compiled out support and the device
// won't work properly. // won't work properly.
if (url.scheme() == "mtp" || url.scheme() == "gphoto2") { 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("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."), tr("If you continue, this device will work slowly and songs copied to it may not work."),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort)
@ -571,7 +571,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
} }
if (url.scheme() == "ipod") { 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("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."), tr("If you continue, this device will work slowly and songs copied to it may not work."),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort) QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort)

View File

@ -35,7 +35,7 @@
DeviceProperties::DeviceProperties(QWidget *parent) DeviceProperties::DeviceProperties(QWidget *parent)
: QDialog(parent), : QDialog(parent),
ui_(new Ui_DeviceProperties), ui_(new Ui_DeviceProperties),
manager_(NULL), manager_(nullptr),
updating_formats_(false) updating_formats_(false)
{ {
ui_->setupUi(this); ui_->setupUi(this);

View File

@ -146,12 +146,12 @@ void DeviceItemDelegate::paint(QPainter* p, const QStyleOptionViewItem& opt, con
DeviceView::DeviceView(QWidget* parent) DeviceView::DeviceView(QWidget* parent)
: AutoExpandingTreeView(parent), : AutoExpandingTreeView(parent),
app_(NULL), app_(nullptr),
merged_model_(NULL), merged_model_(nullptr),
sort_model_(NULL), sort_model_(nullptr),
properties_dialog_(new DeviceProperties), properties_dialog_(new DeviceProperties),
device_menu_(NULL), device_menu_(nullptr),
library_menu_(NULL) library_menu_(nullptr)
{ {
setItemDelegate(new DeviceItemDelegate(this)); setItemDelegate(new DeviceItemDelegate(this));
SetExpandOnReset(false); SetExpandOnReset(false);
@ -167,7 +167,7 @@ DeviceView::~DeviceView() {
} }
void DeviceView::SetApplication(Application* app) { void DeviceView::SetApplication(Application* app) {
Q_ASSERT(app_ == NULL); Q_ASSERT(app_ == nullptr);
app_ = app; app_ = app;
connect(app_->device_manager(), SIGNAL(DeviceConnected(int)), SLOT(DeviceConnected(int))); connect(app_->device_manager(), SIGNAL(DeviceConnected(int)), SLOT(DeviceConnected(int)));

View File

@ -58,7 +58,7 @@ bool GioLister::DeviceInfo::is_suitable() const {
template <typename T, typename F> template <typename T, typename F>
void OperationFinished(F f, GObject *object, GAsyncResult *result) { void OperationFinished(F f, GObject *object, GAsyncResult *result) {
T* obj = reinterpret_cast<T*>(object); T* obj = reinterpret_cast<T*>(object);
GError* error = NULL; GError* error = nullptr;
f(obj, result, &error); 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 // 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, // device is unmounted GIO sends a changed signal before the removed signal,
// and we end up reading information about the / filesystem by mistake. // and we end up reading information about the / filesystem by mistake.
GError* error = NULL; GError* error = nullptr;
GMount* actual_mount = g_file_find_enclosing_mount(root, NULL, &error); GMount* actual_mount = g_file_find_enclosing_mount(root, nullptr, &error);
if (error || !actual_mount) { if (error || !actual_mount) {
g_error_free(error); g_error_free(error);
invalid_enclosing_mount = true; invalid_enclosing_mount = true;
@ -381,10 +381,10 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) {
} }
// Query the filesystem info for size, free space, and type // Query the filesystem info for size, free space, and type
error = NULL; error = nullptr;
GFileInfo* info = g_file_query_filesystem_info(root, GFileInfo* info = g_file_query_filesystem_info(root,
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE "," 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) { if (error) {
qLog(Warning) << error->message; qLog(Warning) << error->message;
g_error_free(error); g_error_free(error);
@ -401,9 +401,9 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount* mount) {
// Query the file's info for a filesystem ID // Query the file's info for a filesystem ID
// Only afc devices (that I know of) give reliably unique IDs // Only afc devices (that I know of) give reliably unique IDs
if (filesystem_type == "afc") { if (filesystem_type == "afc") {
error = NULL; error = nullptr;
info = g_file_query_info(root, G_FILE_ATTRIBUTE_ID_FILESYSTEM, 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) { if (error) {
qLog(Warning) << error->message; qLog(Warning) << error->message;
g_error_free(error); g_error_free(error);
@ -489,10 +489,10 @@ void GioLister::UnmountDevice(const QString &id) {
g_volume_eject_with_operation( g_volume_eject_with_operation(
info.volume, info.volume,
G_MOUNT_UNMOUNT_NONE, G_MOUNT_UNMOUNT_NONE,
NULL, nullptr,
NULL, nullptr,
(GAsyncReadyCallback) VolumeEjectFinished, (GAsyncReadyCallback) VolumeEjectFinished,
NULL); nullptr);
g_object_unref(info.volume); g_object_unref(info.volume);
return; return;
} }
@ -502,18 +502,18 @@ void GioLister::UnmountDevice(const QString &id) {
g_mount_eject_with_operation( g_mount_eject_with_operation(
info.mount, info.mount,
G_MOUNT_UNMOUNT_NONE, G_MOUNT_UNMOUNT_NONE,
NULL, nullptr,
NULL, nullptr,
(GAsyncReadyCallback) MountEjectFinished, (GAsyncReadyCallback) MountEjectFinished,
NULL); nullptr);
} else if (g_mount_can_unmount(info.mount)) { } else if (g_mount_can_unmount(info.mount)) {
g_mount_unmount_with_operation( g_mount_unmount_with_operation(
info.mount, info.mount,
G_MOUNT_UNMOUNT_NONE, G_MOUNT_UNMOUNT_NONE,
NULL, nullptr,
NULL, nullptr,
(GAsyncReadyCallback) MountUnmountFinished, (GAsyncReadyCallback) MountUnmountFinished,
NULL); nullptr);
} }
} }
@ -527,9 +527,9 @@ void GioLister::UpdateDeviceFreeSpace(const QString& id) {
GFile* root = g_mount_get_root(device_info.mount); GFile* root = g_mount_get_root(device_info.mount);
GError* error = NULL; GError* error = nullptr;
GFileInfo* info = g_file_query_filesystem_info( 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) { if (error) {
qLog(Warning) << error->message; qLog(Warning) << error->message;
g_error_free(error); g_error_free(error);
@ -571,7 +571,7 @@ void GioLister::DoMountDevice(const QString& id, int request_id) {
return; return;
} }
g_volume_mount(info.volume, G_MOUNT_MOUNT_NONE, NULL, NULL, g_volume_mount(info.volume, G_MOUNT_MOUNT_NONE, nullptr, nullptr,
VolumeMountFinished, NULL); VolumeMountFinished, nullptr);
emit DeviceMounted(id, request_id, true); emit DeviceMounted(id, request_id, true);
} }

View File

@ -37,8 +37,8 @@ GPodDevice::GPodDevice(
int database_id, bool first_time) int database_id, bool first_time)
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
loader_thread_(new QThread(this)), loader_thread_(new QThread(this)),
loader_(NULL), loader_(nullptr),
db_(NULL) db_(nullptr)
{ {
} }
@ -66,7 +66,7 @@ void GPodDevice::LoadFinished(Itdb_iTunesDB* db) {
db_wait_cond_.wakeAll(); db_wait_cond_.wakeAll();
loader_->deleteLater(); loader_->deleteLater();
loader_ = NULL; loader_ = nullptr;
} }
bool GPodDevice::StartCopy(QList<Song::FileType>* supported_filetypes) { bool GPodDevice::StartCopy(QList<Song::FileType>* supported_filetypes) {
@ -113,7 +113,7 @@ bool GPodDevice::CopyToStorage(const CopyJob& job) {
Itdb_Track* track = AddTrackToITunesDb(job.metadata_); Itdb_Track* track = AddTrackToITunesDb(job.metadata_);
// Copy the file // Copy the file
GError* error = NULL; GError* error = nullptr;
itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_) itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_)
.toLocal8Bit().constData(), &error); .toLocal8Bit().constData(), &error);
if (error) { if (error) {
@ -139,7 +139,7 @@ bool GPodDevice::CopyToStorage(const CopyJob& job) {
void GPodDevice::WriteDatabase(bool success) { void GPodDevice::WriteDatabase(bool success) {
if (success) { if (success) {
// Write the itunes database // Write the itunes database
GError* error = NULL; GError* error = nullptr;
itdb_write(db_, &error); itdb_write(db_, &error);
if (error) { if (error) {
qLog(Error) << "writing database failed:" << error->message; qLog(Error) << "writing database failed:" << error->message;
@ -167,7 +167,7 @@ void GPodDevice::FinishCopy(bool success) {
} }
void GPodDevice::StartDelete() { void GPodDevice::StartDelete() {
StartCopy(NULL); StartCopy(nullptr);
} }
bool GPodDevice::RemoveTrackFromITunesDb(const QString& path, const QString& relative_to) { 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('/', ':'); ipod_filename.replace('/', ':');
// Find the track in the itdb, identify it by its filename // Find the track in the itdb, identify it by its filename
Itdb_Track* track = NULL; Itdb_Track* track = nullptr;
for (GList* tracks = db_->tracks ; tracks != NULL ; tracks = tracks->next) { for (GList* tracks = db_->tracks ; tracks != nullptr ; tracks = tracks->next) {
Itdb_Track* t = static_cast<Itdb_Track*>(tracks->data); Itdb_Track* t = static_cast<Itdb_Track*>(tracks->data);
if (t->ipod_path == ipod_filename) { 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"; qLog(Warning) << "Couldn't find song" << path << "in iTunesDB";
return false; return false;
} }
// Remove the track from all playlists // 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<Itdb_Playlist*>(playlists->data); Itdb_Playlist* playlist = static_cast<Itdb_Playlist*>(playlists->data);
if (itdb_playlist_contains_track(playlist, track)) { if (itdb_playlist_contains_track(playlist, track)) {

View File

@ -30,7 +30,7 @@
GPodLoader::GPodLoader( GPodLoader::GPodLoader(
const QString& mount_point, TaskManager* task_manager, const QString& mount_point, TaskManager* task_manager,
LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device) LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device)
: QObject(NULL), : QObject(nullptr),
device_(device), device_(device),
mount_point_(mount_point), mount_point_(mount_point),
type_(Song::Type_Unknown), type_(Song::Type_Unknown),
@ -48,7 +48,7 @@ void GPodLoader::LoadDatabase() {
emit TaskStarted(task_id); emit TaskStarted(task_id);
// Load the iTunes database // Load the iTunes database
GError* error = NULL; GError* error = nullptr;
Itdb_iTunesDB* db = itdb_parse( Itdb_iTunesDB* db = itdb_parse(
QDir::toNativeSeparators(mount_point_).toLocal8Bit(), &error); QDir::toNativeSeparators(mount_point_).toLocal8Bit(), &error);
@ -71,7 +71,7 @@ void GPodLoader::LoadDatabase() {
? QDir::fromNativeSeparators(mount_point_) : path_prefix_; ? QDir::fromNativeSeparators(mount_point_) : path_prefix_;
SongList songs; 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<Itdb_Track*>(tracks->data); Itdb_Track* track = static_cast<Itdb_Track*>(tracks->data);
Song song; Song song;

View File

@ -22,7 +22,7 @@
#include <QtDebug> #include <QtDebug>
MtpConnection::MtpConnection(const QUrl& url) MtpConnection::MtpConnection(const QUrl& url)
: device_(NULL) : device_(nullptr)
{ {
QString hostname = url.host(); QString hostname = url.host();
// Parse the URL // 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 // Get a list of devices from libmtp and figure out which one is ours
int count = 0; 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); LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(&raw_devices, &count);
if (err != LIBMTP_ERROR_NONE) { if (err != LIBMTP_ERROR_NONE) {
qLog(Warning) << "MTP error:" << err; qLog(Warning) << "MTP error:" << err;
return; return;
} }
LIBMTP_raw_device_t* raw_device = NULL; LIBMTP_raw_device_t* raw_device = nullptr;
for (int i=0 ; i<count ; ++i) { for (int i=0 ; i<count ; ++i) {
if (raw_devices[i].bus_location == bus_location && if (raw_devices[i].bus_location == bus_location &&
raw_devices[i].devnum == device_num) { raw_devices[i].devnum == device_num) {

View File

@ -37,7 +37,7 @@ MtpDevice::MtpDevice(const QUrl& url, DeviceLister* lister,
int database_id, bool first_time) int database_id, bool first_time)
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
loader_thread_(new QThread(this)), loader_thread_(new QThread(this)),
loader_(NULL) loader_(nullptr)
{ {
if (!sInitialisedLibMTP) { if (!sInitialisedLibMTP) {
LIBMTP_Init(); LIBMTP_Init();
@ -67,7 +67,7 @@ void MtpDevice::Init() {
void MtpDevice::LoadFinished() { void MtpDevice::LoadFinished() {
loader_->deleteLater(); loader_->deleteLater();
loader_ = NULL; loader_ = nullptr;
db_busy_.unlock(); db_busy_.unlock();
} }
@ -147,7 +147,7 @@ void MtpDevice::FinishCopy(bool success) {
} }
void MtpDevice::StartDelete() { void MtpDevice::StartDelete() {
StartCopy(NULL); StartCopy(nullptr);
} }
bool MtpDevice::DeleteFromStorage(const DeleteJob& job) { bool MtpDevice::DeleteFromStorage(const DeleteJob& job) {
@ -187,7 +187,7 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) {
} }
bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, LIBMTP_mtpdevice_t* device) { bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, LIBMTP_mtpdevice_t* device) {
uint16_t* list = NULL; uint16_t* list = nullptr;
uint16_t length = 0; uint16_t length = 0;
if (LIBMTP_Get_Supported_Filetypes(device, &list, &length) if (LIBMTP_Get_Supported_Filetypes(device, &list, &length)

View File

@ -28,7 +28,7 @@
MtpLoader::MtpLoader( MtpLoader::MtpLoader(
const QUrl& url, TaskManager* task_manager, const QUrl& url, TaskManager* task_manager,
LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device) LibraryBackend* backend, std::shared_ptr<ConnectedDevice> device)
: QObject(NULL), : QObject(nullptr),
device_(device), device_(device),
url_(url), url_(url),
task_manager_(task_manager), task_manager_(task_manager),
@ -61,7 +61,8 @@ bool MtpLoader::TryLoad() {
// Load the list of songs on the device // Load the list of songs on the device
SongList songs; 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) { while (tracks) {
LIBMTP_track_t* track = tracks; LIBMTP_track_t* track = tracks;

View File

@ -69,7 +69,7 @@ GstEngine::GstEngine(TaskManager* task_manager)
: Engine::Base(), : Engine::Base(),
task_manager_(task_manager), task_manager_(task_manager),
buffering_task_id_(-1), buffering_task_id_(-1),
latest_buffer_(NULL), latest_buffer_(nullptr),
equalizer_enabled_(false), equalizer_enabled_(false),
stereo_balance_(0.0f), stereo_balance_(0.0f),
rg_enabled_(false), rg_enabled_(false),
@ -106,7 +106,7 @@ bool GstEngine::Init() {
} }
void GstEngine::InitialiseGstreamer() { void GstEngine::InitialiseGstreamer() {
gst_init(NULL, NULL); gst_init(nullptr, nullptr);
#ifdef HAVE_MOODBAR #ifdef HAVE_MOODBAR
gstmoodbar_register_static(); gstmoodbar_register_static();
@ -181,14 +181,14 @@ void GstEngine::AddBufferToScope(GstBuffer* buf, int pipeline_id) {
return; return;
} }
if (latest_buffer_ != NULL) { if (latest_buffer_ != nullptr) {
gst_buffer_unref(latest_buffer_); gst_buffer_unref(latest_buffer_);
} }
latest_buffer_ = buf; latest_buffer_ = buf;
} }
const Engine::Scope& GstEngine::scope() { const Engine::Scope& GstEngine::scope() {
if (latest_buffer_ != NULL) { if (latest_buffer_ != nullptr) {
UpdateScope(); UpdateScope();
} }
@ -218,7 +218,7 @@ void GstEngine::UpdateScope() {
memcpy(dest, source, bytes); memcpy(dest, source, bytes);
gst_buffer_unref(latest_buffer_); gst_buffer_unref(latest_buffer_);
latest_buffer_ = NULL; latest_buffer_ = nullptr;
} }
void GstEngine::StartPreloading(const QUrl& url, bool force_stop_at_end, 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. " 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 ) ); "Please make sure that you have installed all necessary GStreamer plugins (e.g. OGG and MP3)").arg( factoryName ) );
gst_object_unref(GST_OBJECT(bin)); gst_object_unref(GST_OBJECT(bin));
return NULL; return nullptr;
} }
if (bin) if (bin)

View File

@ -138,7 +138,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(GstElement* new_bin) {
} }
bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) { bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
GstElement* new_bin = NULL; GstElement* new_bin = nullptr;
if (url.scheme() == "spotify") { if (url.scheme() == "spotify") {
new_bin = gst_bin_new("spotify_bin"); new_bin = gst_bin_new("spotify_bin");
@ -151,8 +151,8 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
// Pick a port number // Pick a port number
const int port = Utilities::PickUnusedPort(); const int port = Utilities::PickUnusedPort();
g_object_set(G_OBJECT(src), "host", "127.0.0.1", NULL); g_object_set(G_OBJECT(src), "host", "127.0.0.1", nullptr);
g_object_set(G_OBJECT(src), "port", port, NULL); g_object_set(G_OBJECT(src), "port", port, nullptr);
// Link the elements // Link the elements
gst_element_link(src, gdp); gst_element_link(src, gdp);
@ -166,7 +166,7 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
InternetModel::Service<SpotifyService>()->server()->StartPlaybackLater(url.toString(), port); InternetModel::Service<SpotifyService>()->server()->StartPlaybackLater(url.toString(), port);
} else { } else {
new_bin = engine_->CreateElement("uridecodebin"); 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), "drained", &SourceDrainedCallback, this);
CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this); CHECKED_GCONNECT(G_OBJECT(new_bin), "pad-added", &NewPadCallback, this);
CHECKED_GCONNECT(G_OBJECT(new_bin), "notify::source", &SourceSetupCallback, 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) { GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) {
GError* error = NULL; GError* error = nullptr;
GstElement* bin = gst_parse_bin_from_description(pipeline, TRUE, &error); GstElement* bin = gst_parse_bin_from_description(pipeline, TRUE, &error);
if (error) { if (error) {
@ -188,7 +188,7 @@ GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) {
qLog(Warning) << message; qLog(Warning) << message;
emit Error(id(), message, domain, code); emit Error(id(), message, domain, code);
return NULL; return nullptr;
} else { } else {
return bin; return bin;
} }
@ -222,7 +222,7 @@ bool GstEnginePipeline::Init() {
return false; return false;
if (GstEngine::DoesThisSinkSupportChangingTheOutputDeviceToAUserEditableString(sink_) && !device_.isEmpty()) 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 // Create all the other elements
GstElement *tee, *probe_queue, *probe_converter, *probe_sink, *audio_queue, GstElement *tee, *probe_queue, *probe_converter, *probe_sink, *audio_queue,
@ -269,9 +269,9 @@ bool GstEnginePipeline::Init() {
} }
// Set replaygain settings // Set replaygain settings
g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, NULL); g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr);
g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), NULL); g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr);
g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), NULL); 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 // 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); gst_object_unref(pad);
// Configure the fakesink properly // 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 // 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; int last_band_frequency = 0;
for (int i=0 ; i<kEqBandCount ; ++i) { for (int i=0 ; i<kEqBandCount ; ++i) {
@ -303,25 +303,25 @@ bool GstEnginePipeline::Init() {
g_object_set(G_OBJECT(band), "freq", frequency, g_object_set(G_OBJECT(band), "freq", frequency,
"bandwidth", bandwidth, "bandwidth", bandwidth,
"gain", 0.0f, NULL); "gain", 0.0f, nullptr);
g_object_unref(G_OBJECT(band)); g_object_unref(G_OBJECT(band));
} }
// Set the stereo balance. // Set the stereo balance.
g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, NULL); g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr);
// Set the buffer duration. We set this on this queue instead of the // Set the buffer duration. We set this on this queue instead of the
// decode bin (in ReplaceDecodeBin()) because setting it on the decode bin // decode bin (in ReplaceDecodeBin()) because setting it on the decode bin
// only affects network sources. // only affects network sources.
// Disable the default buffer and byte limits, so we only buffer based on // Disable the default buffer and byte limits, so we only buffer based on
// time. // time.
g_object_set(G_OBJECT(queue_), "max-size-buffers", 0, NULL); g_object_set(G_OBJECT(queue_), "max-size-buffers", 0, nullptr);
g_object_set(G_OBJECT(queue_), "max-size-bytes", 0, NULL); g_object_set(G_OBJECT(queue_), "max-size-bytes", 0, nullptr);
g_object_set(G_OBJECT(queue_), "max-size-time", buffer_duration_nanosec_, NULL); g_object_set(G_OBJECT(queue_), "max-size-time", buffer_duration_nanosec_, nullptr);
g_object_set(G_OBJECT(queue_), "low-percent", 1, NULL); g_object_set(G_OBJECT(queue_), "low-percent", 1, nullptr);
if (buffer_duration_nanosec_ > 0) { if (buffer_duration_nanosec_ > 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_); gst_element_link(queue_, audioconvert_);
@ -331,12 +331,12 @@ bool GstEnginePipeline::Init() {
GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw-int", GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw-int",
"width", G_TYPE_INT, 16, "width", G_TYPE_INT, 16,
"signed", G_TYPE_BOOLEAN, true, "signed", G_TYPE_BOOLEAN, true,
NULL); nullptr);
GstCaps* caps32 = gst_caps_new_simple ("audio/x-raw-float", GstCaps* caps32 = gst_caps_new_simple ("audio/x-raw-float",
"width", G_TYPE_INT, 32, "width", G_TYPE_INT, 32,
NULL); nullptr);
if (mono_playback_) { 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 // Link the elements with special caps
@ -351,13 +351,13 @@ bool GstEnginePipeline::Init() {
// Link replaygain elements if enabled. // Link replaygain elements if enabled.
if (rg_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. // Link everything else.
gst_element_link(probe_queue, probe_converter); gst_element_link(probe_queue, probe_converter);
gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, 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. // Add probes and handlers.
gst_pad_add_buffer_probe(gst_element_get_static_pad(probe_converter, "src"), G_CALLBACK(HandoffCallback), this); 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() { GstEnginePipeline::~GstEnginePipeline() {
if (pipeline_) { 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_); g_source_remove(bus_cb_id_);
gst_element_set_state(pipeline_, GST_STATE_NULL); gst_element_set_state(pipeline_, GST_STATE_NULL);
gst_object_unref(GST_OBJECT(pipeline_)); gst_object_unref(GST_OBJECT(pipeline_));
@ -509,7 +510,7 @@ void GstEnginePipeline::StreamStatusMessageReceived(GstMessage* msg) {
memset(&callbacks, 0, sizeof(callbacks)); memset(&callbacks, 0, sizeof(callbacks));
callbacks.enter_thread = TaskEnterCallback; 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) { void GstEnginePipeline::TagMessageReceived(GstMessage* msg) {
GstTagList* taglist = NULL; GstTagList* taglist = nullptr;
gst_message_parse_tag(msg, &taglist); gst_message_parse_tag(msg, &taglist);
Engine::SimpleMetaBundle bundle; Engine::SimpleMetaBundle bundle;
@ -585,7 +586,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage* msg) {
} }
QString GstEnginePipeline::ParseTag(GstTagList* list, const char* tag) const { 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); bool success = gst_tag_list_get_string(list, tag, &data);
QString ret; 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 // The segment start time is used to calculate the proper offset of data
// buffers from the start of the stream // buffers from the start of the stream
gint64 start = 0; 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_ = start;
instance->segment_start_received_ = true; 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) { void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *pspec, gpointer self) {
GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(self); GstEnginePipeline* instance = reinterpret_cast<GstEnginePipeline*>(self);
GstElement* element; GstElement* element;
g_object_get(bin, "source", &element, NULL); g_object_get(bin, "source", &element, nullptr);
if (!element) { if (!element) {
return; return;
} }
@ -772,7 +774,7 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps
// documentation, this might be added in the future). Despite that, for now // 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 // we include device inside URL: we decompose it during Init and set device
// here, when this callback is called. // 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") && if (g_object_class_find_property(G_OBJECT_GET_CLASS(element), "extra-headers") &&
instance->url().host().contains("grooveshark")) { 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 // Maybe it could be usefull in some other cases, but for now, I prefer to
// keep this grooveshark specific. // keep this grooveshark specific.
GstStructure* headers; GstStructure* headers;
headers = gst_structure_new("extra-headers", "Range", G_TYPE_STRING, "bytes=0-", NULL); headers = gst_structure_new("extra-headers", "Range", G_TYPE_STRING, "bytes=0-", nullptr);
g_object_set(element, "extra-headers", headers, NULL); g_object_set(element, "extra-headers", headers, nullptr);
gst_structure_free(headers); gst_structure_free(headers);
} }
@ -794,8 +796,8 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps
"Authorization", "Authorization",
G_TYPE_STRING, G_TYPE_STRING,
instance->url().fragment().toAscii().data(), instance->url().fragment().toAscii().data(),
NULL); nullptr);
g_object_set(element, "extra-headers", headers, NULL); g_object_set(element, "extra-headers", headers, nullptr);
gst_structure_free(headers); gst_structure_free(headers);
} }
@ -803,7 +805,7 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps
QString user_agent = QString("%1 %2").arg( QString user_agent = QString("%1 %2").arg(
QCoreApplication::applicationName(), QCoreApplication::applicationName(),
QCoreApplication::applicationVersion()); 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; gain *= 0.12;
GstObject* band = gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), i); 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)); g_object_unref(G_OBJECT(band));
} }
@ -915,12 +917,12 @@ void GstEnginePipeline::UpdateEqualizer() {
if (eq_enabled_) if (eq_enabled_)
preamp = float(eq_preamp_ + 100) * 0.01; // To scale from 0.0 to 2.0 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() { void GstEnginePipeline::UpdateStereoBalance() {
if (stereo_panorama_) { 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() { void GstEnginePipeline::UpdateVolume() {
float vol = double(volume_percent_) * 0.01 * volume_modifier_; 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, void GstEnginePipeline::StartFader(qint64 duration_nanosec,

View File

@ -254,7 +254,7 @@ void GlobalSearch::AlbumArtLoaded(quint64 id, const QImage& image) {
return; return;
int orig_id = cover_loader_tasks_.take(id); 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) { 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 // possible to combine different providers. Just take the results from a
// single provider. // single provider.
if (results.isEmpty()) { if (results.isEmpty()) {
return NULL; return nullptr;
} }
SearchProvider* first_provider = results[0].provider_; SearchProvider* first_provider = results[0].provider_;

View File

@ -24,7 +24,7 @@
GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent) GlobalSearchModel::GlobalSearchModel(GlobalSearch* engine, QObject* parent)
: QStandardItemModel(parent), : QStandardItemModel(parent),
engine_(engine), engine_(engine),
proxy_(NULL), proxy_(nullptr),
use_pretty_covers_(true), use_pretty_covers_(true),
artist_icon_(":/icons/22x22/x-clementine-artist.png"), artist_icon_(":/icons/22x22/x-clementine-artist.png"),
album_icon_(":/icons/22x22/x-clementine-album.png") album_icon_(":/icons/22x22/x-clementine-album.png")

View File

@ -52,7 +52,7 @@ GlobalSearchView::GlobalSearchView(Application* app, QWidget* parent)
app_(app), app_(app),
engine_(app_->global_search()), engine_(app_->global_search()),
ui_(new Ui_GlobalSearchView), ui_(new Ui_GlobalSearchView),
context_menu_(NULL), context_menu_(nullptr),
last_search_id_(0), last_search_id_(0),
front_model_(new GlobalSearchModel(engine_, this)), front_model_(new GlobalSearchModel(engine_, this)),
back_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() { MimeData* GlobalSearchView::SelectedMimeData() {
if (!ui_->results->selectionModel()) if (!ui_->results->selectionModel())
return NULL; return nullptr;
// Get all selected model indexes // Get all selected model indexes
QModelIndexList indexes = ui_->results->selectionModel()->selectedRows(); QModelIndexList indexes = ui_->results->selectionModel()->selectedRows();
@ -377,7 +377,7 @@ MimeData* GlobalSearchView::SelectedMimeData() {
// Still got nothing? Give up. // Still got nothing? Give up.
if (indexes.isEmpty()) { if (indexes.isEmpty()) {
return NULL; return nullptr;
} }
// Get items for these indexes // Get items for these indexes

View File

@ -26,7 +26,7 @@
GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, QObject* parent) GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, QObject* parent)
: SearchProvider(app, parent), : SearchProvider(app, parent),
service_(NULL) service_(nullptr)
{ {
} }

View File

@ -126,7 +126,7 @@ void SearchProvider::LoadArtAsync(int id, const Result& result) {
} }
MimeData* SearchProvider::LoadTracks(const ResultList& results) { MimeData* SearchProvider::LoadTracks(const ResultList& results) {
MimeData* mime_data = NULL; MimeData* mime_data = nullptr;
if (mime_data_contains_urls_only()) { if (mime_data_contains_urls_only()) {
mime_data = new MimeData; mime_data = new MimeData;

View File

@ -26,7 +26,7 @@
SoundCloudSearchProvider::SoundCloudSearchProvider(Application* app, QObject* parent) SoundCloudSearchProvider::SoundCloudSearchProvider(Application* app, QObject* parent)
: SearchProvider(app, parent), : SearchProvider(app, parent),
service_(NULL) service_(nullptr)
{ {
} }

View File

@ -33,8 +33,8 @@ const int kSearchAlbumLimit = 20;
SpotifySearchProvider::SpotifySearchProvider(Application* app, QObject* parent) SpotifySearchProvider::SpotifySearchProvider(Application* app, QObject* parent)
: SearchProvider(app, parent), : SearchProvider(app, parent),
server_(NULL), server_(nullptr),
service_(NULL) service_(nullptr)
{ {
Init("Spotify", "spotify", QIcon(":icons/32x32/spotify.png"), Init("Spotify", "spotify", QIcon(":icons/32x32/spotify.png"),
WantsDelayedQueries | WantsSerialisedArtQueries | ArtIsProbablyRemote | WantsDelayedQueries | WantsSerialisedArtQueries | ArtIsProbablyRemote |
@ -49,7 +49,7 @@ SpotifyServer* SpotifySearchProvider::server() {
service_ = InternetModel::Service<SpotifyService>(); service_ = InternetModel::Service<SpotifyService>();
if (service_->login_state() != SpotifyService::LoginState_LoggedIn) if (service_->login_state() != SpotifyService::LoginState_LoggedIn)
return NULL; return nullptr;
server_ = service_->server(); server_ = service_->server();
connect(server_, SIGNAL(SearchResults(pb::spotify::SearchResponse)), connect(server_, SIGNAL(SearchResults(pb::spotify::SearchResponse)),
@ -66,7 +66,7 @@ SpotifyServer* SpotifySearchProvider::server() {
} }
void SpotifySearchProvider::ServerDestroyed() { void SpotifySearchProvider::ServerDestroyed() {
server_ = NULL; server_ = nullptr;
} }
void SpotifySearchProvider::SearchAsync(int id, const QString& query) { void SpotifySearchProvider::SearchAsync(int id, const QString& query) {

View File

@ -25,7 +25,7 @@ CloudFileService::CloudFileService(
const QIcon& icon, const QIcon& icon,
SettingsDialog::Page settings_page) SettingsDialog::Page settings_page)
: InternetService(service_name, app, parent, parent), : InternetService(service_name, app, parent, parent),
root_(NULL), root_(nullptr),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
library_sort_model_(new QSortFilterProxyModel(this)), library_sort_model_(new QSortFilterProxyModel(this)),
playlist_manager_(app->playlist_manager()), playlist_manager_(app->playlist_manager()),

View File

@ -56,7 +56,7 @@ DigitallyImportedServiceBase::DigitallyImportedServiceBase(
url_handler_(new DigitallyImportedUrlHandler(app, this)), url_handler_(new DigitallyImportedUrlHandler(app, this)),
basic_audio_type_(1), basic_audio_type_(1),
premium_audio_type_(2), premium_audio_type_(2),
root_(NULL), root_(nullptr),
saved_channels_(kSettingsGroup, api_service_name, kStreamsCacheDurationSecs), saved_channels_(kSettingsGroup, api_service_name, kStreamsCacheDurationSecs),
api_client_(new DigitallyImportedClient(api_service_name, this)) api_client_(new DigitallyImportedClient(api_service_name, this))
{ {

View File

@ -79,7 +79,7 @@ void DigitallyImportedUrlHandler::LoadPlaylistFinished(QIODevice* device) {
CancelTask(); CancelTask();
// Try to parse the playlist // Try to parse the playlist
PlaylistParser parser(NULL); PlaylistParser parser(nullptr);
QList<Song> songs = parser.LoadFromDevice(device); QList<Song> songs = parser.LoadFromDevice(device);
qLog(Info) << "Loading station finished, got" << songs.count() << "songs"; qLog(Info) << "Loading station finished, got" << songs.count() << "songs";

View File

@ -133,7 +133,7 @@ QByteArray DropboxAuthenticator::GenerateAuthorisationHeader(
QList<Param> params; QList<Param> params;
params << Param("oauth_consumer_key", kAppKey) params << Param("oauth_consumer_key", kAppKey)
<< Param("oauth_signature_method", "PLAINTEXT") << 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_nonce", QString::number(qrand()))
<< Param("oauth_signature", signature); << Param("oauth_signature", signature);
if (!token.isNull()) { if (!token.isNull()) {

View File

@ -87,29 +87,29 @@ GroovesharkService::GroovesharkService(Application* app, InternetModel *parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
url_handler_(new GroovesharkUrlHandler(this, this)), url_handler_(new GroovesharkUrlHandler(this, this)),
next_pending_search_id_(0), next_pending_search_id_(0),
root_(NULL), root_(nullptr),
search_(NULL), search_(nullptr),
popular_month_(NULL), popular_month_(nullptr),
popular_today_(NULL), popular_today_(nullptr),
stations_(NULL), stations_(nullptr),
grooveshark_radio_(NULL), grooveshark_radio_(nullptr),
favorites_(NULL), favorites_(nullptr),
library_(NULL), library_(nullptr),
playlists_parent_(NULL), playlists_parent_(nullptr),
subscribed_playlists_parent_(NULL), subscribed_playlists_parent_(nullptr),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
context_menu_(NULL), context_menu_(nullptr),
create_playlist_(NULL), create_playlist_(nullptr),
delete_playlist_(NULL), delete_playlist_(nullptr),
rename_playlist_(NULL), rename_playlist_(nullptr),
remove_from_playlist_(NULL), remove_from_playlist_(nullptr),
remove_from_favorites_(NULL), remove_from_favorites_(nullptr),
remove_from_library_(NULL), remove_from_library_(nullptr),
get_url_to_share_song_(NULL), get_url_to_share_song_(nullptr),
get_url_to_share_playlist_(NULL), get_url_to_share_playlist_(nullptr),
search_box_(new SearchBoxWidget(this)), search_box_(new SearchBoxWidget(this)),
search_delay_(new QTimer(this)), search_delay_(new QTimer(this)),
last_search_reply_(NULL), last_search_reply_(nullptr),
api_key_(QByteArray::fromBase64(kApiSecret)), api_key_(QByteArray::fromBase64(kApiSecret)),
login_state_(LoginState_OtherError), login_state_(LoginState_OtherError),
task_popular_id_(0), task_popular_id_(0),
@ -170,7 +170,7 @@ void GroovesharkService::ShowConfig() {
QWidget* GroovesharkService::HeaderWidget() const { QWidget* GroovesharkService::HeaderWidget() const {
if (IsLoggedIn()) if (IsLoggedIn())
return search_box_; return search_box_;
return NULL; return nullptr;
} }
void GroovesharkService::Search(const QString& text, bool now) { void GroovesharkService::Search(const QString& text, bool now) {
@ -405,7 +405,7 @@ void GroovesharkService::Authenticated(QNetworkReply* reply) {
login_state_ = LoginState_NoPremium; login_state_ = LoginState_NoPremium;
} }
if (!error.isEmpty()) { if (!error.isEmpty()) {
QMessageBox::warning(NULL, tr("Grooveshark login error"), error, QMessageBox::Close); QMessageBox::warning(nullptr, tr("Grooveshark login error"), error, QMessageBox::Close);
ResetSessionId(); ResetSessionId();
emit LoginFinished(false); emit LoginFinished(false);
return; return;
@ -430,17 +430,17 @@ void GroovesharkService::RemoveItems() {
root_->removeRows(0, root_->rowCount()); root_->removeRows(0, root_->rowCount());
// 'search', 'favorites', 'popular', ... items were root's children, and have // 'search', 'favorites', 'popular', ... items were root's children, and have
// been deleted: we should update these now invalid pointers // been deleted: we should update these now invalid pointers
search_ = NULL; search_ = nullptr;
popular_month_ = NULL; popular_month_ = nullptr;
popular_today_ = NULL; popular_today_ = nullptr;
library_ = NULL; library_ = nullptr;
favorites_ = NULL; favorites_ = nullptr;
subscribed_playlists_parent_ = NULL; subscribed_playlists_parent_ = nullptr;
stations_ = NULL; stations_ = nullptr;
grooveshark_radio_ = NULL; grooveshark_radio_ = nullptr;
playlists_parent_ = NULL; playlists_parent_ = nullptr;
playlists_.clear(); playlists_.clear();
subscribed_playlists_parent_ = NULL; subscribed_playlists_parent_ = nullptr;
subscribed_playlists_.clear(); subscribed_playlists_.clear();
pending_retrieve_playlists_.clear(); pending_retrieve_playlists_.clear();
} }
@ -1014,7 +1014,7 @@ GeneratorPtr GroovesharkService::CreateGenerator(QStandardItem* item) {
if (item == grooveshark_radio_) { if (item == grooveshark_radio_) {
if (last_artists_ids_.isEmpty()) { 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")); tr("To start Grooveshark radio, you should first listen to a few other Grooveshark songs"));
return ret; return ret;
} }
@ -1240,7 +1240,7 @@ void GroovesharkService::RefreshPlaylist(int playlist_id) {
} }
void GroovesharkService::CreateNewPlaylist() { void GroovesharkService::CreateNewPlaylist() {
QString name = QInputDialog::getText(NULL, QString name = QInputDialog::getText(nullptr,
tr("Create a new Grooveshark playlist"), tr("Create a new Grooveshark playlist"),
tr("Name"), tr("Name"),
QLineEdit::Normal); QLineEdit::Normal);
@ -1333,7 +1333,7 @@ void GroovesharkService::RenamePlaylist(int playlist_id) {
return; return;
} }
const QString& old_name = playlists_[playlist_id].name_; 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("Rename \"%1\" playlist").arg(old_name),
tr("Name"), tr("Name"),
QLineEdit::Normal, QLineEdit::Normal,

View File

@ -200,7 +200,7 @@ QStringList IcecastModel::mimeTypes() const {
QMimeData* IcecastModel::mimeData(const QModelIndexList& indexes) const { QMimeData* IcecastModel::mimeData(const QModelIndexList& indexes) const {
if (indexes.isEmpty()) if (indexes.isEmpty())
return NULL; return nullptr;
SongMimeData* data = new SongMimeData; SongMimeData* data = new SongMimeData;
QList<QUrl> urls; QList<QUrl> urls;
@ -216,7 +216,7 @@ QMimeData* IcecastModel::mimeData(const QModelIndexList& indexes) const {
if (data->songs.isEmpty()) { if (data->songs.isEmpty()) {
delete data; delete data;
return NULL; return nullptr;
} }
data->setUrls(urls); data->setUrls(urls);

View File

@ -52,9 +52,9 @@ const char* IcecastService::kHomepage = "http://dir.xiph.org/";
IcecastService::IcecastService(Application* app, InternetModel* parent) IcecastService::IcecastService(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
context_menu_(NULL), context_menu_(nullptr),
backend_(NULL), backend_(nullptr),
model_(NULL), model_(nullptr),
filter_(new IcecastFilterWidget(0)), filter_(new IcecastFilterWidget(0)),
load_directory_task_id_(0) load_directory_task_id_(0)
{ {

View File

@ -61,7 +61,7 @@ using smart_playlists::Generator;
using smart_playlists::GeneratorMimeData; using smart_playlists::GeneratorMimeData;
using smart_playlists::GeneratorPtr; using smart_playlists::GeneratorPtr;
QMap<QString, InternetService*>* InternetModel::sServices = NULL; QMap<QString, InternetService*>* InternetModel::sServices = nullptr;
InternetModel::InternetModel(Application* app, QObject* parent) InternetModel::InternetModel(Application* app, QObject* parent)
: QStandardItemModel(parent), : QStandardItemModel(parent),
@ -162,7 +162,7 @@ void InternetModel::ServiceDeleted() {
InternetService* InternetModel::ServiceByName(const QString& name) { InternetService* InternetModel::ServiceByName(const QString& name) {
if (sServices->contains(name)) if (sServices->contains(name))
return sServices->value(name); return sServices->value(name);
return NULL; return nullptr;
} }
InternetService* InternetModel::ServiceForItem(const QStandardItem* item) const { InternetService* InternetModel::ServiceForItem(const QStandardItem* item) const {
@ -178,7 +178,7 @@ InternetService* InternetModel::ServiceForIndex(const QModelIndex& index) const
} }
current_index = current_index.parent(); current_index = current_index.parent();
} }
return NULL; return nullptr;
} }
Qt::ItemFlags InternetModel::flags(const QModelIndex& index) const { 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() == indexes[0].data(Role_PlayBehaviour).toInt() ==
PlayBehaviour_DoubleClickAction) { PlayBehaviour_DoubleClickAction) {
InternetModel::ServiceForIndex(indexes[0])->ItemDoubleClicked(itemFromIndex(indexes[0])); InternetModel::ServiceForIndex(indexes[0])->ItemDoubleClicked(itemFromIndex(indexes[0]));
return NULL; return nullptr;
} }
if (indexes.count() == 1 && if (indexes.count() == 1 &&
@ -238,7 +238,7 @@ QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const {
GeneratorPtr generator = GeneratorPtr generator =
InternetModel::ServiceForIndex(indexes[0])->CreateGenerator(itemFromIndex(indexes[0])); InternetModel::ServiceForIndex(indexes[0])->CreateGenerator(itemFromIndex(indexes[0]));
if (!generator) if (!generator)
return NULL; return nullptr;
GeneratorMimeData* data = new GeneratorMimeData(generator); GeneratorMimeData* data = new GeneratorMimeData(generator);
data->setData(LibraryModel::kSmartPlaylistsMimeType, QByteArray()); data->setData(LibraryModel::kSmartPlaylistsMimeType, QByteArray());
data->name_for_new_playlist_ = this->data(indexes.first()).toString(); data->name_for_new_playlist_ = this->data(indexes.first()).toString();
@ -271,7 +271,7 @@ QMimeData* InternetModel::mimeData(const QModelIndexList& indexes) const {
} }
if (urls.isEmpty()) if (urls.isEmpty())
return NULL; return nullptr;
InternetMimeData* data = new InternetMimeData(this); InternetMimeData* data = new InternetMimeData(this);
data->setUrls(urls); data->setUrls(urls);

View File

@ -31,10 +31,10 @@ InternetService::InternetService(const QString& name, Application* app,
app_(app), app_(app),
model_(model), model_(model),
name_(name), name_(name),
append_to_playlist_(NULL), append_to_playlist_(nullptr),
replace_playlist_(NULL), replace_playlist_(nullptr),
open_in_new_playlist_(NULL), open_in_new_playlist_(nullptr),
separator_(NULL) separator_(nullptr)
{ {
} }

View File

@ -32,9 +32,9 @@ const int InternetViewContainer::kAnimationDuration = 500;
InternetViewContainer::InternetViewContainer(QWidget *parent) InternetViewContainer::InternetViewContainer(QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui_(new Ui_InternetViewContainer), ui_(new Ui_InternetViewContainer),
app_(NULL), app_(nullptr),
current_service_(NULL), current_service_(nullptr),
current_header_(NULL) current_header_(nullptr)
{ {
ui_->setupUi(this); 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() if (app_->internet_model()->merged_model()->mapToSource(index).model() == app_->internet_model()
&& index.data(InternetModel::Role_Type) == InternetModel::Type_Service) { && index.data(InternetModel::Role_Type) == InternetModel::Type_Service) {
SetHeaderVisible(current_header_, false); SetHeaderVisible(current_header_, false);
current_service_ = NULL; current_service_ = nullptr;
current_header_ = NULL; current_header_ = nullptr;
} }
} }
@ -133,7 +133,7 @@ void InternetViewContainer::FocusOnFilter(QKeyEvent* event) {
void InternetViewContainer::SetHeaderHeight(int height) { void InternetViewContainer::SetHeaderHeight(int height) {
QTimeLine* animation = qobject_cast<QTimeLine*>(sender()); QTimeLine* animation = qobject_cast<QTimeLine*>(sender());
QWidget* header = NULL; QWidget* header = nullptr;
foreach (QWidget* h, headers_.keys()) { foreach (QWidget* h, headers_.keys()) {
if (headers_[h].animation_ == animation) { if (headers_[h].animation_ == animation) {
header = h; header = h;

View File

@ -73,12 +73,12 @@ const int JamendoService::kApproxDatabaseSize = 300000;
JamendoService::JamendoService(Application* app, InternetModel* parent) JamendoService::JamendoService(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
context_menu_(NULL), context_menu_(nullptr),
library_backend_(NULL), library_backend_(nullptr),
library_filter_(NULL), library_filter_(nullptr),
library_model_(NULL), library_model_(nullptr),
library_sort_model_(new QSortFilterProxyModel(this)), library_sort_model_(new QSortFilterProxyModel(this)),
search_provider_(NULL), search_provider_(nullptr),
load_database_task_id_(0), load_database_task_id_(0),
total_song_count_(0), total_song_count_(0),
accepted_download_(false) { accepted_download_(false) {

View File

@ -86,19 +86,19 @@ const int LastFMService::kFriendsCacheDurationSecs = 60 * 60 * 24; // 1 day
LastFMService::LastFMService(Application* app, InternetModel* parent) LastFMService::LastFMService(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
url_handler_(new LastFMUrlHandler(this, this)), url_handler_(new LastFMUrlHandler(this, this)),
scrobbler_(NULL), scrobbler_(nullptr),
already_scrobbled_(false), already_scrobbled_(false),
station_dialog_(new LastFMStationDialog), station_dialog_(new LastFMStationDialog),
context_menu_(new QMenu), context_menu_(new QMenu),
initial_tune_(false), initial_tune_(false),
tune_task_id_(0), tune_task_id_(0),
scrobbling_enabled_(false), scrobbling_enabled_(false),
root_item_(NULL), root_item_(nullptr),
artist_list_(NULL), artist_list_(nullptr),
tag_list_(NULL), tag_list_(nullptr),
custom_list_(NULL), custom_list_(nullptr),
friends_list_(NULL), friends_list_(nullptr),
neighbours_list_(NULL), neighbours_list_(nullptr),
friend_names_(kSettingsGroup, "friend_names", kFriendsCacheDurationSecs), friend_names_(kSettingsGroup, "friend_names", kFriendsCacheDurationSecs),
connection_problems_(false) connection_problems_(false)
{ {
@ -330,7 +330,7 @@ void LastFMService::AuthenticateReplyFinished(QNetworkReply* reply) {
// Invalidate the scrobbler - it will get recreated later // Invalidate the scrobbler - it will get recreated later
delete scrobbler_; delete scrobbler_;
scrobbler_ = NULL; scrobbler_ = nullptr;
emit AuthenticationComplete(true, QString()); emit AuthenticationComplete(true, QString());
} }

View File

@ -44,7 +44,7 @@ MagnatuneDownloadDialog::MagnatuneDownloadDialog(MagnatuneService* service,
ui_(new Ui_MagnatuneDownloadDialog), ui_(new Ui_MagnatuneDownloadDialog),
service_(service), service_(service),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
current_reply_(NULL), current_reply_(nullptr),
next_row_(0) next_row_(0)
{ {
ui_->setupUi(this); ui_->setupUi(this);
@ -230,7 +230,7 @@ void MagnatuneDownloadDialog::ShowError(const QString &message) {
} }
void MagnatuneDownloadDialog::AllFinished(bool error) { void MagnatuneDownloadDialog::AllFinished(bool error) {
current_reply_ = NULL; current_reply_ = nullptr;
if (error) if (error)
ui_->button_box->button(QDialogButtonBox::Ok)->show(); ui_->button_box->button(QDialogButtonBox::Ok)->show();

View File

@ -67,11 +67,11 @@ const char* MagnatuneService::kDownloadUrl = "http://download.magnatune.com/buy/
MagnatuneService::MagnatuneService(Application* app, InternetModel* parent) MagnatuneService::MagnatuneService(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
url_handler_(new MagnatuneUrlHandler(this, this)), url_handler_(new MagnatuneUrlHandler(this, this)),
context_menu_(NULL), context_menu_(nullptr),
root_(NULL), root_(nullptr),
library_backend_(NULL), library_backend_(nullptr),
library_model_(NULL), library_model_(nullptr),
library_filter_(NULL), library_filter_(nullptr),
library_sort_model_(new QSortFilterProxyModel(this)), library_sort_model_(new QSortFilterProxyModel(this)),
load_database_task_id_(0), load_database_task_id_(0),
membership_(Membership_None), membership_(Membership_None),

View File

@ -32,8 +32,8 @@ const char* SavedRadio::kSettingsGroup = "SavedRadio";
SavedRadio::SavedRadio(Application* app, InternetModel* parent) SavedRadio::SavedRadio(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
context_menu_(NULL), context_menu_(nullptr),
root_(NULL) root_(nullptr)
{ {
LoadStreams(); LoadStreams();

View File

@ -56,8 +56,8 @@ SomaFMServiceBase::SomaFMServiceBase(
: InternetService(name, app, parent, parent), : InternetService(name, app, parent, parent),
url_scheme_(name.toLower().remove(' ')), url_scheme_(name.toLower().remove(' ')),
url_handler_(new SomaFMUrlHandler(app, this, this)), url_handler_(new SomaFMUrlHandler(app, this, this)),
root_(NULL), root_(nullptr),
context_menu_(NULL), context_menu_(nullptr),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
streams_(name, "streams", kStreamsCacheDurationSecs), streams_(name, "streams", kStreamsCacheDurationSecs),
name_(name), name_(name),

View File

@ -76,7 +76,7 @@ void SomaFMUrlHandler::LoadPlaylistFinished() {
} }
// Parse the playlist // Parse the playlist
PlaylistParser parser(NULL); PlaylistParser parser(nullptr);
QList<Song> songs = parser.LoadFromDevice(reply); QList<Song> songs = parser.LoadFromDevice(reply);
qLog(Info) << "Loading station finished, got" << songs.count() << "songs"; qLog(Info) << "Loading station finished, got" << songs.count() << "songs";

View File

@ -57,10 +57,10 @@ typedef QPair<QString, QString> Param;
SoundCloudService::SoundCloudService(Application* app, InternetModel *parent) SoundCloudService::SoundCloudService(Application* app, InternetModel *parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
root_(NULL), root_(nullptr),
search_(NULL), search_(nullptr),
network_(new NetworkAccessManager(this)), network_(new NetworkAccessManager(this)),
context_menu_(NULL), context_menu_(nullptr),
search_box_(new SearchBoxWidget(this)), search_box_(new SearchBoxWidget(this)),
search_delay_(new QTimer(this)), search_delay_(new QTimer(this)),
next_pending_search_id_(0) { next_pending_search_id_(0) {

View File

@ -55,7 +55,7 @@ SpotifyBlobDownloader::~SpotifyBlobDownloader() {
} }
bool SpotifyBlobDownloader::Prompt() { bool SpotifyBlobDownloader::Prompt() {
QMessageBox::StandardButton ret = QMessageBox::question(NULL, QMessageBox::StandardButton ret = QMessageBox::question(nullptr,
tr("Spotify plugin not installed"), 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?"), 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); QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
@ -212,7 +212,7 @@ void SpotifyBlobDownloader::ShowError(const QString& message) {
} }
qLog(Warning) << message; qLog(Warning) << message;
QMessageBox::warning(NULL, tr("Error downloading Spotify plugin"), message, QMessageBox::warning(nullptr, tr("Error downloading Spotify plugin"), message,
QMessageBox::Close); QMessageBox::Close);
deleteLater(); deleteLater();
} }

View File

@ -26,7 +26,7 @@
#include <QTimer> #include <QTimer>
SpotifyServer::SpotifyServer(QObject* parent) SpotifyServer::SpotifyServer(QObject* parent)
: AbstractMessageHandler<pb::spotify::Message>(NULL, parent), : AbstractMessageHandler<pb::spotify::Message>(nullptr, parent),
server_(new QTcpServer(this)), server_(new QTcpServer(this)),
logged_in_(false) logged_in_(false)
{ {

View File

@ -43,15 +43,15 @@ const int SpotifyService::kSearchDelayMsec = 400;
SpotifyService::SpotifyService(Application* app, InternetModel* parent) SpotifyService::SpotifyService(Application* app, InternetModel* parent)
: InternetService(kServiceName, app, parent, parent), : InternetService(kServiceName, app, parent, parent),
server_(NULL), server_(nullptr),
blob_process_(NULL), blob_process_(nullptr),
root_(NULL), root_(nullptr),
search_(NULL), search_(nullptr),
starred_(NULL), starred_(nullptr),
inbox_(NULL), inbox_(nullptr),
toplist_(NULL), toplist_(nullptr),
login_task_id_(0), login_task_id_(0),
context_menu_(NULL), context_menu_(nullptr),
search_box_(new SearchBoxWidget(this)), search_box_(new SearchBoxWidget(this)),
search_delay_(new QTimer(this)), search_delay_(new QTimer(this)),
login_state_(LoginState_OtherError), login_state_(LoginState_OtherError),
@ -181,7 +181,7 @@ void SpotifyService::LoginCompleted(bool success, const QString& error,
} }
if (show_error_dialog) { 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 { } else {
login_state_ = LoginState_LoggedIn; login_state_ = LoginState_LoggedIn;
@ -197,7 +197,7 @@ void SpotifyService::LoginCompleted(bool success, const QString& error,
void SpotifyService::BlobProcessError(QProcess::ProcessError error) { void SpotifyService::BlobProcessError(QProcess::ProcessError error) {
qLog(Error) << "Spotify blob process failed:" << error; qLog(Error) << "Spotify blob process failed:" << error;
blob_process_->deleteLater(); blob_process_->deleteLater();
blob_process_ = NULL; blob_process_ = nullptr;
if (login_task_id_) { if (login_task_id_) {
app_->task_manager()->SetTaskFinished(login_task_id_); app_->task_manager()->SetTaskFinished(login_task_id_);
@ -449,7 +449,7 @@ QStandardItem* SpotifyService::PlaylistBySpotifyIndex(int index) const {
return item; return item;
} }
} }
return NULL; return nullptr;
} }
void SpotifyService::UserPlaylistLoaded(const pb::spotify::LoadPlaylistResponse& response) { void SpotifyService::UserPlaylistLoaded(const pb::spotify::LoadPlaylistResponse& response) {
@ -515,7 +515,7 @@ PlaylistItem::Options SpotifyService::playlistitem_options() const {
QWidget* SpotifyService::HeaderWidget() const { QWidget* SpotifyService::HeaderWidget() const {
if (IsLoggedIn()) if (IsLoggedIn())
return search_box_; return search_box_;
return NULL; return nullptr;
} }
void SpotifyService::EnsureMenuCreated() { void SpotifyService::EnsureMenuCreated() {
@ -719,8 +719,8 @@ void SpotifyService::ShowConfig() {
void SpotifyService::Logout() { void SpotifyService::Logout() {
delete server_; delete server_;
delete blob_process_; delete blob_process_;
server_ = NULL; server_ = nullptr;
blob_process_ = NULL; blob_process_ = nullptr;
login_state_ = LoginState_OtherError; login_state_ = LoginState_OtherError;

View File

@ -41,11 +41,11 @@ SubsonicService::SubsonicService(Application* app, InternetModel* parent)
url_handler_(new SubsonicUrlHandler(this, this)), url_handler_(new SubsonicUrlHandler(this, this)),
scanner_(new SubsonicLibraryScanner(this, this)), scanner_(new SubsonicLibraryScanner(this, this)),
load_database_task_id_(0), load_database_task_id_(0),
context_menu_(NULL), context_menu_(nullptr),
root_(NULL), root_(nullptr),
library_backend_(NULL), library_backend_(nullptr),
library_model_(NULL), library_model_(nullptr),
library_filter_(NULL), library_filter_(nullptr),
library_sort_model_(new QSortFilterProxyModel(this)), library_sort_model_(new QSortFilterProxyModel(this)),
total_song_count_(0), total_song_count_(0),
login_state_(LoginState_OtherError), login_state_(LoginState_OtherError),

View File

@ -85,7 +85,7 @@ QByteArray UbuntuOneAuthenticator::GenerateAuthorisationHeader(
const QString& token, const QString& token,
const QString& token_secret) { const QString& token_secret) {
typedef QPair<QString, QString> Param; typedef QPair<QString, QString> Param;
QString timestamp = QString::number(time(NULL)); QString timestamp = QString::number(time(nullptr));
QList<Param> parameters; QList<Param> parameters;
parameters << Param("oauth_nonce", QString::number(qrand())) parameters << Param("oauth_nonce", QString::number(qrand()))
<< Param("oauth_timestamp", timestamp) << Param("oauth_timestamp", timestamp)

View File

@ -37,10 +37,10 @@ const char* Library::kFtsTable = "songs_fts";
Library::Library(Application* app, QObject *parent) Library::Library(Application* app, QObject *parent)
: QObject(parent), : QObject(parent),
app_(app), app_(app),
backend_(NULL), backend_(nullptr),
model_(NULL), model_(nullptr),
watcher_(NULL), watcher_(nullptr),
watcher_thread_(NULL) watcher_thread_(nullptr)
{ {
backend_ = new LibraryBackend; backend_ = new LibraryBackend;
backend()->moveToThread(app->database()->thread()); backend()->moveToThread(app->database()->thread());

View File

@ -33,7 +33,7 @@
LibraryFilterWidget::LibraryFilterWidget(QWidget *parent) LibraryFilterWidget::LibraryFilterWidget(QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui_(new Ui_LibraryFilterWidget), ui_(new Ui_LibraryFilterWidget),
model_(NULL), model_(nullptr),
group_by_dialog_(new GroupByDialog), group_by_dialog_(new GroupByDialog),
filter_delay_(new QTimer(this)), filter_delay_(new QTimer(this)),
filter_applies_to_model_(true), filter_applies_to_model_(true),

View File

@ -174,7 +174,7 @@ void LibraryModel::SongsDiscovered(const SongList& songs) {
// Special case: if the song is a compilation and the current GroupBy // Special case: if the song is a compilation and the current GroupBy
// level is Artists, then we want the Various Artists node :( // level is Artists, then we want the Various Artists node :(
if (IsArtistGroupBy(type) && song.is_compilation()) { if (IsArtistGroupBy(type) && song.is_compilation()) {
if (container->compilation_artist_node_ == NULL) if (container->compilation_artist_node_ == nullptr)
CreateCompilationArtistNode(true, container); CreateCompilationArtistNode(true, container);
container = container->compilation_artist_node_; container = container->compilation_artist_node_;
} else { } else {
@ -242,7 +242,7 @@ LibraryItem* LibraryModel::CreateCompilationArtistNode(bool signal, LibraryItem*
parent->compilation_artist_node_ = parent->compilation_artist_node_ =
new LibraryItem(LibraryItem::Type_Container, parent); 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_->key = tr("Various artists");
parent->compilation_artist_node_->sort_text = " various"; parent->compilation_artist_node_->sort_text = " various";
parent->compilation_artist_node_->container_level = parent->container_level + 1; 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 // Special case the Various Artists node
if (IsCompilationArtistNode(node)) if (IsCompilationArtistNode(node))
node->parent->compilation_artist_node_ = NULL; node->parent->compilation_artist_node_ = nullptr;
else else
container_nodes_[node->container_level].remove(node->key); container_nodes_[node->container_level].remove(node->key);
@ -702,10 +702,10 @@ void LibraryModel::BeginReset() {
container_nodes_[2].clear(); container_nodes_[2].clear();
divider_nodes_.clear(); divider_nodes_.clear();
pending_art_.clear(); pending_art_.clear();
smart_playlist_node_ = NULL; smart_playlist_node_ = nullptr;
root_ = new LibraryItem(this); root_ = new LibraryItem(this);
root_->compilation_artist_node_ = NULL; root_->compilation_artist_node_ = nullptr;
root_->lazy_loaded = false; root_->lazy_loaded = false;
// Smart playlists? // 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 // Initialise the item depending on what type it's meant to be
LibraryItem* item = new LibraryItem(item_type, parent); LibraryItem* item = new LibraryItem(item_type, parent);
item->compilation_artist_node_ = NULL; item->compilation_artist_node_ = nullptr;
item->container_level = container_level; item->container_level = container_level;
return item; return item;
} }
@ -1072,13 +1072,13 @@ QStringList LibraryModel::mimeTypes() const {
QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const { QMimeData* LibraryModel::mimeData(const QModelIndexList& indexes) const {
if (indexes.isEmpty()) if (indexes.isEmpty())
return NULL; return nullptr;
// Special case: a smart playlist was dragged // Special case: a smart playlist was dragged
if (IndexToItem(indexes.first())->type == LibraryItem::Type_SmartPlaylist) { if (IndexToItem(indexes.first())->type == LibraryItem::Type_SmartPlaylist) {
GeneratorPtr generator = CreateGenerator(indexes.first()); GeneratorPtr generator = CreateGenerator(indexes.first());
if (!generator) if (!generator)
return NULL; return nullptr;
GeneratorMimeData* data = new GeneratorMimeData(generator); GeneratorMimeData* data = new GeneratorMimeData(generator);
data->setData(kSmartPlaylistsMimeType, QByteArray()); data->setData(kSmartPlaylistsMimeType, QByteArray());
@ -1248,7 +1248,7 @@ void LibraryModel::CreateSmartPlaylists() {
void LibraryModel::ItemFromSmartPlaylist(const QSettings& s, bool notify) const { void LibraryModel::ItemFromSmartPlaylist(const QSettings& s, bool notify) const {
LibraryItem* item = new LibraryItem(LibraryItem::Type_SmartPlaylist, 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->display_text = tr(qPrintable(s.value("name").toString()));
item->sort_text = item->display_text; item->sort_text = item->display_text;
item->key = s.value("type").toString(); item->key = s.value("type").toString();

View File

@ -165,11 +165,11 @@ bool LibraryItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view,
LibraryView::LibraryView(QWidget* parent) LibraryView::LibraryView(QWidget* parent)
: AutoExpandingTreeView(parent), : AutoExpandingTreeView(parent),
app_(NULL), app_(nullptr),
filter_(NULL), filter_(nullptr),
total_song_count_(-1), total_song_count_(-1),
nomusic_(":nomusic.png"), nomusic_(":nomusic.png"),
context_menu_(NULL), context_menu_(nullptr),
is_in_keyboard_search_(false) is_in_keyboard_search_(false)
{ {
setItemDelegate(new LibraryItemDelegate(this)); setItemDelegate(new LibraryItemDelegate(this));
@ -296,7 +296,7 @@ void LibraryView::ReloadSettings() {
s.beginGroup(kSettingsGroup); s.beginGroup(kSettingsGroup);
SetAutoOpen(s.value("auto_open", true).toBool()); 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_pretty_covers(s.value("pretty_covers", true).toBool());
app_->library_model()->set_show_dividers(s.value("show_dividers", true).toBool()); app_->library_model()->set_show_dividers(s.value("show_dividers", true).toBool());
} }

View File

@ -49,8 +49,8 @@ const char* LibraryWatcher::kSettingsGroup = "LibraryWatcher";
LibraryWatcher::LibraryWatcher(QObject* parent) LibraryWatcher::LibraryWatcher(QObject* parent)
: QObject(parent), : QObject(parent),
backend_(NULL), backend_(nullptr),
task_manager_(NULL), task_manager_(nullptr),
fs_watcher_(FileSystemWatcherInterface::Create(this)), fs_watcher_(FileSystemWatcherInterface::Create(this)),
stop_requested_(false), stop_requested_(false),
scan_on_startup_(true), scan_on_startup_(true),

View File

@ -137,7 +137,7 @@ void IncreaseFDLimit() {
// getrlimit() lies about the hard limit so we have to check sysctl. // getrlimit() lies about the hard limit so we have to check sysctl.
int max_fd = 0; int max_fd = 0;
size_t len = sizeof(max_fd); 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; limit.rlim_cur = max_fd;
int ret = setrlimit(RLIMIT_NOFILE, &limit); int ret = setrlimit(RLIMIT_NOFILE, &limit);
@ -309,14 +309,14 @@ int main(int argc, char *argv[]) {
// Initialise logging // Initialise logging
logging::Init(); logging::Init();
logging::SetLevels(options.log_levels()); logging::SetLevels(options.log_levels());
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), NULL); g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), nullptr);
// Output the version, so when people attach log output to bug reports they // Output the version, so when people attach log output to bug reports they
// don't have to tell us which version they're using. // don't have to tell us which version they're using.
qLog(Info) << "Clementine" << CLEMENTINE_VERSION_DISPLAY; qLog(Info) << "Clementine" << CLEMENTINE_VERSION_DISPLAY;
// Seed the random number generators. // Seed the random number generators.
time_t t = time(NULL); time_t t = time(nullptr);
srand(t); srand(t);
qsrand(t); qsrand(t);

View File

@ -35,7 +35,7 @@ MoodbarController::MoodbarController(Application* app, QObject* parent)
void MoodbarController::CurrentSongChanged(const Song& song) { void MoodbarController::CurrentSongChanged(const Song& song) {
QByteArray data; QByteArray data;
MoodbarPipeline* pipeline = NULL; MoodbarPipeline* pipeline = nullptr;
const MoodbarLoader::Result result = const MoodbarLoader::Result result =
app_->moodbar_loader()->Load(song.url(), &data, &pipeline); app_->moodbar_loader()->Load(song.url(), &data, &pipeline);

View File

@ -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 // Load a mood file for this song and generate some colors from it
QByteArray bytes; QByteArray bytes;
MoodbarPipeline* pipeline = NULL; MoodbarPipeline* pipeline = nullptr;
switch (app_->moodbar_loader()->Load(url, &bytes, &pipeline)) { switch (app_->moodbar_loader()->Load(url, &bytes, &pipeline)) {
case MoodbarLoader::CannotLoad: case MoodbarLoader::CannotLoad:
data->state_ = Data::State_CannotLoad; data->state_ = Data::State_CannotLoad;

View File

@ -28,10 +28,10 @@
bool MoodbarPipeline::sIsAvailable = false; bool MoodbarPipeline::sIsAvailable = false;
MoodbarPipeline::MoodbarPipeline(const QUrl& local_filename) MoodbarPipeline::MoodbarPipeline(const QUrl& local_filename)
: QObject(NULL), : QObject(nullptr),
local_filename_(local_filename), local_filename_(local_filename),
pipeline_(NULL), pipeline_(nullptr),
convert_element_(NULL), convert_element_(nullptr),
success_(false) success_(false)
{ {
} }
@ -61,7 +61,7 @@ bool MoodbarPipeline::IsAvailable() {
} }
GstElement* MoodbarPipeline::CreateElement(const QString& factory_name) { 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) { if (ret) {
gst_bin_add(GST_BIN(pipeline_), ret); gst_bin_add(GST_BIN(pipeline_), ret);
@ -90,21 +90,21 @@ void MoodbarPipeline::Start() {
GstElement* appsink = CreateElement("appsink"); GstElement* appsink = CreateElement("appsink");
if (!decodebin || !convert_element_ || !fftwspectrum || !moodbar || !appsink) { if (!decodebin || !convert_element_ || !fftwspectrum || !moodbar || !appsink) {
pipeline_ = NULL; pipeline_ = nullptr;
emit Finished(false); emit Finished(false);
return; return;
} }
// Join them together // 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 // 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, g_object_set(fftwspectrum, "def-size", 2048,
"def-step", 1024, "def-step", 1024,
"hiquality", true, NULL); "hiquality", true, nullptr);
g_object_set(moodbar, "height", 1, g_object_set(moodbar, "height", 1,
"max-width", 1000, NULL); "max-width", 1000, nullptr);
// Connect signals // Connect signals
CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this); CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this);
@ -115,7 +115,7 @@ void MoodbarPipeline::Start() {
memset(&callbacks, 0, sizeof(callbacks)); memset(&callbacks, 0, sizeof(callbacks));
callbacks.new_buffer = NewBufferCallback; callbacks.new_buffer = NewBufferCallback;
gst_app_sink_set_callbacks(reinterpret_cast<GstAppSink*>(appsink), &callbacks, this, NULL); gst_app_sink_set_callbacks(reinterpret_cast<GstAppSink*>(appsink), &callbacks, this, nullptr);
// Start playing // Start playing
gst_element_set_state(pipeline_, GST_STATE_PLAYING); gst_element_set_state(pipeline_, GST_STATE_PLAYING);
@ -187,9 +187,10 @@ void MoodbarPipeline::Cleanup() {
Q_ASSERT(QThread::currentThread() != qApp->thread()); Q_ASSERT(QThread::currentThread() != qApp->thread());
if (pipeline_) { 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_element_set_state(pipeline_, GST_STATE_NULL);
gst_object_unref(pipeline_); gst_object_unref(pipeline_);
pipeline_ = NULL; pipeline_ = nullptr;
} }
} }

View File

@ -44,9 +44,9 @@ MoodbarProxyStyle::MoodbarProxyStyle(Application* app, QSlider* slider)
fade_timeline_(new QTimeLine(1000, this)), fade_timeline_(new QTimeLine(1000, this)),
moodbar_colors_dirty_(true), moodbar_colors_dirty_(true),
moodbar_pixmap_dirty_(true), moodbar_pixmap_dirty_(true),
context_menu_(NULL), context_menu_(nullptr),
show_moodbar_action_(NULL), show_moodbar_action_(nullptr),
style_action_group_(NULL) style_action_group_(nullptr)
{ {
slider->setStyle(this); slider->setStyle(this);
slider->installEventFilter(this); slider->installEventFilter(this);

View File

@ -35,8 +35,8 @@ static const int kDecodeChannels = 1;
Chromaprinter::Chromaprinter(const QString& filename) Chromaprinter::Chromaprinter(const QString& filename)
: filename_(filename), : filename_(filename),
event_loop_(NULL), event_loop_(nullptr),
convert_element_(NULL), convert_element_(nullptr),
finishing_(false) { finishing_(false) {
} }
@ -82,8 +82,8 @@ QString Chromaprinter::CreateFingerprint() {
convert_element_ = convert; convert_element_ = convert;
// Connect the elements // Connect the elements
gst_element_link_many(src, decode, NULL); gst_element_link_many(src, decode, nullptr);
gst_element_link_many(convert, resample, NULL); gst_element_link_many(convert, resample, nullptr);
// Chromaprint expects mono floats at a sample rate of 11025Hz. // Chromaprint expects mono floats at a sample rate of 11025Hz.
GstCaps* caps = gst_caps_new_simple( GstCaps* caps = gst_caps_new_simple(
@ -91,19 +91,19 @@ QString Chromaprinter::CreateFingerprint() {
"width", G_TYPE_INT, 16, "width", G_TYPE_INT, 16,
"channels", G_TYPE_INT, kDecodeChannels, "channels", G_TYPE_INT, kDecodeChannels,
"rate", G_TYPE_INT, kDecodeRate, "rate", G_TYPE_INT, kDecodeRate,
NULL); nullptr);
gst_element_link_filtered(resample, sink, caps); gst_element_link_filtered(resample, sink, caps);
gst_caps_unref(caps); gst_caps_unref(caps);
GstAppSinkCallbacks callbacks; GstAppSinkCallbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks)); memset(&callbacks, 0, sizeof(callbacks));
callbacks.new_buffer = NewBufferCallback; callbacks.new_buffer = NewBufferCallback;
gst_app_sink_set_callbacks(reinterpret_cast<GstAppSink*>(sink), &callbacks, this, NULL); gst_app_sink_set_callbacks(reinterpret_cast<GstAppSink*>(sink), &callbacks, this, nullptr);
g_object_set(G_OBJECT(sink), "sync", FALSE, NULL); g_object_set(G_OBJECT(sink), "sync", FALSE, nullptr);
g_object_set(G_OBJECT(sink), "emit-signals", TRUE, NULL); g_object_set(G_OBJECT(sink), "emit-signals", TRUE, nullptr);
// Set the filename // Set the filename
g_object_set(src, "location", filename_.toUtf8().constData(), NULL); g_object_set(src, "location", filename_.toUtf8().constData(), nullptr);
// Connect signals // Connect signals
CHECKED_GCONNECT(decode, "new-decoded-pad", &NewPadCallback, this); CHECKED_GCONNECT(decode, "new-decoded-pad", &NewPadCallback, this);
@ -130,12 +130,12 @@ QString Chromaprinter::CreateFingerprint() {
chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()), data.size() / 2); chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()), data.size() / 2);
chromaprint_finish(chromaprint); chromaprint_finish(chromaprint);
void* fprint = NULL; void* fprint = nullptr;
int size = 0; int size = 0;
int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size); int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size);
QByteArray fingerprint; QByteArray fingerprint;
if (ret == 1) { if (ret == 1) {
void* encoded = NULL; void* encoded = nullptr;
int encoded_size = 0; int encoded_size = 0;
chromaprint_encode_fingerprint( chromaprint_encode_fingerprint(
fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT, &encoded, &encoded_size, 1); 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; qLog(Debug) << "Decode time:" << decode_time << "Codegen time:" << codegen_time;
// Cleanup // Cleanup
callbacks.new_buffer = NULL; callbacks.new_buffer = nullptr;
gst_app_sink_set_callbacks(reinterpret_cast<GstAppSink*>(sink), &callbacks, this, NULL); gst_app_sink_set_callbacks(
gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), NULL, NULL); reinterpret_cast<GstAppSink*>(sink), &callbacks, this, nullptr);
gst_bus_set_sync_handler(
gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), nullptr, nullptr);
g_source_remove(bus_callback_id); g_source_remove(bus_callback_id);
gst_element_set_state(pipeline_, GST_STATE_NULL); gst_element_set_state(pipeline_, GST_STATE_NULL);
gst_object_unref(pipeline_); gst_object_unref(pipeline_);

View File

@ -29,7 +29,7 @@
TagFetcher::TagFetcher(QObject* parent) TagFetcher::TagFetcher(QObject* parent)
: QObject(parent), : QObject(parent),
fingerprint_watcher_(NULL), fingerprint_watcher_(nullptr),
acoustid_client_(new AcoustidClient(this)), acoustid_client_(new AcoustidClient(this)),
musicbrainz_client_(new MusicBrainzClient(this)) musicbrainz_client_(new MusicBrainzClient(this))
{ {
@ -61,7 +61,7 @@ void TagFetcher::Cancel() {
fingerprint_watcher_->cancel(); fingerprint_watcher_->cancel();
delete fingerprint_watcher_; delete fingerprint_watcher_;
fingerprint_watcher_ = NULL; fingerprint_watcher_ = nullptr;
} }
acoustid_client_->CancelAll(); acoustid_client_->CancelAll();

View File

@ -20,7 +20,7 @@
#include "networkremote.h" #include "networkremote.h"
#include "networkremotehelper.h" #include "networkremotehelper.h"
NetworkRemoteHelper* NetworkRemoteHelper::sInstance = NULL; NetworkRemoteHelper* NetworkRemoteHelper::sInstance = nullptr;
NetworkRemoteHelper::NetworkRemoteHelper(Application* app) NetworkRemoteHelper::NetworkRemoteHelper(Application* app)
: app_(app) : app_(app)
@ -56,7 +56,7 @@ void NetworkRemoteHelper::ReloadSettings() {
NetworkRemoteHelper* NetworkRemoteHelper::Instance() { NetworkRemoteHelper* NetworkRemoteHelper::Instance() {
if (!sInstance) { if (!sInstance) {
// normally he shouldn't go here. Only for safety // normally he shouldn't go here. Only for safety
return NULL; return nullptr;
} }
return sInstance; return sInstance;
} }

View File

@ -127,7 +127,7 @@ SongInfoProvider* OutgoingDataCreator::ProviderByName(const QString& name) const
return provider; return provider;
} }
} }
return NULL; return nullptr;
} }
void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) { void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) {

View File

@ -75,7 +75,7 @@ void TinySVCMDNS::PublishInternal(
// Some pointless text, so tinymDNS publishes the service correctly. // Some pointless text, so tinymDNS publishes the service correctly.
const char* txt[] = { const char* txt[] = {
"cat=nyan", "cat=nyan",
NULL nullptr
}; };
foreach(mdnsd* mdnsd, mdnsd_) { foreach(mdnsd* mdnsd, mdnsd_) {
@ -84,7 +84,7 @@ void TinySVCMDNS::PublishInternal(
name.constData(), name.constData(),
QString(type + ".local").toUtf8().constData(), QString(type + ".local").toUtf8().constData(),
port, port,
NULL, nullptr,
txt); txt);
} }
} }

View File

@ -16,7 +16,7 @@
#include <QTextCodec> #include <QTextCodec>
Zeroconf* Zeroconf::sInstance = NULL; Zeroconf* Zeroconf::sInstance = nullptr;
Zeroconf::~Zeroconf() { Zeroconf::~Zeroconf() {
@ -42,7 +42,7 @@ QByteArray Zeroconf::TruncateName(const QString& name) {
QTextCodec* codec = QTextCodec::codecForName("UTF-8"); QTextCodec* codec = QTextCodec::codecForName("UTF-8");
QByteArray truncated_utf8; QByteArray truncated_utf8;
foreach (QChar c, name) { 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) { if (truncated_utf8.size() + rendered.size() >= 63) {
break; break;
} }

View File

@ -114,7 +114,7 @@ Playlist::Playlist(PlaylistBackend* backend,
scrobble_point_(-1), scrobble_point_(-1),
lastfm_status_(LastFM_New), lastfm_status_(LastFM_New),
have_incremented_playcount_(false), have_incremented_playcount_(false),
playlist_sequence_(NULL), playlist_sequence_(nullptr),
ignore_sorting_(false), ignore_sorting_(false),
undo_stack_(new QUndoStack(this)), undo_stack_(new QUndoStack(this)),
special_type_(special_type) 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 // Get the list of rows that were moved
QList<int> source_rows; QList<int> source_rows;
Playlist* source_playlist = NULL; Playlist* source_playlist = nullptr;
qint64 pid = 0; qint64 pid = 0;
qint64 own_pid = QCoreApplication::applicationPid(); qint64 own_pid = QCoreApplication::applicationPid();
@ -1116,7 +1116,7 @@ void Playlist::UpdateItems(const SongList& songs) {
QMimeData* Playlist::mimeData(const QModelIndexList& indexes) const { QMimeData* Playlist::mimeData(const QModelIndexList& indexes) const {
if (indexes.isEmpty()) if (indexes.isEmpty())
return NULL; return nullptr;
// We only want one index per row, but we can't just take column 0 because // We only want one index per row, but we can't just take column 0 because
// the user might have hidden it. // the user might have hidden it.
@ -1377,7 +1377,7 @@ void Playlist::ItemsLoaded() {
GeneratorPtr gen = Generator::Create(p.dynamic_type); GeneratorPtr gen = Generator::Create(p.dynamic_type);
if (gen) { if (gen) {
// Hack: can't think of a better way to get the right backend // 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()) if (p.dynamic_backend == library_->songs_table())
backend = library_; backend = library_;
else if (p.dynamic_backend == MagnatuneService::kSongsTable) else if (p.dynamic_backend == MagnatuneService::kSongsTable)

View File

@ -40,14 +40,14 @@ const int PlaylistContainer::kFilterDelayPlaylistSizeThreshold = 5000;
PlaylistContainer::PlaylistContainer(QWidget *parent) PlaylistContainer::PlaylistContainer(QWidget *parent)
: QWidget(parent), : QWidget(parent),
ui_(new Ui_PlaylistContainer), ui_(new Ui_PlaylistContainer),
manager_(NULL), manager_(nullptr),
undo_(NULL), undo_(nullptr),
redo_(NULL), redo_(nullptr),
playlist_(NULL), playlist_(nullptr),
starting_up_(true), starting_up_(true),
tab_bar_visible_(false), tab_bar_visible_(false),
tab_bar_animation_(new QTimeLine(500, this)), tab_bar_animation_(new QTimeLine(500, this)),
no_matches_label_(NULL), no_matches_label_(nullptr),
filter_timer_(new QTimer(this)) filter_timer_(new QTimer(this))
{ {
ui_->setupUi(this); ui_->setupUi(this);

View File

@ -431,7 +431,7 @@ FilterTree* FilterParser::createSearchTermTreeNode(
} }
// here comes a mess :/ // here comes a mess :/
// well, not that much of a mess, but so many options -_- // well, not that much of a mess, but so many options -_-
SearchTermComparator* cmp = NULL; SearchTermComparator* cmp = nullptr;
if (prefix == "!=" || prefix == "<>") { if (prefix == "!=" || prefix == "<>") {
cmp = new NeComparator(search); cmp = new NeComparator(search);
} else if (!col.isEmpty() && columns_.contains(col) && } else if (!col.isEmpty() && columns_.contains(col) &&

View File

@ -48,7 +48,7 @@ PlaylistItem* PlaylistItem::NewFromType(const QString& type) {
return new InternetPlaylistItem("Internet"); return new InternetPlaylistItem("Internet");
qLog(Warning) << "Invalid PlaylistItem type:" << type; qLog(Warning) << "Invalid PlaylistItem type:" << type;
return NULL; return nullptr;
} }
PlaylistItem* PlaylistItem::NewFromSongsTable(const QString& table, const Song& song) { 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); return new JamendoPlaylistItem(song);
qLog(Warning) << "Invalid PlaylistItem songs table:" << table; qLog(Warning) << "Invalid PlaylistItem songs table:" << table;
return NULL; return nullptr;
} }
void PlaylistItem::BindToQuery(QSqlQuery* query) const { void PlaylistItem::BindToQuery(QSqlQuery* query) const {

View File

@ -55,9 +55,9 @@ public:
PlaylistListContainer::PlaylistListContainer(QWidget* parent) PlaylistListContainer::PlaylistListContainer(QWidget* parent)
: QWidget(parent), : QWidget(parent),
app_(NULL), app_(nullptr),
ui_(new Ui_PlaylistListContainer), ui_(new Ui_PlaylistListContainer),
menu_(NULL), menu_(nullptr),
action_new_folder_(new QAction(this)), action_new_folder_(new QAction(this)),
action_remove_(new QAction(this)), action_remove_(new QAction(this)),
action_save_playlist_(new QAction(this)), action_save_playlist_(new QAction(this)),

View File

@ -127,7 +127,7 @@ QStandardItem* PlaylistListModel::FolderByPath(const QString& path) {
const QStringList parts = path.split('/', QString::SkipEmptyParts); const QStringList parts = path.split('/', QString::SkipEmptyParts);
foreach (const QString& part, parts) { foreach (const QString& part, parts) {
QStandardItem* matching_child = NULL; QStandardItem* matching_child = nullptr;
const int child_count = parent->rowCount(); const int child_count = parent->rowCount();
for (int i=0 ; i<child_count ; ++i) { for (int i=0 ; i<child_count ; ++i) {

View File

@ -41,10 +41,10 @@ using smart_playlists::GeneratorPtr;
PlaylistManager::PlaylistManager(Application* app, QObject *parent) PlaylistManager::PlaylistManager(Application* app, QObject *parent)
: PlaylistManagerInterface(app, parent), : PlaylistManagerInterface(app, parent),
app_(app), app_(app),
playlist_backend_(NULL), playlist_backend_(nullptr),
library_backend_(NULL), library_backend_(nullptr),
sequence_(NULL), sequence_(nullptr),
parser_(NULL), parser_(nullptr),
current_(-1), current_(-1),
active_(-1) active_(-1)
{ {
@ -237,7 +237,7 @@ void PlaylistManager::SaveWithUI(int id, const QString& suggested_filename) {
QString default_filter = parser()->default_filter(); QString default_filter = parser()->default_filter();
filename = QFileDialog::getSaveFileName( 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); parser()->filters(), &default_filter);
if (filename.isNull()) if (filename.isNull())

View File

@ -40,7 +40,7 @@ const char* PlaylistTabBar::kSettingsGroup = "PlaylistTabBar";
PlaylistTabBar::PlaylistTabBar(QWidget *parent) PlaylistTabBar::PlaylistTabBar(QWidget *parent)
: QTabBar(parent), : QTabBar(parent),
manager_(NULL), manager_(nullptr),
menu_(new QMenu(this)), menu_(new QMenu(this)),
menu_index_(-1), menu_index_(-1),
suppress_current_changed_(false), suppress_current_changed_(false),

View File

@ -99,9 +99,9 @@ void PlaylistProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
PlaylistView::PlaylistView(QWidget *parent) PlaylistView::PlaylistView(QWidget *parent)
: QTreeView(parent), : QTreeView(parent),
app_(NULL), app_(nullptr),
style_(new PlaylistProxyStyle(style())), style_(new PlaylistProxyStyle(style())),
playlist_(NULL), playlist_(nullptr),
header_(new PlaylistHeader(Qt::Horizontal, this, this)), header_(new PlaylistHeader(Qt::Horizontal, this, this)),
setting_initial_header_layout_(false), setting_initial_header_layout_(false),
upgrading_from_qheaderview_(false), upgrading_from_qheaderview_(false),
@ -116,7 +116,7 @@ PlaylistView::PlaylistView(QWidget *parent)
glow_enabled_(true), glow_enabled_(true),
currently_glowing_(false), currently_glowing_(false),
glow_intensity_step_(0), glow_intensity_step_(0),
rating_delegate_(NULL), rating_delegate_(nullptr),
inhibit_autoscroll_timer_(new QTimer(this)), inhibit_autoscroll_timer_(new QTimer(this)),
inhibit_autoscroll_(false), inhibit_autoscroll_(false),
currently_autoscrolling_(false), currently_autoscrolling_(false),
@ -982,7 +982,7 @@ void PlaylistView::dropEvent(QDropEvent *event) {
} }
void PlaylistView::PlaylistDestroyed() { void PlaylistView::PlaylistDestroyed() {
playlist_ = NULL; playlist_ = nullptr;
// We'll get a SetPlaylist() soon // We'll get a SetPlaylist() soon
} }

Some files were not shown because too many files have changed in this diff Show More