summaryrefslogtreecommitdiff
path: root/favoritesmodel.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-02 02:02:19 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-02 02:02:19 +0200
commit9f12671ee8dd38a130a16c9146001c9c2494d77c (patch)
tree7d52a44132c0b4ea3fb46c8e6a8baa7901473ec8 /favoritesmodel.h
parent5f66a8e03f3a748d01e162d151c3a7e987899f09 (diff)
downloadtapasboard-9f12671ee8dd38a130a16c9146001c9c2494d77c.tar.gz
tapasboard-9f12671ee8dd38a130a16c9146001c9c2494d77c.zip
read favorite boards from a .ini instead of hardcoding them
Diffstat (limited to 'favoritesmodel.h')
-rw-r--r--favoritesmodel.h37
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