digiKam
itemthumbnailmodel.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 : 2009-03-05
7  * Description : Qt item model for database entries with support for thumbnail loading
8  *
9  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2011 by Gilles Caulier <caulier dot gilles at gmail 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_ITEM_THUMBNAIL_MODEL_H
26 #define DIGIKAM_ITEM_THUMBNAIL_MODEL_H
27 
28 // Local includes
29 
30 #include "itemmodel.h"
31 #include "thumbnailsize.h"
32 #include "digikam_export.h"
33 
34 namespace Digikam
35 {
36 
37 class LoadingDescription;
38 class ThumbnailLoadThread;
39 
40 class DIGIKAM_DATABASE_EXPORT ItemThumbnailModel : public ItemModel
41 {
42  Q_OBJECT
43 
44 public:
45 
52  explicit ItemThumbnailModel(QObject* const parent);
53  ~ItemThumbnailModel() override;
54 
59  void setThumbnailLoadThread(ThumbnailLoadThread* const thread);
60  ThumbnailLoadThread* thumbnailLoadThread() const;
61 
63  void setThumbnailSize(const ThumbnailSize& thumbSize);
64 
66  void setPreloadThumbnailSize(const ThumbnailSize& thumbSize);
67 
68  void setExifRotate(bool rotate);
69 
75  void setEmitDataChanged(bool emitSignal);
76 
82  void setPreloadThumbnails(bool preload);
83 
84  ThumbnailSize thumbnailSize() const;
85 
92  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
93 
99  bool setData(const QModelIndex& index,
100  const QVariant& value,
101  int role = Qt::DisplayRole) override;
102 
103 public Q_SLOTS:
104 
108  void prepareThumbnails(const QList<QModelIndex>& indexesToPrepare);
109  void prepareThumbnails(const QList<QModelIndex>& indexesToPrepare,
110  const ThumbnailSize& thumbSize);
111 
120  void preloadThumbnails(const QList<ItemInfo>&);
121  void preloadThumbnails(const QList<QModelIndex>&);
122  void preloadAllThumbnails();
123 
124 Q_SIGNALS:
125 
126  void thumbnailAvailable(const QModelIndex& index, int requestedSize);
127  void thumbnailFailed(const QModelIndex& index, int requestedSize);
128 
129 protected:
130 
131  void imageInfosCleared() override;
132 
133 protected Q_SLOTS:
134 
135  void slotThumbnailLoaded(const LoadingDescription& loadingDescription,
136  const QPixmap& thumb);
137 
138 private:
139 
140  // Disable
141  ItemThumbnailModel(const ItemThumbnailModel&) = delete;
142  ItemThumbnailModel& operator=(const ItemThumbnailModel&) = delete;
143 
144  class Private;
145  Private* const d;
146 };
147 
148 } // namespace Digikam
149 
150 #endif // DIGIKAM_ITEM_THUMBNAIL_MODEL_H
Definition: itemmodel.h:53
Definition: itemthumbnailmodel.h:41
void thumbnailFailed(const QModelIndex &index, int requestedSize)
void thumbnailAvailable(const QModelIndex &index, int requestedSize)
void setExifRotate(bool rotate)
Definition: loadingdescription.h:45
Definition: thumbnailloadthread.h:46
Definition: thumbnailsize.h:42
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43