forked from qt-creator/qt-creator
ProjectExplorer: Let user provide default build properties
Fixes: QTCREATORBUG-16458 Change-Id: I5f7a2450307a8d2e3392ca167411d1e00b58f05a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -13,6 +13,8 @@ add_qtc_plugin(ProjectExplorer
|
||||
appoutputpane.cpp appoutputpane.h
|
||||
baseprojectwizarddialog.cpp baseprojectwizarddialog.h
|
||||
buildaspects.cpp buildaspects.h
|
||||
buildpropertiessettings.h
|
||||
buildpropertiessettingspage.cpp buildpropertiessettingspage.h
|
||||
buildconfiguration.cpp buildconfiguration.h
|
||||
buildenvironmentwidget.cpp buildenvironmentwidget.h
|
||||
buildinfo.cpp buildinfo.h
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
#include "buildaspects.h"
|
||||
|
||||
#include "buildpropertiessettings.h"
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -131,6 +134,7 @@ SeparateDebugInfoAspect::SeparateDebugInfoAspect()
|
||||
{
|
||||
setDisplayName(tr("Separate Debug Info:"));
|
||||
setSettingsKey("SeparateDebugInfo");
|
||||
setSetting(ProjectExplorerPlugin::buildPropertiesSettings().separateDebugInfo);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
42
src/plugins/projectexplorer/buildpropertiessettings.h
Normal file
42
src/plugins/projectexplorer/buildpropertiessettings.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "projectconfigurationaspects.h"
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildPropertiesSettings
|
||||
{
|
||||
public:
|
||||
BaseTriStateAspect::Value separateDebugInfo = BaseTriStateAspect::Value::Default;
|
||||
BaseTriStateAspect::Value qmlDebugging = BaseTriStateAspect::Value::Default;
|
||||
BaseTriStateAspect::Value qtQuickCompiler = BaseTriStateAspect::Value::Default;
|
||||
bool showQtSettings = false;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
111
src/plugins/projectexplorer/buildpropertiessettingspage.cpp
Normal file
111
src/plugins/projectexplorer/buildpropertiessettingspage.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "buildpropertiessettingspage.h"
|
||||
|
||||
#include "buildpropertiessettings.h"
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QComboBox>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class BuildPropertiesSettingsPage::SettingsWidget : public QWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Internal::BuildPropertiesSettingsPage)
|
||||
public:
|
||||
SettingsWidget()
|
||||
{
|
||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||
for (QComboBox * const comboBox : {&m_separateDebugInfoComboBox, &m_qmlDebuggingComboBox,
|
||||
&m_qtQuickCompilerComboBox}) {
|
||||
comboBox->addItem(tr("Enable"), int(BaseTriStateAspect::Value::Enabled));
|
||||
comboBox->addItem(tr("Disable"), int(BaseTriStateAspect::Value::Disabled));
|
||||
comboBox->addItem(tr("Use Project Default"), int(BaseTriStateAspect::Value::Default));
|
||||
}
|
||||
m_separateDebugInfoComboBox.setCurrentIndex(m_separateDebugInfoComboBox
|
||||
.findData(int(settings.separateDebugInfo)));
|
||||
m_qmlDebuggingComboBox.setCurrentIndex(m_qmlDebuggingComboBox
|
||||
.findData(int(settings.qmlDebugging)));
|
||||
m_qtQuickCompilerComboBox.setCurrentIndex(m_qtQuickCompilerComboBox
|
||||
.findData(int(settings.qtQuickCompiler)));
|
||||
const auto layout = new QFormLayout(this);
|
||||
layout->addRow(tr("Separate debug info:"), &m_separateDebugInfoComboBox);
|
||||
if (settings.showQtSettings) {
|
||||
layout->addRow(tr("QML debugging:"), &m_qmlDebuggingComboBox);
|
||||
layout->addRow(tr("Use Qt Quick Compiler:"), &m_qtQuickCompilerComboBox);
|
||||
} else {
|
||||
m_qmlDebuggingComboBox.hide();
|
||||
m_qtQuickCompilerComboBox.hide();
|
||||
}
|
||||
}
|
||||
|
||||
BuildPropertiesSettings settings() const
|
||||
{
|
||||
BuildPropertiesSettings s;
|
||||
s.separateDebugInfo = static_cast<BaseTriStateAspect::Value>(
|
||||
m_separateDebugInfoComboBox.currentData().toInt());
|
||||
s.qmlDebugging = static_cast<BaseTriStateAspect::Value>(
|
||||
m_qmlDebuggingComboBox.currentData().toInt());
|
||||
s.qtQuickCompiler = static_cast<BaseTriStateAspect::Value>(
|
||||
m_qtQuickCompilerComboBox.currentData().toInt());
|
||||
return s;
|
||||
}
|
||||
|
||||
private:
|
||||
QComboBox m_separateDebugInfoComboBox;
|
||||
QComboBox m_qmlDebuggingComboBox;
|
||||
QComboBox m_qtQuickCompilerComboBox;
|
||||
};
|
||||
|
||||
BuildPropertiesSettingsPage::BuildPropertiesSettingsPage()
|
||||
{
|
||||
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
|
||||
setDisplayName(tr("Default Build Properties"));
|
||||
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
QWidget *BuildPropertiesSettingsPage::widget()
|
||||
{
|
||||
if (!m_widget)
|
||||
m_widget = new SettingsWidget;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void BuildPropertiesSettingsPage::apply()
|
||||
{
|
||||
if (m_widget)
|
||||
ProjectExplorerPlugin::setBuildPropertiesSettings(m_widget->settings());
|
||||
}
|
||||
|
||||
void BuildPropertiesSettingsPage::finish()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
51
src/plugins/projectexplorer/buildpropertiessettingspage.h
Normal file
51
src/plugins/projectexplorer/buildpropertiessettingspage.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class BuildPropertiesSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildPropertiesSettingsPage();
|
||||
|
||||
private:
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
class SettingsWidget;
|
||||
QPointer<SettingsWidget> m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include "appoutputpane.h"
|
||||
#include "buildpropertiessettings.h"
|
||||
#include "buildpropertiessettingspage.h"
|
||||
#include "buildsteplist.h"
|
||||
#include "buildsystem.h"
|
||||
#include "compileoutputwindow.h"
|
||||
@@ -269,6 +271,10 @@ const char ABORT_BUILD_ALL_ON_ERROR_SETTINGS_KEY[]
|
||||
= "ProjectExplorer/Settings/AbortBuildAllOnError";
|
||||
const char LOW_BUILD_PRIORITY_SETTINGS_KEY[] = "ProjectExplorer/Settings/LowBuildPriority";
|
||||
|
||||
const char SEPARATE_DEBUG_INFO_SETTINGS_KEY[] = "ProjectExplorer/Settings/SeparateDebugInfo";
|
||||
const char QML_DEBUGGING_SETTINGS_KEY[] = "ProjectExplorer/Settings/QmlDebugging";
|
||||
const char QT_QUICK_COMPILER_SETTINGS_KEY[] = "ProjectExplorer/Settings/QtQuickCompiler";
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
|
||||
@@ -513,6 +519,7 @@ public:
|
||||
QString m_projectFilterString;
|
||||
MiniProjectTargetSelector * m_targetSelector;
|
||||
ProjectExplorerSettings m_projectExplorerSettings;
|
||||
BuildPropertiesSettings m_buildPropertiesSettings;
|
||||
bool m_shouldHaveRunConfiguration = false;
|
||||
bool m_shuttingDown = false;
|
||||
Core::Id m_runMode = Constants::NO_RUN_MODE;
|
||||
@@ -588,6 +595,7 @@ public:
|
||||
|
||||
// Settings pages
|
||||
ProjectExplorerSettingsPage m_projectExplorerSettingsPage;
|
||||
BuildPropertiesSettingsPage m_buildPropertiesSettingsPage;
|
||||
AppOutputSettingsPage m_appOutputSettingsPage;
|
||||
CompileOutputSettingsPage m_compileOutputSettingsPage;
|
||||
DeviceSettingsPage m_deviceSettingsPage;
|
||||
@@ -1417,6 +1425,17 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
if (dd->m_projectExplorerSettings.buildDirectoryTemplate.isEmpty())
|
||||
dd->m_projectExplorerSettings.buildDirectoryTemplate = Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE;
|
||||
|
||||
const auto loadTriStateValue = [&s](const QString &key) {
|
||||
return static_cast<BaseTriStateAspect::Value>(
|
||||
s->value(key, int(BaseTriStateAspect::Value::Default)).toInt());
|
||||
};
|
||||
dd->m_buildPropertiesSettings.separateDebugInfo
|
||||
= loadTriStateValue(Constants::SEPARATE_DEBUG_INFO_SETTINGS_KEY);
|
||||
dd->m_buildPropertiesSettings.qmlDebugging
|
||||
= loadTriStateValue(Constants::QML_DEBUGGING_SETTINGS_KEY);
|
||||
dd->m_buildPropertiesSettings.qtQuickCompiler
|
||||
= loadTriStateValue(Constants::QT_QUICK_COMPILER_SETTINGS_KEY);
|
||||
|
||||
auto buildManager = new BuildManager(this, dd->m_cancelBuildAction);
|
||||
connect(buildManager, &BuildManager::buildStateChanged,
|
||||
dd, &ProjectExplorerPluginPrivate::updateActions);
|
||||
@@ -2028,6 +2047,13 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
|
||||
|
||||
// Store this in the Core directory scope for backward compatibility!
|
||||
s->setValue(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY, dd->m_projectExplorerSettings.buildDirectoryTemplate);
|
||||
|
||||
s->setValue(Constants::SEPARATE_DEBUG_INFO_SETTINGS_KEY,
|
||||
int(dd->m_buildPropertiesSettings.separateDebugInfo));
|
||||
s->setValue(Constants::QML_DEBUGGING_SETTINGS_KEY,
|
||||
int(dd->m_buildPropertiesSettings.qmlDebugging));
|
||||
s->setValue(Constants::QT_QUICK_COMPILER_SETTINGS_KEY,
|
||||
int(dd->m_buildPropertiesSettings.qtQuickCompiler));
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName)
|
||||
@@ -3867,6 +3893,21 @@ const AppOutputSettings &ProjectExplorerPlugin::appOutputSettings()
|
||||
return dd->m_outputPane.settings();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::setBuildPropertiesSettings(const BuildPropertiesSettings &settings)
|
||||
{
|
||||
dd->m_buildPropertiesSettings = settings;
|
||||
}
|
||||
|
||||
const BuildPropertiesSettings &ProjectExplorerPlugin::buildPropertiesSettings()
|
||||
{
|
||||
return dd->m_buildPropertiesSettings;
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::showQtSettings()
|
||||
{
|
||||
dd->m_buildPropertiesSettings.showQtSettings = true;
|
||||
}
|
||||
|
||||
QStringList ProjectExplorerPlugin::projectFilePatterns()
|
||||
{
|
||||
QStringList patterns;
|
||||
|
||||
@@ -49,6 +49,7 @@ class FilePath;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class BuildPropertiesSettings;
|
||||
class RunControl;
|
||||
class RunConfiguration;
|
||||
class Project;
|
||||
@@ -135,6 +136,10 @@ public:
|
||||
static void setAppOutputSettings(const Internal::AppOutputSettings &settings);
|
||||
static const Internal::AppOutputSettings &appOutputSettings();
|
||||
|
||||
static void setBuildPropertiesSettings(const BuildPropertiesSettings &settings);
|
||||
static const BuildPropertiesSettings &buildPropertiesSettings();
|
||||
static void showQtSettings();
|
||||
|
||||
static void startRunControl(RunControl *runControl);
|
||||
static void showRunErrorMessage(const QString &errorMessage);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ HEADERS += projectexplorer.h \
|
||||
ansifilterparser.h \
|
||||
buildaspects.h \
|
||||
buildinfo.h \
|
||||
buildpropertiessettings.h \
|
||||
buildpropertiessettingspage.h \
|
||||
buildsystem.h \
|
||||
buildtargettype.h \
|
||||
clangparser.h \
|
||||
@@ -174,6 +176,7 @@ SOURCES += projectexplorer.cpp \
|
||||
ansifilterparser.cpp \
|
||||
buildaspects.cpp \
|
||||
buildinfo.cpp \
|
||||
buildpropertiessettingspage.cpp \
|
||||
buildsystem.cpp \
|
||||
clangparser.cpp \
|
||||
configtaskhandler.cpp \
|
||||
|
||||
@@ -37,6 +37,8 @@ Project {
|
||||
"buildinfo.cpp", "buildinfo.h",
|
||||
"buildmanager.cpp", "buildmanager.h",
|
||||
"buildprogress.cpp", "buildprogress.h",
|
||||
"buildpropertiessettings.h",
|
||||
"buildpropertiessettingspage.cpp", "buildpropertiessettingspage.h",
|
||||
"buildsettingspropertiespage.cpp", "buildsettingspropertiespage.h",
|
||||
"buildstep.cpp", "buildstep.h",
|
||||
"buildsteplist.cpp", "buildsteplist.h",
|
||||
|
||||
@@ -552,7 +552,10 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
|
||||
connect(step, &QMakeStep::userArgumentsChanged,
|
||||
this, &QMakeStepConfigWidget::userArgumentsChanged);
|
||||
connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged,
|
||||
this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged);
|
||||
this, [this] {
|
||||
linkQmlDebuggingLibraryChanged();
|
||||
askForRebuild(tr("QML Debugging"));
|
||||
});
|
||||
connect(step->project(), &Project::projectLanguagesUpdated,
|
||||
this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged);
|
||||
connect(step->target(), &Target::parsingFinished,
|
||||
@@ -614,7 +617,6 @@ void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged()
|
||||
{
|
||||
updateSummaryLabel();
|
||||
updateEffectiveQMakeCall();
|
||||
askForRebuild(tr("QML Debugging"));
|
||||
}
|
||||
|
||||
void QMakeStepConfigWidget::useQtQuickCompilerChanged()
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "baseqtversion.h"
|
||||
|
||||
#include <projectexplorer/buildpropertiessettings.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
@@ -42,6 +44,7 @@ QmlDebuggingAspect::QmlDebuggingAspect()
|
||||
{
|
||||
setSettingsKey("EnableQmlDebugging");
|
||||
setDisplayName(tr("QML debugging and profiling:"));
|
||||
setSetting(ProjectExplorerPlugin::buildPropertiesSettings().qmlDebugging);
|
||||
}
|
||||
|
||||
void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
||||
@@ -77,6 +80,7 @@ QtQuickCompilerAspect::QtQuickCompilerAspect()
|
||||
{
|
||||
setSettingsKey("QtQuickCompiler");
|
||||
setDisplayName(tr("Qt Quick Compiler:"));
|
||||
setSetting(ProjectExplorerPlugin::buildPropertiesSettings().qtQuickCompiler);
|
||||
}
|
||||
|
||||
void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -96,6 +97,7 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
|
||||
|
||||
JsExpander::registerGlobalObject<CodeGenerator>("QtSupport");
|
||||
ProjectExplorer::JsonWizardFactory::registerPageFactory(new TranslationWizardPageFactory);
|
||||
ProjectExplorerPlugin::showQtSettings();
|
||||
|
||||
d = new QtSupportPluginPrivate;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user