SVN_SILENT made messages (.desktop file)
[kdegames.git] / kolf / newgame.h
blob4a6f712ad60684620f1e240b50db742423aafb0b
1 /*
2 Copyright (C) 2002-2005, Jason Katz-Brown <jasonkb@mit.edu>
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; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef NEWGAME_H
20 #define NEWGAME_H
22 #include <kpagedialog.h>
23 #include <klineedit.h>
24 #include <kcolorbutton.h>
25 #include <kpushbutton.h>
27 #include <QColor>
29 #include <QPixmap>
30 #include <QWidget>
31 #include <QCheckBox>
33 #include "game.h"
35 class KLineEdit;
36 class K3ListBox;
37 class QScrollArea;
39 class PlayerEditor : public QWidget
41 Q_OBJECT
43 public:
44 explicit PlayerEditor(QString name = QString(), QColor = Qt::red, QWidget *parent = 0);
45 QColor color() { return colorButton->color(); }
46 QString name() { return editor->text(); }
47 void setColor(QColor col) { colorButton->setColor(col); }
48 void setName(const QString &newname) { editor->setText(newname); }
50 signals:
51 void deleteEditor(PlayerEditor *editor);
53 private slots:
54 void removeMe();
56 private:
57 KLineEdit *editor;
58 KColorButton *colorButton;
59 QPixmap grass;
62 class NewGameDialog : public KPageDialog
64 Q_OBJECT
66 public:
67 NewGameDialog(bool enableCourses);
68 ~NewGameDialog();
69 QList<PlayerEditor*> *players() { return &editors; }
70 bool competition() { return mode->isChecked(); }
71 QString course() { return currentCourse; }
73 public slots:
74 void deleteEditor(PlayerEditor *);
76 protected slots:
77 void slotOk();
78 private slots:
79 void addPlayer();
80 void courseSelected(int);
81 void addCourse();
82 void removeCourse();
83 void selectionChanged();
84 void showHighscores();
86 private:
87 QWidget *playersWidget;
88 KPushButton *addButton;
89 QFrame *playerPage;
90 QScrollArea *scroller;
91 QFrame *coursePage;
92 QFrame *optionsPage;
93 QList<QColor> startColors;
94 QList<PlayerEditor*> editors;
95 KPushButton *remove;
96 QCheckBox *mode;
98 QPixmap grass;
100 QStringList names;
101 QStringList externCourses;
102 QMap<QString, CourseInfo> info;
104 QStringList extraCourses;
106 K3ListBox *courseList;
107 QLabel *name;
108 QLabel *author;
109 QLabel *par;
110 QLabel *holes;
112 QString currentCourse;
114 void enableButtons();
115 bool enableCourses;
118 #endif