QTfrontend/gamecfgwidget.h
author unc0rr
Tue, 17 Feb 2009 12:58:25 +0000
changeset 1802 dd148e2506e2
parent 1797 fedd8649fdd9
child 1873 815a3ff1fe4b
permissions -rw-r--r--
Move template filter to map widget (by nemo)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 703
diff changeset
     2
 * Hedgewars, a free turn based strategy game
486
7ea71cd3acd5 - Change proto version to 4
unc0rr
parents: 349
diff changeset
     3
 * Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     4
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
#ifndef GAMECONFIGWIDGET_H
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    20
#define GAMECONFIGWIDGET_H
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    21
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    22
#include <QWidget>
318
46a43b02bbb3 Game config commands are generated by GameCFGWidget
unc0rr
parents: 312
diff changeset
    23
#include <QStringList>
1217
d6d91eec00f2 Remake gamecfgwidget
unc0rr
parents: 1066
diff changeset
    24
#include <QGroupBox>
1783
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    25
#include <QSpinBox>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    26
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    27
#include "mapContainer.h"
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    28
311
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
    29
class QCheckBox;
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
    30
class QVBoxLayout;
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
    31
class QLabel;
1783
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    32
class FreqSpinBox;
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    33
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    34
class FreqSpinBox : public QSpinBox
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    35
{
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    36
	Q_OBJECT
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    37
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    38
public:
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    39
	FreqSpinBox(QWidget* parent) : QSpinBox(parent)
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    40
	{
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    41
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    42
	}
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    43
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    44
	QString textFromValue ( int value ) const
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    45
	{
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    46
		switch (value)
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    47
		{
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    48
			case 0 : return tr("Never");
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    49
			case 1 : return tr("Every turn");
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    50
			default : return tr("Each %1 turn").arg(value);
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    51
		}
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    52
	}
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
    53
};
311
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
    54
1217
d6d91eec00f2 Remake gamecfgwidget
unc0rr
parents: 1066
diff changeset
    55
