createserverdialog.h
1 //------------------------------------------------------------------------------
2 // createserverdialog.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) 2009-2012 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef DOOMSEEKER_GUI_CREATESERVERDIALOG_H
24 #define DOOMSEEKER_GUI_CREATESERVERDIALOG_H
25 
26 #include "dptr.h"
27 #include "serverapi/gamecreateparams.h"
29 #include <QDialog>
30 
32 class EnginePlugin;
33 class GameCreateParams;
34 class MapListPanel;
35 class Message;
36 class Server;
37 
41 class CreateServerDialog : public QDialog
42 {
43  Q_OBJECT
44 
45 public:
46  CreateServerDialog(GameCreateParams::HostMode hostMode, QWidget *parent = nullptr);
47  virtual ~CreateServerDialog();
48 
49  bool commandLineArguments(QString &executable, QStringList &args, bool offline);
50  void makeRemoteGameSetupDialog(EnginePlugin *plugin);
51  MapListPanel *mapListPanel();
52  QString mapName() const;
53  void setIwadByName(const QString &iwad);
54  QStringList wadPaths() const;
55 
56 private slots:
57  void changeToHostMode();
58  void changeToOfflineMode();
59  void firstLoadConfigTimer();
60 
66  void initEngineSpecific(EnginePlugin *engineInfo);
67  void initGamemodeSpecific(const GameMode &gameMode);
68  void showConfiguration();
69  void showLoadConfig();
70  void showSaveConfig();
71  void showStartGameCommandLine();
72  void startGame();
73 
74 private:
75  static const QString TEMP_GAME_CONFIG_FILENAME;
76 
78 
84  void addIwad(const QString &path);
85  void applyModeToUi();
86 
92  bool createHostInfo(GameCreateParams &params, bool offline);
93  void createHostInfoDemoRecord(GameCreateParams &params, bool offline);
94 
95  GameMode currentGameMode() const;
96 
97  bool fillInParamsFromPluginPages(GameCreateParams &params);
98  void initDMFlagsTabs();
99 
105  void initEngineSpecificPages(EnginePlugin *engineInfo);
106 
107  void initServerTab();
108 
109  void initRules();
110 
111  bool loadConfig(const QString &filename, bool loadingPrevious);
112  void runGame(bool offline);
113  bool saveConfig(const QString &filename);
114  void setupMenu();
115  void showCommandLine(bool offline);
116 };
117 
118 #endif