Use std::bind in QtConcurrent::run() to fix compile with Qt 6
This commit is contained in:
@@ -859,7 +859,7 @@ void CollectionModel::LazyPopulate(CollectionItem *parent, const bool signal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CollectionModel::ResetAsync() {
|
void CollectionModel::ResetAsync() {
|
||||||
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(this, &CollectionModel::RunQuery, root_);
|
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(std::bind(&CollectionModel::RunQuery, this, root_));
|
||||||
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
|
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -286,7 +287,7 @@ 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(this, &EditTagDialog::LoadData, s);
|
QFuture<QList<Data>> future = QtConcurrent::run(std::bind(&EditTagDialog::LoadData, this, s));
|
||||||
NewClosure(future, this, SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)), future);
|
NewClosure(future, this, SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)), future);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@@ -344,7 +345,7 @@ bool OrganiseDialog::SetUrls(const QList<QUrl> &urls) {
|
|||||||
|
|
||||||
bool OrganiseDialog::SetFilenames(const QStringList &filenames) {
|
bool OrganiseDialog::SetFilenames(const QStringList &filenames) {
|
||||||
|
|
||||||
songs_future_ = QtConcurrent::run(this, &OrganiseDialog::LoadSongsBlocking, filenames);
|
songs_future_ = QtConcurrent::run(std::bind(&OrganiseDialog::LoadSongsBlocking, this, filenames));
|
||||||
NewClosure(songs_future_, [=]() { SetSongs(songs_future_.result()); });
|
NewClosure(songs_future_, [=]() { SetSongs(songs_future_.result()); });
|
||||||
|
|
||||||
SetLoadingSongs(true);
|
SetLoadingSongs(true);
|
||||||
|
|||||||
@@ -1314,7 +1314,7 @@ 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(backend_, &PlaylistBackend::GetPlaylistItems, id_);
|
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistItems, backend_, id_));
|
||||||
NewClosure(future, this, SLOT(ItemsLoaded(QFuture<PlaylistItemList>)), future);
|
NewClosure(future, this, SLOT(ItemsLoaded(QFuture<PlaylistItemList>)), future);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1353,7 +1353,7 @@ 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) {
|
||||||
QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs);
|
(void)QtConcurrent::run(std::bind(&Playlist::InvalidateDeletedSongs, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit PlaylistLoaded();
|
emit PlaylistLoaded();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -211,7 +212,7 @@ void PlaylistManager::Save(int id, const QString &filename, Playlist::Path path_
|
|||||||
}
|
}
|
||||||
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(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
|
QFuture<QList<Song>> future = QtConcurrent::run(std::bind(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id));
|
||||||
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,7 @@ void SongLoaderInserter::Load(Playlist *destination, int row, bool play_now, boo
|
|||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QtConcurrent::run(this, &SongLoaderInserter::AsyncLoad);
|
(void)QtConcurrent::run([=]{ AsyncLoad(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user