on bbd2cf5 help sign in
unity8/tests/mocks/Unity/fake_previewmodel.h
67 lines 2.0 kB history raw
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
18#ifndef FAKE_PREVIEWMODEL_H
19#define FAKE_PREVIEWMODEL_H
21#include <QAbstractListModel>
22#include <QSharedPointer>
23#include <QVariantMap>
25class PreviewWidgetModel;
27class PreviewModel : public QAbstractListModel
29 Q_OBJECT
31 Q_ENUMS(Roles)
33 Q_PROPERTY(int widgetColumnCount READ widgetColumnCount WRITE setWidgetColumnCount NOTIFY widgetColumnCountChanged)
34 Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
35 Q_PROPERTY(bool processingAction READ processingAction NOTIFY processingActionChanged)
37public:
38 explicit PreviewModel(QObject* parent = 0);
40 enum Roles {
41 RoleColumnModel
42 };
44 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
45 QHash<int, QByteArray> roleNames() const override;
46 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
48 void setWidgetColumnCount(int count);
49 int widgetColumnCount() const;
50 bool loaded() const;
51 bool processingAction() const;
52 void setProcessingAction(bool processing);
54Q_SIGNALS:
55 void widgetColumnCountChanged();
56 void loadedChanged();
57 void processingActionChanged();
58 void triggered(QString const&, QString const&, QVariantMap const&);
60private:
61 QHash<int, QByteArray> m_roles;
62 QList<PreviewWidgetModel*> m_previewWidgetModels;
63};
65Q_DECLARE_METATYPE(PreviewModel*)
67#endif // FAKE_PREVIEWMODEL_H