Remove use of std::bind where possible
This commit is contained in:
@@ -893,7 +893,11 @@ void CollectionModel::LazyPopulate(CollectionItem *parent, const bool signal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollectionModel::ResetAsync() {
|
void CollectionModel::ResetAsync() {
|
||||||
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(std::bind(&CollectionModel::RunQuery, this, root_));
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(&CollectionModel::RunQuery, this, root_);
|
||||||
|
#else
|
||||||
|
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(this, &CollectionModel::RunQuery, root_);
|
||||||
|
#endif
|
||||||
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
|
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
|
|||||||
connect(this, SIGNAL(DeviceCreatedFromDB(DeviceInfo*)), SLOT(AddDeviceFromDB(DeviceInfo*)));
|
connect(this, SIGNAL(DeviceCreatedFromDB(DeviceInfo*)), SLOT(AddDeviceFromDB(DeviceInfo*)));
|
||||||
|
|
||||||
// This reads from the database and contents on the database mutex, which can be very slow on startup.
|
// This reads from the database and contents on the database mutex, which can be very slow on startup.
|
||||||
(void)QtConcurrent::run(&thread_pool_, std::bind(&DeviceManager::LoadAllDevices, this));
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
(void)QtConcurrent::run(&thread_pool_, &DeviceManager::LoadAllDevices, this);
|
||||||
|
#else
|
||||||
|
(void)QtConcurrent::run(&thread_pool_, this, &DeviceManager::LoadAllDevices);
|
||||||
|
#endif
|
||||||
|
|
||||||
// This proxy model only shows connected devices
|
// This proxy model only shows connected devices
|
||||||
connected_devices_model_ = new DeviceStateFilterModel(this);
|
connected_devices_model_ = new DeviceStateFilterModel(this);
|
||||||
|
|||||||
@@ -293,7 +293,11 @@ void EditTagDialog::SetSongs(const SongList &s, const PlaylistItemList &items) {
|
|||||||
ui_->song_list->clear();
|
ui_->song_list->clear();
|
||||||
|
|
||||||
// Reload tags in the background
|
// Reload tags in the background
|
||||||
QFuture<QList<Data>> future = QtConcurrent::run(std::bind(&EditTagDialog::LoadData, this, s));
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QFuture<QList<Data>> future = QtConcurrent::run(&EditTagDialog::LoadData, this, s);
|
||||||
|
#else
|
||||||
|
QFuture<QList<Data>> future = QtConcurrent::run(this, &EditTagDialog::LoadData, s);
|
||||||
|
#endif
|
||||||
NewClosure(future, this, SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)), future);
|
NewClosure(future, this, SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)), future);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,11 @@
|
|||||||
#include "gststartup.h"
|
#include "gststartup.h"
|
||||||
|
|
||||||
GstStartup::GstStartup(QObject *parent) : QObject(parent) {
|
GstStartup::GstStartup(QObject *parent) : QObject(parent) {
|
||||||
initializing_ = QtConcurrent::run([=]{ InitializeGStreamer(); });
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
initializing_ = QtConcurrent::run(&GstStartup::InitializeGStreamer, this);
|
||||||
|
#else
|
||||||
|
initializing_ = QtConcurrent::run(this, &GstStartup::InitializeGStreamer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GstStartup::~GstStartup() {}
|
GstStartup::~GstStartup() {}
|
||||||
|
|||||||
@@ -387,8 +387,11 @@ bool OrganizeDialog::SetUrls(const QList<QUrl> &urls) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OrganizeDialog::SetFilenames(const QStringList &filenames) {
|
bool OrganizeDialog::SetFilenames(const QStringList &filenames) {
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
songs_future_ = QtConcurrent::run(std::bind(&OrganizeDialog::LoadSongsBlocking, this, filenames));
|
songs_future_ = QtConcurrent::run(&OrganizeDialog::LoadSongsBlocking, this, filenames);
|
||||||
|
#else
|
||||||
|
songs_future_ = QtConcurrent::run(this, &OrganizeDialog::LoadSongsBlocking, filenames);
|
||||||
|
#endif
|
||||||
NewClosure(songs_future_, [=]() { SetSongs(songs_future_.result()); });
|
NewClosure(songs_future_, [=]() { SetSongs(songs_future_.result()); });
|
||||||
|
|
||||||
SetLoadingSongs(true);
|
SetLoadingSongs(true);
|
||||||
|
|||||||
@@ -1406,7 +1406,11 @@ void Playlist::Restore() {
|
|||||||
collection_items_by_id_.clear();
|
collection_items_by_id_.clear();
|
||||||
|
|
||||||
cancel_restore_ = false;
|
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);
|
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?
|
// Should we gray out deleted songs asynchronously on startup?
|
||||||
if (greyout) {
|
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();
|
emit PlaylistLoaded();
|
||||||
|
|||||||
@@ -215,7 +215,11 @@ void PlaylistManager::Save(const int id, const QString &filename, const Playlist
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Playlist is not in the playlist manager: probably save action was triggered from the left side bar and the playlist isn't loaded.
|
// 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);
|
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,11 @@ void SongLoaderInserter::Load(Playlist *destination, int row, bool play_now, boo
|
|||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
else {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user