]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/phononwidget.h
Merge branch 'Applications/17.12'
[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 <QUrl>
25 #include <QSize>
26 #include <QWidget>
27
28 #include <Phonon/Global>
29
30 namespace Phonon
31 {
32 class AudioOutput;
33 class MediaObject;
34 class SeekSlider;
35 class VideoPlayer;
36 } // namespace Phonon
37
38 class EmbeddedVideoPlayer;
39 class QToolButton;
40 class QVBoxLayout;
41
42 class PhononWidget : public QWidget
43 {
44 Q_OBJECT
45 public:
46 PhononWidget(QWidget *parent = nullptr);
47
48 void setUrl(const QUrl &url);
49 QUrl url() const;
50
51 void setVideoSize(const QSize& size);
52 QSize videoSize() const;
53
54 signals:
55 /**
56 * Is emitted whenever the video-state
57 * has changed: If true is returned, a video
58 * including control-buttons will be shown.
59 * If false is returned, no video is shown
60 * and the control-buttons are available for
61 * audio only.
62 */
63 void hasVideoChanged(bool hasVideo);
64
65 protected:
66 void showEvent(QShowEvent *event) override;
67 void hideEvent(QHideEvent *event) override;
68
69 private slots:
70 void stateChanged(Phonon::State);
71 void play();
72 void stop();
73 void slotHasVideoChanged(bool);
74
75 private:
76 void applyVideoSize();
77
78 private:
79 QUrl m_url;
80 QSize m_videoSize;
81
82 QToolButton *m_playButton;
83 QToolButton *m_stopButton;
84
85 QVBoxLayout *m_topLayout;
86 Phonon::MediaObject *m_media;
87 Phonon::SeekSlider *m_seekSlider;
88 Phonon::AudioOutput *m_audioOutput;
89 EmbeddedVideoPlayer *m_videoPlayer;
90 };
91
92 #endif // PHONONWIDGET_H