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