-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplicationlist.h
54 lines (44 loc) · 1.19 KB
/
applicationlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef APPLICATIONLIST_H
#define APPLICATIONLIST_H
#include <QAbstractListModel>
#include <QList>
#include <applicationfinder.h>
#include "application.h"
/**
* @brief The Applications class
*
* Generates a list of applications from desktop files
*
*/
class ApplicationList : public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(ApplicationList)
Q_PROPERTY(int count READ count NOTIFY countChanged)
ApplicationFinder m_finder;
QList<Application*> m_data;
public:
enum Roles {
IconRole = Qt::UserRole + 1,
SearchRole,
CommentRole,
IsTerminalRole,
IsHiddenRole,
IsNoDisplayRole
};
explicit ApplicationList(QObject *parent = 0);
virtual ~ApplicationList();
int count() const;
Q_INVOKABLE QObject* get(int index);
// QAbstractItemModel interface
virtual int rowCount(const QModelIndex & = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QHash<int, QByteArray> roleNames() const;
signals:
void countChanged();
void ready();
private slots:
void append(Application* item);
void appsReady();
};
#endif // APPLICATIONLIST_H