Remove capture of ‘this’ via ‘[=]’
This commit is contained in:
parent
38ce208a43
commit
bfd9e76f40
@ -99,33 +99,33 @@ using namespace std::chrono_literals;
|
||||
class ApplicationImpl {
|
||||
public:
|
||||
explicit ApplicationImpl(Application *app) :
|
||||
tag_reader_client_([=]() {
|
||||
tag_reader_client_([app]() {
|
||||
TagReaderClient *client = new TagReaderClient(app);
|
||||
app->MoveToNewThread(client);
|
||||
client->Start();
|
||||
return client;
|
||||
}),
|
||||
database_([=]() {
|
||||
database_([app]() {
|
||||
Database *db = new Database(app, app);
|
||||
app->MoveToNewThread(db);
|
||||
QTimer::singleShot(30s, db, &Database::DoBackup);
|
||||
return db;
|
||||
}),
|
||||
appearance_([=]() { return new Appearance(app); }),
|
||||
task_manager_([=]() { return new TaskManager(app); }),
|
||||
player_([=]() { return new Player(app, app); }),
|
||||
device_finders_([=]() { return new DeviceFinders(app); }),
|
||||
appearance_([app]() { return new Appearance(app); }),
|
||||
task_manager_([app]() { return new TaskManager(app); }),
|
||||
player_([app]() { return new Player(app, app); }),
|
||||
device_finders_([app]() { return new DeviceFinders(app); }),
|
||||
#ifndef Q_OS_WIN
|
||||
device_manager_([=]() { return new DeviceManager(app, app); }),
|
||||
device_manager_([app]() { return new DeviceManager(app, app); }),
|
||||
#endif
|
||||
collection_([=]() { return new SCollection(app, app); }),
|
||||
playlist_backend_([=]() {
|
||||
collection_([app]() { return new SCollection(app, app); }),
|
||||
playlist_backend_([this, app]() {
|
||||
PlaylistBackend *backend = new PlaylistBackend(app, app);
|
||||
app->MoveToThread(backend, database_->thread());
|
||||
return backend;
|
||||
}),
|
||||
playlist_manager_([=]() { return new PlaylistManager(app); }),
|
||||
cover_providers_([=]() {
|
||||
playlist_manager_([app]() { return new PlaylistManager(app); }),
|
||||
cover_providers_([app]() {
|
||||
CoverProviders *cover_providers = new CoverProviders(app);
|
||||
// Initialize the repository of cover providers.
|
||||
cover_providers->AddProvider(new LastFmCoverProvider(app, cover_providers->network(), app));
|
||||
@ -143,13 +143,13 @@ class ApplicationImpl {
|
||||
cover_providers->ReloadSettings();
|
||||
return cover_providers;
|
||||
}),
|
||||
album_cover_loader_([=]() {
|
||||
album_cover_loader_([app]() {
|
||||
AlbumCoverLoader *loader = new AlbumCoverLoader(app);
|
||||
app->MoveToNewThread(loader);
|
||||
return loader;
|
||||
}),
|
||||
current_albumcover_loader_([=]() { return new CurrentAlbumCoverLoader(app, app); }),
|
||||
lyrics_providers_([=]() {
|
||||
current_albumcover_loader_([app]() { return new CurrentAlbumCoverLoader(app, app); }),
|
||||
lyrics_providers_([app]() {
|
||||
LyricsProviders *lyrics_providers = new LyricsProviders(app);
|
||||
// Initialize the repository of lyrics providers.
|
||||
lyrics_providers->AddProvider(new AuddLyricsProvider(lyrics_providers->network(), app));
|
||||
@ -161,7 +161,7 @@ class ApplicationImpl {
|
||||
lyrics_providers->ReloadSettings();
|
||||
return lyrics_providers;
|
||||
}),
|
||||
internet_services_([=]() {
|
||||
internet_services_([app]() {
|
||||
InternetServices *internet_services = new InternetServices(app);
|
||||
#ifdef HAVE_SUBSONIC
|
||||
internet_services->AddService(new SubsonicService(app, internet_services));
|
||||
@ -174,13 +174,13 @@ class ApplicationImpl {
|
||||
#endif
|
||||
return internet_services;
|
||||
}),
|
||||
radio_services_([=]() { return new RadioServices(app, app); }),
|
||||
scrobbler_([=]() { return new AudioScrobbler(app, app); }),
|
||||
radio_services_([app]() { return new RadioServices(app, app); }),
|
||||
scrobbler_([app]() { return new AudioScrobbler(app, app); }),
|
||||
#ifdef HAVE_MOODBAR
|
||||
moodbar_loader_([=]() { return new MoodbarLoader(app, app); }),
|
||||
moodbar_controller_([=]() { return new MoodbarController(app, app); }),
|
||||
moodbar_loader_([app]() { return new MoodbarLoader(app, app); }),
|
||||
moodbar_controller_([app]() { return new MoodbarController(app, app); }),
|
||||
#endif
|
||||
lastfm_import_([=]() { return new LastFMImport(app); })
|
||||
lastfm_import_([app]() { return new LastFMImport(app); })
|
||||
{}
|
||||
|
||||
Lazy<TagReaderClient> tag_reader_client_;
|
||||
|
@ -241,7 +241,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||
app_(app),
|
||||
tray_icon_(tray_icon),
|
||||
osd_(osd),
|
||||
console_([=]() {
|
||||
console_([app]() {
|
||||
Console *console = new Console(app);
|
||||
return console;
|
||||
}),
|
||||
@ -259,7 +259,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||
playlist_list_(new PlaylistListContainer(this)),
|
||||
queue_view_(new QueueView(this)),
|
||||
settings_dialog_(std::bind(&MainWindow::CreateSettingsDialog, this)),
|
||||
cover_manager_([=]() {
|
||||
cover_manager_([this, app]() {
|
||||
AlbumCoverManager *cover_manager = new AlbumCoverManager(app, app->collection_backend(), this);
|
||||
cover_manager->Init();
|
||||
|
||||
@ -269,18 +269,18 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||
return cover_manager;
|
||||
}),
|
||||
equalizer_(new Equalizer),
|
||||
organize_dialog_([=]() {
|
||||
organize_dialog_([this, app]() {
|
||||
OrganizeDialog *dialog = new OrganizeDialog(app->task_manager(), app->collection_backend(), this);
|
||||
dialog->SetDestinationModel(app->collection()->model()->directory_model());
|
||||
return dialog;
|
||||
}),
|
||||
#ifdef HAVE_GSTREAMER
|
||||
transcode_dialog_([=]() {
|
||||
transcode_dialog_([this]() {
|
||||
TranscodeDialog *dialog = new TranscodeDialog(this);
|
||||
return dialog;
|
||||
}),
|
||||
#endif
|
||||
add_stream_dialog_([=]() {
|
||||
add_stream_dialog_([this]() {
|
||||
AddStreamDialog *add_stream_dialog = new AddStreamDialog;
|
||||
QObject::connect(add_stream_dialog, &AddStreamDialog::accepted, this, &MainWindow::AddStreamAccepted);
|
||||
return add_stream_dialog;
|
||||
|
@ -658,7 +658,7 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
|
||||
QFuture<SongList> future = QtConcurrent::run(app_->collection_backend(), &CollectionBackend::GetAlbumSongs, song.effective_albumartist(), song.effective_album(), QueryOptions());
|
||||
#endif
|
||||
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [=]() {
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [this, watcher, song, result]() {
|
||||
SongList songs = watcher->result();
|
||||
watcher->deleteLater();
|
||||
QList<QUrl> urls;
|
||||
@ -703,7 +703,7 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
|
||||
QFuture<SongList> future = QtConcurrent::run(app_->collection_backend(), &CollectionBackend::GetAlbumSongs, song.effective_albumartist(), song.effective_album(), QueryOptions());
|
||||
#endif
|
||||
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [=]() {
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [this, watcher, song, cover_filename]() {
|
||||
SongList songs = watcher->result();
|
||||
watcher->deleteLater();
|
||||
QList<QUrl> urls;
|
||||
|
@ -1182,7 +1182,7 @@ void EditTagDialog::SaveData() {
|
||||
++save_art_pending_;
|
||||
QFuture<QByteArray> future = QtConcurrent::run(&ImageUtils::SaveImageToJpegData, ref.cover_result_.image);
|
||||
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>();
|
||||
QObject::connect(watcher, &QFutureWatcher<QByteArray>::finished, this, [=]() {
|
||||
QObject::connect(watcher, &QFutureWatcher<QByteArray>::finished, this, [this, watcher, ref]() {
|
||||
TagReaderReply *reply = TagReaderClient::Instance()->SaveEmbeddedArt(ref.current_.url().toLocalFile(), watcher->result());
|
||||
QObject::connect(reply, &TagReaderReply::Finished, this, [this, reply, ref]() {
|
||||
SongSaveArtComplete(reply, ref.current_.url().toLocalFile(), ref.current_, ref.cover_action_);
|
||||
@ -1195,7 +1195,7 @@ void EditTagDialog::SaveData() {
|
||||
++save_art_pending_;
|
||||
QFuture<QByteArray> future = QtConcurrent::run(&ImageUtils::FileToJpegData, embedded_cover_from_file);
|
||||
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>();
|
||||
QObject::connect(watcher, &QFutureWatcher<QByteArray>::finished, this, [=]() {
|
||||
QObject::connect(watcher, &QFutureWatcher<QByteArray>::finished, this, [this, watcher, ref]() {
|
||||
TagReaderReply *reply = TagReaderClient::Instance()->SaveEmbeddedArt(ref.current_.url().toLocalFile(), watcher->result());
|
||||
QObject::connect(reply, &TagReaderReply::Finished, this, [this, reply, ref]() {
|
||||
SongSaveArtComplete(reply, ref.current_.url().toLocalFile(), ref.current_, ref.cover_action_);
|
||||
|
@ -70,7 +70,7 @@ void SomaFMService::GetChannels() {
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
const int task_id = app_->task_manager()->StartTask(tr("Getting %1 channels").arg(name_));
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [=]() { GetChannelsReply(reply, task_id); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, task_id]() { GetChannelsReply(reply, task_id); });
|
||||
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void SomaFMService::GetStreamUrl(const int task_id, const RadioChannel &channel)
|
||||
QNetworkRequest req(channel.url);
|
||||
QNetworkReply *reply = network_->get(req);
|
||||
replies_ << reply;
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [=]() { GetStreamUrlsReply(reply, task_id, channel); });
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, task_id, channel]() { GetStreamUrlsReply(reply, task_id, channel); });
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user