File indexing completed on 2024-05-05 04:33:14
0001 /* 0002 SPDX-FileCopyrightText: 2004-2018 Gilles Caulier <caulier dot gilles at gmail dot com> 0003 SPDX-FileCopyrightText: 2004-2005 Renchi Raju <renchi dot raju at gmail dot com> 0004 SPDX-FileCopyrightText: 2004-2005 Jesper K. Pedersen <blackie at kde dot org> 0005 SPDX-FileCopyrightText: 2004-2005 Aurelien Gateau <aurelien dot gateau at free dot fr> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef KIPI_IMAGECOLLECTION_H 0011 #define KIPI_IMAGECOLLECTION_H 0012 0013 // Qt includes 0014 0015 #include <QString> 0016 #include <QDateTime> 0017 #include <QUrl> 0018 0019 // Local includes 0020 0021 #include "libkipi_export.h" 0022 0023 /** @namespace KIPI */ 0024 namespace KIPI 0025 { 0026 0027 class ImageCollectionShared; 0028 0029 /** @class ImageCollection imagecollection.h <KIPI/ImageCollection> 0030 * 0031 Holds info about the collection from KIPI host application. 0032 @note Plugins should never create an instance of ImageCollection, only the host application should do that. 0033 */ 0034 class LIBKIPI_EXPORT ImageCollection 0035 { 0036 0037 public: 0038 0039 ImageCollection(ImageCollectionShared* const); 0040 ImageCollection(const ImageCollection& other); 0041 ImageCollection(); 0042 ~ImageCollection(); 0043 0044 ImageCollection& operator=(const ImageCollection&); 0045 bool operator==(const ImageCollection&) const; 0046 0047 // Collection properties --------------------------------------------------------------------------- 0048 0049 /** 0050 * Returns the name of collection. 0051 */ 0052 QString name() const; 0053 0054 /** 0055 * Returns the comment for the collection of images or QString() if that does not make any sense. 0056 * A comment makes sense for an album, but not for a KIPI::Interface::currentSelection(). 0057 */ 0058 QString comment() const; 0059 0060 /** 0061 * Return the category of the image collection. For example, 0062 * a category can be a sorting class like 'travels', 'friends', 'monuments', etc. 0063 */ 0064 QString category() const; 0065 0066 /** 0067 * Returns the Creation date of the image collection. The default implementation 0068 * return a null date. 0069 */ 0070 QDate date() const; 0071 0072 /** 0073 * Returns a list of image URLs hosted by collection. 0074 */ 0075 QList<QUrl> images() const; 0076 0077 /** 0078 * Returns the directory for the image collection. 0079 * The host application may, however, return anything in case this 0080 * imagecollection is not a directory (check isDirectory()), or may 0081 * return the directory of the first image in the collection, the root 0082 * of the image collection (in case all images has a common root), or 0083 * even an empty URL. 0084 */ 0085 QUrl url() const; 0086 0087 /** 0088 * Returns the directory to place images into. 0089 * This function should only be called if KIPI::Features AcceptNewImages 0090 * is available. 0091 * 0092 * The function may choose to return the directory for the image collection 0093 * or if images from the collection are not available in a common directory, 0094 * then instead a common upload directory. 0095 * 0096 * @note uploadRootUrl() must be a subpath of uploadUrl() 0097 */ 0098 QUrl uploadUrl() const; 0099 0100 /** 0101 * When a plugin wants to upload images, it may choose to display an upload widget, 0102 * which gives the user the possible to show a directory from a tree view. 0103 * 0104 * This tree view widget needs to starts at some URL. This function specifies that location. 0105 * Here are a couple of possible return value different host applications may choose. 0106 * 0107 * If all images are stored rooted at some tree (which is the case for KPhotoAlbum), 0108 * then this function may return this directory unconditionally. 0109 * The root directory returned by uploadUrl() (which is the default implementation for this method) 0110 * will be the directory returned by uploadUrl(). 0111 * 0112 * @note uploadRootUrl() must be a subpath of uploadUrl() 0113 */ 0114 QUrl uploadRootUrl() const; 0115 0116 /** 0117 * This function return the name of the upload root path used by the 0118 * the KIPI::UploadWidget. This name can be different for each host 0119 * app (like "Images" for KPhotoAlbum). 0120 */ 0121 QString uploadRootName() const; 0122 0123 /** 0124 * Returns whether an imagecollection is a physical folder on the filesystem 0125 * or not. It is important to check this, if your plugin needs to do folder 0126 * based operations for an image collection. 0127 */ 0128 bool isDirectory() const; 0129 0130 /** 0131 * Returns true if this Collection is valid 0132 */ 0133 bool isValid() const; 0134 0135 private: 0136 0137 mutable ImageCollectionShared* d; 0138 }; 0139 0140 } // namespace KIPI 0141 0142 #endif /* IMAGECOLLECTION_H */