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();
gst_init(NULL, NULL);
gst_init(nullptr, nullptr);
const QStringList arguments(a.arguments());

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -190,7 +190,7 @@ void GLAnalyzer3::resizeGL( int w, int h )
// Get current timestamp.
timeval tv;
gettimeofday( &tv, NULL );
gettimeofday( &tv, nullptr );
show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;
}
@ -203,7 +203,7 @@ void GLAnalyzer3::analyze( const Scope &s )
{
// compute the dTime since the last call
timeval tv;
gettimeofday( &tv, NULL );
gettimeofday( &tv, nullptr );
double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;
show.dT = currentTime - show.timeStamp;
show.timeStamp = currentTime;

View File

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

View File

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

View File

@ -138,7 +138,7 @@ bool CommandlineOptions::Parse() {
// Parse the arguments
bool ok = false;
forever {
int c = getopt_long(argc_, argv_, "hptusrfv:alk:oyg:", kOptions, NULL);
int c = getopt_long(argc_, argv_, "hptusrfv:alk:oyg:", kOptions, nullptr);
// End of the options
if (c == -1)

View File

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

View File

@ -85,7 +85,7 @@ struct sqlite3_tokenizer_cursor {
/* Tokenizer implementations will typically add additional fields */
};
sqlite3_tokenizer_module* Database::sFTSTokenizer = NULL;
sqlite3_tokenizer_module* Database::sFTSTokenizer = nullptr;
int Database::FTSCreate(int argc, const char* const* argv, sqlite3_tokenizer** tokenizer) {
@ -643,11 +643,11 @@ void Database::BackupFile(const QString& filename) {
QString dest_filename = QString("%1.bak").arg(filename);
const int task_id = app_->task_manager()->StartTask(tr("Backing up database"));
sqlite3* source_connection = NULL;
sqlite3* dest_connection = NULL;
sqlite3* source_connection = nullptr;
sqlite3* dest_connection = nullptr;
BOOST_SCOPE_EXIT((source_connection)(dest_connection)(task_id)(app_)) {
// Harmless to call sqlite3_close() with a NULL pointer.
// Harmless to call sqlite3_close() with a nullptr pointer.
sqlite3_close(source_connection);
sqlite3_close(dest_connection);
app_->task_manager()->SetTaskFinished(task_id);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
#endif
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(',');
foreach (const QString& id, unique_ids) {
backends_ << Backend(NULL, id);
backends_ << Backend(nullptr, id);
}
}
@ -149,7 +149,7 @@ void DeviceManager::DeviceInfo::LoadIcon(const QVariantList& icons, const QStrin
const DeviceManager::DeviceInfo::Backend* DeviceManager::DeviceInfo::BestBackend() const {
int best_priority = -1;
const Backend* ret = NULL;
const Backend* ret = nullptr;
for (int i=0 ; i<backends_.count() ; ++i) {
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
for (int backend_index = 0 ; backend_index < info.backends_.count() ; ++backend_index) {
if (info.backends_[backend_index].unique_id_ == id) {
info.backends_[backend_index].lister_ = NULL;
info.backends_[backend_index].lister_ = nullptr;
break;
}
}
@ -563,7 +563,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
// was "ipod" or "mtp" then the user compiled out support and the device
// won't work properly.
if (url.scheme() == "mtp" || url.scheme() == "gphoto2") {
if (QMessageBox::critical(NULL, tr("This device will not work properly"),
if (QMessageBox::critical(nullptr, tr("This device will not work properly"),
tr("This is an MTP device, but you compiled Clementine without libmtp support.") + " " +
tr("If you continue, this device will work slowly and songs copied to it may not work."),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort)
@ -571,7 +571,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
}
if (url.scheme() == "ipod") {
if (QMessageBox::critical(NULL, tr("This device will not work properly"),
if (QMessageBox::critical(nullptr, tr("This device will not work properly"),
tr("This is an iPod, but you compiled Clementine without libgpod support.") + " " +
tr("If you continue, this device will work slowly and songs copied to it may not work."),
QMessageBox::Abort, QMessageBox::Ignore) == QMessageBox::Abort)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
#include <QtDebug>
MtpConnection::MtpConnection(const QUrl& url)
: device_(NULL)
: device_(nullptr)
{
QString hostname = url.host();
// Parse the URL
@ -53,14 +53,14 @@ MtpConnection::MtpConnection(const QUrl& url)
// Get a list of devices from libmtp and figure out which one is ours
int count = 0;
LIBMTP_raw_device_t* raw_devices = NULL;
LIBMTP_raw_device_t* raw_devices = nullptr;
LIBMTP_error_number_t err = LIBMTP_Detect_Raw_Devices(&raw_devices, &count);
if (err != LIBMTP_ERROR_NONE) {
qLog(Warning) << "MTP error:" << err;
return;
}
LIBMTP_raw_device_t* raw_device = NULL;
LIBMTP_raw_device_t* raw_device = nullptr;
for (int i=0 ; i<count ; ++i) {
if (raw_devices[i].bus_location == bus_location &&
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)
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
loader_thread_(new QThread(this)),
loader_(NULL)
loader_(nullptr)
{
if (!sInitialisedLibMTP) {
LIBMTP_Init();
@ -67,7 +67,7 @@ void MtpDevice::Init() {
void MtpDevice::LoadFinished() {
loader_->deleteLater();
loader_ = NULL;
loader_ = nullptr;
db_busy_.unlock();
}
@ -147,7 +147,7 @@ void MtpDevice::FinishCopy(bool success) {
}
void MtpDevice::StartDelete() {
StartCopy(NULL);
StartCopy(nullptr);
}
bool MtpDevice::DeleteFromStorage(const DeleteJob& job) {
@ -187,7 +187,7 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret) {
}
bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType>* ret, LIBMTP_mtpdevice_t* device) {
uint16_t* list = NULL;
uint16_t* list = nullptr;
uint16_t length = 0;
if (LIBMTP_Get_Supported_Filetypes(device, &list, &length)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ GlobalSearchView::GlobalSearchView(Application* app, QWidget* parent)
app_(app),
engine_(app_->global_search()),
ui_(new Ui_GlobalSearchView),
context_menu_(NULL),
context_menu_(nullptr),
last_search_id_(0),
front_model_(new GlobalSearchModel(engine_, this)),
back_model_(new GlobalSearchModel(engine_, this)),
@ -358,7 +358,7 @@ void GlobalSearchView::ArtLoaded(int id, const QPixmap& pixmap) {
MimeData* GlobalSearchView::SelectedMimeData() {
if (!ui_->results->selectionModel())
return NULL;
return nullptr;
// Get all selected model indexes
QModelIndexList indexes = ui_->results->selectionModel()->selectedRows();
@ -377,7 +377,7 @@ MimeData* GlobalSearchView::SelectedMimeData() {
// Still got nothing? Give up.
if (indexes.isEmpty()) {
return NULL;
return nullptr;
}
// Get items for these indexes

View File

@ -26,7 +26,7 @@
GroovesharkSearchProvider::GroovesharkSearchProvider(Application* app, QObject* 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* mime_data = NULL;
MimeData* mime_data = nullptr;
if (mime_data_contains_urls_only()) {
mime_data = new MimeData;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -133,7 +133,7 @@ QByteArray DropboxAuthenticator::GenerateAuthorisationHeader(
QList<Param> params;
params << Param("oauth_consumer_key", kAppKey)
<< Param("oauth_signature_method", "PLAINTEXT")
<< Param("oauth_timestamp", QString::number(time(NULL)))
<< Param("oauth_timestamp", QString::number(time(nullptr)))
<< Param("oauth_nonce", QString::number(qrand()))
<< Param("oauth_signature", signature);
if (!token.isNull()) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,7 +76,7 @@ void SomaFMUrlHandler::LoadPlaylistFinished() {
}
// Parse the playlist
PlaylistParser parser(NULL);
PlaylistParser parser(nullptr);
QList<Song> songs = parser.LoadFromDevice(reply);
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)
: InternetService(kServiceName, app, parent, parent),
root_(NULL),
search_(NULL),
root_(nullptr),
search_(nullptr),
network_(new NetworkAccessManager(this)),
context_menu_(NULL),
context_menu_(nullptr),
search_box_(new SearchBoxWidget(this)),
search_delay_(new QTimer(this)),
next_pending_search_id_(0) {

View File

@ -55,7 +55,7 @@ SpotifyBlobDownloader::~SpotifyBlobDownloader() {
}
bool SpotifyBlobDownloader::Prompt() {
QMessageBox::StandardButton ret = QMessageBox::question(NULL,
QMessageBox::StandardButton ret = QMessageBox::question(nullptr,
tr("Spotify plugin not installed"),
tr("An additional plugin is required to use Spotify in Clementine. Would you like to download and install it now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
@ -212,7 +212,7 @@ void SpotifyBlobDownloader::ShowError(const QString& message) {
}
qLog(Warning) << message;
QMessageBox::warning(NULL, tr("Error downloading Spotify plugin"), message,
QMessageBox::warning(nullptr, tr("Error downloading Spotify plugin"), message,
QMessageBox::Close);
deleteLater();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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
QByteArray bytes;
MoodbarPipeline* pipeline = NULL;
MoodbarPipeline* pipeline = nullptr;
switch (app_->moodbar_loader()->Load(url, &bytes, &pipeline)) {
case MoodbarLoader::CannotLoad:
data->state_ = Data::State_CannotLoad;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -127,7 +127,7 @@ SongInfoProvider* OutgoingDataCreator::ProviderByName(const QString& name) const
return provider;
}
}
return NULL;
return nullptr;
}
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.
const char* txt[] = {
"cat=nyan",
NULL
nullptr
};
foreach(mdnsd* mdnsd, mdnsd_) {
@ -84,7 +84,7 @@ void TinySVCMDNS::PublishInternal(
name.constData(),
QString(type + ".local").toUtf8().constData(),
port,
NULL,
nullptr,
txt);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,10 +41,10 @@ using smart_playlists::GeneratorPtr;
PlaylistManager::PlaylistManager(Application* app, QObject *parent)
: PlaylistManagerInterface(app, parent),
app_(app),
playlist_backend_(NULL),
library_backend_(NULL),
sequence_(NULL),
parser_(NULL),
playlist_backend_(nullptr),
library_backend_(nullptr),
sequence_(nullptr),
parser_(nullptr),
current_(-1),
active_(-1)
{
@ -237,7 +237,7 @@ void PlaylistManager::SaveWithUI(int id, const QString& suggested_filename) {
QString default_filter = parser()->default_filter();
filename = QFileDialog::getSaveFileName(
NULL, tr("Save playlist", "Title of the playlist save dialog."), filename,
nullptr, tr("Save playlist", "Title of the playlist save dialog."), filename,
parser()->filters(), &default_filter);
if (filename.isNull())

View File

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

View File

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

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