s60devicerunconfiguration.h 6.04 KB
Newer Older
con's avatar
con committed
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
con's avatar
con committed
5
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
hjk's avatar
hjk committed
7
** Contact: Nokia Corporation (info@qt.nokia.com)
con's avatar
con committed
8 9 10 11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12 13 14 15 16 17
** 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.
con's avatar
con committed
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21 22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23 24 25 26 27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28 29
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
con's avatar
con committed
30 31 32
**
**************************************************************************/

33 34 35
#ifndef S60DEVICERUNCONFIGURATION_H
#define S60DEVICERUNCONFIGURATION_H

36
#include <debugger/debuggerrunner.h>
37 38
#include <projectexplorer/runconfiguration.h>

39
#include <QtCore/QFutureInterface>
40
#include <QtCore/QScopedPointer>
41
#include <QtCore/QStringList>
42

43 44 45 46 47
QT_BEGIN_NAMESPACE
class QMessageBox;
class QWidget;
QT_END_NAMESPACE

48
namespace Qt4ProjectManager {
49
class QtVersion;
50
class Qt4BaseTarget;
dt's avatar
dt committed
51

52
namespace Internal {
53
class Qt4SymbianTarget;
54
class Qt4ProFileNode;
55
class S60DeviceRunConfigurationFactory;
56
class CodaRunControl;
57 58 59 60

class S60DeviceRunConfiguration : public ProjectExplorer::RunConfiguration
{
    Q_OBJECT
61 62
    friend class S60DeviceRunConfigurationFactory;

63
public:
64
    S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath);
65
    virtual ~S60DeviceRunConfiguration();
66

67
    Qt4SymbianTarget *qt4Target() const;
68
    const QtVersion *qtVersion() const;
dt's avatar
dt committed
69

70
    using ProjectExplorer::RunConfiguration::isEnabled;
71
    bool isEnabled(ProjectExplorer::BuildConfiguration *configuration) const;
72
    QWidget *createConfigurationWidget();
73

dt's avatar
dt committed
74 75
    ProjectExplorer::OutputFormatter *createOutputFormatter() const;

76 77
    QString commandLineArguments() const;
    void setCommandLineArguments(const QString &args);
78
    QString qmlCommandLineArguments() const;
79

80
    QString projectFilePath() const;
81

82 83 84 85 86 87 88
    QString targetName() const;
    QString localExecutableFileName() const;
    quint32 executableUid() const;

    bool isDebug() const;
    QString symbianTarget() const;

89 90
    QVariantMap toMap() const;

91
    QString proFilePath() const;
92 93 94
signals:
    void targetInformationChanged();

95
protected:
96
    S60DeviceRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60DeviceRunConfiguration *source);
97
    QString defaultDisplayName() const;
98
    virtual bool fromMap(const QVariantMap &map);
99 100 101
private slots:
    void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
    void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success);
102

103
private:
104
    void ctor();
105
    void handleParserState(bool success);
106 107

    QString m_proFilePath;
108
    QString m_commandLineArguments;
109
    bool m_validParse;
110 111 112 113 114
};

class S60DeviceRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
    Q_OBJECT
115

116
public:
117
    explicit S60DeviceRunConfigurationFactory(QObject *parent = 0);
118
    ~S60DeviceRunConfigurationFactory();
119

Tobias Hunger's avatar
Tobias Hunger committed
120 121 122 123 124 125
    bool canCreate(ProjectExplorer::Target *parent, const QString &id) const;
    ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const QString &id);
    bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
    ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
    bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
    ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
126

Tobias Hunger's avatar
Tobias Hunger committed
127
    QStringList availableCreationIds(ProjectExplorer::Target *parent) const;
128 129
    // used to translate the ids to names to display to the user
    QString displayNameForId(const QString &id) const;
130 131
};

132
// S60DeviceDebugRunControl starts debugging
133

134
class S60DeviceDebugRunControl : public Debugger::DebuggerRunControl
135 136 137 138
{
    Q_DISABLE_COPY(S60DeviceDebugRunControl)
    Q_OBJECT
public:
139
    explicit S60DeviceDebugRunControl(S60DeviceRunConfiguration *runConfiguration,
140 141
                                      const Debugger::DebuggerStartParameters &sp,
                                      const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes);
142
    virtual void start();
143
    virtual bool promptToStop(bool *optionalPrompt = 0) const;
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159

private slots:
    void remoteSetupRequested();
    void codaConnected();
    void qmlEngineStateChanged(const Debugger::DebuggerState &state);
    void codaFinished();
    void handleDebuggingFinished();
    void handleMessageFromCoda(ProjectExplorer::RunControl *aCodaRunControl, const QString &msg, ProjectExplorer::OutputFormat format);

private:
    CodaRunControl *m_codaRunControl;
    enum {
        ENotUsingCodaRunControl = 0,
        EWaitingForCodaConnection,
        ECodaConnected,
    } m_codaState;
160 161
};

162 163 164 165 166 167 168 169
class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory
{
public:
    explicit S60DeviceDebugRunControlFactory(QObject *parent = 0);
    bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode) const;

    ProjectExplorer::RunControl* create(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
    QString displayName() const;
170
    ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration * /*runConfiguration */);
171 172
};

173 174 175 176
} // namespace Internal
} // namespace Qt4ProjectManager

#endif // S60DEVICERUNCONFIGURATION_H