joincommandlinebuilder.h
1 //------------------------------------------------------------------------------
2 // joincommandlinebuilder.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; 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 id3D55B51B_0F01_4FAB_8D44E1593B00E437
24 #define id3D55B51B_0F01_4FAB_8D44E1593B00E437
25 
26 #include "serverapi/serverptr.h"
27 #include "dptr.h"
28 #include <QObject>
29 
30 class CommandLineInfo;
31 class GameDemo;
32 class JoinError;
33 class Server;
35 class QAbstractButton;
36 class QUrl;
37 class QWidget;
38 
42 class JoinCommandLineBuilder : public QObject
43 {
44  Q_OBJECT
45 
46  public:
47  JoinCommandLineBuilder(ServerPtr server, GameDemo demo, QWidget *parentWidget);
49 
50  const CommandLineInfo &builtCommandLine() const;
51  static bool checkWadseekerValidity(QWidget *parent=NULL);
52  bool isConfigurationError() const;
53  const QString &error() const;
58  void obtainJoinCommandLine();
59  ServerPtr server() const;
64  void setPasswords(const QString &connectPassword=QString(), const QString &inGamePassword=QString());
68  void setRequireOptionals(bool);
69 
70  signals:
71  void commandLineBuildFinished();
72 
73  private:
74  enum MissingWadsProceed
75  {
76  Ignore,
77  Cancel,
78  Seeking
79  };
80 
82 
83  void allDownloadableWads(const JoinError &joinError, QStringList &required, QStringList &optional);
84  bool buildServerConnectParams(ServerConnectParams &params);
85  bool checkServerStatus();
86  int displayMissingWadsMessage(const QStringList &downloadableWads, QStringList &optionalWads, const QString &message);
87  void failBuild();
88  void handleError(const JoinError &error);
89  MissingWadsProceed handleMissingWads(const JoinError &error);
90  QString mkDemoName();
91  bool tryToInstallGame();
92 
93  private slots:
94  void missingWadsClicked(QAbstractButton *);
95  void onWadseekerDone(int result);
96 };
97 
98 #endif
99 
Structure holding parameters for application launch.
Definition: apprunner.h:37
A DTO for GameClientRunner; exchanges information between main program and plugins, and allows future extensions.
void setPasswords(const QString &connectPassword=QString(), const QString &inGamePassword=QString())
Sets the connect/ingame password and bypasses the prompt. Set passwords to a null string to unset...
A representation of a server for a given game.
Definition: server.h:93
Generates command line for joining specified server.
Indicator of error for the server join process.
Definition: joinerror.h:41
void setRequireOptionals(bool)
Treats optional wads are required so Wadseeker prompts.
void obtainJoinCommandLine()
Runs asynchronously and emits commandLineBuildFinished() when done.