OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qt4projectmanager / qt-maemo / maemodebugsupport.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 ** GNU Lesser General Public License Usage
10 **
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
14 ** Please review the following information to ensure the GNU Lesser General
15 ** Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** Other Usage
23 **
24 ** Alternatively, this file may be used in accordance with the terms and
25 ** conditions contained in a signed written agreement between you and Nokia.
26 **
27 ** If you have questions regarding the use of this file, please contact
28 ** Nokia at qt-info@nokia.com.
29 **
30 **************************************************************************/
31
32 #ifndef MAEMODEBUGSUPPORT_H
33 #define MAEMODEBUGSUPPORT_H
34
35 #include "maemorunconfiguration.h"
36
37 #include <utils/ssh/sftpdefs.h>
38 #include <utils/environment.h>
39
40 #include <QtCore/QObject>
41 #include <QtCore/QPointer>
42 #include <QtCore/QSharedPointer>
43
44 namespace Core { class SftpChannel; }
45
46 namespace Debugger {
47 class DebuggerEngine;
48 }
49
50 namespace ProjectExplorer { class RunControl; }
51
52 namespace Qt4ProjectManager {
53 namespace Internal {
54
55 class MaemoDeviceConfig;
56 class MaemoRunConfiguration;
57 class MaemoSshRunner;
58
59 class MaemoDebugSupport : public QObject
60 {
61     Q_OBJECT
62 public:
63     static ProjectExplorer::RunControl *createDebugRunControl(MaemoRunConfiguration *runConfig);
64
65     MaemoDebugSupport(MaemoRunConfiguration *runConfig,
66         Debugger::DebuggerEngine *engine, bool useGdb);
67     ~MaemoDebugSupport();
68
69     static QString uploadDir(const QSharedPointer<const MaemoDeviceConfig> &devConf);
70
71 private slots:
72     void handleAdapterSetupRequested();
73     void handleSshError(const QString &error);
74     void startExecution();
75     void handleSftpChannelInitialized();
76     void handleSftpChannelInitializationFailed(const QString &error);
77     void handleSftpJobFinished(Utils::SftpJobId job, const QString &error);
78     void handleDebuggingFinished();
79     void handleRemoteOutput(const QByteArray &output);
80     void handleRemoteErrorOutput(const QByteArray &output);
81     void handleProgressReport(const QString &progressOutput);
82     void handleRemoteProcessStarted();
83
84 private:
85     enum State {
86         Inactive, StartingRunner, InitializingUploader, UploadingDumpers,
87         DumpersUploaded, StartingRemoteProcess, Debugging
88     };
89
90     void handleAdapterSetupFailed(const QString &error);
91     void handleAdapterSetupDone();
92     void startDebugging();
93     bool useGdb() const;
94     void setState(State newState);
95     bool setPort(int &port);
96
97     void showMessage(const QString &msg, int channel);
98     const QPointer<Debugger::DebuggerEngine> m_engine;
99     const QPointer<MaemoRunConfiguration> m_runConfig;
100     const QSharedPointer<const MaemoDeviceConfig> m_deviceConfig;
101     MaemoSshRunner * const m_runner;
102     const MaemoRunConfiguration::DebuggingType m_debuggingType;
103     const QString m_dumperLib;
104     const QList<Utils::EnvironmentItem> m_userEnvChanges;
105
106     QSharedPointer<Utils::SftpChannel> m_uploader;
107     Utils::SftpJobId m_uploadJob;
108     QByteArray m_gdbserverOutput;
109     State m_state;
110     int m_gdbServerPort;
111     int m_qmlPort;
112     bool m_useGdb;
113 };
114
115 } // namespace Internal
116 } // namespace Qt4ProjectManager
117
118 #endif // MAEMODEBUGSUPPORT_H