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