ProjectExplorer: Add some BaseStringListAspect

Only for storage now, sufficient for the upcoming use in MakeStep.

Change-Id: Ia84595c6cd50f75c70ccef2afb366db3da0e51ff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-07-21 08:48:06 +02:00
parent faa707e932
commit 6775eeefc5
2 changed files with 65 additions and 1 deletions

View File

@@ -140,6 +140,12 @@ public:
bool m_enabled = true; bool m_enabled = true;
}; };
class BaseStringListAspectPrivate
{
public:
QStringList m_value;
};
} // Internal } // Internal
/*! /*!
@@ -785,4 +791,41 @@ TriState TriState::fromVariant(const QVariant &variant)
return TriState(Value(v)); return TriState(Value(v));
} }
/*!
\class ProjectExplorer::BaseStringListAspect
*/
BaseStringListAspect::BaseStringListAspect()
: d(new Internal::BaseStringListAspectPrivate)
{}
BaseStringListAspect::~BaseStringListAspect() = default;
void BaseStringListAspect::addToLayout(LayoutBuilder &builder)
{
Q_UNUSED(builder)
// TODO - when needed.
}
void BaseStringListAspect::fromMap(const QVariantMap &map)
{
d->m_value = map.value(settingsKey()).toStringList();
}
void BaseStringListAspect::toMap(QVariantMap &data) const
{
data.insert(settingsKey(), d->m_value);
}
QStringList BaseStringListAspect::value() const
{
return d->m_value;
}
void BaseStringListAspect::setValue(const QStringList &value)
{
d->m_value = value;
}
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -42,9 +42,10 @@ namespace ProjectExplorer {
namespace Internal { namespace Internal {
class BaseBoolAspectPrivate; class BaseBoolAspectPrivate;
class BaseStringAspectPrivate;
class BaseIntegerAspectPrivate; class BaseIntegerAspectPrivate;
class BaseSelectionAspectPrivate; class BaseSelectionAspectPrivate;
class BaseStringAspectPrivate;
class BaseStringListAspectPrivate;
} // Internal } // Internal
class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
@@ -231,4 +232,24 @@ public:
void setSetting(TriState setting); void setSetting(TriState setting);
}; };
class PROJECTEXPLORER_EXPORT BaseStringListAspect : public ProjectConfigurationAspect
{
Q_OBJECT
public:
BaseStringListAspect();
~BaseStringListAspect() override;
void addToLayout(LayoutBuilder &builder) override;
QStringList value() const;
void setValue(const QStringList &val);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;
private:
std::unique_ptr<Internal::BaseStringListAspectPrivate> d;
};
} // namespace ProjectExplorer } // namespace ProjectExplorer