1/*
2 This file is part of the KDE project.
3 SPDX-FileCopyrightText: 2001 Martin R. Jones <mjones@kde.org>
4 SPDX-FileCopyrightText: 2001 Carsten Pfeiffer <pfeiffer@kde.org>
5 SPDX-FileCopyrightText: 2008 Rafael Fernández López <ereslibre@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-only
8*/
9
10#ifndef KIMAGEFILEPREVIEW_H
11#define KIMAGEFILEPREVIEW_H
12
13#include <QPixmap>
14#include <QUrl>
15#include <kpreviewwidgetbase.h>
16
17#include <memory>
18
19class KFileItem;
20class KJob;
21class KImageFilePreviewPrivate;
22
23namespace KIO
24{
25class PreviewJob;
26}
27
28/*!
29 * \class KImageFilePreview
30 * \inmodule KIOFileWidgets
31 *
32 * \brief Image preview widget for the file dialog.
33 */
34class KIOFILEWIDGETS_EXPORT KImageFilePreview : public KPreviewWidgetBase
35{
36 Q_OBJECT
37
38public:
39 /*!
40 * Creates a new image file preview.
41 *
42 * \a parent The parent widget.
43 */
44 explicit KImageFilePreview(QWidget *parent = nullptr);
45
46 ~KImageFilePreview() override;
47
48 QSize sizeHint() const override;
49
50public Q_SLOTS:
51 /*!
52 * Shows a preview for the given \a url.
53 */
54 void showPreview(const QUrl &url) override;
55
56 /*!
57 * Clears the preview.
58 */
59 void clearPreview() override;
60
61protected Q_SLOTS:
62 /*!
63 *
64 */
65 void showPreview();
66
67 /*!
68 *
69 */
70 void showPreview(const QUrl &url, bool force);
71
72 /*!
73 *
74 */
75 virtual void gotPreview(const KFileItem &, const QPixmap &);
76
77protected:
78 void resizeEvent(QResizeEvent *event) override;
79
80 /*!
81 *
82 */
83 virtual KIO::PreviewJob *createJob(const QUrl &url, int width, int height);
84
85private:
86 std::unique_ptr<KImageFilePreviewPrivate> const d;
87
88 Q_DISABLE_COPY(KImageFilePreview)
89};
90
91#endif // KIMAGEFILEPREVIEW_H
92

source code of kio/src/filewidgets/kimagefilepreview.h