]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/tooltips/dolphinfilemetadatawidget.h
[PlacesItemModelTest] More index-related fixes
[dolphin.git] / src / views / tooltips / dolphinfilemetadatawidget.h
1 /***************************************************************************
2 * Copyright (C) 2010 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2008 by Fredrik Höglund <fredrik@kde.org> *
4 * Copyright (C) 2012 by Mark Gaiser <markg85@gmail.com> *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 #ifndef DOLPHINFILEMETADATAWIDGET_H
23 #define DOLPHINFILEMETADATAWIDGET_H
24
25 #include <config-baloo.h>
26
27 #include <QWidget>
28
29 class KFileItemList;
30 class QLabel;
31
32 #ifndef HAVE_BALOO
33 class KFileMetaDataWidget;
34 #else
35 namespace Baloo {
36 class FileMetaDataWidget;
37 }
38 #endif
39
40 /**
41 * @brief Widget that shows the meta information and a preview of one
42 * or more files inside a KToolTipWidget.
43 */
44 class DolphinFileMetaDataWidget : public QWidget
45 {
46 Q_OBJECT
47
48 public:
49 explicit DolphinFileMetaDataWidget(QWidget* parent = nullptr);
50 ~DolphinFileMetaDataWidget() override;
51
52 void setPreview(const QPixmap& pixmap);
53 QPixmap preview() const;
54
55 void setName(const QString& name);
56 QString name() const;
57
58 /**
59 * Sets the items for which the meta data should be shown.
60 * The signal metaDataRequestFinished() will be emitted,
61 * as soon as the meta data for the items has been received.
62 */
63 void setItems(const KFileItemList& items);
64 KFileItemList items() const;
65
66 signals:
67 /**
68 * Is emitted after the meta data has been received for the items
69 * set by DolphinFileMetaDataWidget::setItems().
70 */
71 void metaDataRequestFinished(const KFileItemList& items);
72
73 /**
74 * Is emitted when the user clicks a tag or a link
75 * in the metadata widget.
76 */
77 void urlActivated(const QUrl& url);
78
79 private:
80 QLabel* m_preview;
81 QLabel* m_name;
82 #ifndef HAVE_BALOO
83 KFileMetaDataWidget* m_fileMetaDataWidget;
84 #else
85 Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
86 #endif
87 };
88
89 #endif