/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. #ifndef SNORTENED_LINK_PARSER_H
  20. #define SNORTENED_LINK_PARSER_H
  21. #include "DllMacro.h"
  22. #include "Typedefs.h"
  23. #include <QObject>
  24. #include <QPixmap>
  25. #include <QSet>
  26. #include <QStringList>
  27. class NetworkReply;
  28. namespace Tomahawk
  29. {
  30. class DropJobNotifier;
  31. /**
  32. * Small class to parse whitelisted shortened links into the redirected urls
  33. *
  34. * Connect to urls() to get the result
  35. *
  36. */
  37. class DLLEXPORT ShortenedLinkParser : public QObject
  38. {
  39. Q_OBJECT
  40. public:
  41. explicit ShortenedLinkParser( const QStringList& urls, QObject* parent = 0 );
  42. virtual ~ShortenedLinkParser();
  43. static bool handlesUrl( const QString& url );
  44. public slots:
  45. void lookupFinished( const QUrl& url );
  46. signals:
  47. void urls( const QStringList& urls );
  48. private:
  49. void lookupUrl( const QString& url );
  50. void checkFinished();
  51. static QPixmap pixmap();
  52. QStringList m_links;
  53. QSet< NetworkReply* > m_queries;
  54. DropJobNotifier* m_expandJob;
  55. };
  56. }
  57. #endif