b6a54ef4dc4117db80af7d1800be6e25e279ec43
[scorecard] / src / course-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 COURSE_DIALOG_H
10 #define COURSE_DIALOG_H
11
12 #include <QtGui>
13 #include <QDialog>
14 #include <QLabel>
15 #include <QGroupBox>
16 #include <QDialogButtonBox>
17 #include <QLineEdit>
18 #include <QDebug>
19
20 #include "data.h"
21
22 QT_BEGIN_NAMESPACE
23 class QTableWidget;
24 class QTableWidgetItem;
25 QT_END_NAMESPACE
26
27 class CourseSelectDialog: public QDialog
28 {
29   Q_OBJECT
30
31  public:
32   CourseSelectDialog(QWidget *parent = 0);
33
34   void results(QString &club, QString &course);
35
36 private slots:
37   void next(void);
38
39  private:
40
41   void createLayout(QWidget *parent);
42   bool validate(void);
43
44   QLineEdit    *lineEditClub;
45   QLineEdit    *lineEditCourse;
46   QLabel       *labelClub;
47   QLabel       *labelCourse;
48   QPushButton  *pushButtonNext;
49
50   // Layouts
51   QVBoxLayout *leftLayout;
52   QVBoxLayout *rightLayout;
53 };
54
55 class CourseDialog: public QDialog
56 {
57   Q_OBJECT
58
59  public:
60   CourseDialog(QWidget *w);
61   void results(QVector<QString> &, QVector<QString> &, QVector<QString> &);
62   bool validate();
63   void init(Course *course = 0);
64
65  private slots:
66   void up(void);
67   void down(void);
68   void next(void);
69   void finish(void);
70
71  private:
72   enum { ROW_HOLE = 0, ROW_PAR = 1, ROW_HCP = 2, ROW_LEN = 3, 
73          ROW_HOLE_2 = 4, ROW_PAR_2 = 5, ROW_HCP_2 = 6, ROW_LEN_2 = 7};
74   enum { ROWS = 8, COLS = 9, separator_row = 3 };
75
76   void createTable(QWidget *parent = 0);
77   void createButton(QWidget *parent = 0);
78   void createLayout(QWidget *parent = 0);
79   void moveToNextCell(QTableWidgetItem *item);
80
81   // Widgets
82   QTableWidget *table;
83
84   QPushButton *pushButtonUp;
85   QPushButton *pushButtonDown;
86   QPushButton *pushButtonNext;
87   QPushButton *pushButtonFinish;
88
89   // Layouts
90   QVBoxLayout *rightLayout;
91   QVBoxLayout *leftLayout;
92 };
93
94 #endif