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!";
|
qWarning() << "No data for build step list" << i << "found!";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto list = new BuildStepList(this, data);
|
auto list = new BuildStepList(this, Core::Id());
|
||||||
if (list->isNull()) {
|
if (!list->fromMap(data)) {
|
||||||
qWarning() << "Failed to restore build step list" << i;
|
qWarning() << "Failed to restore build step list" << i;
|
||||||
delete list;
|
delete list;
|
||||||
return false;
|
return false;
|
||||||
|
@@ -51,8 +51,7 @@ BuildStepList::BuildStepList(QObject *parent, Core::Id id) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
||||||
ProjectConfiguration(parent, source),
|
ProjectConfiguration(parent, source)
|
||||||
m_isNull(source->m_isNull)
|
|
||||||
{
|
{
|
||||||
setDisplayName(source->displayName());
|
setDisplayName(source->displayName());
|
||||||
Q_ASSERT(parent);
|
Q_ASSERT(parent);
|
||||||
@@ -61,13 +60,6 @@ BuildStepList::BuildStepList(QObject *parent, BuildStepList *source) :
|
|||||||
// will fail to clone the buildsteps!
|
// 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()
|
BuildStepList::~BuildStepList()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_steps);
|
qDeleteAll(m_steps);
|
||||||
@@ -84,11 +76,6 @@ QVariantMap BuildStepList::toMap() const
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuildStepList::isNull() const
|
|
||||||
{
|
|
||||||
return m_isNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
int BuildStepList::count() const
|
int BuildStepList::count() const
|
||||||
{
|
{
|
||||||
return m_steps.count();
|
return m_steps.count();
|
||||||
|
@@ -43,7 +43,6 @@ class PROJECTEXPLORER_EXPORT BuildStepList : public ProjectConfiguration
|
|||||||
public:
|
public:
|
||||||
BuildStepList(QObject *parent, Core::Id id);
|
BuildStepList(QObject *parent, Core::Id id);
|
||||||
BuildStepList(QObject *parent, BuildStepList *source);
|
BuildStepList(QObject *parent, BuildStepList *source);
|
||||||
BuildStepList(QObject *parent, const QVariantMap &data);
|
|
||||||
~BuildStepList() override;
|
~BuildStepList() override;
|
||||||
|
|
||||||
QList<BuildStep *> steps() const;
|
QList<BuildStep *> steps() const;
|
||||||
@@ -68,7 +67,6 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNull() const;
|
|
||||||
int count() const;
|
int count() const;
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
bool contains(Core::Id id) const;
|
bool contains(Core::Id id) const;
|
||||||
@@ -82,6 +80,7 @@ public:
|
|||||||
Target *target() const;
|
Target *target() const;
|
||||||
|
|
||||||
virtual QVariantMap toMap() const override;
|
virtual QVariantMap toMap() const override;
|
||||||
|
virtual bool fromMap(const QVariantMap &map) override;
|
||||||
void cloneSteps(BuildStepList *source);
|
void cloneSteps(BuildStepList *source);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -90,12 +89,8 @@ signals:
|
|||||||
void stepRemoved(int position);
|
void stepRemoved(int position);
|
||||||
void stepMoved(int from, int to);
|
void stepMoved(int from, int to);
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<BuildStep *> m_steps;
|
QList<BuildStep *> m_steps;
|
||||||
bool m_isNull = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -116,8 +116,8 @@ bool DeployConfiguration::fromMap(const QVariantMap &map)
|
|||||||
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap();
|
QVariantMap data = map.value(QLatin1String(BUILD_STEP_LIST_PREFIX) + QLatin1Char('0')).toMap();
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
delete m_stepList;
|
delete m_stepList;
|
||||||
m_stepList = new BuildStepList(this, data);
|
m_stepList = new BuildStepList(this, Core::Id());
|
||||||
if (m_stepList->isNull()) {
|
if (!m_stepList->fromMap(data)) {
|
||||||
qWarning() << "Failed to restore deploy step list";
|
qWarning() << "Failed to restore deploy step list";
|
||||||
delete m_stepList;
|
delete m_stepList;
|
||||||
m_stepList = 0;
|
m_stepList = 0;
|
||||||
|
Reference in New Issue
Block a user