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