ProjectExplorer: Rename 'extraAspect' to 'aspect'

Using aspects is the standard pattern nowadays, there's nothing 'extra'
to them anymore.

Change-Id: I446f9d7b1db58a4899e5e44df33ce51f655e7be4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2018-09-07 13:29:45 +02:00
parent 2f6c6b632c
commit 1c9410e353
27 changed files with 86 additions and 86 deletions

View File

@@ -162,7 +162,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
{ {
auto runConfig = runner->runControl()->runConfiguration(); auto runConfig = runner->runControl()->runConfiguration();
auto aspect = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); auto aspect = runConfig->aspect<Debugger::DebuggerRunConfigurationAspect>();
Core::Id runMode = runner->runMode(); Core::Id runMode = runner->runMode();
const bool debuggingMode = runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE; const bool debuggingMode = runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE;
m_useCppDebugger = debuggingMode && aspect->useCppDebugger(); m_useCppDebugger = debuggingMode && aspect->useCppDebugger();
@@ -194,23 +194,23 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
m_deviceSerialNumber = AndroidManager::deviceSerialNumber(target); m_deviceSerialNumber = AndroidManager::deviceSerialNumber(target);
m_apiLevel = AndroidManager::deviceApiLevel(target); m_apiLevel = AndroidManager::deviceApiLevel(target);
m_extraEnvVars = runConfig->extraAspect<EnvironmentAspect>()->environment(); m_extraEnvVars = runConfig->aspect<EnvironmentAspect>()->environment();
qCDebug(androidRunWorkerLog) << "Environment variables for the app" qCDebug(androidRunWorkerLog) << "Environment variables for the app"
<< m_extraEnvVars.toStringList(); << m_extraEnvVars.toStringList();
m_extraAppParams = runConfig->runnable().commandLineArguments; m_extraAppParams = runConfig->runnable().commandLineArguments;
if (auto aspect = runConfig->extraAspect(Constants::ANDROID_AMSTARTARGS)) if (auto aspect = runConfig->aspect(Constants::ANDROID_AMSTARTARGS))
m_amStartExtraArgs = static_cast<BaseStringAspect *>(aspect)->value().split(' '); m_amStartExtraArgs = static_cast<BaseStringAspect *>(aspect)->value().split(' ');
if (auto aspect = runConfig->extraAspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) { if (auto aspect = runConfig->aspect(Constants::ANDROID_PRESTARTSHELLCMDLIST)) {
for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value()) for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value())
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
} }
for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_PRESTARTSHELLCMDLIST).toStringList()) for (const QString &shellCmd : runner->recordedData(Constants::ANDROID_PRESTARTSHELLCMDLIST).toStringList())
m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd)); m_beforeStartAdbCommands.append(QString("shell %1").arg(shellCmd));
if (auto aspect = runConfig->extraAspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) { if (auto aspect = runConfig->aspect(Constants::ANDROID_POSTFINISHSHELLCMDLIST)) {
for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value()) for (const QString &shellCmd : static_cast<BaseStringListAspect *>(aspect)->value())
m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd)); m_afterFinishAdbCommands.append(QString("shell %1").arg(shellCmd));
} }

View File

@@ -57,7 +57,7 @@ public:
if (auto debuggable = dynamic_cast<DebuggableTestConfiguration *>(config)) if (auto debuggable = dynamic_cast<DebuggableTestConfiguration *>(config))
enableQuick = debuggable->mixedDebugging(); enableQuick = debuggable->mixedDebugging();
if (auto debugAspect = extraAspect<Debugger::DebuggerRunConfigurationAspect>()) { if (auto debugAspect = aspect<Debugger::DebuggerRunConfigurationAspect>()) {
debugAspect->setUseQmlDebugger(enableQuick); debugAspect->setUseQmlDebugger(enableQuick);
ProjectExplorer::ProjectExplorerPlugin::instance()->updateRunActions(); ProjectExplorer::ProjectExplorerPlugin::instance()->updateRunActions();
} }

View File

@@ -58,7 +58,7 @@ const char *BareMetalCustomRunConfiguration::Id = "BareMetal";
bool BareMetalCustomRunConfiguration::isConfigured() const bool BareMetalCustomRunConfiguration::isConfigured() const
{ {
return !extraAspect<ExecutableAspect>()->executable().isEmpty(); return !aspect<ExecutableAspect>()->executable().isEmpty();
} }
RunConfiguration::ConfigurationState RunConfiguration::ConfigurationState

View File

