digiKam
showfotothumbnailmodel.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 : 2013-07-22
7  * Description : Qt item model for Showfoto thumbnails entries
8  *
9  * Copyright (C) 2013 by Mohamed_Anwer <m_dot_anwer at gmx 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 SHOW_FOTO_THUMB_NAIL_MODEL_H
25 #define SHOW_FOTO_THUMB_NAIL_MODEL_H
26 
27 // Local Include
28 
29 #include "showfotoitemmodel.h"
30 #include "thumbnailsize.h"
31 #include "loadingdescription.h"
32 #include "thumbnailloadthread.h"
33 
34 using namespace Digikam;
35 
36 namespace ShowFoto
37 {
38 
39 typedef QPair<ShowfotoItemInfo, QPixmap> CachedItem;
40 
42 {
43  Q_OBJECT
44 
45 public:
46 
53  explicit ShowfotoThumbnailModel(QObject* const parent);
54  ~ShowfotoThumbnailModel() override;
55 
60  void setThumbnailLoadThread(ThumbnailLoadThread* thread);
61  ThumbnailLoadThread* thumbnailLoadThread() const;
62 
66  void setThumbnailSize(const ThumbnailSize& thumbSize);
67 
71  void setPreloadThumbnailSize(const ThumbnailSize& thumbSize);
72 
73  void setExifRotate(bool rotate);
74 
80  void setEmitDataChanged(bool emitSignal);
81 
87  void setPreloadThumbnails(bool preload);
88 
89  ThumbnailSize thumbnailSize() const;
90 
97  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
98 
104  bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::DisplayRole) override;
105 
106  bool pixmapForItem(const QString& url, QPixmap& pix) const;
107  bool getThumbnail(const ShowfotoItemInfo& itemInfo, QImage& thumbnail) const;
108 
109 public Q_SLOTS:
110 
111  void slotThumbInfoLoaded(const ShowfotoItemInfo& info, const QImage& thumbnailImage);
112 
113 Q_SIGNALS:
114 
115  void thumbnailAvailable(const QModelIndex& index, int requestedSize);
116  void thumbnailFailed(const QModelIndex& index, int requestedSize);
117 
118  void signalThumbInfo(const ShowfotoItemInfo& info, const QImage& thumbnailImage) const; // clazy:exclude=const-signal-or-slot
119 
120  void signalItemThumbnail(const ShowfotoItemInfo& info, const QPixmap& pix);
121 
122 protected:
123 
124  void showfotoItemInfosCleared() override;
125 
126 protected Q_SLOTS:
127 
128  void slotThumbnailLoaded(const LoadingDescription& loadingDescription,
129  const QPixmap& thumb);
130 
131 private:
132 
133  // Disable
135  ShowfotoThumbnailModel& operator=(const ShowfotoThumbnailModel&) = delete;
136 
137 private:
138 
139  class Private;
140  Private* const d;
141 };
142 
143 } // namespace ShowFoto
144 
145 #endif // SHOW_FOTO_THUMB_NAIL_MODEL_H
Definition: loadingdescription.h:45
Definition: thumbnailloadthread.h:46
Definition: thumbnailsize.h:42
Definition: showfotoiteminfo.h:48
Definition: showfotoitemmodel.h:47
Definition: showfotothumbnailmodel.h:42
void signalThumbInfo(const ShowfotoItemInfo &info, const QImage &thumbnailImage) const
void thumbnailFailed(const QModelIndex &index, int requestedSize)
void thumbnailAvailable(const QModelIndex &index, int requestedSize)
void setPreloadThumbnails(bool preload)
void signalItemThumbnail(const ShowfotoItemInfo &info, const QPixmap &pix)
qulonglong value
Definition: itemviewutilities.cpp:592
Definition: datefolderview.cpp:43
QPair< CamItemInfo, QPixmap > CachedItem
Definition: camerathumbsctrl.h:43
Definition: showfotofolderviewbar.cpp:52