s60emulatorrunconfiguration.h 5.22 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 7 8
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
con's avatar
con committed
9
** No Commercial Usage
con's avatar
con committed
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.
con's avatar
con committed
15 16 17 18 19 20 21 22 23 24
**
** GNU Lesser General Public License Usage
**
** 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.
**
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 33
**
**************************************************************************/

34 35 36 37 38 39
#ifndef S60EMULATORRUNCONFIGURATION_H
#define S60EMULATORRUNCONFIGURATION_H

#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/applicationlauncher.h>

40
#include <QtCore/QVariantMap>
41
#include <QtGui/QWidget>
42 43 44 45 46 47 48

QT_BEGIN_NAMESPACE
class QLabel;
class QLineEdit;
QT_END_NAMESPACE

namespace Utils {
49
class DetailsWidget;
50
}
51 52

namespace Qt4ProjectManager {
dt's avatar
dt committed
53
class Qt4Project;
54
class Qt4BaseTarget;
dt's avatar
dt committed
55

56
namespace Internal {
57
class Qt4SymbianTarget;
58
class Qt4ProFileNode;
59
class S60EmulatorRunConfigurationFactory;
60 61 62 63

class S60EmulatorRunConfiguration : public ProjectExplorer::RunConfiguration
{
    Q_OBJECT
64 65
    friend class S60EmulatorRunConfigurationFactory;

66
public:
67
    S60EmulatorRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, const QString &proFilePath);
68
    virtual ~S60EmulatorRunConfiguration();
69

70
    Qt4SymbianTarget *qt4Target() const;
dt's avatar
dt committed
71

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

dt's avatar
dt committed
76 77
    ProjectExplorer::OutputFormatter *createOutputFormatter() const;

78 79
    QString executable() const;

80 81
    QVariantMap toMap() const;

82 83
    QString proFilePath() const;

84 85 86 87
signals:
    void targetInformationChanged();

private slots:
88 89
    void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro, bool success);
    void proFileInvalidated(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
90

91
protected:
92
    S60EmulatorRunConfiguration(Qt4ProjectManager::Qt4BaseTarget *parent, S60EmulatorRunConfiguration *source);
93 94
    virtual bool fromMap(const QVariantMap &map);

95
private:
96
    void ctor();
Pawel Polanski's avatar
Pawel Polanski committed
97
    void handleParserState(bool success);
98 99 100
    void updateTarget();

    QString m_proFilePath;
101
    bool m_validParse;
102 103 104 105 106 107
};

class S60EmulatorRunConfigurationWidget : public QWidget
{
    Q_OBJECT
public:
108 109
    explicit S60EmulatorRunConfigurationWidget(S60EmulatorRunConfiguration *runConfiguration,
                                               QWidget *parent = 0);
110 111 112

private slots:
    void updateTargetInformation();
113
    void runConfigurationEnabledChange(bool enabled);
114 115 116

private:
    S60EmulatorRunConfiguration *m_runConfiguration;
117
    Utils::DetailsWidget *m_detailsWidget;
118 119 120 121 122 123 124
    QLabel *m_executableLabel;
};

class S60EmulatorRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
{
    Q_OBJECT
public:
125
    explicit S60EmulatorRunConfigurationFactory(QObject *parent = 0);
126
    ~S60EmulatorRunConfigurationFactory();
127

Tobias Hunger's avatar
Tobias Hunger committed
128 129 130 131 132 133
    bool canCreate(ProjectExplorer::Target *project, 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);
134

Tobias Hunger's avatar
Tobias Hunger committed
135
    QStringList availableCreationIds(ProjectExplorer::Target *pro) const;
136 137
    // used to translate the ids to names to display to the user
    QString displayNameForId(const QString &id) const;
138 139 140 141 142 143
};

class S60EmulatorRunControl : public ProjectExplorer::RunControl
{
    Q_OBJECT
public:
dt's avatar
dt committed
144
    explicit S60EmulatorRunControl(S60EmulatorRunConfiguration *runConfiguration, QString mode);
145 146
    ~S60EmulatorRunControl() {}
    void start();
147
    virtual StopResult stop();
148
    bool isRunning() const;
149
    QIcon icon() const;
150 151 152

private slots:
    void processExited(int exitCode);
153
    void slotAppendMessage(const QString &line, ProjectExplorer::OutputFormat);
154 155 156 157 158 159 160 161 162 163 164
    void slotError(const QString & error);

private:
    ProjectExplorer::ApplicationLauncher m_applicationLauncher;
    QString m_executable;
};

} // namespace Internal
} // namespace Qt4ProjectManager

#endif // S60EMULATORRUNCONFIGURATION_H