File indexing completed on 2024-11-10 03:39:06
0001 /* 0002 This file is part of the KDE project. 0003 SPDX-FileCopyrightText: 2003 Carsten Pfeiffer <pfeiffer@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef KFILEMETAPREVIEW_H 0009 #define KFILEMETAPREVIEW_H 0010 0011 #include <QHash> 0012 #include <QMimeType> 0013 #include <QStackedWidget> 0014 #include <kpreviewwidgetbase.h> 0015 0016 // Internal, but exported for KDirOperator (kfile) and KPreviewProps (kdelibs4support) 0017 class KIOFILEWIDGETS_EXPORT KFileMetaPreview : public KPreviewWidgetBase 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 explicit KFileMetaPreview(QWidget *parent); 0023 ~KFileMetaPreview() override; 0024 0025 virtual void addPreviewProvider(const QString &mimeType, KPreviewWidgetBase *provider); 0026 virtual void clearPreviewProviders(); 0027 0028 public Q_SLOTS: 0029 void showPreview(const QUrl &url) override; 0030 void clearPreview() override; 0031 0032 protected: 0033 virtual KPreviewWidgetBase *previewProviderFor(const QString &mimeType); 0034 0035 private: 0036 void initPreviewProviders(); 0037 KPreviewWidgetBase *findExistingProvider(const QString &mimeType, const QMimeType &mimeInfo) const; 0038 0039 QStackedWidget *m_stack; 0040 QHash<QString, KPreviewWidgetBase *> m_previewProviders; 0041 bool haveAudioPreview; 0042 0043 // may return 0L 0044 static KPreviewWidgetBase *createAudioPreview(QWidget *parent); 0045 static bool s_tryAudioPreview; 0046 0047 private: 0048 class KFileMetaPreviewPrivate; 0049 KFileMetaPreviewPrivate *d; 0050 }; 0051 0052 #endif // KFILEMETAPREVIEW_H