PageRenderTime 127ms CodeModel.GetById 61ms app.highlight 12ms RepoModel.GetById 48ms app.codeStats 1ms

/src/libtomahawk/utils/ShortenedLinkParser.h

http://github.com/tomahawk-player/tomahawk
C Header | 73 lines | 33 code | 16 blank | 24 comment | 0 complexity | c602548e7da65f2a09fae5f45eabd496 MD5 | raw file
 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, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 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 SNORTENED_LINK_PARSER_H
21#define SNORTENED_LINK_PARSER_H
22
23#include "DllMacro.h"
24#include "Typedefs.h"
25
26#include <QObject>
27#include <QPixmap>
28#include <QSet>
29#include <QStringList>
30
31class NetworkReply;
32
33namespace Tomahawk
34{
35
36class DropJobNotifier;
37
38/**
39 * Small class to parse whitelisted shortened links into the redirected urls
40 *
41 * Connect to urls() to get the result
42 *
43 */
44class DLLEXPORT ShortenedLinkParser : public QObject
45{
46    Q_OBJECT
47
48public:
49    explicit ShortenedLinkParser( const QStringList& urls, QObject* parent = 0 );
50    virtual ~ShortenedLinkParser();
51
52    static bool handlesUrl( const QString& url );
53
54public slots:
55    void lookupFinished( const QUrl& url );
56
57signals:
58    void urls( const QStringList& urls );
59
60private:
61    void lookupUrl( const QString& url );
62    void checkFinished();
63
64    static QPixmap pixmap();
65
66    QStringList m_links;
67    QSet< NetworkReply* > m_queries;
68    DropJobNotifier* m_expandJob;
69};
70
71}
72
73#endif