class GameCFGWidget : public QGroupBox
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    56
{
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    57
	Q_OBJECT
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    58
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    59
public:
349
5b37d6a39829 disable widgets if we are slave network client
displacer
parents: 325
diff changeset
    60
	GameCFGWidget(QWidget* parent, bool externalControl=false);
318
46a43b02bbb3 Game config commands are generated by GameCFGWidget
unc0rr
parents: 312
diff changeset
    61
	quint32 getGameFlags() const;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    62
	QString getCurrentSeed() const;
249
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    63
	QString getCurrentMap() const;
ff85fa029541 map choose from files added
displacer
parents: 184
diff changeset
    64
	QString getCurrentTheme() const;
312
c36d0b34ac3d Use new parameters, small protocol change
unc0rr
parents: 311
diff changeset
    65
	quint32 getInitHealth() const;
c36d0b34ac3d Use new parameters, small protocol change
unc0rr
parents: 311
diff changeset
    66
	quint32 getTurnTime() const;
1782
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    67
	quint32 getSuddenDeathTurns() const;
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    68
	quint32 getCaseProbability() const;
318
46a43b02bbb3 Game config commands are generated by GameCFGWidget
unc0rr
parents: 312
diff changeset
    69
	QStringList getFullConfig() const;
696
d6f32ed6edc8 working multiplayer weapons combo
displacer
parents: 486
diff changeset
    70
	QComboBox* WeaponsName;
1802
dd148e2506e2 Move template filter to map widget (by nemo)
unc0rr
parents: 1797
diff changeset
    71
	HWMapContainer* pMapContainer;
696
d6f32ed6edc8 working multiplayer weapons combo
displacer
parents: 486
diff changeset
    72
320
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 318
diff changeset
    73
public slots:
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 318
diff changeset
    74
	void setSeed(const QString & seed);
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 318
diff changeset
    75
	void setMap(const QString & map);
1ee7f087195a - HWMapContainer sets and stores the theme
unc0rr
parents: 318
diff changeset
    76
	void setTheme(const QString & theme);
1427
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    77
	void setInitHealth(int health);
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    78
	void setTurnTime(int time);
1782
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    79
	void setSuddenDeathTurns(int turns);
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    80
	void setCaseProbability(int prob);
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    81
	void setFortsMode(bool value);
1427
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    82
	void setTeamsDivide(bool value);
1530
3b8d723661b2 Implement Solid Land checkbox
unc0rr
parents: 1517
diff changeset
    83
	void setSolid(bool value);
1784
dfe9bafb4590 Apply nemo's patch polished by me:
unc0rr
parents: 1783
diff changeset
    84
	void setBorder(bool value);
703
424297e3165a weapon names transmitted over network
displacer
parents: 697
diff changeset
    85
	void setNetAmmo(const QString& name, const QString& ammo);
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    86
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    87
signals:
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    88
	void seedChanged(const QString & seed);
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    89
	void mapChanged(const QString & map);
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    90
	void themeChanged(const QString & theme);
1427
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    91
	void initHealthChanged(int health);
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    92
	void turnTimeChanged(int time);
1782
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    93
	void suddenDeathTurnsChanged(int turns);
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
    94
	void caseProbabilityChanged(int prob);
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
    95
	void fortsModeChanged(bool value);
1427
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
    96
	void teamsDivideChanged(bool value);
1530
3b8d723661b2 Implement Solid Land checkbox
unc0rr
parents: 1517
diff changeset
    97
	void solidChanged(bool value);
1784
dfe9bafb4590 Apply nemo's patch polished by me:
unc0rr
parents: 1783
diff changeset
    98
	void borderChanged(bool value);
1531
f404233b6d9b - Less crossclass dependancies
unc0rr
parents: 1530
diff changeset
    99
	void newWeaponScheme(const QString & name, const QString & ammo);
f404233b6d9b - Less crossclass dependancies
unc0rr
parents: 1530
diff changeset
   100
f404233b6d9b - Less crossclass dependancies
unc0rr
parents: 1530
diff changeset
   101
private slots:
f404233b6d9b - Less crossclass dependancies
unc0rr
parents: 1530
diff changeset
   102
	void ammoChanged(int index);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   103
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   104
private:
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   105
	QCheckBox * CB_mode_Forts;
1427
b510f7a74ef6 Add 'Divide teams' option to frontend
unc0rr
parents: 1217
diff changeset
   106
	QCheckBox * CB_teamsDivide;
1530
3b8d723661b2 Implement Solid Land checkbox
unc0rr
parents: 1517
diff changeset
   107
	QCheckBox * CB_solid;
1784
dfe9bafb4590 Apply nemo's patch polished by me:
unc0rr
parents: 1783
diff changeset
   108
	QCheckBox * CB_border;
1217
d6d91eec00f2 Remake gamecfgwidget
unc0rr
parents: 1066
diff changeset
   109
	QGridLayout mainLayout;
311
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
   110
	QSpinBox * SB_TurnTime;
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
   111
	QSpinBox * SB_InitHealth;
1782
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
   112
	QSpinBox * SB_SuddenDeath;
1783
169ebeefd7ab Custom spinbox for bonus boxes factor
unc0rr
parents: 1782
diff changeset
   113
	FreqSpinBox * SB_CaseProb;
311
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
   114
	QLabel * L_TurnTime;
b8905423f19f - Limit list of teams in game with 200 px
unc0rr
parents: 249
diff changeset
   115
	QLabel * L_InitHealth;
1782
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
   116
	QLabel * L_SuddenDeath;
e7589e37a6d6 Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents: 1531
diff changeset
   117
	QLabel * L_CaseProb;
325
17c860483407 New signals and slot for GameCFGWidget
unc0rr
parents: 320
diff changeset
   118
703
424297e3165a weapon names transmitted over network
displacer
parents: 697
diff changeset
   119
	QString curNetAmmoName;
697
44f167938201 pre-alpha network weapons selection
displacer
parents: 696
diff changeset
   120
	QString curNetAmmo;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   121
};
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   122
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
   123
#endif // GAMECONFIGWIDGET_H