PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 5ms RepoModel.GetById 36ms app.codeStats 0ms

/src/libtomahawk/utils/ItunesParser.h

http://github.com/tomahawk-player/tomahawk
C Header | 76 lines | 39 code | 13 blank | 24 comment | 0 complexity | 3efe77f538d8d594f690e0025f4f5b53 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Written by Hugo Lindström <hugolm84@gmail.com>
 4 *   But based on Leo Franchi's work from spotifyParser
 5 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 6 *
 7 *   Tomahawk is free software: you can redistribute it and/or modify
 8 *   it under the terms of the GNU General Public License as published by
 9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   Tomahawk is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef ITUNES_PARSER_H
22#define ITUNES_PARSER_H
23
24#include "DllMacro.h"
25#include "Typedefs.h"
26#include "Query.h"
27#include "DropJobNotifier.h"
28
29#include <QObject>
30#include <QSet>
31#include <QtCore/QStringList>
32
33class NetworkReply;
34class TrackModel;
35
36namespace Tomahawk
37{
38
39/**
40 * Small class to parse itunes links into query_ptrs
41 *
42 * Connect to the signals to get the results
43 */
44class DLLEXPORT ItunesParser : public QObject
45{
46    Q_OBJECT
47public:
48    explicit ItunesParser( const QString& trackUrl, QObject* parent = 0 );
49    explicit ItunesParser( const QStringList& trackUrls, QObject* parent = 0 );
50    virtual ~ItunesParser();
51
52signals:
53    void track( const Tomahawk::query_ptr& track );
54    void tracks( const QList< Tomahawk::query_ptr > tracks );
55
56private slots:
57    void itunesResponseLookupFinished();
58
59private:
60    QPixmap pixmap() const;
61    void lookupItunesUri( const QString& track );
62    void checkTrackFinished();
63
64    bool m_single;
65    QList< query_ptr > m_tracks;
66    QSet< NetworkReply* > m_queries;
67    QString m_title, m_info, m_creator;
68    Tomahawk::playlist_ptr m_playlist;
69
70    DropJobNotifier* m_browseJob;
71    static QPixmap* s_pixmap;
72};
73
74}
75
76#endif