#include "assetcollection.h" #include #include #include #include #include "containerfactory.h" #include "color.h" #include "imagecollection.h" AssetCollection::AssetCollection(QObject *parent) : BaseContainer(parent), m_imageCollection(Q_NULLPTR) { } const QList &AssetCollection::colors() const { return m_colors; } ImageCollection *AssetCollection::imageCollection() const { return m_imageCollection; } bool AssetCollection::parseProperty(const QString &key, const QJsonValue &value) { if(key == QStringLiteral("colors")) { Q_ASSERT(value.isArray()); for(auto colorValue : value.toArray()) { Q_ASSERT(colorValue.isObject()); m_colors.append(ContainerFactory::createContainer(colorValue.toObject(), this)); } return true; } if(key == QStringLiteral("gradients")) { Q_ASSERT(value.isArray()); for(auto gradientValue : value.toArray()) { //TODO //qWarning() << "gradients not implemented"; } return true; } if(key == QStringLiteral("imageCollection")) { Q_ASSERT(value.isObject()); m_imageCollection = ContainerFactory::createContainer(value.toObject(), this); return true; } if(key == QStringLiteral("images")) { Q_ASSERT(value.isArray()); for(auto imageValue : value.toArray()) { //TODO //qWarning() << "images not implemented"; } return true; } return BaseContainer::parseProperty(key, value); }