/* This file is part of Clementine. Copyright 2010, David Sansome Clementine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Clementine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Clementine. If not, see . */ #include "mpris.h" #include "mpris1.h" #include "mpris2.h" #include #include #include namespace mpris { Mpris::Mpris(Player* player, ArtLoader* art_loader, QObject* parent) : QObject(parent), player_(player), art_loader_(art_loader), mpris1_(NULL), mpris2_(NULL) { qDebug() << __PRETTY_FUNCTION__; QFuture future = QtConcurrent::run(this, &Mpris::Init); QFutureWatcher* watcher = new QFutureWatcher(this); watcher->setFuture(future); connect(watcher, SIGNAL(finished()), SLOT(Initialised())); } void Mpris::Init() { qDebug() << __PRETTY_FUNCTION__ << "- starting"; qDebug() << __PRETTY_FUNCTION__ << "- registering MPRIS1"; mpris1_ = new mpris::Mpris1(player_, art_loader_); qDebug() << __PRETTY_FUNCTION__ << "- registering MPRIS2"; mpris2_ = new mpris::Mpris2(player_, art_loader_, mpris1_); mpris1_->moveToThread(thread()); mpris2_->moveToThread(thread()); mpris1_->setParent(this); mpris2_->setParent(this); connect(mpris2_, SIGNAL(RaiseMainWindow()), SIGNAL(RaiseMainWindow())); qDebug() << __PRETTY_FUNCTION__ << "- complete"; } void Mpris::Initialised() { qDebug() << __PRETTY_FUNCTION__; mpris2_->InitLibIndicate(); } } // namespace mpris