/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.h

http://github.com/tomahawk-player/tomahawk · C Header · 92 lines · 53 code · 22 blank · 17 comment · 0 complexity · 11d4a1adae81cce1700411f055a33a80 MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Hugo Lindstr??m <hugolm84@gmail.com>
  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 ChartsPlugin_H
  19. #define ChartsPlugin_H
  20. #include "infosystem/infosystem.h"
  21. #include "infosystem/infosystemworker.h"
  22. #include <QtNetwork/QNetworkReply>
  23. #include <QtCore/QObject>
  24. class QNetworkReply;
  25. namespace Tomahawk
  26. {
  27. namespace InfoSystem
  28. {
  29. class ChartsPlugin : public InfoPlugin
  30. {
  31. Q_OBJECT
  32. public:
  33. ChartsPlugin();
  34. virtual ~ChartsPlugin();
  35. enum ChartType {
  36. None = 0x00,
  37. Track = 0x01,
  38. Album = 0x02,
  39. Artist = 0x04
  40. };
  41. void setChartType( ChartType type ) { m_chartType = type; }
  42. ChartType chartType() const { return m_chartType; }
  43. public slots:
  44. void chartReturned();
  45. void chartTypes();
  46. protected slots:
  47. virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
  48. virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
  49. virtual void pushInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant data )
  50. {
  51. Q_UNUSED( caller )
  52. Q_UNUSED( type )
  53. Q_UNUSED( data )
  54. }
  55. private:
  56. void fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData );
  57. void fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requestData );
  58. void dataError( Tomahawk::InfoSystem::InfoRequestData requestData );
  59. QStringList m_chartResources;
  60. QList< InfoStringHash > m_charts;
  61. ChartType m_chartType;
  62. QVariantMap m_allChartsMap;
  63. uint m_chartsFetchJobs;
  64. QList< InfoRequestData > m_cachedRequests;
  65. QHash< QString, QString > m_cachedCountries;
  66. QWeakPointer< QNetworkAccessManager > m_nam;
  67. };
  68. }
  69. }
  70. #endif // ChartsPlugin_H