OSDN Git Service

Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
[qt-creator-jp/qt-creator-jp.git] / src / plugins / coreplugin / ssh / sshremoteprocess_p.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** Commercial Usage
10 **
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** If you are unsure which license is appropriate for your use, please
26 ** contact the sales department at http://qt.nokia.com/contact.
27 **
28 **************************************************************************/
29
30 #ifndef SSHREMOTEPROCESS_P_H
31 #define SSHREMOTEPROCESS_P_H
32
33 #include "sshchannel_p.h"
34
35 #include <QtCore/QList>
36 #include <QtCore/QPair>
37
38 namespace Core {
39 class SshRemoteProcess;
40
41 namespace Internal {
42 class SshSendFacility;
43
44 class SshRemoteProcessPrivate : public AbstractSshChannel
45 {
46     Q_OBJECT
47     friend class Core::SshRemoteProcess;
48 public:
49     enum ProcessState {
50         NotYetStarted, ExecRequested, StartFailed,Running, Exited
51     };
52
53     virtual void handleChannelSuccess();
54     virtual void handleChannelFailure();
55
56     virtual void closeHook();
57
58 signals:
59     void started();
60     void outputAvailable(const QByteArray &output);
61     void errorOutputAvailable(const QByteArray &output);
62     void closed(int exitStatus);
63
64 private:
65     SshRemoteProcessPrivate(const QByteArray &command, quint32 channelId,
66         SshSendFacility &sendFacility, SshRemoteProcess *proc);
67
68     virtual void handleOpenSuccessInternal();
69     virtual void handleOpenFailureInternal();
70     virtual void handleChannelDataInternal(const QByteArray &data);
71     virtual void handleChannelExtendedDataInternal(quint32 type,
72         const QByteArray &data);
73     virtual void handleExitStatus(const SshChannelExitStatus &exitStatus);
74     virtual void handleExitSignal(const SshChannelExitSignal &signal);
75
76     void setProcState(ProcessState newState);
77
78     ProcessState m_procState;
79     bool m_wasRunning;
80     QByteArray m_signal;
81     int m_exitCode;
82
83     const QByteArray m_command;
84
85     typedef QPair<QByteArray, QByteArray> EnvVar;
86     QList<EnvVar> m_env;
87
88     SshRemoteProcess *m_proc;
89 };
90
91 } // namespace Internal
92 } // namespace Core
93
94 #endif // SSHREMOTEPROCESS_P_H