forked from qt-creator/qt-creator
ProjectConfiguration: Add isActive() method
Returns true if the ProjectConfiguration element is currently active and false otherwise. Just a convenience method. Change-Id: If75809ae7e78149d264deaaf6adc4ca8a8be43c2 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -323,6 +323,11 @@ QString BuildConfiguration::buildTypeName(BuildConfiguration::BuildType type)
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildConfiguration::isActive() const
|
||||
{
|
||||
return target()->isActive() && target()->activeBuildConfiguration() == this;
|
||||
}
|
||||
|
||||
///
|
||||
// IBuildConfigurationFactory
|
||||
///
|
||||
|
@@ -88,6 +88,8 @@ public:
|
||||
|
||||
static QString buildTypeName(BuildType type);
|
||||
|
||||
bool isActive() const override;
|
||||
|
||||
signals:
|
||||
void environmentChanged();
|
||||
void buildDirectoryChanged();
|
||||
|
@@ -178,6 +178,11 @@ void BuildStep::reportRunResult(QFutureInterface<bool> &fi, bool success)
|
||||
fi.reportFinished();
|
||||
}
|
||||
|
||||
bool BuildStep::isActive() const
|
||||
{
|
||||
return projectConfiguration()->isActive();
|
||||
}
|
||||
|
||||
/*!
|
||||
If this function returns \c true, the user cannot delete this build step for
|
||||
this target and the user is prevented from changing the order in which
|
||||
|
@@ -81,6 +81,8 @@ public:
|
||||
|
||||
static void reportRunResult(QFutureInterface<bool> &fi, bool success);
|
||||
|
||||
bool isActive() const override;
|
||||
|
||||
signals:
|
||||
/// Adds a \p task to the Issues pane.
|
||||
/// Do note that for linking compile output with tasks, you should first emit the task
|
||||
|
@@ -116,6 +116,11 @@ void BuildStepList::cloneSteps(BuildStepList *source)
|
||||
}
|
||||
}
|
||||
|
||||
bool BuildStepList::isActive() const
|
||||
{
|
||||
return qobject_cast<ProjectConfiguration *>(parent())->isActive();
|
||||
}
|
||||
|
||||
bool BuildStepList::fromMap(const QVariantMap &map)
|
||||
{
|
||||
// We need the ID set before trying to restore the steps!
|
||||
|
@@ -84,6 +84,8 @@ public:
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
void cloneSteps(BuildStepList *source);
|
||||
|
||||
bool isActive() const override;
|
||||
|
||||
signals:
|
||||
void stepInserted(int position);
|
||||
void aboutToRemoveStep(int position);
|
||||
|
@@ -146,6 +146,11 @@ Project *DeployConfiguration::project() const
|
||||
return target()->project();
|
||||
}
|
||||
|
||||
bool DeployConfiguration::isActive() const
|
||||
{
|
||||
return target()->isActive() && target()->activeDeployConfiguration() == this;
|
||||
}
|
||||
|
||||
void DeployConfiguration::cloneSteps(DeployConfiguration *source)
|
||||
{
|
||||
if (source == this)
|
||||
|
@@ -61,6 +61,8 @@ public:
|
||||
Target *target() const;
|
||||
Project *project() const override;
|
||||
|
||||
bool isActive() const override;
|
||||
|
||||
signals:
|
||||
void enabledChanged();
|
||||
|
||||
|
@@ -67,6 +67,8 @@ public:
|
||||
|
||||
virtual Project *project() const = 0;
|
||||
|
||||
virtual bool isActive() const = 0;
|
||||
|
||||
signals:
|
||||
void displayNameChanged();
|
||||
void toolTipChanged();
|
||||
|
@@ -215,6 +215,11 @@ RunConfiguration::~RunConfiguration()
|
||||
qDeleteAll(m_aspects);
|
||||
}
|
||||
|
||||
bool RunConfiguration::isActive() const
|
||||
{
|
||||
return target()->isActive() && target()->activeRunConfiguration() == this;
|
||||
}
|
||||
|
||||
QString RunConfiguration::disabledReason() const
|
||||
{
|
||||
if (target()->project()->isParsing())
|
||||
|
@@ -206,6 +206,8 @@ class PROJECTEXPLORER_EXPORT RunConfiguration : public StatefulProjectConfigurat
|
||||
public:
|
||||
~RunConfiguration() override;
|
||||
|
||||
bool isActive() const override;
|
||||
|
||||
QString disabledReason() const override;
|
||||
|
||||
virtual QWidget *createConfigurationWidget() = 0;
|
||||
|
@@ -209,6 +209,11 @@ void Target::handleKitRemoval(Kit *k)
|
||||
project()->removeTarget(this);
|
||||
}
|
||||
|
||||
bool Target::isActive() const
|
||||
{
|
||||
return project()->activeTarget() == this;
|
||||
}
|
||||
|
||||
Project *Target::project() const
|
||||
{
|
||||
return static_cast<Project *>(parent());
|
||||
|
@@ -57,6 +57,8 @@ public:
|
||||
|
||||
Project *project() const override;
|
||||
|
||||
bool isActive() const final;
|
||||
|
||||
// Kit:
|
||||
Kit *kit() const;
|
||||
|
||||
|
Reference in New Issue
Block a user