]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/informationpanelcontent.h
Open the meta data configuration dialog modeless
[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 KSeparator;
32 class MetaTextLabel;
33 class PhononWidget;
34 class PixmapViewer;
35 class QPixmap;
36 class QString;
37 class QLabel;
38 class QScrollArea;
39
40 /**
41 * @brief Manages the widgets that display the meta information
42 * for file items of the Information Panel.
43 */
44 class InformationPanelContent : public Panel
45 {
46 Q_OBJECT
47
48 public:
49 explicit InformationPanelContent(QWidget* parent = 0);
50 virtual ~InformationPanelContent();
51
52 /**
53 * Shows the meta information for the item \p item.
54 * The preview of the item is generated asynchronously,
55 * the other meta information are fetched synchronously.
56 */
57 void showItem(const KFileItem& item);
58
59 /**
60 * Shows the meta information for the items \p items.
61 */
62 void showItems(const KFileItemList& items);
63
64 /**
65 * Opens a menu which allows to configure which meta information
66 * should be shown.
67 */
68 void configureSettings();
69
70 signals:
71 void urlActivated( const KUrl& url );
72
73 protected:
74 /** @see QObject::eventFilter() */
75 virtual bool eventFilter(QObject* obj, QEvent* event);
76
77 private slots:
78 /**
79 * Is invoked if no preview is available for the item. In this
80 * case the icon will be shown.
81 */
82 void showIcon(const KFileItem& item);
83
84 /**
85 * Is invoked if a preview is available for the item. The preview
86 * \a pixmap is shown inside the info page.
87 */
88 void showPreview(const KFileItem& item, const QPixmap& pixmap);
89
90 /**
91 * Marks the currently shown preview as outdated
92 * by greying the content.
93 */
94 void markOutdatedPreview();
95
96 void slotPlayingStarted();
97 void slotPlayingStopped();
98
99 /**
100 * Is invoked after the file meta data configuration dialog has been
101 * closed and refreshs the visibility of the meta data.
102 */
103 void refreshMetaData();
104
105 private:
106 /**
107 * Checks whether the an URL is repesented by a place. If yes,
108 * then the place icon and name are shown instead of a preview.
109 * @return True, if the URL represents exactly a place.
110 * @param url The url to check.
111 */
112 bool applyPlace(const KUrl& url);
113
114 /**
115 * Sets the text for the label \a m_nameLabel and assures that the
116 * text is split in a way that it can be wrapped within the
117 * label width (QLabel::setWordWrap() does not work if the
118 * text represents one extremely long word).
119 */
120 void setNameLabelText(const QString& text);
121
122 /**
123 * Adjusts the sizes of the widgets dependent on the available
124 * width given by \p width.
125 */
126 void adjustWidgetSizes(int width);
127
128 private:
129 KFileItem m_item;
130
131 bool m_pendingPreview;
132 QTimer* m_outdatedPreviewTimer;
133
134 PixmapViewer* m_preview;
135 PhononWidget* m_phononWidget;
136 QLabel* m_nameLabel;
137 KFileMetaDataWidget* m_metaDataWidget;
138 QScrollArea* m_metaDataArea;
139 };
140
141 #endif // INFORMATIONPANELCONTENT_H