on 80c6878 help sign in
unity8/plugins/Unity/filter.h
87 lines 2.6 kB history raw
1/*
2 * Copyright (C) 2011, 2013 Canonical, Ltd.
3 *
4 * Authors:
5 * Florian Boucault <florian.boucault@canonical.com>
6 * Pawel Stolowski <pawel.stolowski@canonical.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 3.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
21#ifndef FILTER_H
22#define FILTER_H
24// Qt
25#include <QObject>
26#include <QMetaType>
28// libunity-core
29#include <UnityCore/Filter.h>
31// local
32#include "signalslist.h"
34class GenericOptionsModel;
36class Q_DECL_EXPORT Filter : public QObject
38 Q_OBJECT
40 Q_PROPERTY(QString id READ id NOTIFY idChanged)
41 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
42 Q_PROPERTY(QString iconHint READ iconHint NOTIFY iconHintChanged)
43 Q_PROPERTY(QString rendererName READ rendererName NOTIFY rendererNameChanged)
44 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
45 Q_PROPERTY(bool collapsed READ collapsed NOTIFY collapsedChanged)
46 Q_PROPERTY(bool filtering READ filtering NOTIFY filteringChanged)
47 Q_PROPERTY(GenericOptionsModel* options READ options NOTIFY optionsChanged)
49public:
50 explicit Filter(QObject *parent = nullptr);
52 /* getters */
53 QString id() const;
54 QString name() const;
55 QString iconHint() const;
56 QString rendererName() const;
57 bool visible() const;
58 bool collapsed() const;
59 bool filtering() const;
60 virtual GenericOptionsModel* options() const = 0;
62 Q_INVOKABLE void clear();
64 static Filter* newFromUnityFilter(unity::dash::Filter::Ptr unityFilter);
65 bool hasUnityFilter(unity::dash::Filter::Ptr unityFilter) const;
67Q_SIGNALS:
68 void idChanged(std::string);
69 void nameChanged(std::string);
70 void iconHintChanged(std::string);
71 void rendererNameChanged(std::string);
72 void visibleChanged(bool);
73 void collapsedChanged(bool);
74 void filteringChanged(bool);
75 void optionsChanged();
77protected:
78 unity::dash::Filter::Ptr m_unityFilter;
79 virtual void setUnityFilter(unity::dash::Filter::Ptr unityFilter);
81private:
82 SignalsList m_signals;
83};
85Q_DECLARE_METATYPE(Filter*)
87#endif // FILTER_H