diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-02 12:59:17 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-12-02 13:42:20 +0000 |
commit | 27a77f9b56ed18f1c5754e9cbcda42137c8d6e4c (patch) | |
tree | c025a22bc065457fa336e2c957409056cbda2d4a /src | |
parent | f1881777b714ea6d7a8d10081668129ab4028b12 (diff) | |
download | qt-creator-27a77f9b56ed18f1c5754e9cbcda42137c8d6e4c.tar.gz |
ProjectExplorer: Let user provide default build properties
Fixes: QTCREATORBUG-16458
Change-Id: I5f7a2450307a8d2e3392ca167411d1e00b58f05a
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/projectexplorer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/projectexplorer/buildaspects.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/buildpropertiessettings.h | 42 | ||||
-rw-r--r-- | src/plugins/projectexplorer/buildpropertiessettingspage.cpp | 111 | ||||
-rw-r--r-- | src/plugins/projectexplorer/buildpropertiessettingspage.h | 51 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.cpp | 41 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.h | 5 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.pro | 3 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.qbs | 2 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakestep.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtbuildaspects.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtsupportplugin.cpp | 2 |
12 files changed, 271 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/CMakeLists.txt b/src/plugins/projectexplorer/CMakeLists.txt index b05fa30315..dbb4da10dc 100644 --- a/src/plugins/projectexplorer/CMakeLists.txt +++ b/src/plugins/projectexplorer/CMakeLists.txt @@ -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 diff --git a/src/plugins/projectexplorer/buildaspects.cpp b/src/plugins/projectexplorer/buildaspects.cpp index 3cf3b50962..34b7bea10c 100644 --- a/src/plugins/projectexplorer/buildaspects.cpp +++ b/src/plugins/projectexplorer/buildaspects.cpp @@ -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 diff --git a/src/plugins/projectexplorer/buildpropertiessettings.h b/src/plugins/projectexplorer/buildpropertiessettings.h new file mode 100644 index 0000000000..6a2d381f3f --- /dev/null +++ b/src/plugins/projectexplorer/buildpropertiessettings.h @@ -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 diff --git a/src/plugins/projectexplorer/buildpropertiessettingspage.cpp b/src/plugins/projectexplorer/buildpropertiessettingspage.cpp new file mode 100644 index 0000000000..f94fbafaaa --- /dev/null +++ b/src/plugins/projectexplorer/buildpropertiessettingspage.cpp @@ -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 diff --git a/src/plugins/projectexplorer/buildpropertiessettingspage.h b/src/plugins/projectexplorer/buildpropertiessettingspage.h new file mode 100644 index 0000000000..7b7c333a76 --- /dev/null +++ b/src/plugins/projectexplorer/buildpropertiessettingspage.h @@ -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 diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 444bc99f0a..611258e9ab 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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; diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index d7de49c83b..488e905ce1 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -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); diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index d3fd40904c..df4617ea5a 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -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 \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index 2536dd0d6d..e843a3972b 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -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", diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 4614a5a1d8..63febaaa9d 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -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() diff --git a/src/plugins/qtsupport/qtbuildaspects.cpp b/src/plugins/qtsupport/qtbuildaspects.cpp index cc8c13168c..49c106f497 100644 --- a/src/plugins/qtsupport/qtbuildaspects.cpp +++ b/src/plugins/qtsupport/qtbuildaspects.cpp @@ -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) diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index fdfe8b37a7..9193a3071b 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -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; |