Vidalia 0.2.15
|
00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 00007 ** including this file, may be copied, modified, propagated, or distributed 00008 ** except according to the terms described in the LICENSE file. 00009 */ 00010 /* 00011 ** This file was originally written by Steven J. Murdoch, and 00012 ** modified by Matt Edman. It is distributed under the following 00013 ** license: 00014 ** 00015 ** Copyright (C) 2007, Matt Edman 00016 ** Copyright (C) 2007, Steven J. Murdoch 00017 ** <http://www.cl.cam.ac.uk/users/sjm217/> 00018 ** 00019 ** This program is free software; you can redistribute it and/or 00020 ** modify it under the terms of the GNU General Public License 00021 ** as published by the Free Software Foundation; either version 2 00022 ** of the License, or (at your option) any later version. 00023 ** 00024 ** This program is distributed in the hope that it will be useful, 00025 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00027 ** GNU General Public License for more details. 00028 ** 00029 ** You should have received a copy of the GNU General Public License 00030 ** along with this program; if not, write to the Free Software 00031 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, 00032 ** Boston, MA 02110-1301, USA. 00033 */ 00034 00035 /* 00036 ** \file HelperProcess.h 00037 ** \brief Invokes a web browser process (originally by Steven. J. Murdoch) 00038 */ 00039 00040 #ifndef _HELPERPROCESS_H 00041 #define _HELPERPROCESS_H 00042 00043 #include <QProcess> 00044 00045 00046 class HelperProcess : public QProcess 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 /** Default constructor */ 00052 HelperProcess(QObject *parent = 0); 00053 /** Start <b>app</b> with <b>args</b> appended to the end of the command 00054 * line. <b>app</b> will be quoted, so an executable name with spaces is 00055 * acceptable. */ 00056 void start(const QString &app, const QString &args); 00057 /** Start the specified application. */ 00058 void start(const QString &app, const QStringList &args); 00059 /** Returns true iff process is not running. */ 00060 bool isDone() const; 00061 /** Bring process to foreground */ 00062 void toForeground(); 00063 00064 signals: 00065 /** Invoked when start() fails. */ 00066 void startFailed(const QString &errorMessage); 00067 00068 private slots: 00069 /** Invoked when underlying QProcess fails. */ 00070 void onError(QProcess::ProcessError error); 00071 /** Invoked when output is written to the process's stderr. */ 00072 void onReadyReadStandardError(); 00073 /** Invoked when output is written to the process's stdout. */ 00074 void onReadyReadStandardOutput(); 00075 00076 private: 00077 QString _processName; 00078 }; 00079 00080 #endif 00081