summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/qprocesswrapper.h
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-06-02 12:31:17 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2014-06-03 13:04:53 +0200
commit05afd837fc336541ebdf772ab25347860782c02f (patch)
tree02abee082f58b4fb529be1ca83647b1a435a3332 /src/libs/installer/qprocesswrapper.h
parent7c07130119722e2e0afcf423f23a449f93931dfa (diff)
Replace client-server classes and update implementations.
Remove superfluous file engine tests. Introduce auto test for newly added client server classes. Fix some wrong implementations serverside for settings array handling and broken arguments in process wrapper. Replace all other parts that with new implementations. Remove now unused classes. Change-Id: I6f9e836993096a2c2c06b06f2b06d7aa4b287e56 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs/installer/qprocesswrapper.h')
-rw-r--r--src/libs/installer/qprocesswrapper.h69
1 files changed, 44 insertions, 25 deletions
diff --git a/src/libs/installer/qprocesswrapper.h b/src/libs/installer/qprocesswrapper.h
index e7caf61f6..08ceac669 100644
--- a/src/libs/installer/qprocesswrapper.h
+++ b/src/libs/installer/qprocesswrapper.h
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2012-2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2012-2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Installer Framework.
@@ -42,15 +42,20 @@
#ifndef QPROCESSWRAPPER_H
#define QPROCESSWRAPPER_H
-#include <installer_global.h>
+#include "remoteobject.h"
-#include<QtCore/QIODevice>
-#include<QtCore/QObject>
-#include<QtCore/QProcess>
+#include <QIODevice>
+#include <QProcess>
+#include <QReadWriteLock>
+#include <QTimer>
-class INSTALLER_EXPORT QProcessWrapper : public QObject
+namespace QInstaller {
+
+class INSTALLER_EXPORT QProcessWrapper : public RemoteObject
{
Q_OBJECT
+ Q_DISABLE_COPY(QProcessWrapper)
+
public:
enum ProcessState {
NotRunning,
@@ -77,36 +82,43 @@ public:
explicit QProcessWrapper(QObject *parent = 0);
~QProcessWrapper();
- void closeWriteChannel();
int exitCode() const;
+ ProcessState state() const;
ExitStatus exitStatus() const;
+
+ QString workingDirectory() const;
+ void setWorkingDirectory(const QString &dir);
+
+ QStringList environment() const;
+ void setEnvironment(const QStringList &environment);
+
+ QProcessWrapper::ProcessChannel readChannel() const;
+ void setReadChannel(QProcessWrapper::ProcessChannel channel);
+
+ QProcessWrapper::ProcessChannelMode processChannelMode() const;
+ void setProcessChannelMode(QProcessWrapper::ProcessChannelMode channel);
+
+ bool waitForStarted(int msecs = 30000);
+ bool waitForFinished(int msecs = 30000);
+
+ void start(const QString &program, const QStringList &arguments,
+ QIODevice::OpenMode mode = QIODevice::ReadWrite);
+ void start(const QString &program, QIODevice::OpenMode mode = QIODevice::ReadWrite);
+
+ void closeWriteChannel();
void kill();
void terminate();
QByteArray readAll();
QByteArray readAllStandardOutput();
QByteArray readAllStandardError();
- void setWorkingDirectory(const QString &dir);
-
- void start(const QString &program);
- void start(const QString &program, const QStringList &arguments,
- QIODevice::OpenMode mode = QIODevice::ReadWrite);
static bool startDetached(const QString &program);
static bool startDetached(const QString &program, const QStringList &arguments);
static bool startDetached(const QString &program, const QStringList &arguments,
const QString &workingDirectory, qint64 *pid = 0);
- ProcessState state() const;
- bool waitForStarted(int msecs = 30000);
- bool waitForFinished(int msecs = 30000);
- void setEnvironment(const QStringList &environment);
- QString workingDirectory() const;
QString errorString() const;
qint64 write(const QByteArray &byteArray);
- QProcessWrapper::ProcessChannel readChannel() const;
- void setReadChannel(QProcessWrapper::ProcessChannel channel);
- QProcessWrapper::ProcessChannelMode processChannelMode() const;
- void setProcessChannelMode(QProcessWrapper::ProcessChannelMode channel);
#ifdef Q_OS_WIN
void setNativeArguments(const QString &arguments);
#endif
@@ -127,12 +139,19 @@ Q_SIGNALS:
public Q_SLOTS:
void cancel();
-protected:
- void timerEvent(QTimerEvent *event);
+private slots:
+ void processSignals();
private:
- class Private;
- Private *d;
+ QTimer m_timer;
+ QProcess process;
+ mutable QReadWriteLock m_lock;
};
+} // namespace QInstaller
+
+Q_DECLARE_METATYPE(QProcess::ExitStatus)
+Q_DECLARE_METATYPE(QProcess::ProcessError)
+Q_DECLARE_METATYPE(QProcess::ProcessState)
+
#endif // QPROCESSWRAPPER_H