Move cover providers initialisation later in startup.

This commit is contained in:
John Maguire 2016-02-12 16:25:01 +00:00
parent dcdd81d69f
commit affb215a52
3 changed files with 14 additions and 11 deletions

View File

@ -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); }),

View File

@ -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() {}

View File

@ -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