~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of Qt Creator.
 
7
**
 
8
** Commercial License Usage
 
9
** Licensees holding valid commercial Qt licenses may use this file in
 
10
** accordance with the commercial license agreement provided with the
 
11
** Software or, alternatively, in accordance with the terms contained in
 
12
** a written agreement between you and Digia.  For licensing terms and
 
13
** conditions see http://qt.digia.com/licensing.  For further information
 
14
** use the contact form at http://qt.digia.com/contact-us.
 
15
**
 
16
** GNU Lesser General Public License Usage
 
17
** Alternatively, this file may be used under the terms of the GNU Lesser
 
18
** General Public License version 2.1 as published by the Free Software
 
19
** Foundation and appearing in the file LICENSE.LGPL included in the
 
20
** packaging of this file.  Please review the following information to
 
21
** ensure the GNU Lesser General Public License version 2.1 requirements
 
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
23
**
 
24
** In addition, as a special exception, Digia gives you certain additional
 
25
** rights.  These rights are described in the Digia Qt LGPL Exception
 
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
27
**
 
28
****************************************************************************/
 
29
 
 
30
#ifndef DESKTOPQMAKERUNCONFIGURATION_H
 
31
#define DESKTOPQMAKERUNCONFIGURATION_H
 
32
 
 
33
#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
 
34
 
 
35
#include <projectexplorer/localapplicationrunconfiguration.h>
 
36
 
 
37
 
 
38
#include <QStringList>
 
39
#include <QLabel>
 
40
#include <QWidget>
 
41
 
 
42
QT_BEGIN_NAMESPACE
 
43
class QCheckBox;
 
44
class QLineEdit;
 
45
class QRadioButton;
 
46
class QComboBox;
 
47
QT_END_NAMESPACE
 
48
 
 
49
namespace Utils {
 
50
class PathChooser;
 
51
class DetailsWidget;
 
52
}
 
