blob: e7c731cff48f75e88bc28824a4e0f7efae4abc3c (
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
36
37
38
39
40
41
42
|
#ifndef FAVORITESMODEL_H
#define FAVORITESMODEL_H
#include <QtCore/QAbstractListModel>
#include <QtCore/QUrl>
class FavoritesModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit FavoritesModel(QObject *parent = 0);
enum DataRoles {
NameRole = Qt::DisplayRole,
LogoRole = Qt::DecorationRole,
BoardUrlRole = Qt::UserRole,
LoginUsernameRole,
LoginPasswordRole
};
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
protected:
struct FavoriteBoard {
QString name;
QUrl url;
QString username;
QString password;
};
private:
void load();
void save();
private:
QList<FavoriteBoard> _boards;
};
#endif // FAVORITESMODEL_H
|