@@ -85,7 +85,7 @@ void BareMetalDebugSupport::start()
{ {
const auto rc = runControl()->runConfiguration(); const auto rc = runControl()->runConfiguration();
QTC_ASSERT(rc, reportFailure(); return); QTC_ASSERT(rc, reportFailure(); return);
const auto exeAspect = rc->extraAspect<ExecutableAspect>(); const auto exeAspect = rc->aspect<ExecutableAspect>();
QTC_ASSERT(exeAspect, reportFailure(); return); QTC_ASSERT(exeAspect, reportFailure(); return);
const QString bin = exeAspect->executable().toString(); const QString bin = exeAspect->executable().toString();
@@ -124,7 +124,7 @@ void BareMetalDebugSupport::start()
Runnable inferior; Runnable inferior;
inferior.executable = bin; inferior.executable = bin;
if (auto aspect = rc->extraAspect<ArgumentsAspect>()) if (auto aspect = rc->aspect<ArgumentsAspect>())
inferior.commandLineArguments = aspect->arguments(rc->macroExpander()); inferior.commandLineArguments = aspect->arguments(rc->macroExpander());
setInferior(inferior); setInferior(inferior);
setSymbolFile(bin); setSymbolFile(bin);

View File

@@ -63,7 +63,7 @@ BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target, Core::Id id
void BareMetalRunConfiguration::updateTargetInformation() void BareMetalRunConfiguration::updateTargetInformation()
{ {
const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey()); const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath); aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
emit enabledChanged(); emit enabledChanged();
} }

View File

@@ -98,11 +98,11 @@ QString CMakeRunConfiguration::disabledReason() const
void CMakeRunConfiguration::updateTargetInformation() void CMakeRunConfiguration::updateTargetInformation()
{ {
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey()); BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath); aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory); aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged(); aspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
auto terminalAspect = extraAspect<TerminalAspect>(); auto terminalAspect = aspect<TerminalAspect>();
if (!terminalAspect->isUserSet()) if (!terminalAspect->isUserSet())
terminalAspect->setUseTerminal(bti.usesTerminal); terminalAspect->setUseTerminal(bti.usesTerminal);
} }

View File

@@ -906,9 +906,9 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit, bool allowTer
if (runConfig) { if (runConfig) {
m_runParameters.displayName = runConfig->displayName(); m_runParameters.displayName = runConfig->displayName();
if (auto symbolsAspect = runConfig->extraAspect<SymbolFileAspect>()) if (auto symbolsAspect = runConfig->aspect<SymbolFileAspect>())
m_runParameters.symbolFile = symbolsAspect->value(); m_runParameters.symbolFile = symbolsAspect->value();
if (auto terminalAspect = runConfig->extraAspect<TerminalAspect>()) if (auto terminalAspect = runConfig->aspect<TerminalAspect>())
m_runParameters.useTerminal = terminalAspect->useTerminal(); m_runParameters.useTerminal = terminalAspect->useTerminal();
} }
@@ -924,7 +924,7 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, Kit *kit, bool allowTer
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(kit)) if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(kit))
m_runParameters.qtPackageSourceLocation = qtVersion->qtPackageSourcePath().toString(); m_runParameters.qtPackageSourceLocation = qtVersion->qtPackageSourcePath().toString();
if (auto aspect = runConfig ? runConfig->extraAspect<DebuggerRunConfigurationAspect>() : nullptr) { if (auto aspect = runConfig ? runConfig->aspect<DebuggerRunConfigurationAspect>() : nullptr) {
if (!aspect->useCppDebugger()) if (!aspect->useCppDebugger())
m_runParameters.cppEngineType = NoEngineType; m_runParameters.cppEngineType = NoEngineType;
m_runParameters.isQmlDebugging = aspect->useQmlDebugger(); m_runParameters.isQmlDebugging = aspect->useQmlDebugger();

View File

@@ -139,7 +139,7 @@ void IosRunConfiguration::updateDisplayNames()
setDefaultDisplayName(tr("Run on %1").arg(devName)); setDefaultDisplayName(tr("Run on %1").arg(devName));
setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName)); setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName));
extraAspect<ExecutableAspect>()->setExecutable(localExecutable()); aspect<ExecutableAspect>()->setExecutable(localExecutable());
} }
void IosRunConfiguration::updateEnabledState() void IosRunConfiguration::updateEnabledState()

View File

