digiKam
camerathumbsctrl.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 : 2011-08-03
7  * Description : digital camera thumbnails controller
8  *
9  * Copyright (C) 2011-2022 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_CAMERA_THUMBS_CTRL_H
25 #define DIGIKAM_CAMERA_THUMBS_CTRL_H
26 
27 // Qt includes
28 
29 #include <QWidget>
30 #include <QString>
31 #include <QImage>
32 #include <QPixmap>
33 #include <QUrl>
34 
35 // Local includes
36 
37 #include "camiteminfo.h"
38 #include "digikam_export.h"
39 
40 namespace Digikam
41 {
42 
43 class CameraController;
44 
45 typedef QPair<CamItemInfo, QPixmap> CachedItem;
46 
47 class DIGIKAM_GUI_EXPORT CameraThumbsCtrl : public QObject
48 {
49  Q_OBJECT
50 
51 public:
52 
53  explicit CameraThumbsCtrl(CameraController* const ctrl, QWidget* const parent);
54  ~CameraThumbsCtrl() override;
55 
61  bool getThumbInfo(const CamItemInfo& info, CachedItem& item) const;
62 
63  void setCacheSize(int numberOfItems);
64  void clearCache();
65 
69  void updateThumbInfoFromCache(const CamItemInfo& info);
70 
74  CameraController* cameraController() const;
75 
76 Q_SIGNALS:
77 
79 
80 private Q_SLOTS:
81 
82  void slotThumbInfo(const QString&, const QString&, const CamItemInfo&, const QImage&);
83  void slotThumbInfoFailed(const QString&, const QString&, const CamItemInfo&);
84 
85 private:
86 
88  void removeItemFromCache(const QUrl& url);
89  void putItemToCache(const QUrl& url, const CamItemInfo&, const QPixmap& thumb);
90  bool hasItemFromCache(const QUrl& url) const;
91  const CachedItem* retrieveItemFromCache(const QUrl& url) const;
92 
93 private:
94 
95  class Private;
96  const QScopedPointer<Private> d;
97 };
98 
99 } // namespace Digikam
100 
101 #endif // DIGIKAM_CAMERA_THUMBS_CTRL_H
Definition: camiteminfo.h:48
Definition: cameracontroller.h:51
Definition: camerathumbsctrl.h:48
void signalThumbInfoReady(const CamItemInfo &)
Definition: datefolderview.cpp:43
QPair< CamItemInfo, QPixmap > CachedItem
Definition: camerathumbsctrl.h:43