torrentcontentfiltermodel.h 2.43 KB
Newer Older
1 2
/*
 * Bittorrent Client using Qt4 and libtorrent.
3
 * Copyright (C) 2006-2012  Christophe Dumez
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * In addition, as a special exception, the copyright holders give permission to
 * link this program with the OpenSSL project's "OpenSSL" library (or with
 * modified versions of it that use the same license as the "OpenSSL" library),
 * and distribute the linked executables. You must obey the GNU General Public
 * License in all respects for all of the code used other than "OpenSSL".  If you
 * modify file(s), you may extend this exception to your version of the file(s),
 * but you are not obligated to do so. If you do not wish to do so, delete this
 * exception statement from your version.
 *
 * Contact : chris@qbittorrent.org
 */

31 32
#ifndef TORRENTCONTENTFILTERMODEL_H
#define TORRENTCONTENTFILTERMODEL_H
33

34 35
#include <QSortFilterProxyModel>
#include "torrentcontentmodelitem.h"
36
#include "proplistdelegate.h"
37

38
class TorrentContentModel;
39

40
class TorrentContentFilterModel: public QSortFilterProxyModel {
41
  Q_OBJECT
42

43
public:
44 45 46 47
  TorrentContentFilterModel(QObject *parent = 0);
  virtual ~TorrentContentFilterModel();

  TorrentContentModel* model() const;
48
  TorrentContentModelItem::ItemType itemType(const QModelIndex& index) const;
49 50
  int getFileIndex(const QModelIndex& index) const;
  virtual QModelIndex parent(const QModelIndex& child) const;
51 52

signals:
53 54 55 56
  void filteredFilesChanged();

protected:
  virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
57
  virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
58

59
public slots:
60 61 62 63
  void selectAll();
  void selectNone();

private:
64
  TorrentContentModel* m_model;
65
  bool hasFiltered(const QModelIndex& folder) const;
66 67
};

68
#endif // TORRENTCONTENTFILTERMODEL_H