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