HelperProcess.h

Go to the documentation of this file.
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.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  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 ** \version $Id: HelperProcess.h 4132 2009-09-24 02:28:18Z edmanm $ 
00038 ** \brief Invokes a web browser process (originally by Steven. J. Murdoch)
00039 */
00040 
00041 #ifndef _HELPERPROCESS_H
00042 #define _HELPERPROCESS_H
00043 
00044 #include <QProcess>
00045 
00046 
00047 class HelperProcess : public QProcess
00048 {
00049   Q_OBJECT
00050 
00051 public:
00052   /** Default constructor */
00053   HelperProcess(QObject *parent = 0);
00054   /** Start <b>app</b> with <b>args</b> appended to the end of the command
00055    * line. <b>app</b> will be quoted, so an executable name with spaces is
00056    * acceptable. */
00057   void start(const QString &app, const QString &args);
00058   /** Start the specified application. */
00059   void start(const QString &app, const QStringList &args);
00060   /** Returns true iff process is not running. */
00061   bool isDone() const;
00062 
00063 signals:
00064   /** Invoked when start() fails. */
00065   void startFailed(const QString &errorMessage);
00066     
00067 private slots:
00068   /** Invoked when underlying QProcess fails. */
00069   void onError(QProcess::ProcessError error);
00070   /** Invoked when output is written to the process's stderr. */
00071   void onReadyReadStandardError();
00072   /** Invoked when output is written to the process's stdout. */
00073   void onReadyReadStandardOutput();
00074 
00075 private:
00076   QString _processName;
00077 };
00078 
00079 #endif
00080 

Generated on Mon Aug 30 19:14:02 2010 for Vidalia by  doxygen 1.5.9