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 "gui/missingwadsdialog.h"
27 #include "serverapi/serverptr.h"
28 #include "dptr.h"
29 #include <QObject>
30 
31 class CommandLineInfo;
32 class GameDemo;
33 class JoinError;
34 class Server;
36 class QAbstractButton;
37 class QUrl;
38 class QWidget;
39 
43 class JoinCommandLineBuilder : public QObject
44 {
45  Q_OBJECT
46 
47  public:
48  JoinCommandLineBuilder(ServerPtr server, GameDemo demo, QWidget *parentWidget);
50 
51  const CommandLineInfo &builtCommandLine() const;
52  static bool checkWadseekerValidity(QWidget *parent=NULL);
53  bool isConfigurationError() const;
54  const QString &error() const;
59  void obtainJoinCommandLine();
60  ServerPtr server() const;
65  void setPasswords(const QString &connectPassword=QString(), const QString &inGamePassword=QString());
66 
67  signals:
68  void commandLineBuildFinished();
69 
70  private:
72 
73  void allDownloadableWads(const JoinError &joinError, QStringList &required, QStringList &optional);
74  bool buildServerConnectParams(ServerConnectParams &params);
75  bool checkServerStatus();
76  void failBuild();
77  void handleError(const JoinError &error);
78  MissingWadsDialog::MissingWadsProceed handleMissingWads(
79  const JoinError &error);
80  QString mkDemoName();
81  bool tryToInstallGame();
82 
83  private slots:
84  void missingWadsClicked(QAbstractButton *);
85  void onWadseekerDone(int result);
86 };
87 
88 #endif
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 obtainJoinCommandLine()
Runs asynchronously and emits commandLineBuildFinished() when done.