1/*
2 This file is part of the KDE project.
3 SPDX-FileCopyrightText: 2003 Carsten Pfeiffer <pfeiffer@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#ifndef KFILEMETAPREVIEW_H
9#define KFILEMETAPREVIEW_H
10
11#include <QHash>
12#include <QMimeType>
13#include <QStackedWidget>
14#include <kpreviewwidgetbase.h>
15
16// Internal, but exported for KDirOperator (kfile) and KPreviewProps (kdelibs4support)
17class KIOFILEWIDGETS_EXPORT KFileMetaPreview : public KPreviewWidgetBase
18{
19 Q_OBJECT
20
21public:
22 explicit KFileMetaPreview(QWidget *parent);
23 ~KFileMetaPreview() override;
24
25 virtual void addPreviewProvider(const QString &mimeType, KPreviewWidgetBase *provider);
26 virtual void clearPreviewProviders();
27
28public Q_SLOTS:
29 void showPreview(const QUrl &url) override;
30 void clearPreview() override;
31
32protected:
33 virtual KPreviewWidgetBase *previewProviderFor(const QString &mimeType);
34
35private:
36 void initPreviewProviders();
37 KPreviewWidgetBase *findExistingProvider(const QString &mimeType, const QMimeType &mimeInfo) const;
38
39 QStackedWidget *m_stack;
40 QHash<QString, KPreviewWidgetBase *> m_previewProviders;
41 bool haveAudioPreview;
42
43 // may return 0L
44 static KPreviewWidgetBase *createAudioPreview(QWidget *parent);
45 static bool s_tryAudioPreview;
46
47private:
48 class KFileMetaPreviewPrivate;
49 KFileMetaPreviewPrivate *d;
50};
51
52#endif // KFILEMETAPREVIEW_H
53

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