]>
cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/mediawidget.h
2 SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
4 SPDX-License-Identifier: GPL-2.0-or-later
15 #include <QMediaPlayer>
20 class EmbeddedVideoPlayer
;
24 class MediaWidget
: public QWidget
28 enum MediaKind
{ Video
, Audio
};
30 explicit MediaWidget(QWidget
*parent
= nullptr);
32 void setUrl(const QUrl
&url
, MediaKind kind
);
36 void setVideoSize(const QSize
&size
);
37 QSize
videoSize() const;
38 QMediaPlayer::PlaybackState
state() const;
40 void setAutoPlay(bool autoPlay
);
41 bool eventFilter(QObject
*object
, QEvent
*event
) override
;
45 * Is emitted whenever the video-state
46 * has changed: If true is returned, a video
47 * including control-buttons will be shown.
48 * If false is returned, no video is shown
49 * and the control-buttons are available for
52 void hasVideoChanged(bool hasVideo
);
58 void showEvent(QShowEvent
*event
) override
;
59 void hideEvent(QHideEvent
*event
) override
;
64 void setPosition(qint64 position
);
65 void onStateChanged(QMediaPlayer::PlaybackState newState
);
66 void onPositionChanged(qint64 position
);
67 void onDurationChanged(qint64 position
);
70 void applyVideoSize();
71 void togglePlayback();
77 QToolButton
*m_playButton
;
78 QToolButton
*m_pauseButton
;
80 QVBoxLayout
*m_topLayout
;
81 QMediaPlayer
*m_player
;
82 QSlider
*m_seekSlider
;
83 EmbeddedVideoPlayer
*m_videoWidget
;
88 #endif // MEDIAWIDGET_H