]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/phononwidget.h
GIT_SILENT Sync po/docbooks with svn
[dolphin.git] / src / panels / information / phononwidget.h
1 /*
2 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef PHONONWIDGET_H
8 #define PHONONWIDGET_H
9
10 #include <phonon/Global>
11
12 #include <QSize>
13 #include <QUrl>
14 #include <QWidget>
15
16 namespace Phonon
17 {
18 class AudioOutput;
19 class MediaObject;
20 class SeekSlider;
21 class VideoPlayer;
22 } // namespace Phonon
23
24 class EmbeddedVideoPlayer;
25 class QToolButton;
26 class QVBoxLayout;
27
28 class PhononWidget : public QWidget
29 {
30 Q_OBJECT
31 public:
32 enum MediaKind { Video, Audio };
33
34 explicit PhononWidget(QWidget *parent = nullptr);
35
36 void setUrl(const QUrl &url, MediaKind kind);
37 QUrl url() const;
38 void clearUrl();
39
40 void setVideoSize(const QSize &size);
41 QSize videoSize() const;
42 Phonon::State state() const;
43
44 void setAutoPlay(bool autoPlay);
45 bool eventFilter(QObject *object, QEvent *event) override;
46
47 Q_SIGNALS:
48 /**
49 * Is emitted whenever the video-state
50 * has changed: If true is returned, a video
51 * including control-buttons will be shown.
52 * If false is returned, no video is shown
53 * and the control-buttons are available for
54 * audio only.
55 */
56 void hasVideoChanged(bool hasVideo);
57
58 public Q_SLOTS:
59 void play();
60
61 protected:
62 void showEvent(QShowEvent *event) override;
63 void hideEvent(QHideEvent *event) override;
64
65 private Q_SLOTS:
66 void stateChanged(Phonon::State newstate);
67 void stop();
68 void finished();
69
70 private:
71 void applyVideoSize();
72
73 private:
74 void togglePlayback();
75
76 QUrl m_url;
77 QSize m_videoSize;
78
79 QToolButton *m_playButton;
80 QToolButton *m_pauseButton;
81
82 QVBoxLayout *m_topLayout;
83 Phonon::MediaObject *m_media;
84 Phonon::SeekSlider *m_seekSlider;
85 Phonon::AudioOutput *m_audioOutput;
86 EmbeddedVideoPlayer *m_videoPlayer;
87 bool m_autoPlay;
88 bool m_isVideo;
89 };
90
91 #endif // PHONONWIDGET_H