]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/phononwidget.h
Show video previews according to file content instead of the mimetype-string
[dolphin.git] / src / panels / information / phononwidget.h
1 /* This file is part of the KDE project
2 Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (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 Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19 */
20
21 #ifndef PHONONWIDGET_H
22 #define PHONONWIDGET_H
23
24 #include <KUrl>
25
26 #include <QSize>
27 #include <QWidget>
28
29 #include <Phonon/Global>
30
31 namespace Phonon
32 {
33 class AudioOutput;
34 class MediaObject;
35 class SeekSlider;
36 class VideoPlayer;
37 } // namespace Phonon
38
39 class EmbeddedVideoPlayer;
40 class QToolButton;
41 class QVBoxLayout;
42
43 class PhononWidget : public QWidget
44 {
45 Q_OBJECT
46 public:
47 PhononWidget(QWidget *parent = 0);
48
49 void setUrl(const KUrl &url);
50 KUrl url() const;
51
52 void setVideoSize(const QSize& size);
53 QSize videoSize() const;
54
55 signals:
56 /**
57 * Is emitted whenever the video-state
58 * has changed: If true is returned, a video
59 * including control-buttons will be shown.
60 * If false is returned, no video is shown
61 * and the control-buttons are available for
62 * audio only.
63 */
64 void hasVideoChanged(bool hasVideo);
65
66 protected:
67 virtual void showEvent(QShowEvent *event);
68 virtual void hideEvent(QHideEvent *event);
69
70 private slots:
71 void stateChanged(Phonon::State);
72 void play();
73 void stop();
74 void slotHasVideoChanged(bool);
75
76 private:
77 void applyVideoSize();
78
79 private:
80 KUrl m_url;
81 QSize m_videoSize;
82
83 QToolButton *m_playButton;
84 QToolButton *m_stopButton;
85
86 QVBoxLayout *m_topLayout;
87 Phonon::MediaObject *m_media;
88 Phonon::SeekSlider *m_seekSlider;
89 Phonon::AudioOutput *m_audioOutput;
90 EmbeddedVideoPlayer *m_videoPlayer;
91 };
92
93 #endif // PHONONWIDGET_H