digiKam
albumthumbnailloader.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2006-04-14
7  * Description : Load and cache tag thumbnails
8  *
9  * Copyright (C) 2006-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_ALBUM_THUMBNAIL_LOADER_H
26 #define DIGIKAM_ALBUM_THUMBNAIL_LOADER_H
27 
28 // Qt includes
29 
30 #include <QObject>
31 #include <QPixmap>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 class Album;
40 class TAlbum;
41 class PAlbum;
42 class LoadingDescription;
43 
44 class DIGIKAM_GUI_EXPORT AlbumThumbnailLoader : public QObject
45 {
46  Q_OBJECT
47 
48 public:
49 
60  {
62  SmallerSize
63  };
64 
65 public:
66 
67  void cleanUp();
68 
74  void setThumbnailSize(int size, int face);
75 
79  int thumbnailSize() const;
80 
88  bool getAlbumThumbnail(PAlbum* const album);
89 
99  QPixmap getAlbumThumbnailDirectly(PAlbum* const album);
100 
118  bool getTagThumbnail(TAlbum* const album, QPixmap& icon);
119 
129  QPixmap getTagThumbnailDirectly(TAlbum* const album);
130 
136  QPixmap getFaceThumbnailDirectly(TAlbum* const album);
137 
143  QPixmap getStandardTagIcon(RelativeSize size = NormalSize);
144  QPixmap getStandardTagRootIcon(RelativeSize size = NormalSize);
145  QPixmap getStandardTagIcon(TAlbum* const album, RelativeSize size = NormalSize);
146  QPixmap getStandardFaceIcon(TAlbum* const album, RelativeSize size = NormalSize);
147  QPixmap getNewTagIcon(RelativeSize size = NormalSize);
148 
149  QPixmap getStandardAlbumIcon(RelativeSize size = NormalSize);
150  QPixmap getStandardAlbumTrashIcon(RelativeSize size = NormalSize);
151  QPixmap getStandardAlbumRootIcon(RelativeSize size = NormalSize);
152  QPixmap getStandardAlbumIcon(PAlbum* const album, RelativeSize size = NormalSize);
153 
158 /*
159  QImage getAlbumPreviewDirectly(PAlbum* const album, int size);
160 */
161 
162 public:
163 
164  static AlbumThumbnailLoader* instance();
165 
166 Q_SIGNALS:
167 
174  void signalThumbnail(Album* album, const QPixmap&);
175 
179  void signalFailed(Album* album);
180 
186 
190  void signalDispatchThumbnailInternal(int albumID, const QPixmap& thumbnail);
191 
192 protected Q_SLOTS:
193 
194  void slotGotThumbnailFromIcon(const LoadingDescription& loadingDescription, const QPixmap& pixmap);
195  void slotIconChanged(Album* album);
196  void slotDispatchThumbnailInternal(int albumID, const QPixmap& thumbnail);
197 
198 private:
199 
200  // Disable
202  explicit AlbumThumbnailLoader(QObject*) = delete;
203  ~AlbumThumbnailLoader() override;
204 
205  void addUrl(Album* const album, qlonglong id);
206  QPixmap loadIcon(const QString& name, int size = 0) const;
207  int computeIconSize(RelativeSize size) const;
208  int computeFaceSize(RelativeSize size) const;
209 
210 private:
211 
212  friend class AlbumThumbnailLoaderCreator;
213 
214  class Private;
215  Private* const d;
216 };
217 
218 } // namespace Digikam
219 
220 #endif // DIGIKAM_ALBUM_THUMBNAIL_LOADER_H
Definition: albumthumbnailloader.h:45
void signalDispatchThumbnailInternal(int albumID, const QPixmap &thumbnail)
void signalThumbnail(Album *album, const QPixmap &)
void signalFailed(Album *album)
RelativeSize
Definition: albumthumbnailloader.h:60
@ NormalSize
Definition: albumthumbnailloader.h:61
Abstract base class for all album types.
Definition: album.h:67
Definition: loadingdescription.h:45
Definition: album.h:357
Definition: album.h:420
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43