2 ******************************************************************************
4 * @file abstractprocess.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
8 * @see The GNU Public License (GPL) Version 3
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef ABSTRACTPROCESS_H
30 #define ABSTRACTPROCESS_H
32 #include "utils_global.h"
34 #include <QtCore/QStringList>
37 class QTCREATOR_UTILS_EXPORT AbstractProcess
{
40 virtual ~AbstractProcess() {}
42 QString
workingDirectory() const
46 void setWorkingDirectory(const QString
&dir
)
51 QStringList
environment() const
55 void setEnvironment(const QStringList
&env
)
60 virtual bool start(const QString
&program
, const QStringList
&args
) = 0;
61 virtual void stop() = 0;
63 virtual bool isRunning() const = 0;
64 virtual qint64
applicationPID() const = 0;
65 virtual int exitCode() const = 0;
68 virtual void processError(const QString
&error
) = 0;
71 // Add PATH and SystemRoot environment variables in case they are missing
72 static QStringList
fixWinEnvironment(const QStringList
&env
);
73 // Quote a Windows command line correctly for the "CreateProcess" API
74 static QString
createWinCommandline(const QString
&program
, const QStringList
&args
);
75 // Create a bytearray suitable to be passed on as environment
76 // to the "CreateProcess" API (0-terminated UTF 16 strings).
77 static QByteArray
createWinEnvironment(const QStringList
&env
);
82 QStringList m_environment
;
86 #endif // ABSTRACTPROCESS_H