@@ -100,7 +100,7 @@ IosRunner::IosRunner(RunControl *runControl)
stopRunningRunControl(runControl); stopRunningRunControl(runControl);
auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration()); auto runConfig = qobject_cast<IosRunConfiguration *>(runControl->runConfiguration());
m_bundleDir = runConfig->bundleDirectory().toString(); m_bundleDir = runConfig->bundleDirectory().toString();
m_arguments = runConfig->extraAspect<ArgumentsAspect>()->arguments(runConfig->macroExpander()); m_arguments = runConfig->aspect<ArgumentsAspect>()->arguments(runConfig->macroExpander());
m_device = DeviceKitInformation::device(runConfig->target()->kit()); m_device = DeviceKitInformation::device(runConfig->target()->kit());
m_deviceType = runConfig->deviceType(); m_deviceType = runConfig->deviceType();
} }
@@ -387,7 +387,7 @@ IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl)
Runnable runnable; Runnable runnable;
runnable.executable = iosRunConfig->localExecutable().toUserOutput(); runnable.executable = iosRunConfig->localExecutable().toUserOutput();
runnable.commandLineArguments = runnable.commandLineArguments =
iosRunConfig->extraAspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander()); iosRunConfig->aspect<ArgumentsAspect>()->arguments(iosRunConfig->macroExpander());
runControl->setDisplayName(iosRunConfig->applicationName()); runControl->setDisplayName(iosRunConfig->applicationName());
runControl->setRunnable(runnable); runControl->setRunnable(runnable);

View File

@@ -67,9 +67,9 @@ void NimRunConfiguration::updateConfiguration()
QTC_ASSERT(buildConfiguration, return); QTC_ASSERT(buildConfiguration, return);
setActiveBuildConfiguration(buildConfiguration); setActiveBuildConfiguration(buildConfiguration);
const QFileInfo outFileInfo = buildConfiguration->outFilePath().toFileInfo(); const QFileInfo outFileInfo = buildConfiguration->outFilePath().toFileInfo();
extraAspect<ExecutableAspect>()->setExecutable(FileName::fromString(outFileInfo.absoluteFilePath())); aspect<ExecutableAspect>()->setExecutable(FileName::fromString(outFileInfo.absoluteFilePath()));
const QString workingDirectory = outFileInfo.absoluteDir().absolutePath(); const QString workingDirectory = outFileInfo.absoluteDir().absolutePath();
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(FileName::fromString(workingDirectory)); aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(FileName::fromString(workingDirectory));
} }
void NimRunConfiguration::setActiveBuildConfiguration(NimBuildConfiguration *activeBuildConfiguration) void NimRunConfiguration::setActiveBuildConfiguration(NimBuildConfiguration *activeBuildConfiguration)

View File

