forked from qt-creator/qt-creator
ProjectExplorer: Make more aspects directly usable in AspectContainers
Change-Id: I6634c27c8d516411ad84e6cb7c361262ead53124 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -21,7 +21,8 @@ const char PRINT_ON_RUN_KEY[] = "PE.EnvironmentAspect.PrintOnRun";
|
|||||||
// EnvironmentAspect:
|
// EnvironmentAspect:
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
EnvironmentAspect::EnvironmentAspect()
|
EnvironmentAspect::EnvironmentAspect(AspectContainer *container)
|
||||||
|
: BaseAspect(container)
|
||||||
{
|
{
|
||||||
setDisplayName(Tr::tr("Environment"));
|
setDisplayName(Tr::tr("Environment"));
|
||||||
setId("EnvironmentAspect");
|
setId("EnvironmentAspect");
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class PROJECTEXPLORER_EXPORT EnvironmentAspect : public Utils::BaseAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EnvironmentAspect();
|
EnvironmentAspect(Utils::AspectContainer *container = nullptr);
|
||||||
|
|
||||||
// The environment including the user's modifications.
|
// The environment including the user's modifications.
|
||||||
Utils::Environment environment() const;
|
Utils::Environment environment() const;
|
||||||
|
|||||||
@@ -724,7 +724,8 @@ void ExecutableAspect::toMap(QVariantMap &map) const
|
|||||||
on Windows and LD_LIBRARY_PATH everywhere else.
|
on Windows and LD_LIBRARY_PATH everywhere else.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
UseLibraryPathsAspect::UseLibraryPathsAspect()
|
UseLibraryPathsAspect::UseLibraryPathsAspect(AspectContainer *container)
|
||||||
|
: BoolAspect(container)
|
||||||
{
|
{
|
||||||
setId("UseLibraryPath");
|
setId("UseLibraryPath");
|
||||||
setSettingsKey("RunConfiguration.UseLibrarySearchPath");
|
setSettingsKey("RunConfiguration.UseLibrarySearchPath");
|
||||||
@@ -749,7 +750,8 @@ UseLibraryPathsAspect::UseLibraryPathsAspect()
|
|||||||
DYLD_IMAGE_SUFFIX environment variable should be used on Mac.
|
DYLD_IMAGE_SUFFIX environment variable should be used on Mac.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
UseDyldSuffixAspect::UseDyldSuffixAspect()
|
UseDyldSuffixAspect::UseDyldSuffixAspect(AspectContainer *container)
|
||||||
|
: BoolAspect(container)
|
||||||
{
|
{
|
||||||
setId("UseDyldSuffix");
|
setId("UseDyldSuffix");
|
||||||
setSettingsKey("RunConfiguration.UseDyldImageSuffix");
|
setSettingsKey("RunConfiguration.UseDyldImageSuffix");
|
||||||
@@ -765,7 +767,8 @@ UseDyldSuffixAspect::UseDyldSuffixAspect()
|
|||||||
application should run with root permissions.
|
application should run with root permissions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RunAsRootAspect::RunAsRootAspect()
|
RunAsRootAspect::RunAsRootAspect(AspectContainer *container)
|
||||||
|
: BoolAspect(container)
|
||||||
{
|
{
|
||||||
setId("RunAsRoot");
|
setId("RunAsRoot");
|
||||||
setSettingsKey("RunConfiguration.RunAsRoot");
|
setSettingsKey("RunConfiguration.RunAsRoot");
|
||||||
@@ -794,7 +797,8 @@ Interpreter::Interpreter(const QString &_id,
|
|||||||
to use with files or projects using an interpreted language.
|
to use with files or projects using an interpreted language.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
InterpreterAspect::InterpreterAspect()
|
InterpreterAspect::InterpreterAspect(AspectContainer *container)
|
||||||
|
: BaseAspect(container)
|
||||||
{
|
{
|
||||||
addDataExtractor(this, &InterpreterAspect::currentInterpreter, &Data::interpreter);
|
addDataExtractor(this, &InterpreterAspect::currentInterpreter, &Data::interpreter);
|
||||||
}
|
}
|
||||||
@@ -904,8 +908,8 @@ static QString defaultDisplay()
|
|||||||
return qtcEnvironmentVariable("DISPLAY");
|
return qtcEnvironmentVariable("DISPLAY");
|
||||||
}
|
}
|
||||||
|
|
||||||
X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander)
|
X11ForwardingAspect::X11ForwardingAspect(AspectContainer *container)
|
||||||
: m_macroExpander(expander)
|
: StringAspect(container)
|
||||||
{
|
{
|
||||||
setLabelText(Tr::tr("X11 Forwarding:"));
|
setLabelText(Tr::tr("X11 Forwarding:"));
|
||||||
setDisplayStyle(LineEditDisplay);
|
setDisplayStyle(LineEditDisplay);
|
||||||
@@ -918,10 +922,33 @@ X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander)
|
|||||||
addDataExtractor(this, &X11ForwardingAspect::display, &Data::display);
|
addDataExtractor(this, &X11ForwardingAspect::display, &Data::display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void X11ForwardingAspect::setMacroExpander(const MacroExpander *expander)
|
||||||
|
{
|
||||||
|
m_macroExpander = expander;
|
||||||
|
}
|
||||||
|
|
||||||
QString X11ForwardingAspect::display() const
|
QString X11ForwardingAspect::display() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_macroExpander, return value());
|
QTC_ASSERT(m_macroExpander, return value());
|
||||||
return !isChecked() ? QString() : m_macroExpander->expandProcessArgs(value());
|
return !isChecked() ? QString() : m_macroExpander->expandProcessArgs(value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class ProjectExplorer::SymbolFileAspect
|
||||||
|
\inmodule QtCreator
|
||||||
|
|
||||||
|
\brief The SymbolFileAspect class lets a user specify a symbol file
|
||||||
|
for debugging.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
SymbolFileAspect::SymbolFileAspect(AspectContainer *container)
|
||||||
|
: FilePathAspect(container)
|
||||||
|
{}
|
||||||
|
|
||||||
|
MainScriptAspect::MainScriptAspect(AspectContainer *container)
|
||||||
|
: StringAspect(container)
|
||||||
|
{}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class PROJECTEXPLORER_EXPORT UseLibraryPathsAspect : public Utils::BoolAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UseLibraryPathsAspect();
|
UseLibraryPathsAspect(Utils::AspectContainer *container = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT UseDyldSuffixAspect : public Utils::BoolAspect
|
class PROJECTEXPLORER_EXPORT UseDyldSuffixAspect : public Utils::BoolAspect
|
||||||
@@ -139,7 +139,7 @@ class PROJECTEXPLORER_EXPORT UseDyldSuffixAspect : public Utils::BoolAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UseDyldSuffixAspect();
|
UseDyldSuffixAspect(Utils::AspectContainer *container = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT RunAsRootAspect : public Utils::BoolAspect
|
class PROJECTEXPLORER_EXPORT RunAsRootAspect : public Utils::BoolAspect
|
||||||
@@ -147,7 +147,7 @@ class PROJECTEXPLORER_EXPORT RunAsRootAspect : public Utils::BoolAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RunAsRootAspect();
|
RunAsRootAspect(Utils::AspectContainer *container = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ExecutableAspect : public Utils::BaseAspect
|
class PROJECTEXPLORER_EXPORT ExecutableAspect : public Utils::BaseAspect
|
||||||
@@ -197,7 +197,7 @@ class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::FilePathAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SymbolFileAspect() = default;
|
SymbolFileAspect(Utils::AspectContainer *container = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT Interpreter
|
class PROJECTEXPLORER_EXPORT Interpreter
|
||||||
@@ -227,7 +227,7 @@ class PROJECTEXPLORER_EXPORT InterpreterAspect : public Utils::BaseAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InterpreterAspect();
|
InterpreterAspect(Utils::AspectContainer *container = nullptr);
|
||||||
|
|
||||||
Interpreter currentInterpreter() const;
|
Interpreter currentInterpreter() const;
|
||||||
void updateInterpreters(const QList<Interpreter> &interpreters);
|
void updateInterpreters(const QList<Interpreter> &interpreters);
|
||||||
@@ -256,7 +256,7 @@ class PROJECTEXPLORER_EXPORT MainScriptAspect : public Utils::StringAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainScriptAspect() = default;
|
MainScriptAspect(Utils::AspectContainer *container = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT X11ForwardingAspect : public Utils::StringAspect
|
class PROJECTEXPLORER_EXPORT X11ForwardingAspect : public Utils::StringAspect
|
||||||
@@ -264,7 +264,9 @@ class PROJECTEXPLORER_EXPORT X11ForwardingAspect : public Utils::StringAspect
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
X11ForwardingAspect(const Utils::MacroExpander *macroExpander);
|
X11ForwardingAspect(Utils::AspectContainer *container = nullptr);
|
||||||
|
|
||||||
|
void setMacroExpander(const Utils::MacroExpander *macroExpander);
|
||||||
|
|
||||||
struct Data : StringAspect::Data { QString display; };
|
struct Data : StringAspect::Data { QString display; };
|
||||||
|
|
||||||
|
|||||||
@@ -209,8 +209,10 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Id id)
|
|||||||
|
|
||||||
addAspect<TerminalAspect>();
|
addAspect<TerminalAspect>();
|
||||||
|
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
if (HostOsInfo::isAnyUnixHost()) {
|
||||||
addAspect<X11ForwardingAspect>(macroExpander());
|
auto x11Forwarding = addAspect<X11ForwardingAspect>();
|
||||||
|
x11Forwarding->setMacroExpander(macroExpander());
|
||||||
|
}
|
||||||
|
|
||||||
setCommandLineGetter([bufferedAspect, interpreterAspect, argumentsAspect, scriptAspect] {
|
setCommandLineGetter([bufferedAspect, interpreterAspect, argumentsAspect, scriptAspect] {
|
||||||
CommandLine cmd{interpreterAspect->currentInterpreter().command};
|
CommandLine cmd{interpreterAspect->currentInterpreter().command};
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
|||||||
return envModifier(environment);
|
return envModifier(environment);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
if (HostOsInfo::isAnyUnixHost()) {
|
||||||
addAspect<X11ForwardingAspect>(macroExpander());
|
auto x11Forwarding = addAspect<X11ForwardingAspect>();
|
||||||
|
x11Forwarding->setMacroExpander(macroExpander());
|
||||||
|
}
|
||||||
|
|
||||||
setRunnableModifier([this](Runnable &r) {
|
setRunnableModifier([this](Runnable &r) {
|
||||||
const QmlBuildSystem *bs = static_cast<QmlBuildSystem *>(activeBuildSystem());
|
const QmlBuildSystem *bs = static_cast<QmlBuildSystem *>(activeBuildSystem());
|
||||||
|
|||||||
@@ -55,8 +55,11 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar
|
|||||||
|
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
if (HostOsInfo::isAnyUnixHost())
|
||||||
addAspect<TerminalAspect>();
|
addAspect<TerminalAspect>();
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
|
||||||
addAspect<X11ForwardingAspect>(macroExpander());
|
if (HostOsInfo::isAnyUnixHost()) {
|
||||||
|
auto x11Forwarding = addAspect<X11ForwardingAspect>();
|
||||||
|
x11Forwarding->setMacroExpander(macroExpander());
|
||||||
|
}
|
||||||
|
|
||||||
setDefaultDisplayName(runConfigDefaultDisplayName());
|
setDefaultDisplayName(runConfigDefaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,11 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
|||||||
|
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
if (HostOsInfo::isAnyUnixHost())
|
||||||
addAspect<TerminalAspect>();
|
addAspect<TerminalAspect>();
|
||||||
if (HostOsInfo::isAnyUnixHost())
|
|
||||||
addAspect<X11ForwardingAspect>(macroExpander());
|
if (HostOsInfo::isAnyUnixHost()) {
|
||||||
|
auto x11Forwarding = addAspect<X11ForwardingAspect>();
|
||||||
|
x11Forwarding->setMacroExpander(macroExpander());
|
||||||
|
}
|
||||||
|
|
||||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||||
libAspect->setValue(false);
|
libAspect->setValue(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user