ParaView
pqServerLauncher.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqServerLauncher_h
33 #define pqServerLauncher_h
34 
35 #include "pqComponentsModule.h"
36 #include <QObject>
37 #include <QProcess> // needed for QProcess::ProcessError.
38 
39 class pqServer;
41 class QDialog;
42 class QProcessEnvironment;
43 
54 class PQCOMPONENTS_EXPORT pqServerLauncher : public QObject
55 {
56  Q_OBJECT
57  typedef QObject Superclass;
58 public:
60  const pqServerConfiguration& configuration,
61  QObject* parent=0);
62  virtual ~pqServerLauncher();
63 
69  static const QMetaObject* setServerDefaultLauncherType(const QMetaObject*);
70  static const QMetaObject* defaultServerLauncherType();
71 
74  static pqServerLauncher* newInstance(
75  const pqServerConfiguration& configuration, QObject* parent=NULL);
76 
80  bool connectToServer();
81 
84  pqServer* connectedServer() const;
85 
86 protected slots:
87  void processFailed(QProcess::ProcessError);
88  void readStandardOutput();
89  void readStandardError();
90  void launchServerForReverseConnection();
91 
92 protected:
96  bool promptOptions();
97 
100  virtual bool launchServer(bool show_status_dialog);
101 
103  bool processCommand(QString command, double timeout, double delay, const QProcessEnvironment* options = NULL);
104 
105  virtual bool connectToPrelaunchedServer();
106 
107  bool isReverseConnection() const;
108 
112  virtual void prepareDialogForPromptOptions(QDialog&) {}
113 
117  pqServerConfiguration& configuration() const;
118 
120  QProcessEnvironment& options() const;
121 
123  virtual void updateOptionsUsingUserSelections();
124 
128  virtual void handleProcessStandardOutput(const QByteArray& data);
129  virtual void handleProcessErrorOutput(const QByteArray& data);
130 
131 private:
132  Q_DISABLE_COPY(pqServerLauncher)
133 
134  class pqInternals;
135  pqInternals* Internals;
136  static const QMetaObject* DefaultServerLauncherType;
137 };
138 
139 #endif
pqServerLauncher manages launching of server process using the details specified in the server config...
pqServerConfiguration corresponds to a server connection configuration.
virtual void prepareDialogForPromptOptions(QDialog &)
Subclasses can override this method to further customize the dialog being shown to the user to prompt...
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:62