Use std::make_shared

This commit is contained in:
Jonas Kvinge 2021-06-30 16:14:58 +02:00
parent ffa2489998
commit f3a8dde5f0
6 changed files with 7 additions and 7 deletions

View File

@ -3115,7 +3115,7 @@ void MainWindow::PlaylistDelete() {
app_->player()->Next();
}
std::shared_ptr<MusicStorage> storage(new FilesystemMusicStorage("/"));
std::shared_ptr<MusicStorage> storage = std::make_shared<FilesystemMusicStorage>("/");
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
//QObject::connect(delete_files, &DeleteFiles::Finished, this, &MainWindow::DeleteFinished);
delete_files->Start(selected_songs);

View File

@ -809,7 +809,7 @@ std::shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline() {
EnsureInitialized();
std::shared_ptr<GstEnginePipeline> ret(new GstEnginePipeline(this));
std::shared_ptr<GstEnginePipeline> ret = std::make_shared<GstEnginePipeline>(this);
ret->set_output_device(output_, device_);
ret->set_volume_enabled(volume_control_);
ret->set_stereo_balancer_enabled(stereo_balancer_enabled_);

View File

@ -282,7 +282,7 @@ int main(int argc, char *argv[]) {
QNetworkProxyFactory::setApplicationProxyFactory(NetworkProxyFactory::Instance());
// Create the tray icon and OSD
std::shared_ptr<SystemTrayIcon> tray_icon(new SystemTrayIcon);
std::shared_ptr<SystemTrayIcon> tray_icon = std::make_shared<SystemTrayIcon>();
#if defined(Q_OS_MACOS)
OSDMac osd(tray_icon, &app);

View File

@ -199,7 +199,7 @@ QList<PlaylistItemPtr> PlaylistBackend::GetPlaylistItems(int playlist) {
if (db_->CheckErrors(q)) return QList<PlaylistItemPtr>();
// it's probable that we'll have a few songs associated with the same CUE so we're caching results of parsing CUEs
std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
std::shared_ptr<NewSongFromQueryState> state_ptr = std::make_shared<NewSongFromQueryState>();
while (q.next()) {
playlistitems << NewPlaylistItemFromQuery(SqlRow(q), state_ptr);
}
@ -225,7 +225,7 @@ QList<Song> PlaylistBackend::GetPlaylistSongs(int playlist) {
if (db_->CheckErrors(q)) return QList<Song>();
// it's probable that we'll have a few songs associated with the same CUE so we're caching results of parsing CUEs
std::shared_ptr<NewSongFromQueryState> state_ptr(new NewSongFromQueryState());
std::shared_ptr<NewSongFromQueryState> state_ptr = std::make_shared<NewSongFromQueryState>();
while (q.next()) {
songs << NewSongFromQuery(SqlRow(q), state_ptr);
}

View File

@ -212,7 +212,7 @@ void SmartPlaylistQueryWizardPlugin::SetGenerator(PlaylistGeneratorPtr g) {
PlaylistGeneratorPtr SmartPlaylistQueryWizardPlugin::CreateGenerator() const {
std::shared_ptr<PlaylistQueryGenerator> gen(new PlaylistQueryGenerator);
std::shared_ptr<PlaylistQueryGenerator> gen = std::make_shared<PlaylistQueryGenerator>();
gen->Load(MakeSearch());
return std::static_pointer_cast<PlaylistGenerator>(gen);

View File

@ -411,7 +411,7 @@ void Transcoder::JobState::ReportError(GstMessage *msg) const {
bool Transcoder::StartJob(const Job &job) {
std::shared_ptr<JobState> state(new JobState(job, this));
std::shared_ptr<JobState> state = std::make_shared<JobState>(job, this);
emit LogLine(tr("Starting %1").arg(QDir::toNativeSeparators(job.input)));