Vidalia  0.3.1
HelperProcess.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 /*
11 ** This file was originally written by Steven J. Murdoch, and
12 ** modified by Matt Edman. It is distributed under the following
13 ** license:
14 **
15 ** Copyright (C) 2007, Matt Edman
16 ** Copyright (C) 2007, Steven J. Murdoch
17 ** <http://www.cl.cam.ac.uk/users/sjm217/>
18 **
19 ** This program is free software; you can redistribute it and/or
20 ** modify it under the terms of the GNU General Public License
21 ** as published by the Free Software Foundation; either version 2
22 ** of the License, or (at your option) any later version.
23 **
24 ** This program is distributed in the hope that it will be useful,
25 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ** GNU General Public License for more details.
28 **
29 ** You should have received a copy of the GNU General Public License
30 ** along with this program; if not, write to the Free Software
31 ** Foundation, Inc., 51 Franklin Street, Fifth Floor,
32 ** Boston, MA 02110-1301, USA.
33 */
34 
35 /*
36 ** \file HelperProcess.h
37 ** \brief Invokes a web browser process (originally by Steven. J. Murdoch)
38 */
39 
40 #ifndef _HELPERPROCESS_H
41 #define _HELPERPROCESS_H
42 
43 #include <QProcess>
44 
45 
46 class HelperProcess : public QProcess
47 {
48  Q_OBJECT
49 
50 public:
51  /** Default constructor */
52  HelperProcess(QObject *parent = 0);
53  /** Start <b>app</b> with <b>args</b> appended to the end of the command
54  * line. <b>app</b> will be quoted, so an executable name with spaces is
55  * acceptable. */
56  void start(const QString &app, const QString &args);
57  /** Start the specified application. */
58  void start(const QString &app, const QStringList &args);
59  /** Returns true iff process is not running. */
60  bool isDone() const;
61  /** Bring process to foreground */
62  void toForeground();
63 
64 signals:
65  /** Invoked when start() fails. */
66  void startFailed(const QString &errorMessage);
67 
68 private slots:
69  /** Invoked when underlying QProcess fails. */
70  void onError(QProcess::ProcessError error);
71  /** Invoked when output is written to the process's stderr. */
73  /** Invoked when output is written to the process's stdout. */
75 
76 private:
77  QString _processName;
78 };
79 
80 #endif
81 
DebugMessage error(const QString &fmt)
Definition: tcglobal.cpp:40
HelperProcess(QObject *parent=0)
void start(const QString &app, const QString &args)
void onReadyReadStandardError()
void onReadyReadStandardOutput()
void startFailed(const QString &errorMessage)
void onError(QProcess::ProcessError error)
bool isDone() const
QString _processName
Definition: HelperProcess.h:77