PluginView: Functional style dependency list creation

Change-Id: I08c6aeb8be55e73a9d8e55e264046afc19c9e4b9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2016-06-22 13:44:19 +02:00
parent 73dbcb49fd
commit b9bd611e25
3 changed files with 21 additions and 18 deletions

View File

@@ -146,6 +146,23 @@ bool PluginDependency::operator==(const PluginDependency &other) const
return name == other.name && version == other.version && type == other.type;
}
static QString typeString(PluginDependency::Type type)
{
switch (type) {
case PluginDependency::Required:
return QString();
case PluginDependency::Optional:
return ", optional";
case PluginDependency::Test:
return ", test";
}
}
QString PluginDependency::toString() const
{
return name + " (" + version + typeString(type) + ")";
}
/*!
\internal
*/