PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/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
19#ifndef ALBUMPROXYMODEL_H
20#define ALBUMPROXYMODEL_H
21
22#include <QSortFilterProxyModel>
23
24#include "playlistinterface.h"
25#include "playlist/albummodel.h"
26
27#include "dllmacro.h"
28
29class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel
30{
31Q_OBJECT
32
33public:
34    explicit AlbumProxyModel( QObject* parent = 0 );
35    virtual ~AlbumProxyModel() {}
36
37    virtual AlbumModel* sourceModel() const { return m_model; }
38    virtual void setSourceAlbumModel( AlbumModel* sourceModel );
39    virtual void setSourceModel( QAbstractItemModel* sourceModel );
40
41    virtual int albumCount() const { return rowCount( QModelIndex() ); }
42
43    virtual void removeIndex( const QModelIndex& index );
44    virtual void removeIndexes( const QList<QModelIndex>& indexes );
45
46    virtual void emitFilterChanged( const QString &pattern ) { emit filterChanged( pattern ); }
47
48    virtual Tomahawk::playlistinterface_ptr playlistInterface();
49
50signals:
51    void filterChanged( const QString& filter );
52
53protected:
54    bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
55    bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
56
57private:
58    AlbumModel* m_model;
59
60    Tomahawk::playlistinterface_ptr m_playlistInterface;
61};
62
63#endif // ALBUMPROXYMODEL_H