digiKam
dpreviewmanager.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-12-23
7  * Description : a widget to manage preview.
8  *
9  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2012 by Benjamin Girault <benjamin dot girault 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_DPREVIEW_MANAGER_H
26 #define DIGIKAM_DPREVIEW_MANAGER_H
27 
28 // Qt includes
29 
30 #include <QStackedWidget>
31 #include <QString>
32 #include <QColor>
33 #include <QImage>
34 #include <QUrl>
35 
36 // Local includes
37 
38 #include "digikam_export.h"
39 
40 namespace Digikam
41 {
42 
43 class DIGIKAM_EXPORT DPreviewManager : public QStackedWidget
44 {
45  Q_OBJECT
46 
47 public:
48 
50  {
51  MessageMode = 0,
52  PreviewMode
53  };
54 
55 public:
56 
57  explicit DPreviewManager(QWidget* const parent);
58  ~DPreviewManager() override;
59 
60  bool load(const QUrl& file, bool fit = true);
61  void setImage(const QImage& img, bool fit = true);
62  void setText(const QString& text, const QColor& color = Qt::white);
63  void setBusy(bool b, const QString& text = QString());
64  void setThumbnail(const QPixmap& preview = QPixmap());
65  void setButtonText(const QString& text);
66  void setButtonVisible(bool b);
67  void setSelectionAreaPossible(bool b);
68 
70 
75  void setSelectionArea(const QRectF& rectangle);
76  QRectF getSelectionArea() const;
78 
79 Q_SIGNALS:
80 
82 
83 public Q_SLOTS:
84 
85  void slotLoad(const QUrl& url);
86 
87 private Q_SLOTS:
88 
89  void slotProgressTimerDone();
90 
91 private:
92 
93  class Private;
94  Private* const d;
95 };
96 
97 } // namespace Digikam
98 
99 #endif // DIGIKAM_DPREVIEW_MANAGER_H
Definition: dpreviewmanager.h:44
DisplayMode
Definition: dpreviewmanager.h:50
Definition: datefolderview.cpp:43