gamerulespanel.h
1 //------------------------------------------------------------------------------
2 // gamerulespanel.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2014 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef id880d5e15_1a53_40da_bdb9_11d9b4dc3222
24 #define id880d5e15_1a53_40da_bdb9_11d9b4dc3222
25 
26 #include "dptr.h"
27 #include "serverapi/gamecreateparams.h"
28 
29 #include <QWidget>
30 
31 class CreateServerDialog;
32 class EnginePlugin;
33 class GameCreateParams;
34 class GameMode;
35 class Ini;
36 class MapListPanel;
37 
38 class GameRulesPanel : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
43  GameRulesPanel(QWidget *parent);
44  ~GameRulesPanel() override;
45 
46  void fillInParams(GameCreateParams &params);
47  bool isAnythingAvailable() const;
48  MapListPanel *mapListPanel();
49  void loadConfig(Ini &config);
50  void saveConfig(Ini &config);
51  void setupForEngine(const EnginePlugin *engine, const GameMode &gameMode);
52  void setupForHostMode(GameCreateParams::HostMode hostMode);
53  void setCreateServerDialog(CreateServerDialog *dialog);
54 
55 private:
57 
58  void applyModeToUi();
59  void fillInLimits(GameCreateParams &params);
60  void fillInModifiers(GameCreateParams &params);
61  void memorizeLimits();
62  void loadMemorizedLimits(const EnginePlugin *engine);
63  void removeLimitWidgets();
64  void setupLimitWidgets(const EnginePlugin *engine, const GameMode &gameMode);
65  void setupModifiers(const EnginePlugin *engine);
66 };
67 
68 #endif
Game parametrization data used when creating new games.
Dialog window allowing user to create a game.
Game mode representation.
Configuration handler.
Definition: ini.h:69