Remove NewClosure

This commit is contained in:
Jonas Kvinge
2021-01-30 21:53:53 +01:00
parent 98d5e27a8c
commit 88874f0dcd
27 changed files with 133 additions and 545 deletions

View File

@@ -31,6 +31,7 @@
#include <QThread>
#include <QMutex>
#include <QFuture>
#include <QFutureWatcher>
#include <QDataStream>
#include <QMimeData>
#include <QIODevice>
@@ -53,7 +54,6 @@
#include <QtDebug>
#include "core/application.h"
#include "core/closure.h"
#include "core/database.h"
#include "core/iconloader.h"
#include "core/logging.h"
@@ -915,18 +915,22 @@ void CollectionModel::ResetAsync() {
#else
QFuture<CollectionModel::QueryResult> future = QtConcurrent::run(this, &CollectionModel::RunQuery, root_);
#endif
NewClosure(future, this, SLOT(ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult>)), future);
QFutureWatcher<CollectionModel::QueryResult> *watcher = new QFutureWatcher<CollectionModel::QueryResult>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<CollectionModel::QueryResult>::finished, this, &CollectionModel::ResetAsyncQueryFinished);
}
void CollectionModel::ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult> future) {
void CollectionModel::ResetAsyncQueryFinished() {
QFutureWatcher<CollectionModel::QueryResult> *watcher = static_cast<QFutureWatcher<CollectionModel::QueryResult>*>(sender());
const struct QueryResult result = watcher->result();
watcher->deleteLater();
if (QThread::currentThread() != thread() && QThread::currentThread() != backend_->thread()) {
backend_->Close();
}
const struct QueryResult result = future.result();
BeginReset();
root_->lazy_loaded = true;

View File

@@ -228,7 +228,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
void ClearDiskCache();
// Called after ResetAsync
void ResetAsyncQueryFinished(QFuture<CollectionModel::QueryResult> future);
void ResetAsyncQueryFinished();
void AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &result);

View File

@@ -29,6 +29,7 @@
#include <QDialog>
#include <QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#include <QMap>
#include <QSize>
#include <QByteArray>
@@ -47,7 +48,6 @@
#include <QStackedWidget>
#include <QTableWidget>
#include "core/closure.h"
#include "core/iconloader.h"
#include "core/musicstorage.h"
#include "widgets/freespacebar.h"
@@ -247,7 +247,9 @@ void DeviceProperties::UpdateFormats() {
#else
QFuture<bool> future = QtConcurrent::run(std::bind(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_));
#endif
NewClosure(future, this, SLOT(UpdateFormatsFinished(QFuture<bool>)), future);
QFutureWatcher<bool> *watcher = new QFutureWatcher<bool>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<bool>::finished, this, &DeviceProperties::UpdateFormatsFinished);
ui_->formats_stack->setCurrentWidget(ui_->formats_page_loading);
updating_formats_ = true;
@@ -283,11 +285,15 @@ void DeviceProperties::accept() {
void DeviceProperties::OpenDevice() { manager_->Connect(index_); }
void DeviceProperties::UpdateFormatsFinished(QFuture<bool> future) {
void DeviceProperties::UpdateFormatsFinished() {
QFutureWatcher<bool> *watcher = static_cast<QFutureWatcher<bool>*>(sender());
bool result = watcher->result();
watcher->deleteLater();
updating_formats_ = false;
if (!future.result()) {
if (!result) {
supported_formats_.clear();
}

View File

@@ -59,7 +59,7 @@ class DeviceProperties : public QDialog {
private slots:
void ModelChanged();
void OpenDevice();
void UpdateFormatsFinished(QFuture<bool> future);
void UpdateFormatsFinished();
private:
Ui_DeviceProperties *ui_;

View File

@@ -29,6 +29,7 @@
#include <QtGlobal>
#include <QtConcurrent>
#include <QFuture>
#include <QFutureWatcher>
#include <QObject>
#include <QWidget>
#include <QDialog>
@@ -69,7 +70,6 @@
#include <QtDebug>
#include "core/application.h"
#include "core/closure.h"
#include "core/iconloader.h"
#include "core/logging.h"
#include "core/tagreaderclient.h"
@@ -297,15 +297,24 @@ void EditTagDialog::SetSongs(const SongList &s, const PlaylistItemList &items) {
#else
QFuture<QList<Data>> future = QtConcurrent::run(this, &EditTagDialog::LoadData, s);
#endif
NewClosure(future, this, SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)), future);
QFutureWatcher<QList<Data>> *watcher = new QFutureWatcher<QList<Data>>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<QList<Data>>::finished, this, &EditTagDialog::SetSongsFinished);
}
void EditTagDialog::SetSongsFinished(QFuture<QList<Data>> future) {
void EditTagDialog::SetSongsFinished() {
if (!SetLoading(QString())) return;
QFutureWatcher<QList<Data>> *watcher = static_cast<QFutureWatcher<QList<Data>>*>(sender());
QList<Data> result_data = watcher->result();
watcher->deleteLater();
if (!SetLoading(QString())) {
return;
}
data_ = result_data;
data_ = future.result();
if (data_.count() == 0) {
// If there were no valid songs, disable everything
ui_->song_list->setEnabled(false);

View File

@@ -28,7 +28,6 @@
#include <QObject>
#include <QAbstractItemModel>
#include <QDialog>
#include <QFuture>
#include <QList>
#include <QVariant>
#include <QString>
@@ -101,7 +100,7 @@ class EditTagDialog : public QDialog {
};
private slots:
void SetSongsFinished(QFuture<QList<EditTagDialog::Data>> future);
void SetSongsFinished();
void AcceptFinished();
void SelectionChanged();

View File

@@ -35,6 +35,7 @@
#include <QtGlobal>
#include <QFuture>
#include <QFutureWatcher>
#include <QTimer>
#include <QList>
#include <QByteArray>
@@ -50,7 +51,6 @@
#include <QTimerEvent>
#include <QtDebug>
#include "core/closure.h"
#include "core/logging.h"
#include "core/taskmanager.h"
#include "core/timeconstants.h"
@@ -242,7 +242,13 @@ bool GstEngine::Play(const quint64 offset_nanosec) {
if (!current_pipeline_ || current_pipeline_->is_buffering()) return false;
QFuture<GstStateChangeReturn> future = current_pipeline_->SetState(GST_STATE_PLAYING);
NewClosure(future, this, SLOT(PlayDone(QFuture<GstStateChangeReturn>, quint64, int)), future, offset_nanosec, current_pipeline_->id());
QFutureWatcher<GstStateChangeReturn> *watcher = new QFutureWatcher<GstStateChangeReturn>();
watcher->setFuture(future);
int pipeline_id = current_pipeline_->id();
QObject::connect(watcher, &QFutureWatcher<GstStateChangeReturn>::finished, this, [this, watcher, offset_nanosec, pipeline_id]() {
PlayDone(watcher->result(), offset_nanosec, pipeline_id);
watcher->deleteLater();
});
if (is_fading_out_to_pause_) {
current_pipeline_->SetState(GST_STATE_PAUSED);
@@ -634,9 +640,7 @@ void GstEngine::SeekNow() {
}
}
void GstEngine::PlayDone(QFuture<GstStateChangeReturn> future, const quint64 offset_nanosec, const int pipeline_id) {
GstStateChangeReturn ret = future.result();
void GstEngine::PlayDone(const GstStateChangeReturn ret, const quint64 offset_nanosec, const int pipeline_id) {
if (!current_pipeline_ || pipeline_id != current_pipeline_->id()) {
return;

View File

@@ -120,7 +120,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
void FadeoutFinished();
void FadeoutPauseFinished();
void SeekNow();
void PlayDone(QFuture<GstStateChangeReturn> future, const quint64, const int);
void PlayDone(const GstStateChangeReturn ret, const quint64, const int);
void BufferingStarted();
void BufferingProgress(int percent);

View File

@@ -18,6 +18,7 @@
#include <QApplication>
#include <QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#include <QAbstractItemModel>
#include <QSortFilterProxyModel>
#include <QSettings>
@@ -34,7 +35,6 @@
#include <QRect>
#include "core/application.h"
#include "core/closure.h"
#include "playlist/playlist.h"
#include "playlist/playlistview.h"
@@ -212,11 +212,16 @@ void MoodbarItemDelegate::StartLoadingColors(const QUrl &url, const QByteArray &
data->state_ = Data::State_LoadingColors;
QFuture<ColorVector> future = QtConcurrent::run(MoodbarRenderer::Colors, bytes, style_, qApp->palette());
NewClosure(future, this, SLOT(ColorsLoaded(QUrl, QFuture<ColorVector>)), url, future);
QFutureWatcher<ColorVector> *watcher = new QFutureWatcher<ColorVector>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<ColorVector>::finished, [this, watcher, url]() {
ColorsLoaded(url, watcher->result());
watcher->deleteLater();
});
}
void MoodbarItemDelegate::ColorsLoaded(const QUrl &url, QFuture<ColorVector> future) {
void MoodbarItemDelegate::ColorsLoaded(const QUrl &url, const ColorVector &colors) {
Data *data = data_[url];
if (!data) {
@@ -227,7 +232,7 @@ void MoodbarItemDelegate::ColorsLoaded(const QUrl &url, QFuture<ColorVector> fut
return;
}
data->colors_ = future.result();
data->colors_ = colors;
// Load the image next.
StartLoadingImage(url, data);
@@ -239,11 +244,16 @@ void MoodbarItemDelegate::StartLoadingImage(const QUrl &url, Data *data) {
data->state_ = Data::State_LoadingImage;
QFuture<QImage> future = QtConcurrent::run(MoodbarRenderer::RenderToImage, data->colors_, data->desired_size_);
NewClosure(future, this, SLOT(ImageLoaded(QUrl, QFuture<QImage>)), url, future);
QFutureWatcher<QImage> *watcher = new QFutureWatcher<QImage>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<QImage>::finished, this, [this, watcher, url]() {
ImageLoaded(url, watcher->result());
watcher->deleteLater();
});
}
void MoodbarItemDelegate::ImageLoaded(const QUrl &url, QFuture<QImage> future) {
void MoodbarItemDelegate::ImageLoaded(const QUrl &url, const QImage &image) {
Data *data = data_[url];
if (!data) {
@@ -254,8 +264,6 @@ void MoodbarItemDelegate::ImageLoaded(const QUrl &url, QFuture<QImage> future) {
return;
}
QImage image(future.result());
// If the desired size changed then don't even bother converting the image
// to a pixmap, just reload it at the new size.
if (!image.isNull() && data->desired_size_ != image.size()) {

View File

@@ -23,7 +23,6 @@
#include <QObject>
#include <QItemDelegate>
#include <QCache>
#include <QFuture>
#include <QSet>
#include <QByteArray>
#include <QString>
@@ -52,8 +51,8 @@ class MoodbarItemDelegate : public QItemDelegate {
void ReloadSettings();
void DataLoaded(const QUrl &url, MoodbarPipeline *pipeline);
void ColorsLoaded(const QUrl &url, QFuture<ColorVector> future);
void ImageLoaded(const QUrl &url, QFuture<QImage> future);
void ColorsLoaded(const QUrl &url, const ColorVector &colors);
void ImageLoaded(const QUrl &url, const QImage &image);
private:
struct Data {

View File

@@ -28,6 +28,8 @@
#include <QtGlobal>
#include <QGuiApplication>
#include <QtConcurrent>
#include <QFuture>
#include <QFutureWatcher>
#include <QAbstractItemModel>
#include <QDialog>
#include <QScreen>
@@ -56,7 +58,6 @@
#include <QCloseEvent>
#include <QSettings>
#include "core/closure.h"
#include "core/iconloader.h"
#include "core/musicstorage.h"
#include "core/tagreaderclient.h"
@@ -394,7 +395,12 @@ bool OrganizeDialog::SetFilenames(const QStringList &filenames) {
#else
songs_future_ = QtConcurrent::run(this, &OrganizeDialog::LoadSongsBlocking, filenames);
#endif
NewClosure(songs_future_, [=]() { SetSongs(songs_future_.result()); });
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
watcher->setFuture(songs_future_);
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [=]() {
SetSongs(watcher->result());
watcher->deleteLater();
});
SetLoadingSongs(true);
return true;

View File

@@ -36,6 +36,7 @@
#include <QCoreApplication>
#include <QtConcurrent>
#include <QFuture>
#include <QFutureWatcher>
#include <QIODevice>
#include <QDataStream>
#include <QBuffer>
@@ -59,7 +60,6 @@
#include <QtDebug>
#include "core/application.h"
#include "core/closure.h"
#include "core/logging.h"
#include "core/mimedata.h"
#include "core/tagreaderclient.h"
@@ -406,7 +406,12 @@ void Playlist::SongSaveComplete(TagReaderReply *reply, const QPersistentModelInd
PlaylistItemPtr item = item_at(idx.row());
if (item) {
QFuture<void> future = item->BackgroundReload();
NewClosure(future, this, SLOT(ItemReloadComplete(QPersistentModelIndex)), idx);
QFutureWatcher<void> *watcher = new QFutureWatcher<void>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<void>::finished, this, [this, watcher, idx]() {
ItemReloadComplete(idx);
watcher->deleteLater();
});
}
}
else {
@@ -1407,20 +1412,24 @@ void Playlist::Restore() {
cancel_restore_ = false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistItems, backend_, id_);
QFuture<PlaylistItemList> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistItems, backend_, id_);
#else
QFuture<QList<PlaylistItemPtr>> future = QtConcurrent::run(backend_, &PlaylistBackend::GetPlaylistItems, id_);
QFuture<PlaylistItemList> future = QtConcurrent::run(backend_, &PlaylistBackend::GetPlaylistItems, id_);
#endif
NewClosure(future, this, SLOT(ItemsLoaded(QFuture<PlaylistItemList>)), future);
QFutureWatcher<PlaylistItemList> *watcher = new QFutureWatcher<PlaylistItemList>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<PlaylistItemList>::finished, this, &Playlist::ItemsLoaded);
}
void Playlist::ItemsLoaded(QFuture<PlaylistItemList> future) {
void Playlist::ItemsLoaded() {
QFutureWatcher<PlaylistItemList> *watcher = static_cast<QFutureWatcher<PlaylistItemList>*>(sender());
PlaylistItemList items = watcher->result();
watcher->deleteLater();
if (cancel_restore_) return;
PlaylistItemList items = future.result();
// Backend returns empty elements for collection items which it couldn't match (because they got deleted); we don't need those
QMutableListIterator<PlaylistItemPtr> it(items);
while (it.hasNext()) {

View File

@@ -377,7 +377,7 @@ class Playlist : public QAbstractListModel {
void QueueLayoutChanged();
void SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex &idx);
void ItemReloadComplete(const QPersistentModelIndex &idx);
void ItemsLoaded(QFuture<PlaylistItemList> future);
void ItemsLoaded();
void SongInsertVetoListenerDestroyed();
private:

View File

@@ -28,6 +28,7 @@
#include <QThread>
#include <QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#include <QAbstractItemModel>
#include <QAbstractItemView>
#include <QCompleter>
@@ -62,7 +63,6 @@
#include <QtEvents>
#include <QLinearGradient>
#include "core/closure.h"
#include "core/iconloader.h"
#include "core/logging.h"
#include "core/player.h"
@@ -405,7 +405,9 @@ static TagCompletionModel *InitCompletionModel(CollectionBackend *backend, Playl
TagCompleter::TagCompleter(CollectionBackend *backend, Playlist::Column column, QLineEdit *editor) : QCompleter(editor), editor_(editor) {
QFuture<TagCompletionModel*> future = QtConcurrent::run(&InitCompletionModel, backend, column);
NewClosure(future, this, SLOT(ModelReady(QFuture<TagCompletionModel*>)), future);
QFutureWatcher<TagCompletionModel*> *watcher = new QFutureWatcher<TagCompletionModel*>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<TagCompletionModel*>::finished, this, &TagCompleter::ModelReady);
}
@@ -413,9 +415,11 @@ TagCompleter::~TagCompleter() {
delete model();
}
void TagCompleter::ModelReady(QFuture<TagCompletionModel*> future) {
void TagCompleter::ModelReady() {
TagCompletionModel *model = future.result();
QFutureWatcher<TagCompletionModel*> *watcher = static_cast<QFutureWatcher<TagCompletionModel*>*>(sender());
TagCompletionModel *model = watcher->result();
watcher->deleteLater();
setModel(model);
setCaseSensitivity(Qt::CaseInsensitive);
editor_->setCompleter(this);

View File

@@ -30,7 +30,6 @@
#include <QStyledItemDelegate>
#include <QStyleOptionViewItem>
#include <QTreeView>
#include <QFuture>
#include <QCompleter>
#include <QLocale>
#include <QVariant>
@@ -151,7 +150,7 @@ class TagCompleter : public QCompleter {
~TagCompleter() override;
private slots:
void ModelReady(QFuture<TagCompletionModel*> future);
void ModelReady();
private:
QLineEdit *editor_;

View File

@@ -29,6 +29,7 @@
#include <QDialog>
#include <QtConcurrent>
#include <QFuture>
#include <QFutureWatcher>
#include <QDir>
#include <QFileDialog>
#include <QFileInfo>
@@ -45,7 +46,6 @@
#include <QtDebug>
#include "core/application.h"
#include "core/closure.h"
#include "core/logging.h"
#include "core/player.h"
#include "core/utilities.h"
@@ -220,18 +220,23 @@ 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.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QFuture<QList<Song>> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id);
QFuture<SongList> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id);
#else
QFuture<QList<Song>> future = QtConcurrent::run(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
QFuture<SongList> future = QtConcurrent::run(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
#endif
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [this, watcher, filename, path_type]() {
ItemsLoadedForSavePlaylist(watcher->result(), filename, path_type);
watcher->deleteLater();
});
}
}
void PlaylistManager::ItemsLoadedForSavePlaylist(QFuture<SongList> future, const QString &filename, const Playlist::Path path_type) {
void PlaylistManager::ItemsLoadedForSavePlaylist(const SongList &songs, const QString &filename, const Playlist::Path path_type) {
parser_->Save(future.result(), filename, path_type);
parser_->Save(songs, filename, path_type);
}

View File

@@ -230,7 +230,7 @@ class PlaylistManager : public PlaylistManagerInterface {
void OneOfPlaylistsChanged();
void UpdateSummaryText();
void SongsDiscovered(const SongList& songs);
void ItemsLoadedForSavePlaylist(QFuture<SongList> future, const QString& filename, const Playlist::Path path_type);
void ItemsLoadedForSavePlaylist(const SongList &songs, const QString& filename, const Playlist::Path path_type);
void PlaylistLoaded();
private:

View File

@@ -757,7 +757,7 @@ void QobuzRequest::FlushAlbumSongsRequests() {
if (request.offset > 0) params << Param("offset", QString::number(request.offset));
QNetworkReply *reply = CreateRequest(QString("album/get"), params);
replies_ << reply;
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request] { AlbumSongsReplyReceived(reply, request.artist_id, request.album_id, request.offset, request.album_artist, request.album); });
QObject::connect(reply, &QNetworkReply::finished, [this, reply, request]() { AlbumSongsReplyReceived(reply, request.artist_id, request.album_id, request.offset, request.album_artist, request.album); });
}

View File

@@ -23,8 +23,9 @@
#include <QObject>
#include <QString>
#include <QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#include "core/closure.h"
#include "core/taskmanager.h"
#include "playlist/playlist.h"
@@ -67,13 +68,17 @@ void PlaylistGeneratorInserter::Load(Playlist *destination, const int row, const
QObject::connect(generator.get(), &PlaylistGenerator::Error, this, &PlaylistGeneratorInserter::Error);
QFuture<PlaylistItemList> future = QtConcurrent::run(PlaylistGeneratorInserter::Generate, generator, dynamic_count);
NewClosure(future, this, SLOT(Finished(QFuture<PlaylistItemList>)), future);
QFutureWatcher<PlaylistItemList> *watcher = new QFutureWatcher<PlaylistItemList>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<PlaylistItemList>::finished, this, &PlaylistGeneratorInserter::Finished);
}
void PlaylistGeneratorInserter::Finished(QFuture<PlaylistItemList> future) {
void PlaylistGeneratorInserter::Finished() {
PlaylistItemList items = future.result();
QFutureWatcher<PlaylistItemList> *watcher = static_cast<QFutureWatcher<PlaylistItemList>*>(sender());
PlaylistItemList items = watcher->result();
watcher->deleteLater();
if (items.isEmpty()) {
if (is_dynamic_) {

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <QObject>
#include <QFuture>
#include <QString>
#include "playlist/playlist.h"
@@ -52,7 +51,7 @@ class PlaylistGeneratorInserter : public QObject {
void PlayRequested(QModelIndex idx, Playlist::AutoScroll autoscroll);
private slots:
void Finished(QFuture<PlaylistItemList> future);
void Finished();
private:
TaskManager *task_manager_;

View File

@@ -26,11 +26,12 @@
#include <QAbstractItemView>
#include <QString>
#include <QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#include "smartplaylistsearchpreview.h"
#include "ui_smartplaylistsearchpreview.h"
#include "core/closure.h"
#include "playlist/playlist.h"
#include "playlistquerygenerator.h"
@@ -115,11 +116,17 @@ void SmartPlaylistSearchPreview::RunSearch(const SmartPlaylistSearch &search) {
ui_->busy_container->show();
ui_->count_label->hide();
QFuture<PlaylistItemList> future = QtConcurrent::run(DoRunSearch, generator_);
NewClosure(future, this, SLOT(SearchFinished(QFuture<PlaylistItemList>)), future);
QFutureWatcher<PlaylistItemList> *watcher = new QFutureWatcher<PlaylistItemList>();
watcher->setFuture(future);
QObject::connect(watcher, &QFutureWatcher<PlaylistItemList>::finished, this, &SmartPlaylistSearchPreview::SearchFinished);
}
void SmartPlaylistSearchPreview::SearchFinished(QFuture<PlaylistItemList> future) {
void SmartPlaylistSearchPreview::SearchFinished() {
QFutureWatcher<PlaylistItemList> *watcher = static_cast<QFutureWatcher<PlaylistItemList>*>(sender());
PlaylistItemList all_items = watcher->result();
watcher->deleteLater();
last_search_ = std::dynamic_pointer_cast<PlaylistQueryGenerator>(generator_)->search();
generator_.reset();
@@ -132,7 +139,6 @@ void SmartPlaylistSearchPreview::SearchFinished(QFuture<PlaylistItemList> future
return;
}
PlaylistItemList all_items = future.result();
PlaylistItemList displayed_items = all_items.mid(0, PlaylistGenerator::kDefaultLimit);
model_->Clear();

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <QWidget>
#include <QFuture>
#include <QList>
#include "smartplaylistsearch.h"
@@ -56,7 +55,7 @@ class SmartPlaylistSearchPreview : public QWidget {
void RunSearch(const SmartPlaylistSearch &search);
private slots:
void SearchFinished(QFuture<PlaylistItemList> future);
void SearchFinished();
private:
Ui_SmartPlaylistSearchPreview *ui_;