Remove use of std::bind where possible

This commit is contained in:
Jonas Kvinge
2020-11-14 02:13:22 +01:00
parent a155e503f4
commit deddaed04a
8 changed files with 45 additions and 10 deletions

View File

@@ -1406,7 +1406,11 @@ void Playlist::Restore() {
collection_items_by_id_.clear();
cancel_restore_ = false;
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistItems, backend_, id_));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistItems, backend_, id_);
#else
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(backend_, &PlaylistBackend::GetPlaylistItems, id_);
#endif
NewClosure(future, this, SLOT(ItemsLoaded(QFuture<PlaylistItemList>)), future);
}
@@ -1461,7 +1465,11 @@ void Playlist::ItemsLoaded(QFuture<PlaylistItemList> future) {
// Should we gray out deleted songs asynchronously on startup?
if (greyout) {
(void)QtConcurrent::run(std::bind(&Playlist::InvalidateDeletedSongs, this));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
(void)QtConcurrent::run(&Playlist::InvalidateDeletedSongs, this);
#else
(void)QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs);
#endif
}
emit PlaylistLoaded();

View File

@@ -215,7 +215,11 @@ void PlaylistManager::Save(const int id, const QString &filename, const Playlist
}
else {
// Playlist is not in the playlist manager: probably save action was triggered from the left side bar and the playlist isn't loaded.
QFuture<QList<Song>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFuture<QList<Song>> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id);
#else
QFuture<QList<Song>> future = QtConcurrent::run(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
#endif
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
}

View File

@@ -83,7 +83,11 @@ void SongLoaderInserter::Load(Playlist *destination, int row, bool play_now, boo
deleteLater();
}
else {
(void)QtConcurrent::run([=]{ AsyncLoad(); });
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
(void)QtConcurrent::run(&SongLoaderInserter::AsyncLoad, this);
#else
(void)QtConcurrent::run(this, &SongLoaderInserter::AsyncLoad);
#endif
}
}