forked from qt-creator/qt-creator
ProjectExplorer: Introduce a central mechanism to update RC aspects
Using the usual pattern of setting a std::function, and calling it. In the initial steps, update() is meant to be manually called in the derived RunConfigurations, mid-term the idea is to at least cover well-known ("Kit changed", ...) cases centrally. Change-Id: Ic00572bb57fb45ef109bd0ddb8a9c3132d4f0f13 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -311,6 +311,11 @@ BuildSystem *RunConfiguration::activeBuildSystem() const
|
|||||||
return target()->buildSystem();
|
return target()->buildSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunConfiguration::setUpdater(const Updater &updater)
|
||||||
|
{
|
||||||
|
m_updater = updater;
|
||||||
|
}
|
||||||
|
|
||||||
QVariantMap RunConfiguration::toMap() const
|
QVariantMap RunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = ProjectConfiguration::toMap();
|
QVariantMap map = ProjectConfiguration::toMap();
|
||||||
@@ -336,6 +341,12 @@ CommandLine RunConfiguration::commandLine() const
|
|||||||
return m_commandLineGetter();
|
return m_commandLineGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunConfiguration::update()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_updater, return);
|
||||||
|
m_updater();
|
||||||
|
}
|
||||||
|
|
||||||
BuildTargetInfo RunConfiguration::buildTargetInfo() const
|
BuildTargetInfo RunConfiguration::buildTargetInfo() const
|
||||||
{
|
{
|
||||||
BuildSystem *bs = target()->buildSystem();
|
BuildSystem *bs = target()->buildSystem();
|
||||||
|
@@ -172,6 +172,8 @@ public:
|
|||||||
|
|
||||||
QMap<Core::Id, QVariantMap> aspectData() const;
|
QMap<Core::Id, QVariantMap> aspectData() const;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void configurationFinished();
|
void configurationFinished();
|
||||||
void enabledChanged();
|
void enabledChanged();
|
||||||
@@ -183,6 +185,9 @@ protected:
|
|||||||
BuildConfiguration *activeBuildConfiguration() const;
|
BuildConfiguration *activeBuildConfiguration() const;
|
||||||
BuildSystem *activeBuildSystem() const;
|
BuildSystem *activeBuildSystem() const;
|
||||||
|
|
||||||
|
using Updater = std::function<void()>;
|
||||||
|
void setUpdater(const Updater &updater);
|
||||||
|
|
||||||
virtual void updateEnabledState();
|
virtual void updateEnabledState();
|
||||||
virtual void doAdditionalSetup(const RunConfigurationCreationInfo &) {}
|
virtual void doAdditionalSetup(const RunConfigurationCreationInfo &) {}
|
||||||
|
|
||||||
@@ -194,6 +199,7 @@ private:
|
|||||||
|
|
||||||
QString m_buildKey;
|
QString m_buildKey;
|
||||||
CommandLineGetter m_commandLineGetter;
|
CommandLineGetter m_commandLineGetter;
|
||||||
|
Updater m_updater;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RunConfigurationCreationInfo
|
class RunConfigurationCreationInfo
|
||||||
|
Reference in New Issue
Block a user