Merge branch 'master' of /opt/src/sb1/qt/scorecard
[scorecard] / src / list-model.h
1 /*
2  * Copyright (C) 2009 Sakari Poussa
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 2.
7  */
8
9 #include <QStringList>
10 #include <QAbstractListModel>
11
12 #include "data.h"
13
14 class ScoreListModel : public QAbstractListModel
15 {
16     Q_OBJECT
17
18 public:
19
20     ScoreListModel(QList<Score *> &sList, QList<Club *> &cList, QObject *parent = 0) 
21         : QAbstractListModel(parent), scoreList(sList), clubList(cList) {}
22         
23     QVariant data(const QModelIndex & index, int role) const;
24     int rowCount(const QModelIndex & parent) const;
25
26     void update(QList<Score *> &list);
27
28  private:
29     QList<Score *> scoreList;
30     QList<Club *> clubList;
31 };
32
33 class CourseListModel : public QAbstractListModel
34 {
35     Q_OBJECT
36
37 public:
38
39     CourseListModel(QList<Club *> &list, QObject *parent = 0);
40
41     int rowCount(const QModelIndex & parent) const;
42     QVariant data(const QModelIndex & index, int role) const;
43     void update(QList<Club *> &list);
44     void updateList();
45
46 private:
47     QList<Club *> clubList;
48     QList<QString *> clubAndCourseList;
49 };