1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2015 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtLocation module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
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 The Qt Company. For licensing terms |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/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 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or later as published by the Free |
28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
29 | ** the packaging of this file. Please review the following information to |
30 | ** ensure the GNU General Public License version 2.0 requirements will be |
31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
32 | ** |
33 | ** $QT_END_LICENSE$ |
34 | ** |
35 | ****************************************************************************/ |
36 | |
37 | #include "qplaceimage.h" |
38 | #include "qplaceimage_p.h" |
39 | |
40 | QT_USE_NAMESPACE |
41 | |
42 | QPlaceImagePrivate::QPlaceImagePrivate() : QPlaceContentPrivate() |
43 | { |
44 | } |
45 | |
46 | QPlaceImagePrivate::QPlaceImagePrivate(const QPlaceImagePrivate &other) |
47 | : QPlaceContentPrivate(other) |
48 | { |
49 | url = other.url; |
50 | id = other.id; |
51 | mimeType = other.mimeType; |
52 | } |
53 | |
54 | QPlaceImagePrivate::~QPlaceImagePrivate() |
55 | { |
56 | } |
57 | |
58 | bool QPlaceImagePrivate::compare(const QPlaceContentPrivate *other) const |
59 | { |
60 | const QPlaceImagePrivate *od = static_cast<const QPlaceImagePrivate *>(other); |
61 | return QPlaceContentPrivate::compare(other) |
62 | && url == od->url && id == od->id && mimeType == od->mimeType; |
63 | } |
64 | |
65 | /*! |
66 | \class QPlaceImage |
67 | \inmodule QtLocation |
68 | \ingroup QtLocation-places |
69 | \ingroup QtLocation-places-data |
70 | \since 5.6 |
71 | |
72 | \brief The QPlaceImage class represents a reference to an image. |
73 | |
74 | Each QPlaceImage represents a set of metadata about an image such as it's |
75 | url, identifier and MIME type. These are properties in addition to those provided |
76 | by QPlaceContent. |
77 | |
78 | Note: The Places API only supports images as 'retrieve-only' objects. Submitting |
79 | images to a provider is not a supported use case. |
80 | \sa QPlaceContent |
81 | */ |
82 | |
83 | /*! |
84 | Constructs an new QPlaceImage. |
85 | */ |
86 | QPlaceImage::QPlaceImage() |
87 | : QPlaceContent(new QPlaceImagePrivate) |
88 | { |
89 | } |
90 | |
91 | /*! |
92 | Destructor. |
93 | */ |
94 | QPlaceImage::~QPlaceImage() |
95 | { |
96 | } |
97 | |
98 | /*! |
99 | \fn QPlaceImage::QPlaceImage(const QPlaceContent &other) |
100 | Constructs a copy of \a other if possible, otherwise constructs a default image. |
101 | */ |
102 | |
103 | Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceImage) |
104 | |
105 | Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceImage) |
106 | |
107 | /*! |
108 | Returns the image's url. |
109 | */ |
110 | QUrl QPlaceImage::url() const |
111 | { |
112 | Q_D(const QPlaceImage); |
113 | return d->url; |
114 | } |
115 | |
116 | /*! |
117 | Sets the image's \a url. |
118 | */ |
119 | void QPlaceImage::setUrl(const QUrl &url) |
120 | { |
121 | Q_D(QPlaceImage); |
122 | d->url = url; |
123 | } |
124 | |
125 | /*! |
126 | Returns the image's identifier. |
127 | */ |
128 | QString QPlaceImage::imageId() const |
129 | { |
130 | Q_D(const QPlaceImage); |
131 | return d->id; |
132 | } |
133 | |
134 | /*! |
135 | Sets image's \a identifier. |
136 | */ |
137 | void QPlaceImage::setImageId(const QString &identifier) |
138 | { |
139 | Q_D(QPlaceImage); |
140 | d->id = identifier; |
141 | } |
142 | |
143 | /*! |
144 | Returns the image's MIME type. |
145 | */ |
146 | QString QPlaceImage::mimeType() const |
147 | { |
148 | Q_D(const QPlaceImage); |
149 | return d->mimeType; |
150 | } |
151 | |
152 | /*! |
153 | Sets image's MIME \a type. |
154 | */ |
155 | void QPlaceImage::setMimeType(const QString &type) |
156 | { |
157 | Q_D(QPlaceImage); |
158 | d->mimeType = type; |
159 | } |
160 | |