forked from qt-creator/qt-creator
Remove BuildStepList::isNull
It's not really needed. The Null-ness is equivalent to a failed fromMap() which we execute on all usage paths anyways. Change-Id: I72bb7fb55b7f26680fa68da8eef751ca96380ecd Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -173,8 +173,8 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
||||
qWarning() << "No data for build step list" << i << "found!";
|
||||
continue;
|
||||
}
|
||||
auto list = new BuildStepList(this, data);
|
||||
if (list->isNull()) {
|
||||
auto list = new BuildStepList(this, Core::Id());
|
||||
if (!list->fromMap(data)) {
|
||||
qWarning() << "Failed to restore build step list" << i;
|
||||
delete list;
|
||||
return false;
|
||||
|
@@ -51,8 +51,7 @@ BuildStepList::BuildStepList(QObject *parent, Core::Id id) :
|
||||
}
|
||||
|
||||
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
||||
ProjectConfiguration(parent, source),
|
||||
m_isNull(source->m_isNull)
|
||||
ProjectConfiguration(parent, source)
|
||||
{
|
||||
setDisplayName(source->displayName());
|
||||
Q_ASSERT(parent);
|
||||
@@ -61,13 +60,6 @@ BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
||||
// will fail to clone the buildsteps!
|
||||
}
|
||||
|
||||
BuildStepList::BuildStepList(QObject *parent, const QVariantMap &data) :
|
||||
ProjectConfiguration(parent, Core::Id())
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
m_isNull = !fromMap(data);
|
||||
}
|
||||
|
||||
BuildStepList::~BuildStepList()
|
||||
{
|
||||
qDeleteAll(m_steps);
|
||||
@@ -84,11 +76,6 @@ QVariantMap BuildStepList::toMap() const
|
||||
return map;
|
||||
}
|
||||
|
||||
bool BuildStepList::isNull() const
|
||||
{
|
||||
return m_isNull;
|
||||
}
|
||||
|
||||
int BuildStepList::count() const
|
||||
{
|
||||
return m_steps.count();
|
||||
|
@@ -43,7 +43,6 @@ class PROJECTEXPLORER_EXPORT BuildStepList : public ProjectConfiguration
|
||||
public:
|
||||
BuildStepList(QObject *parent, Core::Id id);
|
||||
BuildStepList(QObject *parent, BuildStepList *source);
|
||||
BuildStepList(QObject *parent, const QVariantMap &data);
|
||||
~BuildStepList() override;
|
||||
|
||||
QList<BuildStep *> steps() const;
|
||||
@@ -68,7 +67,6 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isNull() const;
|
||||
int count() const;
|
||||
bool isEmpty() const;
|
||||
bool contains(Core::Id id) const;
|
||||
@@ -82,6 +80,7 @@ public:
|
||||
Target *target() const;
|
||||
|
||||
virtual QVariantMap toMap() const override;
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
void cloneSteps(BuildStepList *source);
|
||||
|
||||
signals:
|
||||
@@ -90,12 +89,8 @@ signals:
|
||||
void stepRemoved(int position);
|
||||
void stepMoved(int from, int to);
|
||||
|
||||
protected:
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
|
||||
private:
|
||||
QList<BuildStep *> m_steps;
|
||||
bool m_isNull = false;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -116,8 +116,8 @@ bool DeployConfiguration::fromMap(const QVariantMap &map)
|
||||
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap();
|
||||
if (!data.isEmpty()) {
|
||||
delete m_stepList;
|
||||
m_stepList = new BuildStepList(this, data);
|
||||
if (m_stepList->isNull()) {
|
||||
m_stepList = new BuildStepList(this, Core::Id());
|
||||
if (!m_stepList->fromMap(data)) {
|
||||
qWarning() << "Failed to restore deploy step list";
|
||||
delete m_stepList;
|
||||
m_stepList = 0;
|
||||
|
Reference in New Issue
Block a user