53
 
 
54
namespace QmakeProjectManager {
 
55
 
 
56
class QmakeProject;
 
57
class QmakeProFileNode;
 
58
class QmakePriFileNode;
 
59
class TargetInformation;
 
60
 
 
61
namespace Internal {
 
62
class DesktopQmakeRunConfigurationFactory;
 
63
 
 
64
class DesktopQmakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
 
65
{
 
66
    Q_OBJECT
 
67
    // to change the display name and arguments and set the userenvironmentchanges
 
68
    friend class DesktopQmakeRunConfigurationWidget;
 
69
    friend class DesktopQmakeRunConfigurationFactory;
 
70
 
 
71
public:
 
72
    DesktopQmakeRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
 
73
    virtual ~DesktopQmakeRunConfiguration();
 
74
 
 
75
    virtual bool isEnabled() const;
 
76
    virtual QString disabledReason() const;
 
77
    virtual QWidget *createConfigurationWidget();
 
78
 
 
79
    virtual QString executable() const;
 
80
    virtual RunMode runMode() const;
 
81
    bool forcedGuiMode() const;
 
82
    virtual QString workingDirectory() const;
 
83
    virtual QString commandLineArguments() const;
 
84
    QString dumperLibrary() const;
 
85
    QStringList dumperLibraryLocations() const;
 
86
 
 
87
    bool isUsingDyldImageSuffix() const;
 
88
    void setUsingDyldImageSuffix(bool state);
 
89
 
 
90
    QString proFilePath() const;
 
91
 
 
92
    QVariantMap toMap() const;
 
93
 
 
94
    Utils::OutputFormatter *createOutputFormatter() const;
 
95
 
 
96
    void setRunMode(RunMode runMode);
 
97
 
 
98
    void addToBaseEnvironment(Utils::Environment &env) const;
 
99
 
 
100
signals:
 
101
    void commandLineArgumentsChanged(const QString&);
 
102
    void baseWorkingDirectoryChanged(const QString&);
 
103
    void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
 
104
    void usingDyldImageSuffixChanged(bool);
 
105
 
 
106
    // Note: These signals might not get emitted for every change!
 
107
    void effectiveTargetInformationChanged();
 
108
 
 
109
private slots:
 
110
    void kitChanged();
 
111
    void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
 
112
 
 
113
protected:
 
114
    DesktopQmakeRunConfiguration(ProjectExplorer::Target *parent, DesktopQmakeRunConfiguration *source);
 
115
    virtual bool fromMap(const QVariantMap &map);
 
116
 
 
117
private:
 
118
    QPair<QString, QString> extractWorkingDirAndExecutable(const QmakeProFileNode *node) const;
 
119
    void setBaseWorkingDirectory(const QString &workingDirectory);
 
120
    QString baseWorkingDirectory() const;
 
121
    void setCommandLineArguments(const QString &argumentsString);
 
122
    QString rawCommandLineArguments() const;
 
123
    QString defaultDisplayName();
 
124
 
 
125
    void ctor();
 
126
 
 
127
    void updateTarget();
 
128
    QString m_commandLineArguments;
 
129
    QString m_proFilePath; // Full path to the Application Pro File
 
130
 
 
131
    // Cached startup sub project information
 
132
    ProjectExplorer::LocalApplicationRunConfiguration::RunMode m_runMode;
 
133
    bool m_forcedGuiMode;
 
134
    bool m_userSetName;
 
135
    bool m_isUsingDyldImageSuffix;
 
136
    QString m_userWorkingDirectory;
 
137
    bool m_parseSuccess;
 
138
    bool m_parseInProgress;
 
139
};
 
140
 
 
141
class DesktopQmakeRunConfigurationWidget : public QWidget
 
142
{
 
143
    Q_OBJECT
 
144
 
 
145
public:
 
146
    DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent);
 
147
    ~DesktopQmakeRunConfigurationWidget();
 
148
 
 
149
protected:
 
150
    void showEvent(QShowEvent *event);
 
151
    void hideEvent(QHideEvent *event);
 
152
 
 
153
private slots:
 
154
    void runConfigurationEnabledChange();
 
155
    void workDirectoryEdited();
 
156
    void workingDirectoryReseted();
 
157
    void argumentsEdited(const QString &arguments);
 
158
    void environmentWasChanged();
 
159
 
 
160
    void workingDirectoryChanged(const QString &workingDirectory);
 
161
    void commandLineArgumentsChanged(const QString &args);
 
162
    void runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode runMode);
 
163
 
 
164
    void effectiveTargetInformationChanged();
 
165
    void termToggled(bool);
 
166
    void qvfbToggled(bool);
 
167
    void usingDyldImageSuffixToggled(bool);
 
168
    void usingDyldImageSuffixChanged(bool);
 
169
 
 
170
private:
 
171
    DesktopQmakeRunConfiguration *m_qmakeRunConfiguration;
 
172
    bool m_ignoreChange;
 
173
    QLabel *m_disabledIcon;
 
174
    QLabel *m_disabledReason;
 
175
    QLineEdit *m_executableLineEdit;
 
176
    Utils::PathChooser *m_workingDirectoryEdit;
 
177
    QLineEdit *m_argumentsLineEdit;
 
178
    QCheckBox *m_useTerminalCheck;
 
179
    QCheckBox *m_useQvfbCheck;
 
180
    QCheckBox *m_usingDyldImageSuffix;
 
181
    QLineEdit *m_qmlDebugPort;
 
182
    Utils::DetailsWidget *m_detailsContainer;
 
183
    bool m_isShown;
 
184
};
 
185
 
 
186
class DesktopQmakeRunConfigurationFactory : public QmakeRunConfigurationFactory
 
187
{
 
188
    Q_OBJECT
 
189
 
 
190
public:
 
191
    explicit DesktopQmakeRunConfigurationFactory(QObject *parent = 0);
 
192
    ~DesktopQmakeRunConfigurationFactory();
 
193
 
 
194
    bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
 
195
    bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
 
196
    bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
 
197
    ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
 
198
 
 
199
    QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
 
200
    QString displayNameForId(const Core::Id id) const;
 
201
 
 
202
    QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
 
203
                                                                        ProjectExplorer::Node *n);
 
204
 
 
205
private:
 
206
    bool canHandle(ProjectExplorer::Target *t) const;
 
207
 
 
208
    ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
 
209
    ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
 
210
                                                 const QVariantMap &map);
 
211
};
 
212
 
 
213
} // namespace Internal
 
214
} // namespace QmakeProjectManager
 
215
 
 
216
#endif // DESKTOPQMAKERUNCONFIGURATION_H