/src/libtomahawk/playlist/albumproxymodel.h

http://github.com/tomahawk-player/tomahawk · C Header · 63 lines · 30 code · 16 blank · 17 comment · 0 complexity · 19c4557a5ed45b43bf74b666466bad50 MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.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 ALBUMPROXYMODEL_H
  19. #define ALBUMPROXYMODEL_H
  20. #include <QSortFilterProxyModel>
  21. #include "playlistinterface.h"
  22. #include "playlist/albummodel.h"
  23. #include "dllmacro.h"
  24. class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel
  25. {
  26. Q_OBJECT
  27. public:
  28. explicit AlbumProxyModel( QObject* parent = 0 );
  29. virtual ~AlbumProxyModel() {}
  30. virtual AlbumModel* sourceModel() const { return m_model; }
  31. virtual void setSourceAlbumModel( AlbumModel* sourceModel );
  32. virtual void setSourceModel( QAbstractItemModel* sourceModel );
  33. virtual int albumCount() const { return rowCount( QModelIndex() ); }
  34. virtual void removeIndex( const QModelIndex& index );
  35. virtual void removeIndexes( const QList<QModelIndex>& indexes );
  36. virtual void emitFilterChanged( const QString &pattern ) { emit filterChanged( pattern ); }
  37. virtual Tomahawk::playlistinterface_ptr playlistInterface();
  38. signals:
  39. void filterChanged( const QString& filter );
  40. protected:
  41. bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
  42. bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
  43. private:
  44. AlbumModel* m_model;
  45. Tomahawk::playlistinterface_ptr m_playlistInterface;
  46. };
  47. #endif // ALBUMPROXYMODEL_H