Use QListWidget instead of comboboxes
[scorecard] / src / score-dialog.h
1 #ifndef SCORE_DIALOG_H
2 #define SCORE_DIALOG_H
3
4 #include <QDialog>
5 #include <QTableWidget>
6 #include <QListWidget>
7 #include <QComboBox>
8 #include <QLabel>
9 #include <QPushButton>
10 #include <QLayout>
11
12 #include "data.h"
13
14 class SelectDialog: public QDialog
15 {
16   Q_OBJECT
17
18  public:
19   SelectDialog(QWidget *parent = 0);
20
21   void results(QString &club, QString &course, QString &date);
22   void init(QList<Club *> &list);
23
24 private slots:
25   void next(void);
26
27  private:
28
29   bool validate(void);
30   void reject(void);
31
32   void comboBoxCourseUpdate(void);
33   void createLayout(QWidget *parent = 0);
34
35   // Widgets
36   QListWidget  *listClub;
37   QLineEdit    *lineEditDate;
38   QLabel       *labelClub;
39   QLabel       *labelCourse;
40   QPushButton  *pushButtonNext;
41
42   // Layouts
43   QVBoxLayout *leftLayout;
44   QVBoxLayout *rightLayout;
45
46   QList<Club *> clubList;
47 };
48
49 class ScoreDialog: public QDialog
50 {
51   Q_OBJECT
52
53 public:
54   ScoreDialog(QWidget *parent = 0);
55   void init(Course *course);
56   void results(QVector<QString> &scores);
57   bool validate(void);
58
59 private slots:
60   void itemChanged(QTableWidgetItem *item);
61   void moveToNextCell(QTableWidgetItem *item);
62   void finish(void);
63   void up(void);
64   void down(void);
65   void next(void);
66
67 private:
68
69   void createTable(QWidget *parent = 0);
70   void createButton(QWidget *parent = 0);
71   void createLayout(QWidget *parent = 0);
72   void setDefaultScore(QTableWidget *table);
73   
74   enum { ROWS = 8, COLS = 9 };
75   enum { ROW_HOLE = 0, ROW_PAR = 1, ROW_HCP = 2, ROW_SCORE = 3, 
76          ROW_HOLE_2 = 4, ROW_PAR_2 = 5, ROW_HCP_2 = 6, ROW_SCORE_2 = 7};
77
78   void reject(void);
79
80   // Widgets
81   QTableWidget *table;
82
83   QPushButton  *pushButtonFinish;
84   QPushButton  *pushButtonUp;
85   QPushButton  *pushButtonDown;
86   QPushButton  *pushButtonNext;
87
88   // Layouts
89   QVBoxLayout *leftLayout;
90   QVBoxLayout *rightLayout;
91 };
92 #endif