2 * Copyright (C) 2009 Sakari Poussa
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.
10 #include <QAbstractTableModel>
17 // TODO: change name to ScoreTableModel
18 class ScoreTableModel : public QAbstractTableModel
24 enum { ViewMode = 0, EditMode = 1 };
26 ScoreTableModel(QObject *parent = 0) : QAbstractTableModel(parent)
32 currentMode = ViewMode;
34 Qt::ItemFlags flags ( const QModelIndex & index );
37 void setScore(QList<Score *> &sList, Score *score = 0);
38 Score *getScore(void);
39 void setClub(QList<Club *> &cList);
41 Course *getCourse(void);
43 Course *findCourse(const QString &clubName, const QString &courseName);
44 QString& clubName(void);
45 QString& courseName(void);
46 int rowCount(const QModelIndex & parent) const;
47 int columnCount(const QModelIndex & parent) const;
48 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
49 QVariant data(const QModelIndex & index, int role) const;
50 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
52 int setItem(int row, int col, int data);
54 QString getInfoText();
55 QString getCountText();
64 enum { ROWS = 8, COLS = 9 };
65 enum { ROW_HOLE = 0, ROW_PAR = 1, ROW_HCP = 2, ROW_SCORE = 3,
66 ROW_HOLE_2 = 4, ROW_PAR_2 = 5, ROW_HCP_2 = 6, ROW_SCORE_2 = 7};
68 QList<Score *> scoreList;
69 QList<Club *> clubList;
73 // Current data pointers