~nick-dedekind/unity8/indicators.hint-interval

« back to all changes in this revision

Viewing changes to tests/mocks/Unity/scopes-ng/fake_preview_model.h

  • Committer: Nick Dedekind
  • Date: 2014-03-07 15:54:57 UTC
  • mfrom: (638.1.118 unity8)
  • Revision ID: nicholas.dedekind@gmail.com-20140307155457-f0s1zu5ll2czt3rq
merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
16
 
 
17
 
 
18
#ifndef NG_FAKE_PREVIEW_H
 
19
#define NG_FAKE_PREVIEW_H
 
20
 
 
21
#include <QAbstractListModel>
 
22
#include <QSharedPointer>
 
23
#include <QVariantMap>
 
24
 
 
25
namespace scopes_ng
 
26
{
 
27
 
 
28
class PreviewData;
 
29
 
 
30
class Q_DECL_EXPORT PreviewModel : public QAbstractListModel
 
31
{
 
32
    Q_OBJECT
 
33
 
 
34
    Q_ENUMS(Roles)
 
35
 
 
36
public:
 
37
    explicit PreviewModel(QObject* parent = 0);
 
38
 
 
39
    enum Roles {
 
40
        RoleWidgetId,
 
41
        RoleType,
 
42
        RoleProperties
 
43
    };
 
44
 
 
45
    QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
 
46
    QHash<int, QByteArray> roleNames() const override;
 
47
    int rowCount(const QModelIndex& parent = QModelIndex()) const override;
 
48
 
 
49
Q_SIGNALS:
 
50
    void actionTriggered(QString widgetId, QString actionId, QVariantMap data);
 
51
 
 
52
public Q_SLOTS:
 
53
    void triggered(QString widgetId, QString actionId, QVariantMap data);
 
54
 
 
55
private:
 
56
    QHash<int, QByteArray> m_roles;
 
57
    QList<QSharedPointer<PreviewData>> m_previewWidgets;
 
58
 
 
59
    void populateWidgets();
 
60
 
 
61
};
 
62
 
 
63
} // namespace scopes_ng
 
64
 
 
65
 
 
66
Q_DECLARE_METATYPE(scopes_ng::PreviewModel*)
 
67
 
 
68
#endif // NG_FAKE_PREVIW_H