/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. #ifndef ITUNES_PARSER_H
  21. #define ITUNES_PARSER_H
  22. #include "DllMacro.h"
  23. #include "Typedefs.h"
  24. #include "Query.h"
  25. #include "DropJobNotifier.h"
  26. #include <QObject>
  27. #include <QSet>
  28. #include <QtCore/QStringList>
  29. class NetworkReply;
  30. class TrackModel;
  31. namespace Tomahawk
  32. {
  33. /**
  34. * Small class to parse itunes links into query_ptrs
  35. *
  36. * Connect to the signals to get the results
  37. */
  38. class DLLEXPORT ItunesParser : public QObject
  39. {
  40. Q_OBJECT
  41. public:
  42. explicit ItunesParser( const QString& trackUrl, QObject* parent = 0 );
  43. explicit ItunesParser( const QStringList& trackUrls, QObject* parent = 0 );
  44. virtual ~ItunesParser();
  45. signals:
  46. void track( const Tomahawk::query_ptr& track );
  47. void tracks( const QList< Tomahawk::query_ptr > tracks );
  48. private slots:
  49. void itunesResponseLookupFinished();
  50. private:
  51. QPixmap pixmap() const;
  52. void lookupItunesUri( const QString& track );
  53. void checkTrackFinished();
  54. bool m_single;
  55. QList< query_ptr > m_tracks;
  56. QSet< NetworkReply* > m_queries;
  57. QString m_title, m_info, m_creator;
  58. Tomahawk::playlist_ptr m_playlist;
  59. DropJobNotifier* m_browseJob;
  60. static QPixmap* s_pixmap;
  61. };
  62. }
  63. #endif