| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
| 4 | ** Contact: http://www.qt-project.org/legal |
| 5 | ** |
| 6 | ** This file is part of the QtDocGallery module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and Digia. For licensing terms and |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 2.1 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 24 | ** |
| 25 | ** In addition, as a special exception, Digia gives you certain additional |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 28 | ** |
| 29 | ** GNU General Public License Usage |
| 30 | ** Alternatively, this file may be used under the terms of the GNU |
| 31 | ** General Public License version 3.0 as published by the Free Software |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
| 33 | ** packaging of this file. Please review the following information to |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
| 36 | ** |
| 37 | ** |
| 38 | ** $QT_END_LICENSE$ |
| 39 | ** |
| 40 | ****************************************************************************/ |
| 41 | |
| 42 | #ifndef QGALLERYITEMREQUEST_H |
| 43 | #define QGALLERYITEMREQUEST_H |
| 44 | |
| 45 | #include <qgalleryabstractrequest.h> |
| 46 | #include <qgalleryproperty.h> |
| 47 | #include <qgalleryresource.h> |
| 48 | |
| 49 | #include <QtCore/qurl.h> |
| 50 | |
| 51 | QT_BEGIN_NAMESPACE_DOCGALLERY |
| 52 | |
| 53 | class QGalleryFilter; |
| 54 | class QGalleryResultSet; |
| 55 | |
| 56 | class QGalleryItemRequestPrivate; |
| 57 | |
| 58 | class Q_GALLERY_EXPORT QGalleryItemRequest : public QGalleryAbstractRequest |
| 59 | { |
| 60 | Q_OBJECT |
| 61 | |
| 62 | Q_PROPERTY(QStringList propertyNames READ propertyNames WRITE setPropertyNames NOTIFY propertyNamesChanged) |
| 63 | Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged) |
| 64 | Q_PROPERTY(QVariant itemId READ itemId WRITE setItemId NOTIFY itemIdChanged) |
| 65 | Q_PROPERTY(bool valid READ isValid NOTIFY itemChanged) |
| 66 | Q_PROPERTY(QString itemType READ itemType NOTIFY itemChanged) |
| 67 | Q_PROPERTY(QUrl itemUrl READ itemUrl NOTIFY itemChanged) |
| 68 | Q_PROPERTY(QList<QGalleryResource> resources READ resources NOTIFY itemChanged) |
| 69 | |
| 70 | public: |
| 71 | explicit QGalleryItemRequest(QObject *parent = Q_NULLPTR); |
| 72 | explicit QGalleryItemRequest(QAbstractGallery *gallery, QObject *parent = Q_NULLPTR); |
| 73 | ~QGalleryItemRequest(); |
| 74 | |
| 75 | QStringList propertyNames() const; |
| 76 | void setPropertyNames(const QStringList &names); |
| 77 | |
| 78 | bool autoUpdate() const; |
| 79 | void setAutoUpdate(bool enabled); |
| 80 | |
| 81 | QVariant itemId() const; |
| 82 | void setItemId(const QVariant &itemId); |
| 83 | |
| 84 | QGalleryResultSet *resultSet() const; |
| 85 | |
| 86 | int propertyKey(const QString &property) const; |
| 87 | QGalleryProperty::Attributes propertyAttributes(int key) const; |
| 88 | QVariant::Type propertyType(int key) const; |
| 89 | |
| 90 | bool isValid() const; |
| 91 | |
| 92 | QUrl itemUrl() const; |
| 93 | QString itemType() const; |
| 94 | QList<QGalleryResource> resources() const; |
| 95 | |
| 96 | QVariant metaData(int key) const; |
| 97 | bool setMetaData(int key, const QVariant &value); |
| 98 | |
| 99 | QVariant metaData(const QString &property) const; |
| 100 | bool setMetaData(const QString &property, const QVariant &value); |
| 101 | |
| 102 | Q_SIGNALS: |
| 103 | void propertyNamesChanged(); |
| 104 | void autoUpdateChanged(); |
| 105 | void itemIdChanged(); |
| 106 | void resultSetChanged(QGalleryResultSet *resultSet); |
| 107 | void itemChanged(); |
| 108 | void metaDataChanged(const QList<int> &keys); |
| 109 | |
| 110 | protected: |
| 111 | void setResponse(QGalleryAbstractResponse *response); |
| 112 | |
| 113 | private: |
| 114 | Q_DECLARE_PRIVATE(QGalleryItemRequest) |
| 115 | Q_PRIVATE_SLOT(d_func(), void _q_itemsInserted(int, int)) |
| 116 | Q_PRIVATE_SLOT(d_func(), void _q_itemsRemoved(int, int)) |
| 117 | Q_PRIVATE_SLOT(d_func(), void _q_itemsMoved(int, int, int)) |
| 118 | Q_PRIVATE_SLOT(d_func(), void _q_currentItemChanged()) |
| 119 | Q_PRIVATE_SLOT(d_func(), void _q_metaDataChanged(int, int, const QList<int> &)) |
| 120 | }; |
| 121 | |
| 122 | QT_END_NAMESPACE_DOCGALLERY |
| 123 | |
| 124 | #endif |
| 125 | |