File indexing completed on 2025-01-19 04:24:32

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Andrew Coder <andrew.coder@gmail.com>                             *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef PLAYDAR_PROXY_RESOLVER_H
0018 #define PLAYDAR_PROXY_RESOLVER_H
0019 
0020 #include "Controller.h"
0021 #include "../PlaydarCollection.h"
0022 #include "../PlaydarMeta.h"
0023 #include "core-impl/meta/proxy/MetaProxy.h"
0024 
0025 #include <QObject>
0026 
0027 class QUrl;
0028 
0029 namespace Playdar
0030 {
0031     /**
0032      * ProxyResolver takes a MetaProxy::Track and a playdar:// url,
0033      * and updates the Track with a PlaydarTrack if we can find it.
0034      */
0035     class ProxyResolver : public QObject
0036     {
0037         Q_OBJECT
0038         
0039         public:
0040             ProxyResolver( Collections::PlaydarCollection *collection,
0041                            const QUrl &url, const MetaProxy::TrackPtr &track );
0042             ~ProxyResolver() override;
0043         
0044         Q_SIGNALS:
0045             void playdarError( Playdar::Controller::ErrorState );
0046         
0047         private Q_SLOTS:
0048             void slotPlaydarError( Playdar::Controller::ErrorState error );
0049             void collectQuery( Playdar::Query *query );
0050             void collectSolution( Meta::PlaydarTrackPtr track );
0051             void slotQueryDone( Playdar::Query *query, const Meta::PlaydarTrackList & tracks );
0052             
0053         private:
0054             QPointer< Collections::PlaydarCollection > m_collection;
0055             MetaProxy::TrackPtr m_proxyTrack;
0056             Playdar::Controller* m_controller;
0057             Playdar::Query* m_query;
0058     };
0059 }
0060 
0061 #endif