2
* Copyright (C) 2011 Canonical, Ltd.
5
* Michael Zanetti <michael.zanetti@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/>.
20
#include <QAbstractListModel>
24
class LauncherModel: public QAbstractListModel
30
RoleDesktopFile = Qt::UserRole,
37
LauncherModel(QObject *parent = 0);
40
int rowCount(const QModelIndex &parent) const;
42
QVariant data(const QModelIndex &index, int role) const;
44
Q_INVOKABLE LauncherItem* get(int index) const;
45
Q_INVOKABLE void move(int oldIndex, int newIndex);
47
QHash<int, QByteArray> roleNames() const;
50
QList<LauncherItem*> m_list;
53
class LauncherItem: public QObject
56
Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
57
Q_PROPERTY(QString name READ name CONSTANT)
58
Q_PROPERTY(QString icon READ icon CONSTANT)
59
Q_PROPERTY(bool favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
60
Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
63
LauncherItem(const QString &desktopFile, const QString &name, const QString &icon, QObject *parent = 0);
65
QString desktopFile() const;
70
bool favorite() const;
71
void setFavorite(bool favorite);
74
void setRunning(bool running);
77
void favoriteChanged(bool favorite);
78
void runningChanged(bool running);
81
QString m_desktopFile;