Exemple #1
0
Application::Application(QObject* parent)
  : QObject(parent),
    tag_reader_client_(NULL),
    database_(NULL),
    album_cover_loader_(NULL),
    playlist_backend_(NULL),
    podcast_backend_(NULL),
    appearance_(NULL),
    cover_providers_(NULL),
    task_manager_(NULL),
    player_(NULL),
    playlist_manager_(NULL),
    current_art_loader_(NULL),
    global_search_(NULL),
    internet_model_(NULL),
    library_(NULL),
    device_manager_(NULL),
    podcast_updater_(NULL),
    podcast_downloader_(NULL),
    gpodder_sync_(NULL)
{
  tag_reader_client_ = new TagReaderClient(this);
  MoveToNewThread(tag_reader_client_);
  tag_reader_client_->Start();

  database_ = new Database(this, this);
  MoveToNewThread(database_);

  album_cover_loader_ = new AlbumCoverLoader(this);
  MoveToNewThread(album_cover_loader_);

  playlist_backend_ = new PlaylistBackend(this, this);
  MoveToThread(playlist_backend_, database_->thread());

  podcast_backend_ = new PodcastBackend(this, this);
  MoveToThread(podcast_backend_, database_->thread());

  appearance_ = new Appearance(this);
  cover_providers_ = new CoverProviders(this);
  task_manager_ = new TaskManager(this);
  player_ = new Player(this, this);
  playlist_manager_ = new PlaylistManager(this, this);
  current_art_loader_ = new CurrentArtLoader(this, this);
  global_search_ = new GlobalSearch(this, this);
  internet_model_ = new InternetModel(this, this);
  library_ = new Library(this, this);
  device_manager_ = new DeviceManager(this, this);
  podcast_updater_ = new PodcastUpdater(this, this);
  podcast_downloader_ = new PodcastDownloader(this, this);
  gpodder_sync_ = new GPodderSync(this, this);

  library_->Init();
  library_->StartThreads();

  QMetaObject::invokeMethod(database_, "DoBackup", Qt::QueuedConnection);
}
Exemple #2
0
void Application::MoveToNewThread(QObject* object) {
  QThread* thread = new QThread(this);

  MoveToThread(object, thread);

  thread->start();
  threads_ << thread;
}
Exemple #3
0
Application::Application(QObject* parent)
    : QObject(parent),
      tag_reader_client_(nullptr),
      database_(nullptr),
      album_cover_loader_(nullptr),
      playlist_backend_(nullptr),
      podcast_backend_(nullptr),
      appearance_(nullptr),
      cover_providers_(nullptr),
      task_manager_(nullptr),
      player_(nullptr),
      playlist_manager_(nullptr),
      current_art_loader_(nullptr),
      global_search_(nullptr),
      internet_model_(nullptr),
      library_(nullptr),
      device_manager_(nullptr),
      podcast_updater_(nullptr),
      podcast_deleter_(nullptr),
      podcast_downloader_(nullptr),
      gpodder_sync_(nullptr),
      moodbar_loader_(nullptr),
      moodbar_controller_(nullptr),
      network_remote_(nullptr),
      network_remote_helper_(nullptr),
      scrobbler_(nullptr) {
  tag_reader_client_ = new TagReaderClient(this);
  MoveToNewThread(tag_reader_client_);
  tag_reader_client_->Start();

  database_ = new Database(this, this);
  MoveToNewThread(database_);

  album_cover_loader_ = new AlbumCoverLoader(this);
  MoveToNewThread(album_cover_loader_);

  playlist_backend_ = new PlaylistBackend(this, this);
  MoveToThread(playlist_backend_, database_->thread());

  podcast_backend_ = new PodcastBackend(this, this);
  MoveToThread(podcast_backend_, database_->thread());

  appearance_ = new Appearance(this);
  cover_providers_ = new CoverProviders(this);
  task_manager_ = new TaskManager(this);
  player_ = new Player(this, this);
  playlist_manager_ = new PlaylistManager(this, this);
  current_art_loader_ = new CurrentArtLoader(this, this);
  global_search_ = new GlobalSearch(this, this);
  internet_model_ = new InternetModel(this, this);
  library_ = new Library(this, this);
  device_manager_ = new DeviceManager(this, this);
  podcast_updater_ = new PodcastUpdater(this, this);

  podcast_deleter_ = new PodcastDeleter(this, this);
  MoveToNewThread(podcast_deleter_);

  podcast_downloader_ = new PodcastDownloader(this, this);
  gpodder_sync_ = new GPodderSync(this, this);

#ifdef HAVE_MOODBAR
  moodbar_loader_ = new MoodbarLoader(this, this);
  moodbar_controller_ = new MoodbarController(this, this);
#endif

  // Network Remote
  network_remote_ = new NetworkRemote(this);
  MoveToNewThread(network_remote_);

  // This must be before libraray_->Init();
  // In the constructor the helper waits for the signal
  // PlaylistManagerInitialized
  // to start the remote. Without the playlist manager clementine can
  // crash when a client connects before the manager is initialized!
  network_remote_helper_ = new NetworkRemoteHelper(this);

#ifdef HAVE_LIBLASTFM
  scrobbler_ = new LastFMService(this, this);
#endif  // HAVE_LIBLASTFM

  library_->Init();

  DoInAMinuteOrSo(database_, SLOT(DoBackup()));
}