debuggerrunner.h 4.05 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
**
9
** Commercial Usage
10
**
11 12 13 14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
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
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30 31 32
#ifndef DEBUGGERRUNNER_H
#define DEBUGGERRUNNER_H

33
#include "debugger_global.h"
hjk's avatar
hjk committed
34 35
#include "debuggerconstants.h"

con's avatar
con committed
36
#include <projectexplorer/runconfiguration.h>
37 38

namespace ProjectExplorer {
39
class Environment;
40
}
con's avatar
con committed
41

42

con's avatar
con committed
43
namespace Debugger {
hjk's avatar
hjk committed
44

45
class DebuggerStartParameters;
hjk's avatar
hjk committed
46

47
namespace Internal {
48
class DebuggerEngine;
49 50
}

hjk's avatar
hjk committed
51 52
//DEBUGGER_EXPORT QDebug operator<<(QDebug str, const DebuggerStartParameters &);

53
class DEBUGGER_EXPORT DebuggerRunControlFactory
54
    : public ProjectExplorer::IRunControlFactory
con's avatar
con committed
55 56 57 58
{
    Q_OBJECT

public:
59
    DebuggerRunControlFactory(QObject *parent, DebuggerEngineType enabledEngines);
con's avatar
con committed
60

61
    // ProjectExplorer::IRunControlFactory
62 63 64 65 66 67 68
    bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
        const QString &mode) const;
    ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration
        *runConfiguration, const QString &mode);
    QString displayName() const;
    QWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration
        *runConfiguration);
69

70
    // This is used by the "Non-Standard" scenarios, e.g. Attach to Core.
71 72 73
    // FIXME: What to do in case of a 0 runConfiguration?
    ProjectExplorer::RunControl *create(const DebuggerStartParameters &sp,
        ProjectExplorer::RunConfiguration *runConfiguration = 0);
74

con's avatar
con committed
75
private:
76
    DebuggerEngineType m_enabledEngines;
con's avatar
con committed
77 78
};

79

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

public:
88
    DebuggerRunControl(ProjectExplorer::RunConfiguration *runConfiguration);
89
    ~DebuggerRunControl();
90

91
    // ProjectExplorer::RunControl
con's avatar
con committed
92 93 94
    virtual void start();
    virtual void stop();
    virtual bool isRunning() const;
95
    QString displayName() const;
con's avatar
con committed
96

97
    void createEngine(const DebuggerStartParameters &startParameters);
98

99 100
    void setCustomEnvironment(ProjectExplorer::Environment env);
    void setEnabledEngines(DebuggerEngineType enabledEngines);
101

102 103 104
    void startFailed();
    void startSuccessful();
    void debuggingFinished();
105

Friedemann Kleint's avatar
Friedemann Kleint committed
106
    DebuggerState state() const;
107
    Internal::DebuggerEngine *engine();
108

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

111 112 113 114
    static bool checkDebugConfiguration(int toolChain,
                                 QString *errorMessage,
                                 QString *settingsCategory = 0,
                                 QString *settingsPage = 0);
115

con's avatar
con committed
116
private slots:
117 118
    void handleStarted();
    void handleFinished();
con's avatar
con committed
119 120

private:
121
    void init();
122 123 124 125 126 127 128 129 130

    DebuggerEngineType engineForExecutable(const QString &executable);
    DebuggerEngineType engineForMode(DebuggerStartMode mode);

    Internal::DebuggerEngine *m_engine;
    bool m_running;
    DebuggerEngineType m_enabledEngines;
    QString m_errorMessage;
    QString m_settingsIdHint;
con's avatar
con committed
131 132 133 134 135
};

} // namespace Debugger

#endif // DEBUGGERRUNNER_H