/src/GetNewStuffModel.h

http://github.com/tomahawk-player/tomahawk · C Header · 64 lines · 35 code · 10 blank · 19 comment · 0 complexity · 89f6575bdc17a8abcccf1d26dfbfce14 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 GETNEWSTUFFMODEL_H
  19. #define GETNEWSTUFFMODEL_H
  20. #include <QModelIndex>
  21. #include <attica/content.h>
  22. #include <QPixmap>
  23. class GetNewStuffModel: public QAbstractListModel
  24. {
  25. Q_OBJECT
  26. public:
  27. enum NewStuffRoles {
  28. // DisplayRole is title
  29. // DecorationRole is qicon for item
  30. DownloadUrlRole = Qt::UserRole + 1,
  31. RatingRole = Qt::UserRole + 2,
  32. DownloadCounterRole = Qt::UserRole + 3,
  33. VersionRole = Qt::UserRole + 4,
  34. DescriptionRole = Qt::UserRole + 5,
  35. TypeRole = Qt::UserRole + 6, // Category in attica-speak. What sort of item this is (resolver, etc).
  36. AuthorRole = Qt::UserRole + 7,
  37. StateRole = Qt::UserRole + 8,
  38. UserHasRatedRole = Qt::UserRole + 9
  39. };
  40. enum Types {
  41. ResolverType = 0,
  42. };
  43. explicit GetNewStuffModel( QObject* parent = 0 );
  44. virtual ~GetNewStuffModel();
  45. virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
  46. virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
  47. virtual bool setData( const QModelIndex &index, const QVariant &value, int role );
  48. private slots:
  49. void resolversReloaded( const Attica::Content::List& );
  50. void resolverStateChanged( const QString& resolverId );
  51. private:
  52. Attica::Content::List m_contentList;
  53. };
  54. #endif // GETNEWSTUFFMODEL_H