2
* Copyright (C) 2011 Canonical, Ltd.
5
* Florian Boucault <florian.boucault@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
#include <QAbstractListModel>
28
#include <UnityCore/Lens.h>
29
#include <UnityCore/HomeLens.h>
42
class Lenses : public QAbstractListModel
48
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
51
explicit Lenses(QObject *parent = 0);
60
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
61
Q_INVOKABLE int rowCount(const QModelIndex& parent = QModelIndex()) const;
63
Q_INVOKABLE QVariant get(int row) const;
64
Q_INVOKABLE QVariant get(const QString& lens_id) const;
66
QHash<int, QByteArray> roleNames() const;
71
void activateLensRequested(const QString& lens_id);
72
void loadedChanged(bool loaded);
75
void onLensAdded(const unity::dash::Lens::Ptr& lens);
76
void onLensesLoaded();
77
void onLensPropertyChanged();
80
unity::dash::Lenses::Ptr m_unityLenses;
81
unity::dash::HomeLens::Ptr m_homeLens;
82
QList<Lens*> m_lenses;
83
QHash<int, QByteArray> m_roles;
86
void addUnityLens(const unity::dash::Lens::Ptr& unity_lens);
87
void removeUnityLens(int index);