From 85fb48bc51fed06a50b6178727fdf9e96aea4fc4 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sat, 13 Sep 2014 22:40:39 +0200 Subject: UI can now add some widgets around --- src/widgetinfomodel.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/widgetinfomodel.h (limited to 'src/widgetinfomodel.h') diff --git a/src/widgetinfomodel.h b/src/widgetinfomodel.h new file mode 100644 index 0000000..6b30a91 --- /dev/null +++ b/src/widgetinfomodel.h @@ -0,0 +1,46 @@ +#ifndef WIDGETINFOMODEL_H +#define WIDGETINFOMODEL_H + +#include +#include + +#include "widgetinfo.h" + +class WidgetInfoModel : public QAbstractListModel +{ + Q_OBJECT + +public: + explicit WidgetInfoModel(const QString &settingsPrefix, QObject *parent = 0); + + enum Roles { + UrlRole = Qt::UserRole, + InvertRole, + PageRole, + SizeRole, + PositionRole + }; + + QHash roleNames() const; + int rowCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + +signals: + +public slots: + void reload(); + int addWidget(const QUrl &url, int page, WidgetInfo::WidgetPosition pos, WidgetInfo::WidgetSize size); + void removeWidget(int widgetId); + +private: + int findEmptySlot(); + +private slots: + void handleSettingChanged(const QString &key); + +private: + MDConfGroup *_settings; + QVector _widgets; +}; + +#endif // WIDGETINFOMODEL_H -- cgit v1.2.3