QGalleryFilter QDeclarativeGalleryFilterIntersection::filter() const { QGalleryIntersectionFilter intersectionFilter; typedef QList<QDeclarativeGalleryFilterBase *>::const_iterator iterator; for (iterator it = m_filters.begin(), end = m_filters.end(); it != end; ++it) { QGalleryFilter filter = (*it)->filter(); switch (filter.type()) { case QGalleryFilter::MetaData: intersectionFilter.append(filter.toMetaDataFilter()); break; case QGalleryFilter::Union: intersectionFilter.append(filter.toUnionFilter()); break; case QGalleryFilter::Intersection: intersectionFilter.append(filter.toIntersectionFilter()); break; default: break; } } return intersectionFilter; }
QSimulatorGalleryResultSet::QSimulatorGalleryResultSet(QObject *parent) : QGalleryResultSet(parent), connection(0), valid(false), mCurrentIndex(0) { queryRequest = qobject_cast<QGalleryQueryRequest*>(parent); itemRequest = qobject_cast<QGalleryItemRequest*>(parent); if (queryRequest) { if (queryRequest->rootType() == QLatin1String("Image")) { // Do the image magic connection = Simulator::DocGalleryConnection::instance(); } else { QGalleryFilter filter = queryRequest->filter(); if (filter.toMetaDataFilter().propertyName() != QLatin1String("filePath")) { qWarning("The Qt Simulator can only handle filePath filters currently"); return; } filePath = filter.toMetaDataFilter().value().toString(); } } else if (itemRequest) { filePath = itemRequest->itemId().toString(); } else { qWarning("Unsupport Request Type!"); return; } image = QImage(filePath); if (!image.isNull()) itemTypeString = QDocumentGallery::Image.name(); else if (!filePath.isEmpty()) itemTypeString = QDocumentGallery::File.name(); valid = true; finish(); }