forked from qt-creator/qt-creator
ProjectExplorer: Access default build properties more directly
Change-Id: I2c80e68028971e8b6fd10ef8fba6cf23834e02de Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#include "devicesupport/idevice.h"
|
||||
#include "kitinformation.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorertr.h"
|
||||
#include "target.h"
|
||||
|
||||
@@ -168,7 +167,7 @@ SeparateDebugInfoAspect::SeparateDebugInfoAspect(AspectContainer *container)
|
||||
{
|
||||
setDisplayName(Tr::tr("Separate debug info:"));
|
||||
setSettingsKey("SeparateDebugInfo");
|
||||
setValue(ProjectExplorerPlugin::buildPropertiesSettings().separateDebugInfo());
|
||||
setValue(buildPropertiesSettings().separateDebugInfo());
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "buildaspects.h"
|
||||
#include "buildinfo.h"
|
||||
#include "buildpropertiessettings.h"
|
||||
#include "buildsteplist.h"
|
||||
#include "buildstepspage.h"
|
||||
#include "buildsystem.h"
|
||||
@@ -621,7 +622,7 @@ FilePath BuildConfiguration::buildDirectoryFromTemplate(const FilePath &projectD
|
||||
[buildType] { return buildTypeName(buildType); });
|
||||
exp.registerSubProvider([kit] { return kit->macroExpander(); });
|
||||
|
||||
FilePath buildDir = FilePath::fromUserInput(ProjectExplorerPlugin::buildDirectoryTemplate());
|
||||
FilePath buildDir = FilePath::fromUserInput(buildPropertiesSettings().buildDirectoryTemplate());
|
||||
qCDebug(bcLog) << "build dir template:" << buildDir.toUserOutput();
|
||||
buildDir = exp.expand(buildDir);
|
||||
qCDebug(bcLog) << "expanded build:" << buildDir.toUserOutput();
|
||||
|
@@ -6,15 +6,24 @@
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "projectexplorertr.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
// Default directory:
|
||||
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE[]
|
||||
= "../%{JS: Util.asciify(\"build-%{Project:Name}-%{Kit:FileSystemName}-%{BuildConfig:Name}\")}";
|
||||
static QString defaultBuildDirectoryTemplate()
|
||||
{
|
||||
return "../%{JS: Util.asciify(\"build-%{Project:Name}-%{Kit:FileSystemName}-%{BuildConfig:Name}\")}";
|
||||
}
|
||||
|
||||
BuildPropertiesSettings &buildPropertiesSettings()
|
||||
{
|
||||
static BuildPropertiesSettings theSettings;
|
||||
return theSettings;
|
||||
}
|
||||
|
||||
BuildPropertiesSettings::BuildTriStateAspect::BuildTriStateAspect(AspectContainer *container)
|
||||
: TriStateAspect(container, Tr::tr("Enable"), Tr::tr("Disable"), Tr::tr("Use Project Default"))
|
||||
@@ -24,11 +33,6 @@ BuildPropertiesSettings::BuildPropertiesSettings()
|
||||
{
|
||||
setAutoApply(false);
|
||||
|
||||
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
|
||||
setDisplayName(Tr::tr("Default Build Properties"));
|
||||
setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||
setSettings(this);
|
||||
|
||||
setLayouter([this] {
|
||||
using namespace Layouting;
|
||||
|
||||
@@ -45,7 +49,7 @@ BuildPropertiesSettings::BuildPropertiesSettings()
|
||||
|
||||
buildDirectoryTemplate.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
buildDirectoryTemplate.setSettingsKey("Directories/BuildDirectory.TemplateV2");
|
||||
buildDirectoryTemplate.setDefaultValue(DEFAULT_BUILD_DIRECTORY_TEMPLATE);
|
||||
buildDirectoryTemplate.setDefaultValue(defaultBuildDirectoryTemplate());
|
||||
buildDirectoryTemplate.setLabelText(Tr::tr("Default build directory:"));
|
||||
buildDirectoryTemplate.setUseGlobalMacroExpander();
|
||||
buildDirectoryTemplate.setUseResetButton();
|
||||
@@ -55,21 +59,35 @@ BuildPropertiesSettings::BuildPropertiesSettings()
|
||||
|
||||
qmlDebugging.setSettingsKey("ProjectExplorer/Settings/QmlDebugging");
|
||||
qmlDebugging.setLabelText(Tr::tr("QML debugging:"));
|
||||
qmlDebugging.setVisible(false);
|
||||
|
||||
qtQuickCompiler.setSettingsKey("ProjectExplorer/Settings/QtQuickCompiler");
|
||||
qtQuickCompiler.setLabelText(Tr::tr("Use qmlcachegen:"));
|
||||
qtQuickCompiler.setVisible(false);
|
||||
|
||||
QObject::connect(&showQtSettings, &BaseAspect::changed, &qmlDebugging, [this] {
|
||||
qmlDebugging.setVisible(showQtSettings());
|
||||
});
|
||||
QObject::connect(&showQtSettings, &BaseAspect::changed, &qtQuickCompiler, [this] {
|
||||
qtQuickCompiler.setVisible(showQtSettings());
|
||||
});
|
||||
readSettings();
|
||||
}
|
||||
|
||||
QString BuildPropertiesSettings::defaultBuildDirectoryTemplate()
|
||||
void BuildPropertiesSettings::showQtSettings()
|
||||
{
|
||||
return QString(DEFAULT_BUILD_DIRECTORY_TEMPLATE);
|
||||
buildPropertiesSettings().qmlDebugging.setVisible(true);
|
||||
buildPropertiesSettings().qtQuickCompiler.setVisible(true);
|
||||
}
|
||||
|
||||
// BuildPropertiesSettingsPage
|
||||
|
||||
class BuildPropertiesSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
BuildPropertiesSettingsPage()
|
||||
{
|
||||
setId("AB.ProjectExplorer.BuildPropertiesSettingsPage");
|
||||
setDisplayName(Tr::tr("Default Build Properties"));
|
||||
setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||
setSettingsProvider([] { return &buildPropertiesSettings(); });
|
||||
}
|
||||
};
|
||||
|
||||
const BuildPropertiesSettingsPage settingsPage;
|
||||
|
||||
} // ProjectExplorer
|
||||
|
@@ -5,11 +5,11 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildPropertiesSettings : public Core::PagedSettings
|
||||
class PROJECTEXPLORER_EXPORT BuildPropertiesSettings : public Utils::AspectContainer
|
||||
{
|
||||
public:
|
||||
BuildPropertiesSettings();
|
||||
@@ -24,9 +24,10 @@ public:
|
||||
BuildTriStateAspect separateDebugInfo{this};
|
||||
BuildTriStateAspect qmlDebugging{this};
|
||||
BuildTriStateAspect qtQuickCompiler{this};
|
||||
Utils::BoolAspect showQtSettings;
|
||||
|
||||
QString defaultBuildDirectoryTemplate();
|
||||
static void showQtSettings(); // Called by the Qt support plugin
|
||||
};
|
||||
|
||||
PROJECTEXPLORER_EXPORT BuildPropertiesSettings &buildPropertiesSettings();
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -588,7 +588,6 @@ public:
|
||||
QString m_projectFilterString;
|
||||
MiniProjectTargetSelector * m_targetSelector;
|
||||
ProjectExplorerSettings m_projectExplorerSettings;
|
||||
BuildPropertiesSettings m_buildPropertiesSettings;
|
||||
QList<CustomParserSettings> m_customParsers;
|
||||
bool m_shouldHaveRunConfiguration = false;
|
||||
Id m_runMode = Constants::NO_RUN_MODE;
|
||||
@@ -1681,8 +1680,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
= s->value(Constants::LOW_BUILD_PRIORITY_SETTINGS_KEY, defaultSettings.lowBuildPriority)
|
||||
.toBool();
|
||||
|
||||
dd->m_buildPropertiesSettings.readSettings();
|
||||
|
||||
const int customParserCount = s->value(Constants::CUSTOM_PARSER_COUNT_KEY).toInt();
|
||||
for (int i = 0; i < customParserCount; ++i) {
|
||||
CustomParserSettings settings;
|
||||
@@ -2258,7 +2255,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
|
||||
int(dd->m_projectExplorerSettings.stopBeforeBuild),
|
||||
int(defaultSettings.stopBeforeBuild));
|
||||
|
||||
dd->m_buildPropertiesSettings.writeSettings();
|
||||
buildPropertiesSettings().writeSettings(); // FIXME: Should not be needed.
|
||||
|
||||
s->setValueWithDefault(Constants::CUSTOM_PARSER_COUNT_KEY, int(dd->m_customParsers.count()), 0);
|
||||
for (int i = 0; i < dd->m_customParsers.count(); ++i) {
|
||||
@@ -3927,16 +3924,6 @@ const AppOutputSettings &ProjectExplorerPlugin::appOutputSettings()
|
||||
return dd->m_outputPane.settings();
|
||||
}
|
||||
|
||||
BuildPropertiesSettings &ProjectExplorerPlugin::buildPropertiesSettings()
|
||||
{
|
||||
return dd->m_buildPropertiesSettings;
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::showQtSettings()
|
||||
{
|
||||
dd->m_buildPropertiesSettings.showQtSettings.setValue(true);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::setCustomParsers(const QList<CustomParserSettings> &settings)
|
||||
{
|
||||
if (dd->m_customParsers != settings) {
|
||||
@@ -4000,21 +3987,6 @@ void ProjectExplorerPlugin::openOpenProjectDialog()
|
||||
ICore::openFiles(files, ICore::SwitchMode);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the current build directory template.
|
||||
|
||||
\sa setBuildDirectoryTemplate
|
||||
*/
|
||||
QString ProjectExplorerPlugin::buildDirectoryTemplate()
|
||||
{
|
||||
return dd->m_buildPropertiesSettings.buildDirectoryTemplate.value();
|
||||
}
|
||||
|
||||
QString ProjectExplorerPlugin::defaultBuildDirectoryTemplate()
|
||||
{
|
||||
return dd->m_buildPropertiesSettings.defaultBuildDirectoryTemplate();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::updateActions()
|
||||
{
|
||||
dd->updateActions();
|
||||
|
@@ -28,7 +28,6 @@ class ProcessHandle;
|
||||
} // Utils
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class BuildPropertiesSettings;
|
||||
class CustomParserSettings;
|
||||
class FolderNode;
|
||||
class Node;
|
||||
@@ -119,9 +118,6 @@ public:
|
||||
static void setAppOutputSettings(const Internal::AppOutputSettings &settings);
|
||||
static const Internal::AppOutputSettings &appOutputSettings();
|
||||
|
||||
static BuildPropertiesSettings &buildPropertiesSettings();
|
||||
static void showQtSettings();
|
||||
|
||||
static void setCustomParsers(const QList<CustomParserSettings> &settings);
|
||||
static void addCustomParser(const CustomParserSettings &settings);
|
||||
static void removeCustomParser(Utils::Id id);
|
||||
@@ -159,9 +155,6 @@ public:
|
||||
static void openNewProjectDialog();
|
||||
static void openOpenProjectDialog();
|
||||
|
||||
static QString buildDirectoryTemplate();
|
||||
static QString defaultBuildDirectoryTemplate();
|
||||
|
||||
static void updateActions();
|
||||
|
||||
static void activateProjectPanel(Utils::Id panelId);
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/makestep.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectexplorertr.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
@@ -55,10 +54,10 @@ namespace QmakeProjectManager {
|
||||
|
||||
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
|
||||
{
|
||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||
config.separateDebugInfo = settings.separateDebugInfo.value();
|
||||
config.linkQmlDebuggingQQ2 = settings.qmlDebugging.value();
|
||||
config.useQtQuickCompiler = settings.qtQuickCompiler.value();
|
||||
const BuildPropertiesSettings &settings = buildPropertiesSettings();
|
||||
config.separateDebugInfo = settings.separateDebugInfo();
|
||||
config.linkQmlDebuggingQQ2 = settings.qmlDebugging();
|
||||
config.useQtQuickCompiler = settings.qtQuickCompiler();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -655,7 +654,7 @@ QString QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
|
||||
static BuildInfo createBuildInfo(const Kit *k, const FilePath &projectPath,
|
||||
BuildConfiguration::BuildType type)
|
||||
{
|
||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||
const BuildPropertiesSettings &settings = buildPropertiesSettings();
|
||||
QtVersion *version = QtKitAspect::qtVersion(k);
|
||||
QmakeExtraBuildInfo extraInfo;
|
||||
BuildInfo info;
|
||||
@@ -666,7 +665,7 @@ static BuildInfo createBuildInfo(const Kit *k, const FilePath &projectPath,
|
||||
info.displayName = ::ProjectExplorer::Tr::tr("Release");
|
||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||
suffix = Tr::tr("Release", "Shadow build directory suffix");
|
||||
if (settings.qtQuickCompiler.value() == TriState::Default) {
|
||||
if (settings.qtQuickCompiler() == TriState::Default) {
|
||||
if (version && version->isQtQuickCompilerSupported())
|
||||
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
|
||||
}
|
||||
@@ -681,15 +680,15 @@ static BuildInfo createBuildInfo(const Kit *k, const FilePath &projectPath,
|
||||
info.displayName = ::ProjectExplorer::Tr::tr("Profile");
|
||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||
suffix = Tr::tr("Profile", "Shadow build directory suffix");
|
||||
if (settings.separateDebugInfo.value() == TriState::Default)
|
||||
if (settings.separateDebugInfo() == TriState::Default)
|
||||
extraInfo.config.separateDebugInfo = TriState::Enabled;
|
||||
|
||||
if (settings.qtQuickCompiler.value() == TriState::Default) {
|
||||
if (settings.qtQuickCompiler() == TriState::Default) {
|
||||
if (version && version->isQtQuickCompilerSupported())
|
||||
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
|
||||
}
|
||||
}
|
||||
if (settings.qmlDebugging.value() == TriState::Default) {
|
||||
if (settings.qmlDebugging() == TriState::Default) {
|
||||
if (version && version->isQmlDebuggingSupported())
|
||||
extraInfo.config.linkQmlDebuggingQQ2 = TriState::Enabled;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ QmlDebuggingAspect::QmlDebuggingAspect(AspectContainer *container)
|
||||
{
|
||||
setSettingsKey("EnableQmlDebugging");
|
||||
setDisplayName(Tr::tr("QML debugging and profiling:"));
|
||||
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qmlDebugging.value());
|
||||
setValue(buildPropertiesSettings().qmlDebugging());
|
||||
}
|
||||
|
||||
void QmlDebuggingAspect::addToLayout(Layouting::LayoutItem &parent)
|
||||
@@ -69,7 +69,7 @@ QtQuickCompilerAspect::QtQuickCompilerAspect(AspectContainer *container)
|
||||
{
|
||||
setSettingsKey("QtQuickCompiler");
|
||||
setDisplayName(Tr::tr("Qt Quick Compiler:"));
|
||||
setValue(ProjectExplorerPlugin::buildPropertiesSettings().qtQuickCompiler.value());
|
||||
setValue(buildPropertiesSettings().qtQuickCompiler());
|
||||
}
|
||||
|
||||
void QtQuickCompilerAspect::setBuildConfiguration(const BuildConfiguration *buildConfig)
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include <coreplugin/jsexpander.h>
|
||||
|
||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||
#include <projectexplorer/buildpropertiessettings.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -132,7 +132,8 @@ void QtSupportPlugin::initialize()
|
||||
|
||||
JsExpander::registerGlobalObject<CodeGenerator>("QtSupport");
|
||||
ProjectExplorer::JsonWizardFactory::registerPageFactory(new TranslationWizardPageFactory);
|
||||
ProjectExplorerPlugin::showQtSettings();
|
||||
|
||||
BuildPropertiesSettings::showQtSettings();
|
||||
|
||||
d = new QtSupportPluginPrivate;
|
||||
|
||||
|
Reference in New Issue
Block a user