generalgamesetuppanel.h
1 //------------------------------------------------------------------------------
2 // generalgamesetuppanel.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 idb76a672e_9f54_4dbc_a933_33ea083e8f11
24 #define idb76a672e_9f54_4dbc_a933_33ea083e8f11
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 GameFileList;
35 class GameMode;
36 class Ini;
37 
38 class GeneralGameSetupPanel : public QWidget
39 {
40  Q_OBJECT
41 
42 public:
43  GeneralGameSetupPanel(QWidget *parent);
44  ~GeneralGameSetupPanel() override;
45 
46  GameMode currentGameMode() const;
47  EnginePlugin *currentPlugin() const;
48  void fillInParams(GameCreateParams &params);
49  void loadConfig(Ini &config, bool loadingPrevious);
50  QString mapName() const;
51  void reloadAppConfig();
52  void saveConfig(Ini &config);
53  void setupForEngine(EnginePlugin *engine);
54  void setupForHostMode(GameCreateParams::HostMode hostMode);
55  void setCreateServerDialog(CreateServerDialog *dialog);
56  void setIwadByName(const QString &iwad);
57  QStringList getAllWadPaths() const;
58 
59 signals:
60  void gameModeChanged(const GameMode &gameMode);
61  void pluginChanged(EnginePlugin *plugin);
62 
63 protected:
64  void showEvent(QShowEvent *event) override;
65 
66 private:
68 
69  GameFileList gameExecutables() const;
70 
71  QString pathToExe();
72 
73  bool setEngine(const QString &engineName);
74  void setupDifficulty(const EnginePlugin *engine);
75 
76 private slots:
77  void onGameModeChanged(int);
78  void updateMapWarningVisibility();
79 };
80 
81 #endif