]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/tooltips/filemetadatatooltip.h
[KStandardItemListWidget] Update icon when palette changes
[dolphin.git] / src / views / tooltips / filemetadatatooltip.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 FILEMETADATATOOLTIP_H
23 #define FILEMETADATATOOLTIP_H
24
25 #include <QWidget>
26 #include "config-baloo.h"
27
28 class KFileItemList;
29 class QLabel;
30
31 #ifndef HAVE_BALOO
32 class KFileMetaDataWidget;
33 #else
34 namespace Baloo {
35 class FileMetaDataWidget;
36 }
37 #endif
38
39 /**
40 * @brief Tooltip, that shows the meta information and a preview of one
41 * or more files.
42 */
43 class FileMetaDataToolTip : public QWidget
44 {
45 Q_OBJECT
46
47 public:
48 FileMetaDataToolTip(QWidget* parent = 0);
49 virtual ~FileMetaDataToolTip();
50
51 void setPreview(const QPixmap& pixmap);
52 QPixmap preview() const;
53
54 void setName(const QString& name);
55 QString name() const;
56
57 /**
58 * Sets the items for which the meta data should be shown.
59 * The signal metaDataRequestFinished() will be emitted,
60 * as soon as the meta data for the items has been received.
61 */
62 void setItems(const KFileItemList& items);
63 KFileItemList items() const;
64
65 signals:
66 /**
67 * Is emitted after the meta data has been received for the items
68 * set by FileMetaDataToolTip::setItems().
69 */
70 void metaDataRequestFinished(const KFileItemList& items);
71
72 protected:
73 virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
74 virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
75
76 private:
77 QLabel* m_preview;
78 QLabel* m_name;
79 #ifndef HAVE_BALOO
80 KFileMetaDataWidget* m_fileMetaDataWidget;
81 #else
82 Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
83 #endif
84 };
85
86 #endif