diff options
Diffstat (limited to 'favoritesmodel.h')
-rw-r--r-- | favoritesmodel.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/favoritesmodel.h b/favoritesmodel.h new file mode 100644 index 0000000..59959d4 --- /dev/null +++ b/favoritesmodel.h @@ -0,0 +1,37 @@ +#ifndef FAVORITESMODEL_H +#define FAVORITESMODEL_H + +#include <QtCore/QAbstractListModel> + +class FavoritesModel : public QAbstractListModel +{ + Q_OBJECT +public: + explicit FavoritesModel(QObject *parent = 0); + + enum DataRoles { + NameRole = Qt::DisplayRole, + LogoRole = Qt::DecorationRole, + + BoardUrlRole = Qt::UserRole + }; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + +protected: + struct FavoriteBoard { + QString name; + QString url; + }; + +private: + void load(); + void save(); + +private: + + QList<FavoriteBoard> _boards; +}; + +#endif // FAVORITESMODEL_H |