LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / abstractprocess.h
blobbfbb7e55713d366109ccbf101f36a47c1eec05b9
1 /**
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.
7 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
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
22 * for more details.
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>
36 namespace Utils {
37 class QTCREATOR_UTILS_EXPORT AbstractProcess {
38 public:
39 AbstractProcess() {}
40 virtual ~AbstractProcess() {}
42 QString workingDirectory() const
44 return m_workingDir;
46 void setWorkingDirectory(const QString &dir)
48 m_workingDir = dir;
51 QStringList environment() const
53 return m_environment;
55 void setEnvironment(const QStringList &env)
57 m_environment = 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;
67 // signals:
68 virtual void processError(const QString &error) = 0;
70 #ifdef Q_OS_WIN
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);
78 #endif
80 private:
81 QString m_workingDir;
82 QStringList m_environment;
84 } // namespace Utils
86 #endif // ABSTRACTPROCESS_H