File indexing completed on 2024-04-14 14:55:11
0001 /** =========================================================== 0002 * @file 0003 * 0004 * This file is a part of KDE project 0005 * <a href="https://commits.kde.org/libmediawiki">libmediawiki</a> 0006 * 0007 * @date 2011-03-22 0008 * @brief a MediaWiki C++ interface for KDE 0009 * 0010 * @author Copyright (C) 2011-2012 by Gilles Caulier 0011 * <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a> 0012 * @author Copyright (C) 2010 by Ludovic Delfau 0013 * <a href="mailto:ludovicdelfau at gmail dot com">ludovicdelfau at gmail dot com</a> 0014 * 0015 * This program is free software; you can redistribute it 0016 * and/or modify it under the terms of the GNU General 0017 * Public License as published by the Free Software Foundation; 0018 * either version 2, or (at your option) 0019 * any later version. 0020 * 0021 * This program is distributed in the hope that it will be useful, 0022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0024 * GNU General Public License for more details. 0025 * 0026 * ============================================================ */ 0027 0028 #include "imageinfo.h" 0029 0030 // C++ includes 0031 0032 #include <algorithm> 0033 0034 namespace mediawiki 0035 { 0036 0037 class Q_DECL_HIDDEN Imageinfo::ImageinfoPrivate 0038 { 0039 public: 0040 0041 QDateTime timestamp; 0042 QString user; 0043 QString comment; 0044 QUrl url; 0045 QUrl descriptionUrl; 0046 QUrl thumbUrl; 0047 qint64 thumbWidth; 0048 qint64 thumbHeight; 0049 qint64 size; 0050 qint64 width; 0051 qint64 height; 0052 QString sha1; 0053 QString mime; 0054 QHash<QString, QVariant> metadata; 0055 }; 0056 0057 Imageinfo::Imageinfo() 0058 : d(new ImageinfoPrivate()) 0059 { 0060 d->thumbWidth = -1; 0061 d->thumbHeight = -1; 0062 d->size = -1; 0063 d->width = -1; 0064 d->height = -1; 0065 } 0066 0067 Imageinfo::Imageinfo(const Imageinfo& other) 0068 : d(new ImageinfoPrivate(*(other.d))) 0069 {} 0070 0071 Imageinfo::~Imageinfo() 0072 { 0073 delete d; 0074 } 0075 0076 Imageinfo& Imageinfo::operator=(Imageinfo other) 0077 { 0078 *d = *other.d; 0079 return *this; 0080 } 0081 0082 bool Imageinfo::operator==(const Imageinfo& other) const 0083 { 0084 return timestamp() == other.timestamp() && 0085 user() == other.user() && 0086 comment() == other.comment() && 0087 url() == other.url() && 0088 descriptionUrl() == other.descriptionUrl() && 0089 thumbUrl() == other.thumbUrl() && 0090 thumbWidth() == other.thumbWidth() && 0091 thumbHeight() == other.thumbHeight() && 0092 size() == other.size() && 0093 width() == other.width() && 0094 height() == other.height() && 0095 sha1() == other.sha1() && 0096 mime() == other.mime() && 0097 metadata() == other.metadata(); 0098 } 0099 0100 QDateTime Imageinfo::timestamp() const 0101 { 0102 return d->timestamp; 0103 } 0104 0105 void Imageinfo::setTimestamp(const QDateTime& timestamp) 0106 { 0107 d->timestamp = timestamp; 0108 } 0109 0110 QString Imageinfo::user() const 0111 { 0112 return d->user; 0113 } 0114 0115 void Imageinfo::setUser(const QString& user) 0116 { 0117 d->user = user; 0118 } 0119 0120 QString Imageinfo::comment() const 0121 { 0122 return d->comment; 0123 } 0124 0125 void Imageinfo::setComment(const QString& comment) 0126 { 0127 d->comment = comment; 0128 } 0129 0130 QUrl Imageinfo::url() const 0131 { 0132 return d->url; 0133 } 0134 0135 void Imageinfo::setUrl(const QUrl& url) 0136 { 0137 d->url = url; 0138 } 0139 0140 QUrl Imageinfo::descriptionUrl() const 0141 { 0142 return d->url; 0143 } 0144 0145 void Imageinfo::setDescriptionUrl(const QUrl& descriptionUrl) 0146 { 0147 d->descriptionUrl = descriptionUrl; 0148 } 0149 0150 QUrl Imageinfo::thumbUrl() const 0151 { 0152 return d->thumbUrl; 0153 } 0154 0155 void Imageinfo::setThumbUrl(const QUrl& thumbUrl) 0156 { 0157 d->thumbUrl = thumbUrl; 0158 } 0159 0160 qint64 Imageinfo::thumbWidth() const 0161 { 0162 return d->thumbWidth; 0163 } 0164 0165 void Imageinfo::setThumbWidth(qint64 thumbWidth) 0166 { 0167 d->thumbWidth = thumbWidth; 0168 } 0169 0170 qint64 Imageinfo::thumbHeight() const 0171 { 0172 return d->thumbHeight; 0173 } 0174 0175 void Imageinfo::setThumbHeight(qint64 thumbHeight) 0176 { 0177 d->thumbHeight = thumbHeight; 0178 } 0179 0180 qint64 Imageinfo::size() const 0181 { 0182 return d->size; 0183 } 0184 0185 void Imageinfo::setSize(qint64 size) 0186 { 0187 d->size = size; 0188 } 0189 0190 qint64 Imageinfo::width() const 0191 { 0192 return d->width; 0193 } 0194 0195 void Imageinfo::setWidth(qint64 width) 0196 { 0197 d->width = width; 0198 } 0199 0200 qint64 Imageinfo::height() const 0201 { 0202 return d->height; 0203 } 0204 0205 void Imageinfo::setHeight(qint64 height) 0206 { 0207 d->height = height; 0208 } 0209 0210 QString Imageinfo::sha1() const 0211 { 0212 return d->sha1; 0213 } 0214 0215 void Imageinfo::setSha1(const QString& sha1) 0216 { 0217 d->sha1 = sha1; 0218 } 0219 0220 QString Imageinfo::mime() const 0221 { 0222 return d->mime; 0223 } 0224 0225 void Imageinfo::setMime(const QString& mime) 0226 { 0227 d->mime = mime; 0228 } 0229 0230 const QHash<QString, QVariant>& Imageinfo::metadata() const 0231 { 0232 return d->metadata; 0233 } 0234 0235 QHash<QString, QVariant>& Imageinfo::metadata() 0236 { 0237 return d->metadata; 0238 } 0239 0240 void Imageinfo::setMetadata(const QHash<QString, QVariant>& metadata) 0241 { 0242 d->metadata = metadata; 0243 } 0244 0245 } // namespace mediawiki