File indexing completed on 2024-05-12 05:47:52

0001 /*
0002  * SPDX-FileCopyrightText: 2010 Peter Penz <peter.penz19@gmail.com>
0003  * SPDX-FileCopyrightText: 2008 Fredrik Höglund <fredrik@kde.org>
0004  * SPDX-FileCopyrightText: 2012 Mark Gaiser <markg85@gmail.com>
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef DOLPHINFILEMETADATAWIDGET_H
0010 #define DOLPHINFILEMETADATAWIDGET_H
0011 
0012 #include "config-dolphin.h"
0013 
0014 #include <QWidget>
0015 
0016 class KFileItemList;
0017 class QLabel;
0018 
0019 namespace Baloo
0020 {
0021 class FileMetaDataWidget;
0022 }
0023 
0024 /**
0025  * @brief Widget that shows the meta information and a preview of one
0026  *        or more files inside a KToolTipWidget.
0027  */
0028 class DolphinFileMetaDataWidget : public QWidget
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     explicit DolphinFileMetaDataWidget(QWidget *parent = nullptr);
0034     ~DolphinFileMetaDataWidget() override;
0035 
0036     void setPreview(const QPixmap &pixmap);
0037     QPixmap preview() const;
0038 
0039     void setName(const QString &name);
0040     QString name() const;
0041 
0042     /**
0043      * Sets the items for which the meta data should be shown.
0044      * The signal metaDataRequestFinished() will be emitted,
0045      * as soon as the meta data for the items has been received.
0046      */
0047     void setItems(const KFileItemList &items);
0048     KFileItemList items() const;
0049 
0050 Q_SIGNALS:
0051     /**
0052      * Is emitted after the meta data has been received for the items
0053      * set by DolphinFileMetaDataWidget::setItems().
0054      */
0055     void metaDataRequestFinished(const KFileItemList &items);
0056 
0057     /**
0058      * Is emitted when the user clicks a tag or a link
0059      * in the metadata widget.
0060      */
0061     void urlActivated(const QUrl &url);
0062 
0063 private:
0064     QLabel *m_preview;
0065     QLabel *m_name;
0066     Baloo::FileMetaDataWidget *m_fileMetaDataWidget;
0067 };
0068 
0069 #endif