1
/****************************************************************************************
2
* Copyright (c) 2012 Bart Cerneels <bart.cerneels@kde.org> *
4
* This program is free software; you can redistribute it and/or modify it under *
5
* the terms of the GNU General Public License as published by the Free Software *
6
* Foundation; either version 2 of the License, or (at your option) any later *
9
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
10
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
11
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
13
* You should have received a copy of the GNU General Public License along with *
14
* this program. If not, see <http://www.gnu.org/licenses/>. *
15
****************************************************************************************/
17
#include "MetaProxyWorker.h"
19
#include "core-impl/collections/support/CollectionManager.h"
23
Worker::Worker( const KUrl &url )
24
: Amarok::TrackForUrlWorker( url )
32
Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( m_url );
34
//no TrackProvider has a track for us yet, query new ones that are added.
37
//TODO: should only have to connecto to TrackProvider signals.
38
//Each Collection contains a TrackProvider
39
connect( CollectionManager::instance(),
40
SIGNAL(trackProviderAdded( Collections::TrackProvider * )),
41
SLOT(slotNewTrackProvider( Collections::TrackProvider * )) );
42
connect( CollectionManager::instance(),
43
SIGNAL(collectionAdded( Collections::Collection * )),
44
SLOT(slotNewCollection( Collections::Collection * )) );
49
emit( finishedLookup( track ) );
53
Worker::slotNewTrackProvider( Collections::TrackProvider *newTrackProvider )
55
if( !newTrackProvider )
60
if( newTrackProvider->possiblyContainsTrack( m_url ) )
62
Meta::TrackPtr track = newTrackProvider->trackForUrl( m_url );
63
emit( finishedLookup( track ) );
68
Worker::slotNewCollection( Collections::Collection *newCollection )
75
if( newCollection->possiblyContainsTrack( m_url ) )
77
Meta::TrackPtr track = newCollection->trackForUrl( m_url );
78
emit( finishedLookup( track ) );
82
} // namespace MetaProxy