Stellarium 0.12.3
SatellitesListFilterModel.hpp
1 /*
2  * Copyright (C) 2013 Bogdan Marinov
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef SATELLITESLISTFILTERMODEL_HPP
20 #define SATELLITESLISTFILTERMODEL_HPP
21 
22 #include <QSortFilterProxyModel>
23 
24 #include "Satellite.hpp" // for the flags
25 
27 class SatellitesListFilterModel : public QSortFilterProxyModel
28 {
29  Q_OBJECT
30 
35  Q_PROPERTY(SatFlag filterFlag
36  READ getFilterFlag
37  WRITE setFilterFlag)
38 
39 
40 
41 
42 
43  Q_PROPERTY(QString filterGroup
44  READ getFilterGroup
45  WRITE setFilterGroup)
46 
47 public:
48  SatellitesListFilterModel(QObject *parent = 0);
49 
50  SatFlag getFilterFlag() const { return filterFlag; }
51  void setFilterFlag(const SatFlag& flag);
52 
53  QString getFilterGroup() const { return filterGroup; }
54  void setFilterGroup(const QString& groupId);
55 
56  void setSecondaryFilters(const QString& groupId,
57  const SatFlag& flag);
58 
59 signals:
60 
61 public slots:
62 
63 protected:
65  bool filterAcceptsRow(int source_row,
66  const QModelIndex& source_parent) const;
67 
68 private:
69  SatFlag filterFlag;
70  QString filterGroup;
71 };
72 
73 #endif // SATELLITESLISTFILTERMODEL_HPP