SSH: Derive SshRemoteProcess from QIODevice.

Now it looks even more like QProcess. Things like process channels are
still missing.

Change-Id: I3f30cd00ed4a054d02e83add9a6f4162b48f8345
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-11-15 17:13:02 +01:00
parent d9dde0d5e8
commit 4c76e40617
17 changed files with 171 additions and 91 deletions

View File

@@ -35,7 +35,7 @@
#include <utils/utils_global.h>
#include <QtCore/QObject>
#include <QtCore/QProcess>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
@@ -50,7 +50,8 @@ class SshRemoteProcessPrivate;
class SshSendFacility;
} // namespace Internal
class QTCREATOR_UTILS_EXPORT SshRemoteProcess : public QObject
// TODO: ProcessChannel
class QTCREATOR_UTILS_EXPORT SshRemoteProcess : public QIODevice
{
Q_OBJECT
@@ -77,6 +78,13 @@ public:
~SshRemoteProcess();
// QIODevice stuff
bool atEnd() const;
qint64 bytesAvailable() const;
bool canReadLine() const;
void close();
bool isSequential() const { return true; }
/*
* Note that this is of limited value in practice, because servers are
* usually configured to ignore such requests for security reasons.
@@ -85,10 +93,8 @@ public:
void requestTerminal(const SshPseudoTerminal &terminal);
void start();
void closeChannel();
bool isRunning() const;
QString errorString() const;
int exitCode() const;
QByteArray exitSignal() const;
@@ -99,8 +105,6 @@ public:
void sendSignal(const QByteArray &signal);
void kill() { sendSignal(KillSignal); }
void sendInput(const QByteArray &data); // Should usually have a trailing newline.
signals:
void started();
@@ -118,6 +122,10 @@ private:
Internal::SshSendFacility &sendFacility);
SshRemoteProcess(quint32 channelId, Internal::SshSendFacility &sendFacility);
// QIODevice stuff
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
void init();
Internal::SshRemoteProcessPrivate *d;