Debian Codegraph @

src/newgamedlg.h

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2004-2005 Artur Wiebe *
3 * [email protected] *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21 #ifndef _NEWGAMEDLG_H_
22 #define _NEWGAMEDLG_H_
23
24 #include <QDialog>
25 #include <QLabel>
26 #include <QLineEdit>
27 #include <QSettings>
28 #include <QPushButton>
29 #include <QListWidget>
30 #include <QTabWidget>
31 #include <QCheckBox>
32 #include <QGroupBox>
33 #include <QRadioButton>
34
35
36 #define COMPUTER 0
37 #define HUMAN 1
38
39
40 class myPlayer;
41
42
43 class myNewGameDlg : public QDialog
44 {
45 Q_OBJECT
46
47 public:
48 myNewGameDlg(QWidget* parent);
49 ~myNewGameDlg();
50
51 // playing against the computer
52 int rules() const;
53 // return HUMAN/COMPUTER
54 int opponent() const { return m_player_two.options->currentIndex(); }
55 //
56 int skill() const;
57 //
58 bool freePlacement() const { return m_freeplace->isChecked(); }
59
60 //
61 const QString name() const { return m_player_one.name->text(); }
62 bool isWhite() const { return m_player_one.white->isChecked(); }
63 const QString opponentName() const { return m_player_two.name->text(); }
64
65 // for settings
66 void writeSettings(QSettings*);
67 void readSettings(QSettings*);
68
69 private slots:
70 void slot_game(int id); // ListWidget
71 void slot_game_start(int id);
72 void slot_skills();
73
74 void slot_reject();
75 void slot_start();
76
77 private:
78 QWidget* create_player_one();
79 QWidget* create_player_two();
80
81 QWidget* create_human_options();
82 QWidget* create_computer_options();
83
84 private:
85 struct player_one_struct {
86 QGroupBox* box;
87 QLineEdit* name;
88 QGroupBox* rules;
89 QRadioButton* rule_english;
90 QRadioButton* rule_russian;
91 QCheckBox* white;
92 };
93 struct player_one_struct m_player_one;
94
95 struct player_two_struct {
96 QGroupBox* box;
97 QLineEdit* name;
98 int last_game_index;
99 QTabWidget* options;
100 // human options
101 // computer options
102 struct computer_stuct {
103 QMap<int, QRadioButton*> skills;
104 };
105 struct computer_stuct computer;
106 };
107 struct player_two_struct m_player_two;
108
109 QCheckBox* m_freeplace;
110 QPushButton* start_button;
111
112 QString m_cfg_player2;
113 };
114
115 #endif
116