digiKam
dimgpreviewitem.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 : 2010-04-30
7  * Description : Graphics View items for DImg
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
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_DIMG_PREVIEW_ITEM_H
25 #define DIGIKAM_DIMG_PREVIEW_ITEM_H
26 
27 // Qt includes
28 
29 #include <QGraphicsItem>
30 #include <QObject>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "graphicsdimgitem.h"
36 
37 namespace Digikam
38 {
39 
40 class DImg;
41 class ICCSettingsContainer;
42 class LoadingDescription;
43 class PreviewSettings;
44 
45 class DIGIKAM_EXPORT DImgPreviewItem : public GraphicsDImgItem
46 {
47  Q_OBJECT
48 
49 public:
50 
51  enum State
52  {
56  ImageLoadingFailed
57  };
58 
59 public:
60 
61  explicit DImgPreviewItem(QGraphicsItem* const parent = nullptr);
62  ~DImgPreviewItem() override;
63 
64  void setDisplayingWidget(QWidget* const widget);
65  void setPreviewSettings(const PreviewSettings& settings);
66 
67  QString path() const;
68  void setPath(const QString& path, bool rePreview = false);
69 
70  State state() const;
71  bool isLoaded() const;
72  void reload();
73 
74  void setPreloadPaths(const QStringList& pathsToPreload);
75 
76  QString userLoadingHint() const override;
77 
78 Q_SIGNALS:
79 
80  void stateChanged(int state);
81  void loaded();
82  void loadingFailed();
83 
84 private Q_SLOTS:
85 
86  void slotGotImagePreview(const LoadingDescription& loadingDescription, const DImg& image);
87  void preloadNext();
88  void slotFileChanged(const QString& path);
89  void iccSettingsChanged(const ICCSettingsContainer& current, const ICCSettingsContainer& previous);
90 
91 private:
92 
93  // Disable
94  DImgPreviewItem(QObject*);
95 
96  class DImgPreviewItemPrivate;
97  Q_DECLARE_PRIVATE(DImgPreviewItem)
98 
99 protected:
100 
101  explicit DImgPreviewItem(DImgPreviewItemPrivate& dd, QGraphicsItem* const parent = nullptr);
102 };
103 
104 } // namespace Digikam
105 
106 #endif // DIGIKAM_DIMG_PREVIEW_ITEM_H
Definition: dimgitems_p.h:97
State
Definition: dimgpreviewitem.h:52
@ Loading
Definition: dimgpreviewitem.h:54
@ ImageLoaded
Definition: dimgpreviewitem.h:55
@ NoImage
Definition: dimgpreviewitem.h:53
QString path() const
void stateChanged(int state)
Definition: dimg.h:62
Definition: iccsettingscontainer.h:44
Definition: loadingdescription.h:45
Definition: previewsettings.h:35
Definition: datefolderview.cpp:43