Use lambdas for QtConcurrent::run instead of NewClosure

This commit is contained in:
Jonas Kvinge
2020-07-18 16:28:39 +02:00
parent 425dac478e
commit af67de8aa6
12 changed files with 25 additions and 47 deletions

View File

@@ -25,7 +25,7 @@
#include <QtGlobal>
#include <QObject>
#include <QDialog>
#include <QtConcurrentRun>
#include <QtConcurrent>
#include <QFuture>
#include <QDir>
#include <QFileDialog>
@@ -42,7 +42,6 @@
#include <QtDebug>
#include "core/application.h"
#include "core/closure.h"
#include "core/logging.h"
#include "core/player.h"
#include "core/utilities.h"
@@ -211,18 +210,11 @@ void PlaylistManager::Save(int id, const QString &filename, Playlist::Path path_
}
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(playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
NewClosure(future, this, SLOT(ItemsLoadedForSavePlaylist(QFuture<SongList>, QString, Playlist::Path)), future, filename, path_type);
(void)QtConcurrent::run([=]() { parser_->Save(playlist_backend_->GetPlaylistSongs(id), filename, path_type); });
}
}
void PlaylistManager::ItemsLoadedForSavePlaylist(QFuture<SongList> future, const QString &filename, Playlist::Path path_type) {
parser_->Save(future.result(), filename, path_type);
}
void PlaylistManager::SaveWithUI(int id, const QString &playlist_name) {
QSettings settings;