]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/informationpanelcontent.h
Fix forward declation
[dolphin.git] / src / panels / information / informationpanelcontent.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef INFORMATIONPANELCONTENT_H
21 #define INFORMATIONPANELCONTENT_H
22
23 #include <panels/panel.h>
24
25 #include <kconfig.h>
26 #include <kurl.h>
27 #include <kvbox.h>
28
29 class KFileItem;
30 class KFileMetaDataWidget;
31 class PhononWidget;
32 class PixmapViewer;
33 class QPixmap;
34 class QString;
35 class QLabel;
36 class QScrollArea;
37
38 /**
39 * @brief Manages the widgets that display the meta information
40 * for file items of the Information Panel.
41 */
42 class InformationPanelContent : public Panel
43 {
44 Q_OBJECT
45
46 public:
47 explicit InformationPanelContent(QWidget* parent = 0);
48 virtual ~InformationPanelContent();
49
50 /**
51 * Shows the meta information for the item \p item.
52 * The preview of the item is generated asynchronously,
53 * the other meta information are fetched synchronously.
54 */
55 void showItem(const KFileItem& item);
56
57 /**
58 * Shows the meta information for the items \p items.
59 */
60 void showItems(const KFileItemList& items);
61
62 /**
63 * Opens a menu which allows to configure which meta information
64 * should be shown.
65 */
66 void configureSettings();
67
68 signals:
69 void urlActivated( const KUrl& url );
70
71 protected:
72 /** @see QObject::eventFilter() */
73 virtual bool eventFilter(QObject* obj, QEvent* event);
74
75 private slots:
76 /**
77 * Is invoked if no preview is available for the item. In this
78 * case the icon will be shown.
79 */
80 void showIcon(const KFileItem& item);
81
82 /**
83 * Is invoked if a preview is available for the item. The preview
84 * \a pixmap is shown inside the info page.
85 */
86 void showPreview(const KFileItem& item, const QPixmap& pixmap);
87
88 /**
89 * Marks the currently shown preview as outdated
90 * by greying the content.
91 */
92 void markOutdatedPreview();
93
94 void slotPlayingStarted();
95 void slotPlayingStopped();
96
97 /**
98 * Is invoked after the file meta data configuration dialog has been
99 * closed and refreshs the visibility of the meta data.
100 */
101 void refreshMetaData();
102
103 private:
104 /**
105 * Checks whether the an URL is repesented by a place. If yes,
106 * then the place icon and name are shown instead of a preview.
107 * @return True, if the URL represents exactly a place.
108 * @param url The url to check.
109 */
110 bool applyPlace(const KUrl& url);
111
112 /**
113 * Sets the text for the label \a m_nameLabel and assures that the
114 * text is split in a way that it can be wrapped within the
115 * label width (QLabel::setWordWrap() does not work if the
116 * text represents one extremely long word).
117 */
118 void setNameLabelText(const QString& text);
119
120 /**
121 * Adjusts the sizes of the widgets dependent on the available
122 * width given by \p width.
123 */
124 void adjustWidgetSizes(int width);
125
126 private:
127 KFileItem m_item;
128
129 bool m_pendingPreview;
130 QTimer* m_outdatedPreviewTimer;
131
132 PixmapViewer* m_preview;
133 PhononWidget* m_phononWidget;
134 QLabel* m_nameLabel;
135 KFileMetaDataWidget* m_metaDataWidget;
136 QScrollArea* m_metaDataArea;
137 };
138
139 #endif // INFORMATIONPANELCONTENT_H