forked from qt-creator/qt-creator
ProjectExplorer: Remove an unneeded signal
The only ProjectConfigurationModel instance that needs to react to runConfigurationsUpdated() was directly accessible at the only place where the signal got emitted. A number of further simplifications fell out of that. Change-Id: I5e61409091c5a0b84667fa8f6da0d7de9fd40e0e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -148,8 +148,6 @@ public:
|
|||||||
, m_cleanSteps(bc, Constants::BUILDSTEPS_CLEAN)
|
, m_cleanSteps(bc, Constants::BUILDSTEPS_CLEAN)
|
||||||
, m_buildDirectoryAspect(bc, bc)
|
, m_buildDirectoryAspect(bc, bc)
|
||||||
, m_tooltipAspect(bc)
|
, m_tooltipAspect(bc)
|
||||||
, m_deployConfigurationModel(bc->target())
|
|
||||||
, m_runConfigurationModel(bc->target())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool m_clearSystemEnvironment = false;
|
bool m_clearSystemEnvironment = false;
|
||||||
@@ -770,8 +768,7 @@ void BuildConfiguration::updateDefaultRunConfigurations()
|
|||||||
removeRunConfiguration(rc);
|
removeRunConfiguration(rc);
|
||||||
|
|
||||||
emit runConfigurationsUpdated();
|
emit runConfigurationsUpdated();
|
||||||
if (this == target()->activeBuildConfiguration())
|
runConfigurationModel()->triggerUpdate();
|
||||||
emit target()->runConfigurationsUpdated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<RunConfiguration *> BuildConfiguration::runConfigurations() const
|
const QList<RunConfiguration *> BuildConfiguration::runConfigurations() const
|
||||||
|
@@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
#include "projectconfigurationmodel.h"
|
#include "projectconfigurationmodel.h"
|
||||||
|
|
||||||
#include "buildconfiguration.h"
|
|
||||||
#include "deployconfiguration.h"
|
|
||||||
#include "projectconfiguration.h"
|
#include "projectconfiguration.h"
|
||||||
#include "projectexplorertr.h"
|
#include "projectexplorertr.h"
|
||||||
#include "runconfiguration.h"
|
#include "runconfiguration.h"
|
||||||
#include "target.h"
|
|
||||||
|
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
|
||||||
@@ -27,13 +24,6 @@ static bool isOrderedBefore(const ProjectConfiguration *a, const ProjectConfigur
|
|||||||
return Utils::caseFriendlyCompare(a->displayName(), b->displayName()) < 0;
|
return Utils::caseFriendlyCompare(a->displayName(), b->displayName()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectConfigurationModel::ProjectConfigurationModel(Target *target)
|
|
||||||
{
|
|
||||||
connect(target, &Target::runConfigurationsUpdated, this, [this] {
|
|
||||||
emit dataChanged(index(0, 0), index(rowCount(), 0));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
int ProjectConfigurationModel::rowCount(const QModelIndex &parent) const
|
int ProjectConfigurationModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return parent.isValid() ? 0 : m_projectConfigurations.size();
|
return parent.isValid() ? 0 : m_projectConfigurations.size();
|
||||||
@@ -141,4 +131,9 @@ void ProjectConfigurationModel::removeProjectConfiguration(ProjectConfiguration
|
|||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectConfigurationModel::triggerUpdate()
|
||||||
|
{
|
||||||
|
emit dataChanged(index(0, 0), index(rowCount(), 0));
|
||||||
|
}
|
||||||
|
|
||||||
} // ProjectExplorer
|
} // ProjectExplorer
|
||||||
|
@@ -5,10 +5,7 @@
|
|||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Target;
|
|
||||||
class ProjectConfiguration;
|
class ProjectConfiguration;
|
||||||
|
|
||||||
// Documentation inside.
|
// Documentation inside.
|
||||||
@@ -17,8 +14,6 @@ class ProjectConfigurationModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ProjectConfigurationModel(Target *target);
|
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
@@ -29,6 +24,8 @@ public:
|
|||||||
void addProjectConfiguration(ProjectConfiguration *pc);
|
void addProjectConfiguration(ProjectConfiguration *pc);
|
||||||
void removeProjectConfiguration(ProjectConfiguration *pc);
|
void removeProjectConfiguration(ProjectConfiguration *pc);
|
||||||
|
|
||||||
|
void triggerUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void displayNameChanged(ProjectConfiguration *pc);
|
void displayNameChanged(ProjectConfiguration *pc);
|
||||||
|
|
||||||
|
@@ -61,9 +61,8 @@ static QString formatDeviceInfo(const ProjectExplorer::IDevice::DeviceInfo &inpu
|
|||||||
class TargetPrivate
|
class TargetPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TargetPrivate(Target *t, Kit *k) :
|
TargetPrivate(Kit *k)
|
||||||
m_kit(k),
|
: m_kit(k)
|
||||||
m_buildConfigurationModel(t)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QIcon m_overlayIcon;
|
QIcon m_overlayIcon;
|
||||||
@@ -83,7 +82,7 @@ public:
|
|||||||
|
|
||||||
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
Target::Target(Project *project, Kit *k, _constructor_tag) :
|
||||||
QObject(project),
|
QObject(project),
|
||||||
d(std::make_unique<TargetPrivate>(this, k))
|
d(std::make_unique<TargetPrivate>(k))
|
||||||
{
|
{
|
||||||
QTC_CHECK(d->m_kit);
|
QTC_CHECK(d->m_kit);
|
||||||
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
connect(DeviceManager::instance(), &DeviceManager::updated, this, &Target::updateDeviceState);
|
||||||
|
@@ -107,7 +107,6 @@ signals:
|
|||||||
void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
void removedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
||||||
void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
void addedRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
||||||
void activeRunConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
|
void activeRunConfigurationChanged(ProjectExplorer::RunConfiguration *rc);
|
||||||
void runConfigurationsUpdated();
|
|
||||||
|
|
||||||
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
|
void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
|
||||||
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
|
void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
|
||||||
|
Reference in New Issue
Block a user