forked from qt-creator/qt-creator
QmakeProject: Add a checkbox for use of the Qt Quick Compiler
Change-Id: Ibeb9fbf21e72d977b37616337595666aa9b59ccc Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
@@ -66,6 +66,7 @@ const char QMAKE_BS_ID[] = "QtProjectManager.QMakeBuildStep";
|
||||
|
||||
const char QMAKE_ARGUMENTS_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeArguments";
|
||||
const char QMAKE_FORCED_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeForced";
|
||||
const char QMAKE_USE_qtQuickCompiler[] = "QtProjectManager.QMakeBuildStep.UseqtQuickCompiler";
|
||||
const char QMAKE_QMLDEBUGLIBAUTO_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto";
|
||||
const char QMAKE_QMLDEBUGLIB_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary";
|
||||
}
|
||||
@@ -74,7 +75,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl) :
|
||||
AbstractProcessStep(bsl, Core::Id(QMAKE_BS_ID)),
|
||||
m_forced(false),
|
||||
m_needToRunQMake(false),
|
||||
m_linkQmlDebuggingLibrary(DebugLink)
|
||||
m_linkQmlDebuggingLibrary(DebugLink),
|
||||
m_useQtQuickCompiler(false)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -82,7 +84,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl) :
|
||||
QMakeStep::QMakeStep(BuildStepList *bsl, Core::Id id) :
|
||||
AbstractProcessStep(bsl, id),
|
||||
m_forced(false),
|
||||
m_linkQmlDebuggingLibrary(DebugLink)
|
||||
m_linkQmlDebuggingLibrary(DebugLink),
|
||||
m_useQtQuickCompiler(false)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -91,7 +94,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl, QMakeStep *bs) :
|
||||
AbstractProcessStep(bsl, bs),
|
||||
m_forced(bs->m_forced),
|
||||
m_userArgs(bs->m_userArgs),
|
||||
m_linkQmlDebuggingLibrary(bs->m_linkQmlDebuggingLibrary)
|
||||
m_linkQmlDebuggingLibrary(bs->m_linkQmlDebuggingLibrary),
|
||||
m_useQtQuickCompiler(bs->m_useQtQuickCompiler)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -180,6 +184,8 @@ QStringList QMakeStep::deducedArguments()
|
||||
arguments << QLatin1String(Constants::QMAKEVAR_QUICK2_DEBUG);
|
||||
}
|
||||
|
||||
if (useQtQuickCompiler() && version)
|
||||
arguments << QLatin1String("CONFIG+=qtquickcompiler");
|
||||
|
||||
return arguments;
|
||||
}
|
||||
@@ -369,6 +375,27 @@ void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
|
||||
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
||||
}
|
||||
|
||||
bool QMakeStep::useQtQuickCompiler() const
|
||||
{
|
||||
const Core::Context languages = project()->projectLanguages();
|
||||
if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS))
|
||||
return false;
|
||||
return m_useQtQuickCompiler;
|
||||
}
|
||||
|
||||
void QMakeStep::setUseQtQuickCompiler(bool enable)
|
||||
{
|
||||
if (enable == m_useQtQuickCompiler)
|
||||
return;
|
||||
|
||||
m_useQtQuickCompiler = enable;
|
||||
|
||||
emit useQtQuickCompilerChanged();
|
||||
|
||||
qmakeBuildConfiguration()->emitQMakeBuildConfigurationChanged();
|
||||
qmakeBuildConfiguration()->emitProFileEvaluateNeeded();
|
||||
}
|
||||
|
||||
QStringList QMakeStep::parserArguments()
|
||||
{
|
||||
QStringList result;
|
||||
@@ -403,6 +430,7 @@ QVariantMap QMakeStep::toMap() const
|
||||
map.insert(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), m_linkQmlDebuggingLibrary == DebugLink);
|
||||
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary == DoLink);
|
||||
map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
|
||||
map.insert(QLatin1String(QMAKE_USE_qtQuickCompiler), m_useQtQuickCompiler);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -410,6 +438,7 @@ bool QMakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
|
||||
m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
|
||||
m_useQtQuickCompiler = map.value(QLatin1String(QMAKE_USE_qtQuickCompiler), false).toBool();
|
||||
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
|
||||
m_linkQmlDebuggingLibrary = DebugLink;
|
||||
} else {
|
||||
@@ -434,12 +463,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
|
||||
m_ui->qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
|
||||
m_ui->qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
|
||||
m_ui->qtQuickCompilerCheckBox->setChecked(m_step->useQtQuickCompiler());
|
||||
|
||||
qmakeBuildConfigChanged();
|
||||
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
updateQmlDebuggingOption();
|
||||
updateQtQuickCompilerOption();
|
||||
|
||||
connect(m_ui->qmakeAdditonalArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(qmakeArgumentsLineEdited()));
|
||||
@@ -447,10 +478,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
this, SLOT(buildConfigurationSelected()));
|
||||
connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)),
|
||||
this, SLOT(linkQmlDebuggingLibraryChecked(bool)));
|
||||
connect(m_ui->qtQuickCompilerCheckBox, &QAbstractButton::toggled,
|
||||
this, &QMakeStepConfigWidget::useQtQuickCompilerChecked);
|
||||
connect(step, SIGNAL(userArgumentsChanged()),
|
||||
this, SLOT(userArgumentsChanged()));
|
||||
connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()),
|
||||
this, SLOT(linkQmlDebuggingLibraryChanged()));
|
||||
connect(step, &QMakeStep::useQtQuickCompilerChanged,
|
||||
this, &QMakeStepConfigWidget::useQtQuickCompilerChanged);
|
||||
connect(step->qmakeBuildConfiguration(), SIGNAL(qmakeBuildConfigurationChanged()),
|
||||
this, SLOT(qmakeBuildConfigChanged()));
|
||||
connect(step->target(), SIGNAL(kitChanged()), this, SLOT(qtVersionChanged()));
|
||||
@@ -516,6 +551,17 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged()
|
||||
updateQmlDebuggingOption();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::useQtQuickCompilerChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
// m_ui->qtQuickCompilerCheckBox->setChecked(m_step->useQtQuickCompiler());
|
||||
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
updateQtQuickCompilerOption();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
@@ -557,7 +603,11 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
updateQmlDebuggingOption();
|
||||
askForRebuild();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::askForRebuild()
|
||||
{
|
||||
QMessageBox *question = new QMessageBox(Core::ICore::mainWindow());
|
||||
question->setWindowTitle(tr("QML Debugging"));
|
||||
question->setText(tr("The option will only take effect if the project is recompiled. Do you want to recompile now?"));
|
||||
@@ -567,6 +617,21 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
|
||||
question->show();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::useQtQuickCompilerChecked(bool checked)
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
|
||||
m_ignoreChange = true;
|
||||
m_step->setUseQtQuickCompiler(checked);
|
||||
m_ignoreChange = false;
|
||||
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
updateQtQuickCompilerOption();
|
||||
askForRebuild();
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::updateSummaryLabel()
|
||||
{
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(m_step->target()->kit());
|
||||
@@ -596,6 +661,17 @@ void QMakeStepConfigWidget::updateQmlDebuggingOption()
|
||||
m_ui->qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty());
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::updateQtQuickCompilerOption()
|
||||
{
|
||||
QString warningText;
|
||||
bool supported = QtSupport::BaseQtVersion::isQtQuickCompilerSupported(m_step->target()->kit(),
|
||||
&warningText);
|
||||
m_ui->qtQuickCompilerCheckBox->setEnabled(supported);
|
||||
m_ui->qtQuickCompilerLabel->setText(tr("Enable Qt Quick Compiler:"));
|
||||
m_ui->qtQuickCompilerWarningText->setText(warningText);
|
||||
m_ui->qtQuickCompilerWarningIcon->setVisible(!warningText.isEmpty());
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::updateEffectiveQMakeCall()
|
||||
{
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(m_step->target()->kit());
|
||||
|
||||
@@ -112,12 +112,15 @@ public:
|
||||
void setUserArguments(const QString &arguments);
|
||||
bool linkQmlDebuggingLibrary() const;
|
||||
void setLinkQmlDebuggingLibrary(bool enable);
|
||||
bool useQtQuickCompiler() const;
|
||||
void setUseQtQuickCompiler(bool enable);
|
||||
|
||||
QVariantMap toMap() const;
|
||||
|
||||
signals:
|
||||
void userArgumentsChanged();
|
||||
void linkQmlDebuggingLibraryChanged();
|
||||
void useQtQuickCompilerChanged();
|
||||
|
||||
protected:
|
||||
QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
|
||||
@@ -135,6 +138,7 @@ private:
|
||||
bool m_needToRunQMake; // set in init(), read in run()
|
||||
QString m_userArgs;
|
||||
QmlLibraryLink m_linkQmlDebuggingLibrary;
|
||||
bool m_useQtQuickCompiler;
|
||||
bool m_scriptTemplate;
|
||||
};
|
||||
|
||||
@@ -154,11 +158,13 @@ private slots:
|
||||
void qmakeBuildConfigChanged();
|
||||
void userArgumentsChanged();
|
||||
void linkQmlDebuggingLibraryChanged();
|
||||
void useQtQuickCompilerChanged();
|
||||
|
||||
// slots for dealing with user changes in our UI
|
||||
void qmakeArgumentsLineEdited();
|
||||
void buildConfigurationSelected();
|
||||
void linkQmlDebuggingLibraryChecked(bool checked);
|
||||
void useQtQuickCompilerChecked(bool checked);
|
||||
|
||||
private slots:
|
||||
void recompileMessageBoxFinished(int button);
|
||||
@@ -166,7 +172,9 @@ private slots:
|
||||
private:
|
||||
void updateSummaryLabel();
|
||||
void updateQmlDebuggingOption();
|
||||
void updateQtQuickCompilerOption();
|
||||
void updateEffectiveQMakeCall();
|
||||
void askForRebuild();
|
||||
|
||||
void setSummaryText(const QString &);
|
||||
|
||||
|
||||
@@ -154,6 +154,65 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="qtQuickCompilerLabel">
|
||||
<property name="text">
|
||||
<string>Use QML compiler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="qtQuickCompilerCheckBox">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qtQuickCompilerWarningIcon">
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../coreplugin/core.qrc">:/core/images/warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qtQuickCompilerWarningText">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Effective qmake call:</string>
|
||||
@@ -163,7 +222,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QPlainTextEdit" name="qmakeArgumentsEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -183,6 +242,7 @@
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../projectexplorer/projectexplorer.qrc"/>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1501,6 +1501,35 @@ bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseQtVersion::isQtQuickCompilerSupported(Kit *k, QString *reason)
|
||||
{
|
||||
QTC_ASSERT(k, return false);
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(k);
|
||||
if (!version) {
|
||||
if (reason)
|
||||
*reason = QCoreApplication::translate("BaseQtVersion", "No Qt version.");
|
||||
return false;
|
||||
}
|
||||
return version->isQtQuickCompilerSupported(reason);
|
||||
}
|
||||
|
||||
bool BaseQtVersion::isQtQuickCompilerSupported(QString *reason) const
|
||||
{
|
||||
if (!isValid()) {
|
||||
if (reason)
|
||||
*reason = QCoreApplication::translate("BaseQtVersion", "Invalid Qt version.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (qtVersion() < QtVersionNumber(5, 3, 0)) {
|
||||
if (reason)
|
||||
*reason = QCoreApplication::translate("BaseQtVersion", "Requires Qt 5.3.0 or newer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseQtVersion::buildDebuggingHelper(Kit *k, int tools)
|
||||
{
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(k);
|
||||
|
||||
@@ -184,6 +184,8 @@ public:
|
||||
|
||||
static bool isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason = 0);
|
||||
bool isQmlDebuggingSupported(QString *reason = 0) const;
|
||||
static bool isQtQuickCompilerSupported(ProjectExplorer::Kit *k, QString *reason = 0);
|
||||
bool isQtQuickCompilerSupported(QString *reason = 0) const;
|
||||
static void buildDebuggingHelper(ProjectExplorer::Kit *k, int tools);
|
||||
void buildDebuggingHelper(ProjectExplorer::ToolChain *tc, int tools);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user