@@ -94,7 +94,7 @@ private:
CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc) CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc)
: QDialog(Core::ICore::dialogParent()), : QDialog(Core::ICore::dialogParent()),
m_rc(rc), m_rc(rc),
m_workingDirectory(rc->extraAspect<EnvironmentAspect>()) m_workingDirectory(rc->aspect<EnvironmentAspect>())
{ {
auto vbox = new QVBoxLayout(this); auto vbox = new QVBoxLayout(this);
vbox->addWidget(new QLabel(tr("Could not find the executable, please specify one."))); vbox->addWidget(new QLabel(tr("Could not find the executable, please specify one.")));
@@ -121,21 +121,21 @@ CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc)
m_executableChooser = new PathChooser(this); m_executableChooser = new PathChooser(this);
m_executableChooser->setHistoryCompleter("Qt.CustomExecutable.History"); m_executableChooser->setHistoryCompleter("Qt.CustomExecutable.History");
m_executableChooser->setExpectedKind(PathChooser::ExistingCommand); m_executableChooser->setExpectedKind(PathChooser::ExistingCommand);
m_executableChooser->setPath(rc->extraAspect<ExecutableAspect>()->executable().toString()); m_executableChooser->setPath(rc->aspect<ExecutableAspect>()->executable().toString());
layout->addRow(tr("Executable:"), m_executableChooser); layout->addRow(tr("Executable:"), m_executableChooser);
connect(m_executableChooser, &PathChooser::rawPathChanged, connect(m_executableChooser, &PathChooser::rawPathChanged,
this, &CustomExecutableDialog::changed); this, &CustomExecutableDialog::changed);
copyAspect(rc->extraAspect<ArgumentsAspect>(), &m_arguments); copyAspect(rc->aspect<ArgumentsAspect>(), &m_arguments);
m_arguments.addToConfigurationLayout(layout); m_arguments.addToConfigurationLayout(layout);
copyAspect(rc->extraAspect<WorkingDirectoryAspect>(), &m_workingDirectory); copyAspect(rc->aspect<WorkingDirectoryAspect>(), &m_workingDirectory);
m_workingDirectory.addToConfigurationLayout(layout); m_workingDirectory.addToConfigurationLayout(layout);
copyAspect(rc->extraAspect<TerminalAspect>(), &m_terminal); copyAspect(rc->aspect<TerminalAspect>(), &m_terminal);
m_terminal.addToConfigurationLayout(layout); m_terminal.addToConfigurationLayout(layout);
auto enviromentAspect = rc->extraAspect<EnvironmentAspect>(); auto enviromentAspect = rc->aspect<EnvironmentAspect>();
connect(enviromentAspect, &EnvironmentAspect::environmentChanged, connect(enviromentAspect, &EnvironmentAspect::environmentChanged,
this, &CustomExecutableDialog::environmentWasChanged); this, &CustomExecutableDialog::environmentWasChanged);
environmentWasChanged(); environmentWasChanged();
@@ -146,10 +146,10 @@ CustomExecutableDialog::CustomExecutableDialog(RunConfiguration *rc)
void CustomExecutableDialog::accept() void CustomExecutableDialog::accept()
{ {
auto executable = FileName::fromString(m_executableChooser->path()); auto executable = FileName::fromString(m_executableChooser->path());
m_rc->extraAspect<ExecutableAspect>()->setExecutable(executable); m_rc->aspect<ExecutableAspect>()->setExecutable(executable);
copyAspect(&m_arguments, m_rc->extraAspect<ArgumentsAspect>()); copyAspect(&m_arguments, m_rc->aspect<ArgumentsAspect>());
copyAspect(&m_workingDirectory, m_rc->extraAspect<WorkingDirectoryAspect>()); copyAspect(&m_workingDirectory, m_rc->aspect<WorkingDirectoryAspect>());
copyAspect(&m_terminal, m_rc->extraAspect<TerminalAspect>()); copyAspect(&m_terminal, m_rc->aspect<TerminalAspect>());
QDialog::accept(); QDialog::accept();
} }
@@ -168,7 +168,7 @@ bool CustomExecutableDialog::event(QEvent *event)
void CustomExecutableDialog::environmentWasChanged() void CustomExecutableDialog::environmentWasChanged()
{ {
auto aspect = m_rc->extraAspect<EnvironmentAspect>(); auto aspect = m_rc->aspect<EnvironmentAspect>();
QTC_ASSERT(aspect, return); QTC_ASSERT(aspect, return);
m_executableChooser->setEnvironment(aspect->environment()); m_executableChooser->setEnvironment(aspect->environment());
} }
@@ -242,7 +242,7 @@ void CustomExecutableRunConfiguration::configurationDialogFinished()
QString CustomExecutableRunConfiguration::rawExecutable() const QString CustomExecutableRunConfiguration::rawExecutable() const
{ {
return extraAspect<ExecutableAspect>()->executable().toString(); return aspect<ExecutableAspect>()->executable().toString();
} }
bool CustomExecutableRunConfiguration::isConfigured() const bool CustomExecutableRunConfiguration::isConfigured() const
@@ -253,12 +253,12 @@ bool CustomExecutableRunConfiguration::isConfigured() const
Runnable CustomExecutableRunConfiguration::runnable() const Runnable CustomExecutableRunConfiguration::runnable() const
{ {
FileName workingDirectory = FileName workingDirectory =
extraAspect<WorkingDirectoryAspect>()->workingDirectory(macroExpander()); aspect<WorkingDirectoryAspect>()->workingDirectory(macroExpander());
Runnable r; Runnable r;
r.executable = extraAspect<ExecutableAspect>()->executable().toString(); r.executable = aspect<ExecutableAspect>()->executable().toString();
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments(macroExpander()); r.commandLineArguments = aspect<ArgumentsAspect>()->arguments(macroExpander());
r.environment = extraAspect<EnvironmentAspect>()->environment(); r.environment = aspect<EnvironmentAspect>()->environment();
r.workingDirectory = workingDirectory.toString(); r.workingDirectory = workingDirectory.toString();
r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE); r.device = DeviceManager::instance()->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);

View File

@@ -154,7 +154,7 @@ bool ProjectConfiguration::fromMap(const QVariantMap &map)
return true; return true;
} }
ProjectConfigurationAspect *ProjectConfiguration::extraAspect(Core::Id id) const ProjectConfigurationAspect *ProjectConfiguration::aspect(Core::Id id) const
{ {
return Utils::findOrDefault(m_aspects, Utils::equal(&ProjectConfigurationAspect::id, id)); return Utils::findOrDefault(m_aspects, Utils::equal(&ProjectConfigurationAspect::id, id));
} }

View File

