]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/phononwidget.h
Build with QT_NO_KEYWORDS
[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
33 enum MediaKind {
34 Video,
35 Audio
36 };
37
38 explicit PhononWidget(QWidget *parent = nullptr);
39
40 void setUrl(const QUrl &url, MediaKind kind);
41 QUrl url() const;
42 void clearUrl();
43
44 void setVideoSize(const QSize& size);
45 QSize videoSize() const;
46 Phonon::State state() const;
47
48 void setAutoPlay(bool autoPlay);
49 bool eventFilter(QObject *object, QEvent *event) override;
50
51 Q_SIGNALS:
52 /**
53 * Is emitted whenever the video-state
54 * has changed: If true is returned, a video
55 * including control-buttons will be shown.
56 * If false is returned, no video is shown
57 * and the control-buttons are available for
58 * audio only.
59 */
60 void hasVideoChanged(bool hasVideo);
61
62 public Q_SLOTS:
63 void play();
64
65 protected:
66 void showEvent(QShowEvent *event) override;
67 void hideEvent(QHideEvent *event) override;
68
69 private Q_SLOTS:
70 void stateChanged(Phonon::State newstate);
71 void stop();
72 void finished();
73
74 private:
75 void applyVideoSize();
76
77 private:
78 void togglePlayback();
79
80 QUrl m_url;
81 QSize m_videoSize;
82
83 QToolButton *m_playButton;
84 QToolButton *m_pauseButton;
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 bool m_autoPlay;
92 bool m_isVideo;
93 };
94
95 #endif // PHONONWIDGET_H