Fixes in backup configuration file (scorecard.conf). Backup works now.
[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 #include "table-model.h"
22
23 QT_BEGIN_NAMESPACE
24 class QTableWidget;
25 class QTableWidgetItem;
26 QT_END_NAMESPACE
27
28 class CourseWindow: public QMainWindow
29 {
30     Q_OBJECT;
31
32 public:
33     CourseWindow(QWidget *parent = 0);
34
35     void setup(Course *course);
36
37 private:
38     CourseTableModel *model;
39 };
40
41 class CourseSelectDialog: public QDialog
42 {
43   Q_OBJECT
44
45  public:
46   CourseSelectDialog(QWidget *parent = 0);
47
48   void results(QString &club, QString &course);
49
50 private slots:
51   void next(void);
52
53  private:
54
55   void createLayout(QWidget *parent);
56   void showNote(QString msg);
57   bool validate(void);
58
59   QLineEdit    *lineEditClub;
60   QLineEdit    *lineEditCourse;
61   QLabel       *labelClub;
62   QLabel       *labelCourse;
63   QPushButton  *pushButtonNext;
64
65   // Layouts
66   QVBoxLayout *leftLayout;
67   QVBoxLayout *rightLayout;
68 };
69
70 class CourseDialog: public QDialog
71 {
72   Q_OBJECT
73
74  public:
75   CourseDialog(QWidget *w);
76   void results(QVector<QString> &, QVector<QString> &, QVector<QString> &);
77   bool validate();
78   void init(Course *course = 0);
79
80  private slots:
81   void up(void);
82   void down(void);
83   void next(void);
84   void finish(void);
85
86  private:
87   enum { ROW_HOLE = 0, ROW_PAR = 1, ROW_HCP = 2, ROW_LEN = 3, 
88          ROW_HOLE_2 = 4, ROW_PAR_2 = 5, ROW_HCP_2 = 6, ROW_LEN_2 = 7};
89   enum { ROWS = 8, COLS = 9, separator_row = 3 };
90
91   void createTable(QWidget *parent = 0);
92   void createButton(QWidget *parent = 0);
93   void createLayout(QWidget *parent = 0);
94   void moveToNextCell(QTableWidgetItem *item);
95
96   // Widgets
97   QTableWidget *table;
98
99   QPushButton *pushButtonUp;
100   QPushButton *pushButtonDown;
101   QPushButton *pushButtonNext;
102   QPushButton *pushButtonFinish;
103
104   // Layouts
105   QVBoxLayout *rightLayout;
106   QVBoxLayout *leftLayout;
107 };
108
109 #endif