@@ -126,9 +126,9 @@ public:
const QList<ProjectConfigurationAspect *> aspects() const { return m_aspects; } const QList<ProjectConfigurationAspect *> aspects() const { return m_aspects; }
ProjectConfigurationAspect *extraAspect(Core::Id id) const; ProjectConfigurationAspect *aspect(Core::Id id) const;
template <typename T> T *extraAspect() const template <typename T> T *aspect() const
{ {
for (ProjectConfigurationAspect *aspect : m_aspects) for (ProjectConfigurationAspect *aspect : m_aspects)
if (T *result = qobject_cast<T *>(aspect)) if (T *result = qobject_cast<T *>(aspect))

View File

@@ -193,7 +193,7 @@ RunConfiguration::RunConfiguration(Target *target, Core::Id id)
}); });
expander->registerPrefix("CurrentRun:Env", tr("Variables in the current run environment"), expander->registerPrefix("CurrentRun:Env", tr("Variables in the current run environment"),
[this](const QString &var) { [this](const QString &var) {
const auto envAspect = extraAspect<EnvironmentAspect>(); const auto envAspect = aspect<EnvironmentAspect>();
return envAspect ? envAspect->environment().value(var) : QString(); return envAspect ? envAspect->environment().value(var) : QString();
}); });
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME, expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
@@ -376,14 +376,14 @@ bool RunConfiguration::fromMap(const QVariantMap &map)
Runnable RunConfiguration::runnable() const Runnable RunConfiguration::runnable() const
{ {
Runnable r; Runnable r;
if (auto aspect = extraAspect<ExecutableAspect>()) if (auto executableAspect = aspect<ExecutableAspect>())
r.executable = aspect->executable().toString(); r.executable = executableAspect->executable().toString();
if (auto aspect = extraAspect<ArgumentsAspect>()) if (auto argumentsAspect = aspect<ArgumentsAspect>())
r.commandLineArguments = aspect->arguments(macroExpander()); r.commandLineArguments = argumentsAspect->arguments(macroExpander());
if (auto aspect = extraAspect<WorkingDirectoryAspect>()) if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>())
r.workingDirectory = aspect->workingDirectory(macroExpander()).toString(); r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()).toString();
if (auto aspect = extraAspect<EnvironmentAspect>()) if (auto environmentAspect = aspect<EnvironmentAspect>())
r.environment = aspect->environment(); r.environment = environmentAspect->environment();
return r; return r;
} }
@@ -1556,7 +1556,7 @@ SimpleTargetRunner::SimpleTargetRunner(RunControl *runControl)
m_runnable = runControl->runnable(); // Default value. Can be overridden using setRunnable. m_runnable = runControl->runnable(); // Default value. Can be overridden using setRunnable.
m_device = runControl->device(); // Default value. Can be overridden using setDevice. m_device = runControl->device(); // Default value. Can be overridden using setDevice.
if (auto runConfig = runControl->runConfiguration()) { if (auto runConfig = runControl->runConfiguration()) {
if (auto terminalAspect = runConfig->extraAspect<TerminalAspect>()) if (auto terminalAspect = runConfig->aspect<TerminalAspect>())
m_useTerminal = terminalAspect->useTerminal(); m_useTerminal = terminalAspect->useTerminal();
} }
} }

View File

@@ -185,8 +185,8 @@ public:
template <class T = ISettingsAspect> T *currentSettings(Core::Id id) const template <class T = ISettingsAspect> T *currentSettings(Core::Id id) const
{ {
if (auto aspect = qobject_cast<GlobalOrProjectAspect *>(extraAspect(id))) if (auto a = qobject_cast<GlobalOrProjectAspect *>(aspect(id)))
return qobject_cast<T *>(aspect->currentSettings()); return qobject_cast<T *>(a->currentSettings());
return nullptr; return nullptr;
} }

View File

@@ -241,9 +241,9 @@ private:
Runnable runnable() const final; Runnable runnable() const final;
bool supportsDebugger() const { return true; } bool supportsDebugger() const { return true; }
QString mainScript() const { return extraAspect<MainScriptAspect>()->value(); } QString mainScript() const { return aspect<MainScriptAspect>()->value(); }
QString arguments() const { return extraAspect<ArgumentsAspect>()->arguments(macroExpander()); } QString arguments() const { return aspect<ArgumentsAspect>()->arguments(macroExpander()); }
QString interpreter() const { return extraAspect<InterpreterAspect>()->value(); } QString interpreter() const { return aspect<InterpreterAspect>()->value(); }
void updateTargetInformation(); void updateTargetInformation();
}; };
@@ -283,7 +283,7 @@ void PythonRunConfiguration::updateTargetInformation()
const BuildTargetInfo bti = buildTargetInfo(); const BuildTargetInfo bti = buildTargetInfo();
const QString script = bti.targetFilePath.toString(); const QString script = bti.targetFilePath.toString();
setDefaultDisplayName(tr("Run %1").arg(script)); setDefaultDisplayName(tr("Run %1").arg(script));
extraAspect<MainScriptAspect>()->setValue(script); aspect<MainScriptAspect>()->setValue(script);
} }
Runnable PythonRunConfiguration::runnable() const Runnable PythonRunConfiguration::runnable() const
@@ -291,9 +291,9 @@ Runnable PythonRunConfiguration::runnable() const
Runnable r; Runnable r;
QtcProcess::addArg(&r.commandLineArguments, mainScript()); QtcProcess::addArg(&r.commandLineArguments, mainScript());
QtcProcess::addArgs(&r.commandLineArguments, QtcProcess::addArgs(&r.commandLineArguments,
extraAspect<ArgumentsAspect>()->arguments(macroExpander())); aspect<ArgumentsAspect>()->arguments(macroExpander()));
r.executable = extraAspect<InterpreterAspect>()->value(); r.executable = aspect<InterpreterAspect>()->value();
r.environment = extraAspect<EnvironmentAspect>()->environment(); r.environment = aspect<EnvironmentAspect>()->environment();
return r; return r;
} }

