connectionhandler.h
1 //------------------------------------------------------------------------------
2 // connectionhandler.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) 2012 Braden "Blzut3" Obrzut <admin@maniacsvault.net>
22 // "Zalewa" <zalewapl@gmail.com>
23 //------------------------------------------------------------------------------
24 
25 #ifndef __CONNECTIONHANDLER_H__
26 #define __CONNECTIONHANDLER_H__
27 
28 #include "dptr.h"
29 #include "serverapi/serverptr.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 = nullptr);
63  ~ConnectionHandler() override;
64 
65  void run();
66 
67  static ConnectionHandler *connectByUrl(const QUrl &url);
68 
69 signals:
70  void finished(int response);
71 
72 private:
74 
75  void finish(int response);
76  void refreshToJoin();
77  void runCommandLine(const CommandLineInfo &cli);
78 
79 private slots:
80  void buildJoinCommandLine();
81  void checkResponse(const ServerPtr &server, int response);
82  void onCommandLineBuildFinished();
83 };
84 
85 #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