~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/libtomahawk/utils/ExfmParser.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
Import upstream version 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 
2
 *
 
3
 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 
4
 *   Copyright 2010-2011, Hugo Lindström <hugolm84@gmail.com>
 
5
 *
 
6
 *   Tomahawk is free software: you can redistribute it and/or modify
 
7
 *   it under the terms of the GNU General Public License as published by
 
8
 *   the Free Software Foundation, either version 3 of the License, or
 
9
 *   (at your option) any later version.
 
10
 *
 
11
 *   Tomahawk is distributed in the hope that it will be useful,
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
 *   GNU General Public License for more details.
 
15
 *
 
16
 *   You should have received a copy of the GNU General Public License
 
17
 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef Exfm_PARSER_H
 
21
#define Exfm_PARSER_H
 
22
 
 
23
#include "DllMacro.h"
 
24
#include "Typedefs.h"
 
25
#include "Query.h"
 
26
#include "DropJob.h"
 
27
#include "jobview/JobStatusItem.h"
 
28
#include <QObject>
 
29
#include <QtCore/QStringList>
 
30
 
 
31
/**
 
32
 * Small class to parse Exfm links into query_ptrs
 
33
 *
 
34
 * Connect to the signals to get the results
 
35
 */
 
36
 
 
37
class NetworkReply;
 
38
 
 
39
namespace Tomahawk
 
40
{
 
41
 
 
42
class DropJobNotifier;
 
43
 
 
44
class DLLEXPORT ExfmParser : public QObject
 
45
{
 
46
    Q_OBJECT
 
47
public:
 
48
    friend class ExfmJobNotifier;
 
49
    explicit ExfmParser( const QString& trackUrl, bool createNewPlaylist = false, QObject* parent = 0 );
 
50
    explicit ExfmParser( const QStringList& trackUrls, bool createNewPlaylist = false, QObject* parent = 0 );
 
51
    virtual ~ExfmParser();
 
52
 
 
53
    // if true, emits track(), if false, emits tracks().
 
54
    // only matters if you're using the QString constructor and explicityl dont' want
 
55
    // the single track signal
 
56
    void setSingleMode( bool single ) { m_single = single; }
 
57
 
 
58
signals:
 
59
    void track( const Tomahawk::query_ptr& track );
 
60
    void tracks( const QList< Tomahawk::query_ptr > tracks );
 
61
    void playlist( const Tomahawk::query_ptr& playlist );
 
62
 
 
63
private slots:
 
64
    void exfmBrowseFinished();
 
65
    void exfmLookupFinished();
 
66
    void playlistCreated();
 
67
 
 
68
private:
 
69
    QPixmap pixmap() const;
 
70
    void lookupUrl( const QString& url );
 
71
    void checkBrowseFinished();
 
72
    void parseTrack( const QVariantMap& res );
 
73
 
 
74
    bool m_single;
 
75
    bool m_trackMode;
 
76
    bool m_createNewPlaylist;
 
77
 
 
78
    int m_subscribers;
 
79
    QList< query_ptr > m_tracks;
 
80
    QSet< NetworkReply* > m_queries;
 
81
    Tomahawk::playlist_ptr m_playlist;
 
82
    DropJobNotifier* m_browseJob;
 
83
    DropJob::DropType m_type;
 
84
    static QPixmap* s_pixmap;
 
85
};
 
86
 
 
87
}
 
88
 
 
89
#endif