summaryrefslogtreecommitdiff
path: root/src/availablewidgetsmodel.h
blob: 86114d9c170526f9814996d840371799b4482ab5 (plain)
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
#ifndef AVAILABLEWIDGETSMODEL_H
#define AVAILABLEWIDGETSMODEL_H

#include <QtCore/QAbstractListModel>
#include <QtCore/QFileSystemWatcher>

#include "widgetinfo.h"

class AvailableWidgetsModel : public QAbstractListModel
{
	Q_OBJECT
public:
	explicit AvailableWidgetsModel(QObject *parent = 0);

	enum Roles {
		UrlRole = Qt::UserRole,
		DescriptionRole,
		SizeRole
	};

	QHash<int, QByteArray> roleNames() const;
	int rowCount(const QModelIndex &parent) const;
	QVariant data(const QModelIndex &index, int role) const;

signals:

public slots:
	void reload();

private:
	QFileSystemWatcher *_watcher;
	QVector<WidgetInfo> _widgets;
};

#endif // AVAILABLEWIDGETSMODEL_H