~mzanetti/unity8/modeswitchwarning

« back to all changes in this revision

Viewing changes to plugins/Utils/applicationsfiltermodel.h

  • Committer: Michael Zanetti
  • Date: 2015-10-09 09:57:09 UTC
  • Revision ID: michael.zanetti@canonical.com-20151009095709-ys1oyiur58m5locd
added a filter model for apps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef APPLICATIONSFILTERMODEL_H
 
2
#define APPLICATIONSFILTERMODEL_H
 
3
 
 
4
#include <QSortFilterProxyModel>
 
5
 
 
6
namespace unity {
 
7
namespace shell {
 
8
namespace application {
 
9
class ApplicationManagerInterface;
 
10
}
 
11
}
 
12
}
 
13
using namespace unity::shell::application;
 
14
 
 
15
class ApplicationsFilterModel: public QSortFilterProxyModel
 
16
{
 
17
    Q_OBJECT
 
18
 
 
19
    Q_PROPERTY(ApplicationManagerInterface* applicationsModel READ applicationsModel WRITE setApplicationsModel NOTIFY applicationsModelChanged)
 
20
    Q_PROPERTY(bool filterTouchApps READ filterTouchApps WRITE setFilterTouchApps NOTIFY filterTouchAppsChanged)
 
21
    Q_PROPERTY(bool filterLegacyApps READ filterLegacyApps WRITE setFilterLegacyApps NOTIFY filterLegacyAppsChanged)
 
22
 
 
23
public:
 
24
    ApplicationsFilterModel(QObject *parent = 0);
 
25
 
 
26
    ApplicationManagerInterface* applicationsModel() const;
 
27
    void setApplicationsModel(ApplicationManagerInterface* applicationsModel);
 
28
 
 
29
    bool filterTouchApps() const;
 
30
    void setFilterTouchApps(bool filterTouchApps);
 
31
 
 
32
    bool filterLegacyApps() const;
 
33
    void setFilterLegacyApps(bool filterLegacyApps);
 
34
 
 
35
    bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
 
36
 
 
37
Q_SIGNALS:
 
38
    void applicationsModelChanged();
 
39
    void filterTouchAppsChanged();
 
40
    void filterLegacyAppsChanged();
 
41
 
 
42
private:
 
43
    ApplicationManagerInterface* m_appModel;
 
44
    bool m_filterTouchApps;
 
45
    bool m_filterLegacyApps;
 
46
};
 
47
 
 
48
#endif