Kgapi

file.h
1 /*
2  SPDX-FileCopyrightText: 2012 Andrius da Costa Ribas <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef LIBKGAPI2_DRIVEFILE_H
8 #define LIBKGAPI2_DRIVEFILE_H
9 
10 #include "object.h"
11 #include "types.h"
12 #include "change.h"
13 
14 #include <QString>
15 #include <QStringList>
16 #include <QUrl>
17 #include <QVariantMap>
18 #include <QImage>
19 
20 #include <QDateTime>
21 
22 namespace KGAPI2
23 {
24 
25 namespace Drive
26 {
27 
37 class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
38 {
39  private:
40  class Private;
41 
42  public:
46  class Labels
47  {
48  public:
49  explicit Labels();
50  explicit Labels(const Labels &other);
51  virtual ~Labels();
52  bool operator==(const Labels &other) const;
53  bool operator!=(const Labels &other) const { return !operator==(other); }
54 
58  bool starred() const;
59 
65  void setStarred(bool starred);
66 
72 #ifndef KGAPIDRIVE_NO_DEPRECATED
73  KGAPIDRIVE_DEPRECATED bool hidden() const;
74 #endif
75 
80 #ifndef KGAPIDRIVE_NO_DEPRECATED
81  KGAPIDRIVE_DEPRECATED void setHidden(bool hidden);
82 #endif
83 
87  bool trashed() const;
88 
94  void setTrashed(bool trashed);
95 
99  bool restricted() const;
100 
106  void setRestricted(bool restricted);
107 
111  bool viewed() const;
112 
118  void setViewed(bool viewed);
119 
120  private:
121  class Private;
122  Private *const d;
123  friend class Private;
124  friend class File::Private;
125  };
126 
129 
134  {
135  public:
136  explicit IndexableText(const IndexableText &other);
137  virtual ~IndexableText();
138  bool operator==(const IndexableText &other) const;
139  bool operator!=(const IndexableText &other) const { return !operator==(other); }
140 
144  QString text() const;
145 
151  void setText(const QString &text);
152 
153  private:
154  explicit IndexableText();
155 
156  class Private;
157  Private *const d;
158  friend class Private;
159  friend class File::Private;
160  };
161 
163 
169  {
170  public:
175  class Location
176  {
177  public:
178  explicit Location(const Location &other);
179  virtual ~Location();
180  bool operator==(const Location &other) const;
181  bool operator!=(const Location &other) const { return !operator==(other); }
182 
186  qreal latitude() const;
187 
191  qreal longitude() const;
192 
196  qreal altitude() const;
197 
198  private:
199  explicit Location();
200 
201  class Private;
202  Private *const d;
203  friend class Private;
204  friend class ImageMediaMetadata;
205  };
206 
208 
209  explicit ImageMediaMetadata(const ImageMediaMetadata &other);
210  virtual ~ImageMediaMetadata();
211  bool operator==(const ImageMediaMetadata &other) const;
212  bool operator!=(const ImageMediaMetadata &other) const { return !operator==(other); }
213 
217  int width() const;
218 
222  int height() const;
223 
227  int rotation() const;
228 
232  LocationPtr location() const;
233 
234  QString date() const;
235 
236  QString cameraMake() const;
237 
238  QString cameraModel() const;
239 
240  float exposureTime() const;
241 
242  float aperture() const;
243 
244  bool flashUsed() const;
245 
246  float focalLength() const;
247 
248  int isoSpeed() const;
249 
250  QString meteringMode() const;
251 
252  QString sensor() const;
253 
254  QString exposureMode() const;
255 
256  QString colorSpace() const;
257 
258  QString whiteBalance() const;
259 
260  float exposureBias() const;
261 
262  float maxApertureValue() const;
263 
264  int subjectDistance() const;
265 
266  QString lens() const;
267 
268  private:
269  explicit ImageMediaMetadata(const QVariantMap &jsonMap);
270 
271  class Private;
272  Private *const d;
273  friend class Private;
274  friend class File::Private;
275  };
276 
278 
279  class Thumbnail
280  {
281  public:
282  explicit Thumbnail(const Thumbnail &other);
283  virtual ~Thumbnail();
284  bool operator==(const Thumbnail &other) const;
285  bool operator!=(const Thumbnail &other) const { return !operator==(other); }
286 
287  QImage image() const;
288 
289  QString mimeType() const;
290 
291  private:
292  explicit Thumbnail(const QVariantMap &jsonMap);
293 
294  class Private;
295  Private * const d;
296  friend class Private;
297  friend class File::Private;
298  };
299 
301 
307  NoOptions = 0,
308  ExcludeCreationDate = 1
309  };
310  Q_DECLARE_FLAGS(SerializationOptions, SerializationOption)
311 
312  explicit File();
313  explicit File(const File &other);
314  virtual ~File();
315  bool operator==(const File &other) const;
316  bool operator!=(const File &other) const { return !operator==(other); }
317 
321  static QString folderMimeType();
322 
326  QString id() const;
327 
331  QUrl selfLink() const;
332 
338  QString title() const;
339 
347  void setTitle(const QString &title);
348 
352  QString mimeType() const;
353 
359  void setMimeType(const QString &mimeType);
360 
364  QString description() const;
365 
371  void setDescription(const QString &description);
372 
376  File::LabelsPtr labels() const;
377 
383  void setLabels(const LabelsPtr &labels);
384 
388  QDateTime createdDate() const;
389 
395  QDateTime modifiedDate() const;
396 
404  void setModifiedDate(const QDateTime &modifiedDate);
405 
410  QDateTime modifiedByMeDate() const;
411 
417  QUrl downloadUrl() const;
418 
424  File::IndexableTextPtr& indexableText();
425 
429  PermissionPtr userPermission() const;
430 
437  QString fileExtension() const;
438 
444  QString md5Checksum() const;
445 
451  qlonglong fileSize() const;
452 
457  QUrl alternateLink() const;
458 
462  QUrl embedLink() const;
463 
467  qlonglong version() const;
468 
472  QDateTime sharedWithMeDate() const;
473 
481  ParentReferencesList parents() const;
482 
492  void setParents(const ParentReferencesList &parents);
493 
499  QMap < QString /* format */, QUrl /* url */ > exportLinks() const;
500 
508  QString originalFileName() const;
509 
513  qlonglong quotaBytesUsed() const;
514 
518  QStringList ownerNames() const;
519 
525  QString lastModifyingUserName() const;
526 
530  bool editable() const;
531 
535  bool writersCanShare() const;
536 
540  QUrl thumbnailLink() const;
541 
545  QDateTime lastViewedByMeDate() const;
546 
552  void setLastViewedByMeDate(const QDateTime &lastViewedByMeDate);
553 
561  QUrl webContentLink() const;
562 
569  bool explicitlyTrashed() const;
570 
577  File::ImageMediaMetadataPtr imageMediaMetadata() const;
578 
582  ThumbnailPtr thumbnail() const;
583 
584  QUrl webViewLink() const;
585 
586  QUrl iconLink() const;
587 
588  bool shared() const;
589 
590  UsersList owners() const;
591 
592  UserPtr lastModifyingUser() const;
593 
594  bool isFolder() const;
595 
596  struct Fields {
597  static const QString Items;
598  static const QString SelfLink;
599  static const QString Etag;
600  static const QString Kind;
601  static const QString NextLink;
602  static const QString NextPageToken;
603  static const QString Id;
604  static const QString Title;
605  static const QString MimeType;
606  static const QString Description;
607  static const QString Labels;
608  static const QString CreatedDate;
609  static const QString ModifiedDate;
610  static const QString ModifiedByMeDate;
611  static const QString DownloadUrl;
612  static const QString IndexableText;
613  static const QString UserPermission;
614  static const QString FileExtension;
615  static const QString Md5Checksum;
616  static const QString FileSize;
617  static const QString AlternateLink;
618  static const QString EmbedLink;
619  static const QString SharedWithMeDate;
620  static const QString Parents;
621  static const QString ExportLinks;
622  static const QString OriginalFilename;
623  static const QString OwnerNames;
624  static const QString LastModifiedByMeDate;
625  static const QString Editable;
626  static const QString WritersCanShare;
627  static const QString ThumbnailLink;
628  static const QString LastViewedByMeDate;
629  static const QString WebContentLink;
630  static const QString ExplicitlyTrashed;
631  static const QString ImageMediaMetadata;
632  static const QString Thumbnail;
633  static const QString WebViewLink;
634  static const QString IconLink;
635  static const QString Shared;
636  static const QString Owners;
637  static const QString LastModifyingUser;
638  static const QString AppDataContents;
639  static const QString OpenWithLinks;
640  static const QString DefaultOpenWithLink;
641  static const QString HeadRevisionId;
642  static const QString Copyable;
643  static const QString Properties;
644  static const QString MarkedViewedByMeDate;
645  static const QString Version;
646  static const QString SharingUser;
647  static const QString Permissions;
648  };
649 
650  static FilePtr fromJSON(const QByteArray &jsonData);
651  static FilesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData);
652  static QByteArray toJSON(const FilePtr &file, SerializationOptions options = NoOptions);
653 
654  static FilePtr fromJSON(const QVariantMap &jsonData);
655 
656 private:
657  Private * const d;
658  friend class Private;
659  friend class Change::Private;
660  friend class ParentReference;
661  friend class Permission;
662 };
663 
664 } /* namespace Drive */
665 
666 } /* namespace KGAPI2 */
667 
668 Q_DECLARE_OPERATORS_FOR_FLAGS(KGAPI2::Drive::File::SerializationOptions)
669 
670 #endif // LIBKGAPI2_DRIVEFILE_H
ParentReference contains a reference to a file&#39;s parent.
Base class for all objects.
Definition: object.h:31
Permission contains a permission for a file.
Definition: permission.h:34
SerializationOption
JSON serialization options.
Definition: file.h:306
Structure to store additional information about a feed.
Definition: types.h:24
Description
DriveFile::IndexableText holds the structure used for indexableText property.
Definition: file.h:133
DriveFile::ImageMediaMetadata::Location holds the structure used for imageMediaMetadata.location property.
Definition: file.h:175
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:16
DriveFile::Labels holds the structure used for labels property.
Definition: file.h:46
Title
DriveFile::ImageMediaMetadata holds the structure used for imageMediaMetadata property.
Definition: file.h:168
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 23:10:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.