forked from qt-creator/qt-creator
Android: Use aspects more directly in AndroidRunConfiguration
Change-Id: I0eed35acd6c65dccd99ace12dc98bf0e3ab1a2f0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -28,8 +28,9 @@ namespace Android {
|
|||||||
class BaseStringListAspect final : public Utils::StringAspect
|
class BaseStringListAspect final : public Utils::StringAspect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BaseStringListAspect() = default;
|
explicit BaseStringListAspect(AspectContainer *container)
|
||||||
~BaseStringListAspect() final = default;
|
: StringAspect(container)
|
||||||
|
{}
|
||||||
|
|
||||||
void fromMap(const QVariantMap &map) final
|
void fromMap(const QVariantMap &map) final
|
||||||
{
|
{
|
||||||
@@ -50,39 +51,34 @@ public:
|
|||||||
AndroidRunConfiguration(Target *target, Id id)
|
AndroidRunConfiguration(Target *target, Id id)
|
||||||
: RunConfiguration(target, id)
|
: RunConfiguration(target, id)
|
||||||
{
|
{
|
||||||
auto envAspect = addAspect<EnvironmentAspect>();
|
environment.addSupportedBaseEnvironment(Tr::tr("Clean Environment"), {});
|
||||||
envAspect->addSupportedBaseEnvironment(Tr::tr("Clean Environment"), {});
|
|
||||||
|
|
||||||
auto extraAppArgsAspect = addAspect<ArgumentsAspect>();
|
extraAppArgs.setMacroExpander(macroExpander());
|
||||||
extraAppArgsAspect->setMacroExpander(macroExpander());
|
|
||||||
|
|
||||||
connect(extraAppArgsAspect, &BaseAspect::changed, this, [target, extraAppArgsAspect] {
|
connect(&extraAppArgs, &BaseAspect::changed, this, [this, target] {
|
||||||
if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) {
|
if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) {
|
||||||
const QString buildKey = target->activeBuildKey();
|
const QString buildKey = target->activeBuildKey();
|
||||||
target->buildSystem()->setExtraData(buildKey,
|
target->buildSystem()->setExtraData(buildKey,
|
||||||
Android::Constants::AndroidApplicationArgs,
|
Android::Constants::AndroidApplicationArgs,
|
||||||
extraAppArgsAspect->arguments());
|
extraAppArgs());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
auto amStartArgsAspect = addAspect<StringAspect>();
|
amStartArgs.setId(Constants::ANDROID_AM_START_ARGS);
|
||||||
amStartArgsAspect->setId(Constants::ANDROID_AM_START_ARGS);
|
amStartArgs.setSettingsKey("Android.AmStartArgsKey");
|
||||||
amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey");
|
amStartArgs.setLabelText(Tr::tr("Activity manager start arguments:"));
|
||||||
amStartArgsAspect->setLabelText(Tr::tr("Activity manager start arguments:"));
|
amStartArgs.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
amStartArgsAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
amStartArgs.setHistoryCompleter("Android.AmStartArgs.History");
|
||||||
amStartArgsAspect->setHistoryCompleter("Android.AmStartArgs.History");
|
|
||||||
|
|
||||||
auto preStartShellCmdAspect = addAspect<BaseStringListAspect>();
|
preStartShellCmd.setDisplayStyle(StringAspect::TextEditDisplay);
|
||||||
preStartShellCmdAspect->setDisplayStyle(StringAspect::TextEditDisplay);
|
preStartShellCmd.setId(Constants::ANDROID_PRESTARTSHELLCMDLIST);
|
||||||
preStartShellCmdAspect->setId(Constants::ANDROID_PRESTARTSHELLCMDLIST);
|
preStartShellCmd.setSettingsKey("Android.PreStartShellCmdListKey");
|
||||||
preStartShellCmdAspect->setSettingsKey("Android.PreStartShellCmdListKey");
|
preStartShellCmd.setLabelText(Tr::tr("Pre-launch on-device shell commands:"));
|
||||||
preStartShellCmdAspect->setLabelText(Tr::tr("Pre-launch on-device shell commands:"));
|
|
||||||
|
|
||||||
auto postStartShellCmdAspect = addAspect<BaseStringListAspect>();
|
postStartShellCmd.setDisplayStyle(StringAspect::TextEditDisplay);
|
||||||
postStartShellCmdAspect->setDisplayStyle(StringAspect::TextEditDisplay);
|
postStartShellCmd.setId(Constants::ANDROID_POSTFINISHSHELLCMDLIST);
|
||||||
postStartShellCmdAspect->setId(Constants::ANDROID_POSTFINISHSHELLCMDLIST);
|
postStartShellCmd.setSettingsKey("Android.PostStartShellCmdListKey");
|
||||||
postStartShellCmdAspect->setSettingsKey("Android.PostStartShellCmdListKey");
|
postStartShellCmd.setLabelText(Tr::tr("Post-quit on-device shell commands:"));
|
||||||
postStartShellCmdAspect->setLabelText(Tr::tr("Post-quit on-device shell commands:"));
|
|
||||||
|
|
||||||
setUpdater([this] {
|
setUpdater([this] {
|
||||||
const BuildTargetInfo bti = buildTargetInfo();
|
const BuildTargetInfo bti = buildTargetInfo();
|
||||||
@@ -92,6 +88,12 @@ public:
|
|||||||
|
|
||||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnvironmentAspect environment{this};
|
||||||
|
ArgumentsAspect extraAppArgs{this};
|
||||||
|
StringAspect amStartArgs{this};
|
||||||
|
BaseStringListAspect preStartShellCmd{this};
|
||||||
|
BaseStringListAspect postStartShellCmd{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
AndroidRunConfigurationFactory::AndroidRunConfigurationFactory()
|
AndroidRunConfigurationFactory::AndroidRunConfigurationFactory()
|
||||||
|
Reference in New Issue
Block a user