| 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 "qplaceeditorial.h" | 
| 38 | #include "qplaceeditorial_p.h" | 
| 39 |  | 
| 40 | QT_USE_NAMESPACE | 
| 41 |  | 
| 42 | QPlaceEditorialPrivate::QPlaceEditorialPrivate() | 
| 43 | :   QPlaceContentPrivate() | 
| 44 | { | 
| 45 | } | 
| 46 |  | 
| 47 | QPlaceEditorialPrivate::QPlaceEditorialPrivate(const QPlaceEditorialPrivate &other) | 
| 48 | :   QPlaceContentPrivate(other), text(other.text), contentTitle(other.contentTitle), | 
| 49 |     language(other.language) | 
| 50 | { | 
| 51 | } | 
| 52 |  | 
| 53 | QPlaceEditorialPrivate::~QPlaceEditorialPrivate() | 
| 54 | { | 
| 55 | } | 
| 56 |  | 
| 57 | bool QPlaceEditorialPrivate::compare(const QPlaceContentPrivate *other) const | 
| 58 | { | 
| 59 |     const QPlaceEditorialPrivate *od = static_cast<const QPlaceEditorialPrivate *>(other); | 
| 60 |     return QPlaceContentPrivate::compare(other) | 
| 61 |            && text == od->text | 
| 62 |            && contentTitle == od->contentTitle | 
| 63 |            && language == od->language; | 
| 64 | } | 
| 65 |  | 
| 66 | /*! | 
| 67 |     \class QPlaceEditorial | 
| 68 |     \inmodule QtLocation | 
| 69 |     \ingroup QtLocation-places | 
| 70 |     \ingroup QtLocation-places-data | 
| 71 |     \since 5.6 | 
| 72 |  | 
| 73 |     \brief The QPlaceEditorial class represents a publisher's article describing a place. | 
| 74 |  | 
| 75 |     Each QPlaceEditorial has a title, text and language; in addition to those properties | 
| 76 |     inherited from QPlaceContent. | 
| 77 |  | 
| 78 |     Note: The Places API only supports editorials as 'retrieve-only' objects.  Submitting editorials | 
| 79 |     to a provider is not a supported use case. | 
| 80 |  | 
| 81 |     \sa QPlaceContent | 
| 82 | */ | 
| 83 |  | 
| 84 | /*! | 
| 85 |     Constructs a new editorial object. | 
| 86 | */ | 
| 87 | QPlaceEditorial::QPlaceEditorial() | 
| 88 | :   QPlaceContent(new QPlaceEditorialPrivate) | 
| 89 | { | 
| 90 | } | 
| 91 |  | 
| 92 | /*! | 
| 93 |     Destructor. | 
| 94 | */ | 
| 95 | QPlaceEditorial::~QPlaceEditorial() | 
| 96 | { | 
| 97 | } | 
| 98 |  | 
| 99 | /*! | 
| 100 |     \fn QPlaceEditorial::QPlaceEditorial(const QPlaceContent &other) | 
| 101 |     Constructs a copy of \a other if possible, otherwise constructs a default editorial object. | 
| 102 | */ | 
| 103 | Q_IMPLEMENT_CONTENT_COPY_CTOR(QPlaceEditorial) | 
| 104 |  | 
| 105 | Q_IMPLEMENT_CONTENT_D_FUNC(QPlaceEditorial) | 
| 106 |  | 
| 107 | /*! | 
| 108 |     Returns a textual description of the place. | 
| 109 |  | 
| 110 |     Depending upon the provider, the | 
| 111 |     editorial text could be either rich(HTML based) text or plain text. | 
| 112 | */ | 
| 113 | QString QPlaceEditorial::text() const | 
| 114 | { | 
| 115 |     Q_D(const QPlaceEditorial); | 
| 116 |     return d->text; | 
| 117 | } | 
| 118 |  | 
| 119 | /*! | 
| 120 |     Sets the \a text of the editorial. | 
| 121 | */ | 
| 122 | void QPlaceEditorial::setText(const QString &text) | 
| 123 | { | 
| 124 |     Q_D(QPlaceEditorial); | 
| 125 |     d->text = text; | 
| 126 | } | 
| 127 |  | 
| 128 | /*! | 
| 129 |     Returns the title of the editorial. | 
| 130 | */ | 
| 131 | QString QPlaceEditorial::title() const | 
| 132 | { | 
| 133 |     Q_D(const QPlaceEditorial); | 
| 134 |     return d->contentTitle; | 
| 135 | } | 
| 136 |  | 
| 137 | /*! | 
| 138 |     Sets the \a title of the editorial. | 
| 139 | */ | 
| 140 | void QPlaceEditorial::setTitle(const QString &title) | 
| 141 | { | 
| 142 |     Q_D(QPlaceEditorial); | 
| 143 |     d->contentTitle = title; | 
| 144 | } | 
| 145 |  | 
| 146 | /*! | 
| 147 |     Returns the language of the editorial.   Typically this would be a language code | 
| 148 |     in the 2 letter ISO 639-1 format. | 
| 149 | */ | 
| 150 | QString QPlaceEditorial::language() const | 
| 151 | { | 
| 152 |     Q_D(const QPlaceEditorial); | 
| 153 |     return d->language; | 
| 154 | } | 
| 155 |  | 
| 156 | /*! | 
| 157 |     Sets the \a language of the editorial. Typically this would be a language code | 
| 158 |     in the 2 letter ISO 639-1 format. | 
| 159 | */ | 
| 160 | void QPlaceEditorial::setLanguage(const QString &language) | 
| 161 | { | 
| 162 |     Q_D(QPlaceEditorial); | 
| 163 |     d->language = language; | 
| 164 | } | 
| 165 |  |