Try out actually using lambdas for something useful.

This commit is contained in:
John Maguire 2014-04-23 18:05:59 +02:00
parent c7459b1b28
commit b3ef8b0fe0
2 changed files with 4 additions and 4 deletions

View File

@ -155,7 +155,10 @@ bool OrganiseDialog::SetFilenames(const QStringList& filenames) {
QtConcurrent::run(this, &OrganiseDialog::LoadSongsBlocking, filenames);
QFutureWatcher<SongList>* watcher = new QFutureWatcher<SongList>(this);
watcher->setFuture(songs_future_);
connect(watcher, SIGNAL(finished()), SLOT(LoadSongsFinished()));
NewClosure(watcher, SIGNAL(finished()), [&]() {
SetSongs(songs_future_.result());
watcher->deleteLater();
});
SetLoadingSongs(true);
return true;
@ -171,8 +174,6 @@ void OrganiseDialog::SetLoadingSongs(bool loading) {
}
}
void OrganiseDialog::LoadSongsFinished() { SetSongs(songs_future_.result()); }
SongList OrganiseDialog::LoadSongsBlocking(const QStringList& filenames) {
SongList songs;
Song song;

View File

@ -73,7 +73,6 @@ class OrganiseDialog : public QDialog {
void InsertTag(const QString& tag);
void UpdatePreviews();
void LoadSongsFinished();
void OrganiseFinished(const QStringList& files_with_errors);
private: