debuggerrunner.h 4.11 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2 3 4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
con's avatar
con committed
9
** No Commercial Usage
10
**
con's avatar
con committed
11 12 13 14
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
15
**
16
** GNU Lesser General Public License Usage
17
**
18 19 20 21 22 23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
con's avatar
con committed
25 26 27 28 29 30
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
con's avatar
con committed
31
**
32
**************************************************************************/
hjk's avatar
hjk committed
33

con's avatar
con committed
34 35 36
#ifndef DEBUGGERRUNNER_H
#define DEBUGGERRUNNER_H

37
#include "debugger_global.h"
hjk's avatar
hjk committed
38

con's avatar
con committed
39
#include <projectexplorer/runconfiguration.h>
40

41 42
#include <QtCore/QScopedPointer>

43
namespace Utils {
44
class Environment;
45
}
con's avatar
con committed
46 47

namespace Debugger {
48
class DebuggerEngine;
49
class DebuggerRunControl;
50
class DebuggerStartParameters;
hjk's avatar
hjk committed
51

hjk's avatar
hjk committed
52 53 54 55
namespace Internal {

class DebuggerRunControlPrivate;

56
class DebuggerRunControlFactory
57
    : public ProjectExplorer::IRunControlFactory
con's avatar
con committed
58 59
{
public:
60
    DebuggerRunControlFactory(QObject *parent, unsigned enabledEngines);
con's avatar
con committed
61

62
    // This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
63
    // FIXME: What to do in case of a 0 runConfiguration?
64 65
    typedef ProjectExplorer::RunConfiguration RunConfiguration;
    typedef ProjectExplorer::RunControl RunControl;
66
    DebuggerRunControl *create(const DebuggerStartParameters &sp,
67
        RunConfiguration *runConfiguration = 0);
68

69 70 71 72
    // ProjectExplorer::IRunControlFactory
    // FIXME: Used by qmljsinspector.cpp:469
    RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
    bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
hjk's avatar
hjk committed
73

con's avatar
con committed
74
private:
75 76 77
    QString displayName() const;
    QWidget *createConfigurationWidget(RunConfiguration *runConfiguration);

78
    unsigned m_enabledEngines;
con's avatar
con committed
79 80
};

hjk's avatar
hjk committed
81 82
} // namespace Internal

83

84 85
// This is a job description containing all data "local" to the jobs, including
// the models of the individual debugger views.
86
class DEBUGGER_EXPORT DebuggerRunControl
hjk's avatar
hjk committed
87
    : public ProjectExplorer::RunControl
con's avatar
con committed
88 89 90 91
{
    Q_OBJECT

public:
92
    typedef ProjectExplorer::RunConfiguration RunConfiguration;
hjk's avatar
hjk committed
93
    DebuggerRunControl(RunConfiguration *runConfiguration,
94
        unsigned enabledEngines, const DebuggerStartParameters &sp);
95
    ~DebuggerRunControl();
96

97
    // ProjectExplorer::RunControl
hjk's avatar
hjk committed
98 99 100 101
    void start();
    bool aboutToStop() const;
    StopResult stop(); // Called from SnapshotWindow.
    bool isRunning() const;
102
    QString displayName() const;
con's avatar
con committed
103

104
    void setCustomEnvironment(Utils::Environment env);
105 106
    void startFailed();
    void debuggingFinished();
107
    RunConfiguration *runConfiguration() const;
108
    DebuggerEngine *engine(); // FIXME: Remove. Only used by Maemo support.
109

110
    void showMessage(const QString &msg, int channel);
hjk's avatar
hjk committed
111

112 113 114 115
    static bool checkDebugConfiguration(int toolChain,
                                 QString *errorMessage,
                                 QString *settingsCategory = 0,
                                 QString *settingsPage = 0);
116
signals:
117
    void engineRequestSetup();
118

con's avatar
con committed
119
private slots:
120
    void handleFinished();
con's avatar
con committed
121

122 123 124
protected:
    const DebuggerStartParameters &startParameters() const;

con's avatar
con committed
125
private:
126
    friend class Internal::DebuggerRunControlFactory;
hjk's avatar
hjk committed
127
    QScopedPointer<Internal::DebuggerRunControlPrivate> d;
con's avatar
con committed
128 129 130 131 132
};

} // namespace Debugger

#endif // DEBUGGERRUNNER_H