View File

@@ -110,11 +110,11 @@ void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{ {
if (auto dyldAspect = extraAspect<UseDyldSuffixAspect>()) { if (auto dyldAspect = aspect<UseDyldSuffixAspect>()) {
if (dyldAspect->value()) if (dyldAspect->value())
env.set("DYLD_IMAGE_SUFFIX", "_debug"); env.set("DYLD_IMAGE_SUFFIX", "_debug");
} }
bool usingLibraryPaths = extraAspect<UseLibraryPathsAspect>()->value(); bool usingLibraryPaths = aspect<UseLibraryPathsAspect>()->value();
const auto key = qMakePair(env.toStringList(), usingLibraryPaths); const auto key = qMakePair(env.toStringList(), usingLibraryPaths);
const auto it = m_envCache.constFind(key); const auto it = m_envCache.constFind(key);
@@ -146,16 +146,16 @@ void QbsRunConfiguration::updateTargetInformation()
{ {
BuildTargetInfo bti = buildTargetInfo(); BuildTargetInfo bti = buildTargetInfo();
const FileName executable = executableToRun(bti); const FileName executable = executableToRun(bti);
auto terminalAspect = extraAspect<TerminalAspect>(); auto terminalAspect = aspect<TerminalAspect>();
if (!terminalAspect->isUserSet()) if (!terminalAspect->isUserSet())
terminalAspect->setUseTerminal(bti.usesTerminal); terminalAspect->setUseTerminal(bti.usesTerminal);
extraAspect<ExecutableAspect>()->setExecutable(executable); aspect<ExecutableAspect>()->setExecutable(executable);
if (!executable.isEmpty()) { if (!executable.isEmpty()) {
QString defaultWorkingDir = QFileInfo(executable.toString()).absolutePath(); QString defaultWorkingDir = QFileInfo(executable.toString()).absolutePath();
if (!defaultWorkingDir.isEmpty()) { if (!defaultWorkingDir.isEmpty()) {
auto wdAspect = extraAspect<WorkingDirectoryAspect>(); auto wdAspect = aspect<WorkingDirectoryAspect>();
wdAspect->setDefaultWorkingDirectory(FileName::fromString(defaultWorkingDir)); wdAspect->setDefaultWorkingDirectory(FileName::fromString(defaultWorkingDir));
} }
} }

View File

@@ -91,20 +91,20 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core:
void DesktopQmakeRunConfiguration::updateTargetInformation() void DesktopQmakeRunConfiguration::updateTargetInformation()
{ {
setDefaultDisplayName(defaultDisplayName()); setDefaultDisplayName(defaultDisplayName());
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged(); aspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
BuildTargetInfo bti = buildTargetInfo(); BuildTargetInfo bti = buildTargetInfo();
auto wda = extraAspect<WorkingDirectoryAspect>(); auto wda = aspect<WorkingDirectoryAspect>();
wda->setDefaultWorkingDirectory(bti.workingDirectory); wda->setDefaultWorkingDirectory(bti.workingDirectory);
if (wda->pathChooser()) if (wda->pathChooser())
wda->pathChooser()->setBaseFileName(target()->project()->projectDirectory()); wda->pathChooser()->setBaseFileName(target()->project()->projectDirectory());
auto terminalAspect = extraAspect<TerminalAspect>(); auto terminalAspect = aspect<TerminalAspect>();
if (!terminalAspect->isUserSet()) if (!terminalAspect->isUserSet())
terminalAspect->setUseTerminal(bti.usesTerminal); terminalAspect->setUseTerminal(bti.usesTerminal);
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath); aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
} }
QVariantMap DesktopQmakeRunConfiguration::toMap() const QVariantMap DesktopQmakeRunConfiguration::toMap() const
@@ -135,9 +135,9 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
{ {
BuildTargetInfo bti = buildTargetInfo(); BuildTargetInfo bti = buildTargetInfo();
if (bti.runEnvModifier) if (bti.runEnvModifier)
bti.runEnvModifier(env, extraAspect<UseLibraryPathsAspect>()->value()); bti.runEnvModifier(env, aspect<UseLibraryPathsAspect>()->value());
if (auto dyldAspect = extraAspect<UseDyldSuffixAspect>()) { if (auto dyldAspect = aspect<UseDyldSuffixAspect>()) {
if (dyldAspect->value()) if (dyldAspect->value())
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug")); env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
} }

View File

@@ -302,7 +302,7 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
auto runConfiguration = runControl->runConfiguration(); auto runConfiguration = runControl->runConfiguration();
if (runConfiguration) { if (runConfiguration) {
auto aspect = static_cast<QmlProfilerRunConfigurationAspect *>( auto aspect = static_cast<QmlProfilerRunConfigurationAspect *>(
runConfiguration->extraAspect(Constants::SETTINGS)); runConfiguration->aspect(Constants::SETTINGS));
if (aspect) { if (aspect) {
if (QmlProfilerSettings *settings = static_cast<QmlProfilerSettings *>(aspect->currentSettings())) { if (QmlProfilerSettings *settings = static_cast<QmlProfilerSettings *>(aspect->currentSettings())) {
d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ? d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ?

View File

@@ -305,7 +305,7 @@ Runnable QmlProjectRunConfiguration::runnable() const
Runnable r; Runnable r;
r.executable = executable(); r.executable = executable();
r.commandLineArguments = commandLineArguments(); r.commandLineArguments = commandLineArguments();
r.environment = extraAspect<QmlProjectEnvironmentAspect>()->environment(); r.environment = aspect<QmlProjectEnvironmentAspect>()->environment();
r.workingDirectory = static_cast<QmlProject *>(project())->targetDirectory(target()).toString(); r.workingDirectory = static_cast<QmlProject *>(project())->targetDirectory(target()).toString();
return r; return r;
} }
@@ -354,7 +354,7 @@ QString QmlProjectRunConfiguration::executable() const
QString QmlProjectRunConfiguration::commandLineArguments() const QString QmlProjectRunConfiguration::commandLineArguments() const
{ {
// arguments in .user file // arguments in .user file
QString args = extraAspect<ArgumentsAspect>()->arguments(macroExpander()); QString args = aspect<ArgumentsAspect>()->arguments(macroExpander());
const Target *currentTarget = target(); const Target *currentTarget = target();
const IDevice::ConstPtr device = DeviceKitInformation::device(currentTarget->kit()); const IDevice::ConstPtr device = DeviceKitInformation::device(currentTarget->kit());
const Utils::OsType osType = device ? device->osType() : Utils::HostOsInfo::hostOs(); const Utils::OsType osType = device ? device->osType() : Utils::HostOsInfo::hostOs();

View File

@@ -265,7 +265,7 @@ void QnxAttachDebugSupport::showProcessesDialog()
// QString projectSourceDirectory = dlg.projectSource(); // QString projectSourceDirectory = dlg.projectSource();
QString localExecutable = dlg.localExecutable(); QString localExecutable = dlg.localExecutable();
if (localExecutable.isEmpty()) { if (localExecutable.isEmpty()) {
if (auto aspect = runConfig->extraAspect<SymbolFileAspect>()) if (auto aspect = runConfig->aspect<SymbolFileAspect>())
localExecutable = aspect->fileName().toString(); localExecutable = aspect->fileName().toString();
} }

View File

@@ -45,7 +45,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id)
Runnable QnxRunConfiguration::runnable() const Runnable QnxRunConfiguration::runnable() const
{ {
Runnable r = RemoteLinuxRunConfiguration::runnable(); Runnable r = RemoteLinuxRunConfiguration::runnable();
QString libPath = extraAspect<QtLibPathAspect>()->value(); QString libPath = aspect<QtLibPathAspect>()->value();
if (!libPath.isEmpty()) { if (!libPath.isEmpty()) {
r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH"); r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH");
r.environment.appendOrSet("QML_IMPORT_PATH", libPath + "/imports:$QML_IMPORT_PATH"); r.environment.appendOrSet("QML_IMPORT_PATH", libPath + "/imports:$QML_IMPORT_PATH");

View File

@@ -45,7 +45,7 @@ Slog2InfoRunner::Slog2InfoRunner(RunControl *runControl)
: RunWorker(runControl) : RunWorker(runControl)
{ {
setId("Slog2InfoRunner"); setId("Slog2InfoRunner");
m_applicationId = runControl->runConfiguration()->extraAspect<ExecutableAspect>()->executable().fileName(); m_applicationId = runControl->runConfiguration()->aspect<ExecutableAspect>()->executable().fileName();
// See QTCREATORBUG-10712 for details. // See QTCREATORBUG-10712 for details.
// We need to limit length of ApplicationId to 63 otherwise it would not match one in slog2info. // We need to limit length of ApplicationId to 63 otherwise it would not match one in slog2info.

View File

@@ -65,7 +65,7 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar
bool RemoteLinuxCustomRunConfiguration::isConfigured() const bool RemoteLinuxCustomRunConfiguration::isConfigured() const
{ {
return !extraAspect<ExecutableAspect>()->executable().isEmpty(); return !aspect<ExecutableAspect>()->executable().isEmpty();
} }
RunConfiguration::ConfigurationState RunConfiguration::ConfigurationState
@@ -88,7 +88,7 @@ Core::Id RemoteLinuxCustomRunConfiguration::runConfigId()
QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName() QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName()
{ {
QString remoteExecutable = extraAspect<ExecutableAspect>()->executable().toString(); QString remoteExecutable = aspect<ExecutableAspect>()->executable().toString();
QString display = remoteExecutable.isEmpty() QString display = remoteExecutable.isEmpty()
? tr("Custom Executable") : tr("Run \"%1\"").arg(remoteExecutable); ? tr("Custom Executable") : tr("Run \"%1\"").arg(remoteExecutable);
return RunConfigurationFactory::decoratedTargetName(display, target()); return RunConfigurationFactory::decoratedTargetName(display, target());

View File

@@ -89,8 +89,8 @@ void RemoteLinuxRunConfiguration::updateTargetInformation()
QString localExecutable = bti.targetFilePath.toString(); QString localExecutable = bti.targetFilePath.toString();
DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable); DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
extraAspect<ExecutableAspect>()->setExecutable(FileName::fromString(depFile.remoteFilePath())); aspect<ExecutableAspect>()->setExecutable(FileName::fromString(depFile.remoteFilePath()));
extraAspect<SymbolFileAspect>()->setValue(localExecutable); aspect<SymbolFileAspect>()->setValue(localExecutable);
emit enabledChanged(); emit enabledChanged();
} }

View File

@@ -86,7 +86,7 @@ void ValgrindToolRunner::start()
m_runner.setDevice(device()); m_runner.setDevice(device());
m_runner.setDebuggee(runnable()); m_runner.setDebuggee(runnable());
if (auto aspect = runControl()->runConfiguration()->extraAspect<TerminalAspect>()) if (auto aspect = runControl()->runConfiguration()->aspect<TerminalAspect>())
m_runner.setUseTerminal(aspect->useTerminal()); m_runner.setUseTerminal(aspect->useTerminal());
connect(&m_runner, &ValgrindRunner::processOutputReceived, connect(&m_runner, &ValgrindRunner::processOutputReceived,

View File

@@ -84,13 +84,13 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
bool loopbackExemptClient = false; bool loopbackExemptClient = false;
bool loopbackExemptServer = false; bool loopbackExemptServer = false;
if (auto aspect = runConfiguration->extraAspect<ArgumentsAspect>()) if (auto aspect = runConfiguration->aspect<ArgumentsAspect>())
m_arguments = aspect->arguments(runConfiguration->macroExpander()); m_arguments = aspect->arguments(runConfiguration->macroExpander());
if (auto aspect = runConfiguration->extraAspect<UninstallAfterStopAspect>()) if (auto aspect = runConfiguration->aspect<UninstallAfterStopAspect>())
m_uninstallAfterStop = aspect->value(); m_uninstallAfterStop = aspect->value();
if (auto aspect = runConfiguration->extraAspect<LoopbackExemptClientAspect>()) if (auto aspect = runConfiguration->aspect<LoopbackExemptClientAspect>())
loopbackExemptClient = aspect->value(); loopbackExemptClient = aspect->value();
if (auto aspect = runConfiguration->extraAspect<LoopbackExemptServerAspect>()) if (auto aspect = runConfiguration->aspect<LoopbackExemptServerAspect>())
loopbackExemptServer = aspect->value(); loopbackExemptServer = aspect->value();
if (loopbackExemptClient && loopbackExemptServer) if (loopbackExemptClient && loopbackExemptServer)
m_loopbackArguments = "--loopbackexempt clientserver"; m_loopbackArguments = "--loopbackexempt clientserver";