From affb215a52423c305357d71ba10f2949c37c9624 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 12 Feb 2016 16:25:01 +0000 Subject: [PATCH] Move cover providers initialisation later in startup. --- src/core/application.cpp | 15 ++++++++++++++- src/internet/lastfm/lastfmservice.cpp | 2 -- src/main.cpp | 8 -------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/core/application.cpp b/src/core/application.cpp index 72ac2ff26..bab3a853f 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -22,7 +22,11 @@ #include "application.h" +#include "covers/amazoncoverprovider.h" +#include "covers/musicbrainzcoverprovider.h" + #ifdef HAVE_LIBLASTFM +#include "covers/lastfmcoverprovider.h" #include "internet/lastfm/lastfmservice.h" #endif // HAVE_LIBLASTFM @@ -63,7 +67,16 @@ Application::Application(QObject* parent) return backend; }), appearance_([=]() { return new Appearance(this); }), - cover_providers_([=]() { return new CoverProviders(this); }), + cover_providers_([=]() { + CoverProviders* cover_providers = new CoverProviders(this); + // Initialize the repository of cover providers. + cover_providers->AddProvider(new AmazonCoverProvider); + cover_providers->AddProvider(new MusicbrainzCoverProvider); + #ifdef HAVE_LIBLASTFM + cover_providers->AddProvider(new LastFmCoverProvider(this)); + #endif + return cover_providers; + }), task_manager_([=]() { return new TaskManager(this); }), player_([=]() { return new Player(this, this); }), playlist_manager_([=]() { return new PlaylistManager(this); }), diff --git a/src/internet/lastfm/lastfmservice.cpp b/src/internet/lastfm/lastfmservice.cpp index ba58b4f85..2c53d6aa9 100644 --- a/src/internet/lastfm/lastfmservice.cpp +++ b/src/internet/lastfm/lastfmservice.cpp @@ -92,8 +92,6 @@ LastFMService::LastFMService(Application* app, QObject* parent) // we emit the signal the first time to be sure the buttons are in the right // state emit ScrobblingEnabledChanged(scrobbling_enabled_); - - app_->cover_providers()->AddProvider(new LastFmCoverProvider(this)); } LastFMService::~LastFMService() {} diff --git a/src/main.cpp b/src/main.cpp index 1a961c805..42d8f0fc0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,9 +56,6 @@ #include "core/song.h" #include "core/ubuntuunityhack.h" #include "core/utilities.h" -#include "covers/amazoncoverprovider.h" -#include "covers/coverproviders.h" -#include "covers/musicbrainzcoverprovider.h" #include "engines/enginebase.h" #include "smartplaylists/generator.h" #include "ui/iconloader.h" @@ -448,11 +445,6 @@ int main(int argc, char* argv[]) { QNetworkProxyFactory::setApplicationProxyFactory( NetworkProxyFactory::Instance()); - // Initialize the repository of cover providers. Last.fm registers itself - // when its service is created. - app.cover_providers()->AddProvider(new AmazonCoverProvider); - app.cover_providers()->AddProvider(new MusicbrainzCoverProvider); - #ifdef Q_OS_LINUX // In 11.04 Ubuntu decided that the system tray should be reserved for certain // whitelisted applications. Clementine will override this setting and insert