/src/libtomahawk/utils/JspfLoader.h

http://github.com/tomahawk-player/tomahawk · C Header · 77 lines · 42 code · 18 blank · 17 comment · 0 complexity · f58bd1c77ef6ea183166d1ad78730376 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. *
  5. * Tomahawk is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Tomahawk is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef JSPFLOADER_H
  19. #define JSPFLOADER_H
  20. #include <QObject>
  21. #include <QUrl>
  22. #include <QFile>
  23. #include <QNetworkReply>
  24. #include <QNetworkRequest>
  25. #include "Playlist.h"
  26. #include "Typedefs.h"
  27. #include "DllMacro.h"
  28. namespace Tomahawk
  29. {
  30. class DLLEXPORT JSPFLoader : public QObject
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit JSPFLoader( bool autoCreate = true, QObject* parent = 0 );
  35. virtual ~JSPFLoader();
  36. QList< Tomahawk::query_ptr > entries() const;
  37. void setOverrideTitle( const QString& newTitle ) { m_overrideTitle = newTitle; }
  38. void setAutoDelete( bool autoDelete ) { m_autoDelete = autoDelete; }
  39. signals:
  40. void failed();
  41. void ok( const Tomahawk::playlist_ptr& );
  42. void tracks( const QList< Tomahawk::query_ptr > tracks );
  43. public slots:
  44. void load( const QUrl& url );
  45. void load( QFile& file );
  46. private slots:
  47. void networkLoadFinished();
  48. void networkError( QNetworkReply::NetworkError e );
  49. private:
  50. void reportError();
  51. void gotBody();
  52. bool m_autoCreate, m_autoDelete;
  53. QList< Tomahawk::query_ptr > m_entries;
  54. QString m_title, m_info, m_creator, m_overrideTitle;
  55. QByteArray m_body;
  56. Tomahawk::playlist_ptr m_playlist;
  57. };
  58. }
  59. #endif // JSPFLOADER_H