summaryrefslogtreecommitdiffstats
path: root/atlantik/client/selectconfiguration_widget.h
blob: 033a0eb0c9d792f60ae87c6915edee70b259b2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) 2002-2004 Rob Kaper <cap@capsi.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; see the file COPYING.  If not, write to
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA 02110-1301, USA.

#ifndef ATLANTIK_SELECTCONFIGURATION_WIDGET_H
#define ATLANTIK_SELECTCONFIGURATION_WIDGET_H

#include <qwidget.h>
#include <qlayout.h>
#include <qvgroupbox.h>

#include <klistview.h>
#include <kpushbutton.h>

class QCheckBox;
class QListViewItem;

class AtlanticCore;
class ConfigOption;
class Game;
class Player;

class SelectConfiguration : public QWidget
{
Q_OBJECT

public:
	SelectConfiguration(AtlanticCore *atlanticCore, QWidget *parent, const char *name=0);

	void setCanStart(const bool &canStart);
	QString hostToConnect() const;
	int portToConnect();

private slots:
	void addConfigOption(ConfigOption *configOption);
	void changeOption();
	void gameOption(QString title, QString type, QString value, QString edit, QString command);
	void optionChanged(ConfigOption *configOption);
	void optionChanged();
	void slotEndUpdate();
	void initGame();
	void playerChanged(Player *player);
	void gameChanged(Game *game);

signals:
	void startGame();
	void leaveGame();
	void joinConfiguration(int configurationId);
	void newConfiguration();
	void changeOption(int configId, const QString &value);
	void buttonCommand(QString);
	void iconSelected(const QString &);
	void statusMessage(const QString &message);

private:
	QVBoxLayout *m_mainLayout;
	QVGroupBox *m_configBox, *m_messageBox;
	KPushButton *m_backButton, *m_startButton;
	QMap <QObject *, QString> m_optionCommandMap;
	QMap <QObject *, ConfigOption *> m_configMap;
	QMap <ConfigOption *, QCheckBox *> m_configBoxMap;
	QMap <QString, QCheckBox *> m_checkBoxMap;
	QMap <Player *, QListViewItem *> m_items;
	Game *m_game;
	AtlanticCore *m_atlanticCore;
};

#endif