2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
17#ifndef APPLICATION_LIST_MODEL_H
18#define APPLICATION_LIST_MODEL_H
20#include <QAbstractListModel>
21#include <QQmlListProperty>
22#include "ApplicationInfo.h"
24class ApplicationManager;
26class ApplicationListModel : public QAbstractListModel {
29 Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
30 Q_PROPERTY(QQmlListProperty<ApplicationInfo> applications READ applications)
31 Q_CLASSINFO("DefaultProperty", "applications")
34 explicit ApplicationListModel(QObject* parent = 0);
35 virtual ~ApplicationListModel();
37 // QAbstractItemModel methods.
38 int rowCount(const QModelIndex& parent = QModelIndex()) const;
39 QVariant data(const QModelIndex& index, int role) const;
40 QHash<int,QByteArray> roleNames() const { return m_roleNames; }
41 Q_INVOKABLE QVariant get(int index) const;
42 Q_INVOKABLE void move(int from, int to);
44 QQmlListProperty<ApplicationInfo> applications();
46 Q_INVOKABLE void add(ApplicationInfo* application);
47 Q_INVOKABLE void remove(ApplicationInfo* application);
48 Q_INVOKABLE bool contains(ApplicationInfo* application) const;
49 Q_INVOKABLE void clear();
55 Q_DISABLE_COPY(ApplicationListModel)
57 static void appendApplication(QQmlListProperty<ApplicationInfo> *list,
58 ApplicationInfo *application);
59 static int countApplications(QQmlListProperty<ApplicationInfo> *list);
60 static ApplicationInfo* atApplication(QQmlListProperty<ApplicationInfo> *list, int index);
61 static void clearApplications(QQmlListProperty<ApplicationInfo> *list);
63 QHash<int,QByteArray> m_roleNames;
64 QList<ApplicationInfo*> m_applications;
66 friend class ApplicationManager;
69Q_DECLARE_METATYPE(ApplicationListModel*)
71#endif // APPLICATION_LIST_MODEL_H
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list