connectionhandler.h
1 //------------------------------------------------------------------------------
2 // connectionhandler.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) 2012 Braden Obrzut <admin@maniacsvault.net>
22 // "Zalewa" <zalewapl@gmail.com>
23 //------------------------------------------------------------------------------
24 
25 #ifndef __CONNECTIONHANDLER_H__
26 #define __CONNECTIONHANDLER_H__
27 
28 #include "serverapi/serverptr.h"
29 #include "dptr.h"
30 #include <QObject>
31 
32 class CommandLineInfo;
33 class JoinError;
34 class Server;
35 class QUrl;
36 class QWidget;
37 
42 class PluginUrlHandler : public QObject
43 {
44  Q_OBJECT
45 
46  public:
47  static void registerAll();
48  static void registerScheme(const QString &scheme);
49 
50  public slots:
51  void handleUrl(const QUrl &url);
52 
53  private:
54  static PluginUrlHandler *instance;
55 };
56 
57 class ConnectionHandler : public QObject
58 {
59  Q_OBJECT
60 
61  public:
62  ConnectionHandler(ServerPtr server, QWidget *parentWidget=NULL, bool handleResponse=false);
64 
65  void run();
66 
67  static ConnectionHandler *connectByUrl(const QUrl &url);
68 
69  protected:
70  void finish(int response);
71  void refreshToJoin();
72 
73  protected slots:
74  void checkResponse(const ServerPtr &server, int response);
75 
76  signals:
77  void finished(int response);
78 
79  private:
81 
82  void buildJoinCommandLine();
83  void runCommandLine(const CommandLineInfo &cli);
84 
85  private slots:
86  void onCommandLineBuildFinished();
87 };
88 
89 #endif
Structure holding parameters for application launch.
Definition: apprunner.h:37
A representation of a server for a given game.
Definition: server.h:93
Indicator of error for the server join process.
Definition: joinerror.h:41