forked from qt-creator/qt-creator
ProjectExplorer: Add a RunConfiguration::setRunnableModifier()
To override RunConfiguration::runnable() behavior without the need for subclassing. Will be useful for the docker plugin. Change-Id: I9e8511faa95355038b08c3e3be24429d66a5253f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -307,6 +307,11 @@ CommandLine RunConfiguration::commandLine() const
|
|||||||
return m_commandLineGetter();
|
return m_commandLineGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunConfiguration::setRunnableModifier(const RunnableModifier &runnableModifier)
|
||||||
|
{
|
||||||
|
m_runnableModifier = runnableModifier;
|
||||||
|
}
|
||||||
|
|
||||||
void RunConfiguration::update()
|
void RunConfiguration::update()
|
||||||
{
|
{
|
||||||
if (m_updater)
|
if (m_updater)
|
||||||
@@ -398,6 +403,8 @@ Runnable RunConfiguration::runnable() const
|
|||||||
r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()).toString();
|
r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()).toString();
|
||||||
if (auto environmentAspect = aspect<EnvironmentAspect>())
|
if (auto environmentAspect = aspect<EnvironmentAspect>())
|
||||||
r.environment = environmentAspect->environment();
|
r.environment = environmentAspect->environment();
|
||||||
|
if (m_runnableModifier)
|
||||||
|
m_runnableModifier(r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -138,6 +138,9 @@ public:
|
|||||||
void setCommandLineGetter(const CommandLineGetter &cmdGetter);
|
void setCommandLineGetter(const CommandLineGetter &cmdGetter);
|
||||||
Utils::CommandLine commandLine() const;
|
Utils::CommandLine commandLine() const;
|
||||||
|
|
||||||
|
using RunnableModifier = std::function<void(Runnable &)>;
|
||||||
|
void setRunnableModifier(const RunnableModifier &extraModifier);
|
||||||
|
|
||||||
virtual Runnable runnable() const;
|
virtual Runnable runnable() const;
|
||||||
|
|
||||||
// Return a handle to the build system target that created this run configuration.
|
// Return a handle to the build system target that created this run configuration.
|
||||||
@@ -194,6 +197,7 @@ private:
|
|||||||
|
|
||||||
QString m_buildKey;
|
QString m_buildKey;
|
||||||
CommandLineGetter m_commandLineGetter;
|
CommandLineGetter m_commandLineGetter;
|
||||||
|
RunnableModifier m_runnableModifier;
|
||||||
Updater m_updater;
|
Updater m_updater;
|
||||||
Utils::MacroExpander m_expander;
|
Utils::MacroExpander m_expander;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user