diff options
author | Xizhi Zhu <xizhi.zhu@gmail.com> | 2012-08-17 22:34:11 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-17 21:38:50 +0200 |
commit | 745e15ab3cc5cf6e0cb0cba51ca865151aadc3c8 (patch) | |
tree | c407989f23611f008c2cdeee8998d1c59c0c7f28 | |
parent | 92defcdcef4b17dfbca21c18de7eebac13219736 (diff) |
Removed the broken simulator backend.
Change-Id: I39c2fed7635b42f76a142a6ac906696454185516
Reviewed-by: Xizhi Zhu <xizhi.zhu@gmail.com>
-rw-r--r-- | src/gallery/gallery.pro | 4 | ||||
-rw-r--r-- | src/gallery/simulator/docgalleryconnection_simulator.cpp | 122 | ||||
-rw-r--r-- | src/gallery/simulator/docgalleryconnection_simulator.h | 98 | ||||
-rw-r--r-- | src/gallery/simulator/docgallerysimulatordata.cpp | 87 | ||||
-rw-r--r-- | src/gallery/simulator/docgallerysimulatordata.h | 87 | ||||
-rw-r--r-- | src/gallery/simulator/qdocumentgallery_simulator.cpp | 137 | ||||
-rw-r--r-- | src/gallery/simulator/qsimulatorgalleryresultset.cpp | 264 | ||||
-rw-r--r-- | src/gallery/simulator/qsimulatorgalleryresultset_p.h | 112 | ||||
-rw-r--r-- | src/gallery/simulator/simulator.pri | 20 |
9 files changed, 1 insertions, 930 deletions
diff --git a/src/gallery/gallery.pro b/src/gallery/gallery.pro index 3dd4170..6f70f6f 100644 --- a/src/gallery/gallery.pro +++ b/src/gallery/gallery.pro @@ -46,9 +46,7 @@ OTHER_FILES = \ qgalleryproperty.qdoc \ qgallerytype.qdoc -simulator: { - include (simulator/simulator.pri) -} else: linux-* { +linux-* { contains(QT_CONFIG, dbus): contains(tracker_enabled, yes): { include (tracker/tracker.pri) } else: { diff --git a/src/gallery/simulator/docgalleryconnection_simulator.cpp b/src/gallery/simulator/docgalleryconnection_simulator.cpp deleted file mode 100644 index fddb00c..0000000 --- a/src/gallery/simulator/docgalleryconnection_simulator.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "docgalleryconnection_simulator.h" - -#include <mobilityconnection_p.h> -#include <private/qsimulatordata_p.h> - -#include <QtNetwork/QLocalSocket> - -QT_DOCGALLERY_BEGIN_NAMESPACE - -using namespace QtSimulatorPrivate; - -namespace Simulator { -DocGalleryConnection::DocGalleryConnection(MobilityConnection *mobilityCon) - : QObject(mobilityCon) - , mConnection(mobilityCon) - , mRegisteredWithSimulator(false) - , mInitialDataReceived(false) -{ - qt_registerDocGalleryTypes(); - mobilityCon->addMessageHandler(this); - getInitialData(); -} - -DocGalleryConnection *DocGalleryConnection::instance() -{ - static DocGalleryConnection *docGalleryConnection = 0; - - if (!docGalleryConnection) - docGalleryConnection = new DocGalleryConnection(MobilityConnection::instance()); - return docGalleryConnection; -} - - -QLocalSocket *DocGalleryConnection::sendSocket() -{ - return mConnection->sendSocket(); -} - -void DocGalleryConnection::getInitialData() -{ - mInitialDataReceived = false; - RemoteMetacall<void>::call(mConnection->sendSocket(), NoSync, "setRequestsDocGallery"); - - // blockingly handle all remote calls until the simulator signals the initial data - // sending is done - QByteArray readBuffer; - QLocalSocket *readSocket = mConnection->receiveSocket(); - while (!mInitialDataReceived) { - readSocket->waitForReadyRead(100); - readBuffer += readSocket->readAll(); - forever { - IncomingRemoteMetacall rpc; - if (rpc.read(&readBuffer)) { - if (rpc.call(readSocket, this)) - continue; - qWarning("Ignoring a call to %s,", rpc.signature().data()); - } - break; - } - } -} - -void DocGalleryConnection::initialDocGalleryDataSent() -{ - mInitialDataReceived = true; -} - -void DocGalleryConnection::setDocGalleryData(const QtMobility::DocGallerySimulatorData &data) -{ - mGalleryData = data; -} - -DocGallerySimulatorData DocGalleryConnection::galleryData() const -{ - return mGalleryData; -} - -#include "moc_docgalleryconnection_simulator.cpp" -} - -QT_DOCGALLERY_END_NAMESPACE diff --git a/src/gallery/simulator/docgalleryconnection_simulator.h b/src/gallery/simulator/docgalleryconnection_simulator.h deleted file mode 100644 index d865f8e..0000000 --- a/src/gallery/simulator/docgalleryconnection_simulator.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef DOCGALLERYCONNECTION_SIMULATOR_P_H -#define DOCGALLERYCONNECTION_SIMULATOR_P_H - -#include "qgalleryglobal.h" -#include "docgallerysimulatordata.h" -#include <QtCore/QObject> -#include <QtCore/QList> - -QT_BEGIN_HEADER - -class QLocalSocket; - -QT_DOCGALLERY_BEGIN_NAMESPACE - -namespace Simulator { -class MobilityConnection; - -class DocGalleryConnection : public QObject -{ - Q_OBJECT -public: - explicit DocGalleryConnection(MobilityConnection *mobilityCon); - static DocGalleryConnection *instance(); - - QLocalSocket *sendSocket(); - - QtMobility::DocGallerySimulatorData galleryData() const; -private slots: - void setDocGalleryData(const QtMobility::DocGallerySimulatorData &data); - void initialDocGalleryDataSent(); - -private: - void getInitialData(); - - DocGallerySimulatorData mGalleryData; - - MobilityConnection *mConnection; - bool mRegisteredWithSimulator; - bool mInitialDataReceived; -}; -} - -QT_DOCGALLERY_END_NAMESPACE -QT_END_HEADER - -#endif // DOCGALLERYCONNECTION_SIMULATOR_P_H diff --git a/src/gallery/simulator/docgallerysimulatordata.cpp b/src/gallery/simulator/docgallerysimulatordata.cpp deleted file mode 100644 index 5d0bff5..0000000 --- a/src/gallery/simulator/docgallerysimulatordata.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "docgallerysimulatordata.h" - -QT_DOCGALLERY_BEGIN_NAMESPACE - -void qt_registerDocGalleryTypes() -{ - qRegisterMetaTypeStreamOperators<DocGallerySimulatorData>("QtMobility::DocGallerySimulatorData"); -} - -QDataStream &operator<<(QDataStream &out, const DocGallerySimulatorData &s) -{ - out << s.artists << s.images; - return out; -} - -QDataStream &operator<<(QDataStream &out, const DocGalleryArtistItem &i) -{ - out << i.artist; - return out; -} - -QDataStream &operator<<(QDataStream &out, const DocGalleryImageItem &i) -{ - out << i.fileName << i.tags << i.title << i.width << i.height; - return out; -} - -QDataStream &operator>>(QDataStream &in, DocGallerySimulatorData &s) -{ - in >> s.artists >> s.images; - return in; -} - -QDataStream &operator>>(QDataStream &in, DocGalleryArtistItem &i) -{ - in >> i.artist; - return in; -} - -QDataStream &operator>>(QDataStream &in, DocGalleryImageItem &i) -{ - in >> i.fileName >> i.tags >> i.title >> i.width >> i.height; - return in; -} - -QT_DOCGALLERY_END_NAMESPACE diff --git a/src/gallery/simulator/docgallerysimulatordata.h b/src/gallery/simulator/docgallerysimulatordata.h deleted file mode 100644 index 48ba34f..0000000 --- a/src/gallery/simulator/docgallerysimulatordata.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef DOCGALLERYSIMULATORDATA_H -#define DOCGALLERYSIMULATORDATA_H - -#include "qgalleryglobal.h" -#include <QtCore/QList> -#include <QtCore/QString> -#include <QtCore/QMetaType> - -QT_DOCGALLERY_BEGIN_NAMESPACE -struct DocGalleryImageItem -{ - QString fileName; - int width; - int height; - QString title; - QString tags; -}; - -struct DocGalleryArtistItem -{ - QString artist; -}; - -struct DocGallerySimulatorData -{ - QList<DocGalleryImageItem> images; - QList<DocGalleryArtistItem> artists; -}; - -void qt_registerDocGalleryTypes(); -QT_DOCGALLERY_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt::DocGallerySimulatorData) - -#endif // DOCGALLERYSIMULATORDATA_H diff --git a/src/gallery/simulator/qdocumentgallery_simulator.cpp b/src/gallery/simulator/qdocumentgallery_simulator.cpp deleted file mode 100644 index 8af5d61..0000000 --- a/src/gallery/simulator/qdocumentgallery_simulator.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdocumentgallery.h" - -#include "qabstractgallery_p.h" - -#include "qgalleryitemrequest.h" -#include "qgalleryqueryrequest.h" -#include "qgallerytyperequest.h" - -#include "qgalleryabstractresponse.h" - -#include "qsimulatorgalleryresultset_p.h" -#include "docgalleryconnection_simulator.h" - -#include <QtCore/qmetaobject.h> - -Q_DECLARE_METATYPE(QVector<QStringList>) - -QT_DOCGALLERY_BEGIN_NAMESPACE - -using namespace Simulator; - -class QDocumentGalleryPrivate : public QAbstractGalleryPrivate -{ -public: - QGalleryAbstractResponse *createItemResponse(QGalleryItemRequest *request); - QGalleryAbstractResponse *createTypeResponse(QGalleryTypeRequest *request); - QGalleryAbstractResponse *createQueryResponse(QGalleryQueryRequest *request); - -private: -}; - -QGalleryAbstractResponse *QDocumentGalleryPrivate::createTypeResponse(QGalleryTypeRequest *request) -{ - Q_UNUSED(request); - return new QGalleryAbstractResponse(QDocumentGallery::NoGallery); -} - -QGalleryAbstractResponse *QDocumentGalleryPrivate::createItemResponse(QGalleryItemRequest *request) -{ - return new QSimulatorGalleryResultSet(request); -} - -QGalleryAbstractResponse *QDocumentGalleryPrivate::createQueryResponse( - QGalleryQueryRequest *request) -{ - return new QSimulatorGalleryResultSet(request); -} - - -QDocumentGallery::QDocumentGallery(QObject *parent) - : QAbstractGallery(*new QDocumentGalleryPrivate, parent) -{ -} - -QDocumentGallery::~QDocumentGallery() -{ -} - -bool QDocumentGallery::isRequestSupported(QGalleryAbstractRequest::RequestType type) const -{ - if (type == QGalleryAbstractRequest::ItemRequest || type == QGalleryAbstractRequest::QueryRequest) - return true; - return false; -} - -QStringList QDocumentGallery::itemTypePropertyNames(const QString &itemType) const -{ - Q_UNUSED(itemType); - return QStringList(); -} - -QGalleryProperty::Attributes QDocumentGallery::propertyAttributes( - const QString &propertyName, const QString &itemType) const -{ - Q_UNUSED(propertyName); - Q_UNUSED(itemType); - return QGalleryProperty::CanRead; -} - -QGalleryAbstractResponse *QDocumentGallery::createResponse(QGalleryAbstractRequest *request) -{ - Q_D(QDocumentGallery); - - switch (request->type()) { - case QGalleryAbstractRequest::QueryRequest: - return d->createQueryResponse(static_cast<QGalleryQueryRequest *>(request)); - case QGalleryAbstractRequest::ItemRequest: - return d->createItemResponse(static_cast<QGalleryItemRequest *>(request)); - case QGalleryAbstractRequest::TypeRequest: - return d->createTypeResponse(static_cast<QGalleryTypeRequest *>(request)); - default: - return 0; - } -} - -QT_DOCGALLERY_END_NAMESPACE diff --git a/src/gallery/simulator/qsimulatorgalleryresultset.cpp b/src/gallery/simulator/qsimulatorgalleryresultset.cpp deleted file mode 100644 index 36cddfd..0000000 --- a/src/gallery/simulator/qsimulatorgalleryresultset.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsimulatorgalleryresultset_p.h" - -#include "qdocumentgallery.h" - -#include <QtCore/QDateTime> - -QT_DOCGALLERY_BEGIN_NAMESPACE - -namespace Utility { -enum PropertyKeys { - // Query Properties - FileName = 0, - FilePath, - FileExtension, - FileSize, - MimeType, - LastModified, - LastAccessed, - // Image Properties - Title, - Width, - Height, - Keywords -}; -} - -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(); -} - -QSimulatorGalleryResultSet::~QSimulatorGalleryResultSet() -{ -} - -int QSimulatorGalleryResultSet::propertyKey(const QString &property) const -{ - if (property == QDocumentGallery::url.name() || - property == QDocumentGallery::fileName.name()) - return Utility::FileName; - else if(property == QDocumentGallery::filePath.name() || - property == QDocumentGallery::path.name()) - return Utility::FilePath; - else if (property == QDocumentGallery::fileExtension.name()) - return Utility::FileExtension; - else if (property == QDocumentGallery::fileSize.name()) - return Utility::FileSize; - else if (property == QDocumentGallery::mimeType.name()) - return Utility::MimeType; - else if (property == QDocumentGallery::lastModified.name()) - return Utility::LastModified; - else if (property == QDocumentGallery::lastAccessed.name()) - return Utility::LastAccessed; - else if (property == QDocumentGallery::title.name()) - return Utility::Title; - else if (property == QDocumentGallery::width.name()) - return Utility::Width; - else if (property == QDocumentGallery::height.name()) - return Utility::Height; - else if (property == QDocumentGallery::keywords.name()) - return Utility::Keywords; - return -1; -} - -QGalleryProperty::Attributes QSimulatorGalleryResultSet::propertyAttributes(int key) const -{ - switch(key) { - case Utility::FileName: return QGalleryProperty::CanRead; - case Utility::FilePath: return QGalleryProperty::CanRead; - case Utility::FileExtension: return QGalleryProperty::CanRead; - case Utility::FileSize: return QGalleryProperty::CanRead; - case Utility::LastModified: return QGalleryProperty::CanRead; - case Utility::LastAccessed: return QGalleryProperty::CanRead; - case Utility::Title: return QGalleryProperty::CanRead; - case Utility::Width: return QGalleryProperty::CanRead; - case Utility::Height: return QGalleryProperty::CanRead; - case Utility::Keywords: return QGalleryProperty::CanRead; - default: return QGalleryProperty::Attributes(); - } -} - -QVariant::Type QSimulatorGalleryResultSet::propertyType(int key) const -{ - QVariant::Type ret = QVariant::Invalid; - switch(key) { - case Utility::FileName: ret = QVariant::String; break; - case Utility::FilePath: ret = QVariant::String; break; - case Utility::FileExtension: ret = QVariant::String; break; - case Utility::FileSize: ret = QVariant::Int; break; - case Utility::LastModified: ret = QVariant::DateTime; break; - case Utility::LastAccessed: ret = QVariant::DateTime; break; - case Utility::Title: ret = QVariant::String; break; - case Utility::Width: ret = QVariant::Int; break; - case Utility::Keywords: ret = QVariant::String; break; - default: ret = QVariant::Invalid;break; - } - - return ret; -} - -int QSimulatorGalleryResultSet::itemCount() const -{ - if (connection) - return connection->galleryData().images.count(); - return valid ? 1 : 0; -} - -bool QSimulatorGalleryResultSet::isValid() const -{ - return valid; -} - -QVariant QSimulatorGalleryResultSet::itemId() const -{ - if (valid) { - return currentFileInfo().absoluteFilePath(); - } - return QVariant(); -} - -QUrl QSimulatorGalleryResultSet::itemUrl() const -{ - if (connection) { - QString data = currentFileInfo().absoluteFilePath(); - return QUrl::fromLocalFile(data); - } - return QUrl(); -} - -QString QSimulatorGalleryResultSet::itemType() const -{ - return itemTypeString; -} - -QVariant QSimulatorGalleryResultSet::metaData(int key) const -{ - QFileInfo info = currentFileInfo(); - if (key == Utility::FileName) - return info.absoluteFilePath(); - else if (key == Utility::FilePath) - return info.absolutePath(); - else if (key == Utility::FileExtension) - return info.suffix(); - else if (key == Utility::FileSize) - return info.size(); - else if (key == Utility::LastAccessed) - return info.lastRead(); - else if (key == Utility::LastModified) - return info.lastModified(); - else if (key == Utility::Title) - return QLatin1String("Image Title of Simulator"); - else if (key == Utility::Width) - return image.width(); - else if (key == Utility::Height) - return image.height(); - else if (key == Utility::Keywords) - return QLatin1String("Simulator, Some Tags, Not read from file yet"); - return QVariant(); -} - -bool QSimulatorGalleryResultSet::setMetaData(int key, const QVariant &value) -{ - Q_UNUSED(key); - Q_UNUSED(value); - return false; -} - -int QSimulatorGalleryResultSet::currentIndex() const -{ - return mCurrentIndex; -} - -bool QSimulatorGalleryResultSet::fetch(int index) -{ - if (connection) { - if (index < 0 || index >= connection->galleryData().images.size()) - return false; - mCurrentIndex = index; - } - return true; -} - -QFileInfo QSimulatorGalleryResultSet::currentFileInfo() const -{ - if (connection) - return QFileInfo(connection->galleryData().images.at(mCurrentIndex).fileName); - else - return QFileInfo(filePath); -} - -QT_DOCGALLERY_END_NAMESPACE diff --git a/src/gallery/simulator/qsimulatorgalleryresultset_p.h b/src/gallery/simulator/qsimulatorgalleryresultset_p.h deleted file mode 100644 index c4d5cbe..0000000 --- a/src/gallery/simulator/qsimulatorgalleryresultset_p.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtDocGallery module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QSIMULATORGALLERYRESULTSET_H -#define QSIMULATORGALLERYRESULTSET_H - -#include "qgalleryglobal.h" -#include "docgalleryconnection_simulator.h" -#include "qgalleryresultset.h" -#include "qgalleryqueryrequest.h" -#include "qgalleryitemrequest.h" -#include <QtCore/QObject> -#include <QtCore/QFileInfo> -#include <QtGui/QImage> - -QT_DOCGALLERY_BEGIN_NAMESPACE - -class QSimulatorGalleryResultSet : public QGalleryResultSet -{ - Q_OBJECT -public: - explicit QSimulatorGalleryResultSet(QObject *parent = 0); - - ~QSimulatorGalleryResultSet(); - - int propertyKey(const QString &property) const; - QGalleryProperty::Attributes propertyAttributes(int key) const ; - QVariant::Type propertyType(int key) const; - - int itemCount() const; - - bool isValid() const; - - QVariant itemId() const; - QUrl itemUrl() const; - QString itemType() const; - QVariant metaData(int key) const; - bool setMetaData(int key, const QVariant &value); - - int currentIndex() const; - bool fetch(int index); - -signals: - -public slots: - -private: - QFileInfo currentFileInfo() const; - - Simulator::DocGalleryConnection* connection; - QGalleryQueryRequest* queryRequest; - QGalleryItemRequest* itemRequest; - - QString filePath; - QString itemTypeString; - QImage image; - bool valid; - int mCurrentIndex; -}; - -QT_DOCGALLERY_END_NAMESPACE - -#endif // QSIMULATORGALLERYRESULTSET_H diff --git a/src/gallery/simulator/simulator.pri b/src/gallery/simulator/simulator.pri deleted file mode 100644 index c459596..0000000 --- a/src/gallery/simulator/simulator.pri +++ /dev/null @@ -1,20 +0,0 @@ - -INCLUDEPATH += $$PWD - -DEFINES += QT_DOCUMENT_GALLERY_SIMULATOR - -PRIVATE_HEADERS += \ - $$PWD/qsimulatorgalleryresultset_p.h \ - $$PWD/docgalleryconnection_simulator.h - -SOURCES += \ - $$PWD/qdocumentgallery_simulator.cpp \ - $$PWD/qsimulatorgalleryresultset.cpp \ - $$PWD/docgalleryconnection_simulator.cpp \ - $$PWD/docgallerysimulatordata.cpp - -HEADERS += \ - $$PWD/docgallerysimulatordata.h - -INCLUDEPATH += ../mobilitysimulator -qtAddLibrary(QtMobilitySimulator) |