1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2008-02-29 7 * Description : Drag object info containers. 8 * 9 * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef DIGIKAM_DDRAG_OBJECTS_H 25 #define DIGIKAM_DDRAG_OBJECTS_H 26 27 // Qt includes 28 29 #include <QMimeData> 30 #include <QList> 31 #include <QStringList> 32 #include <QUrl> 33 34 // Local includes 35 36 #include "cameratype.h" 37 38 class QWidget; 39 40 namespace Digikam 41 { 42 43 /** 44 * Provides a drag object with additional information for internal drag&drop 45 * 46 * Images can be moved through ItemDrag. It is possible to move them on 47 * another application which is supported through QT to e.g. copy the images. 48 * digiKam can use the IDs, if ItemDrag is dropped on digikam itself. 49 * The urls set via setUrls() are used for external drops (k3b, gimp, ...) 50 */ 51 class DItemDrag : public QMimeData 52 { 53 Q_OBJECT 54 55 public: 56 57 DItemDrag(const QList<QUrl>& urls, 58 const QList<int>& albumIDs, 59 const QList<qlonglong>& imageIDs); 60 61 static bool canDecode(const QMimeData* e); 62 static QStringList mimeTypes(); 63 static bool decode(const QMimeData* e, 64 QList<QUrl>& urls, 65 QList<int>& albumIDs, 66 QList<qlonglong>& imageIDs); 67 68 private: 69 70 // Disable 71 explicit DItemDrag(QObject*) = delete; 72 }; 73 74 // ------------------------------------------------------------------------ 75 76 /** 77 * Provides a drag object for an album 78 * 79 * When an album is moved through drag'n'drop an object of this class 80 * is created. 81 */ 82 class DAlbumDrag : public QMimeData 83 { 84 Q_OBJECT 85 86 public: 87 88 DAlbumDrag(const QUrl& databaseUrl, int albumid, const QUrl& fileUrl = QUrl()); 89 static QStringList mimeTypes(); 90 static bool canDecode(const QMimeData* e); 91 static bool decode(const QMimeData* e, QList<QUrl>& urls, int& albumID); 92 93 private: 94 95 // Disable 96 explicit DAlbumDrag(QObject*) = delete; 97 }; 98 99 // ------------------------------------------------------------------------ 100 101 /** 102 * Provides a drag object for a list of tags 103 * 104 * When a tag is moved through drag'n'drop an object of this class 105 * is created. 106 */ 107 class DTagListDrag : public QMimeData 108 { 109 Q_OBJECT 110 111 public: 112 113 explicit DTagListDrag(const QList<int>& tagIDs); 114 static QStringList mimeTypes(); 115 static bool canDecode(const QMimeData* e); 116 static bool decode(const QMimeData* e, QList<int>& tagIDs); 117 118 private: 119 120 // Disable 121 explicit DTagListDrag(QObject*) = delete; 122 }; 123 124 // ------------------------------------------------------------------------ 125 126 /** 127 * Provides a drag object for a list of camera items 128 * 129 * When a camera item is moved through drag'n'drop an object of this class 130 * is created. 131 */ 132 class DCameraItemListDrag : public QMimeData 133 { 134 Q_OBJECT 135 136 public: 137 138 explicit DCameraItemListDrag(const QStringList& cameraItemPaths); 139 static QStringList mimeTypes(); 140 static bool canDecode(const QMimeData* e); 141 static bool decode(const QMimeData* e, QStringList& cameraItemPaths); 142 143 private: 144 145 // Disable 146 explicit DCameraItemListDrag(QObject*) = delete; 147 }; 148 149 // ------------------------------------------------------------------------ 150 151 /** 152 * Provides a drag object for a camera object 153 * 154 * When a camera object is moved through drag'n'drop an object of this class 155 * is created. 156 */ 157 class DCameraDragObject : public QMimeData 158 { 159 Q_OBJECT 160 161 public: 162 163 explicit DCameraDragObject(const CameraType& ctype); 164 static QStringList mimeTypes(); 165 static bool canDecode(const QMimeData* e); 166 static bool decode(const QMimeData* e, CameraType& ctype); 167 168 private: 169 170 // Disable 171 explicit DCameraDragObject(QObject*) = delete; 172 }; 173 174 } // namespace Digikam 175 176 #endif // DIGIKAM_DDRAG_OBJECTS_H 177