Changeset View
Changeset View
Standalone View
Standalone View
src/panels/information/phononwidget.h
Show All 37 Lines | |||||
38 | class EmbeddedVideoPlayer; | 38 | class EmbeddedVideoPlayer; | ||
39 | class QToolButton; | 39 | class QToolButton; | ||
40 | class QVBoxLayout; | 40 | class QVBoxLayout; | ||
41 | 41 | | |||
42 | class PhononWidget : public QWidget | 42 | class PhononWidget : public QWidget | ||
43 | { | 43 | { | ||
44 | Q_OBJECT | 44 | Q_OBJECT | ||
45 | public: | 45 | public: | ||
46 | | ||||
47 | enum MediaKind { | ||||
48 | Video, | ||||
49 | Audio | ||||
50 | }; | ||||
51 | | ||||
46 | explicit PhononWidget(QWidget *parent = nullptr); | 52 | explicit PhononWidget(QWidget *parent = nullptr); | ||
47 | 53 | | |||
48 | void setUrl(const QUrl &url); | 54 | void setUrl(const QUrl &url, MediaKind kind); | ||
elvisangelaccio: bool arguments in API should be avoided in favor of enums. | |||||
49 | QUrl url() const; | 55 | QUrl url() const; | ||
50 | 56 | | |||
51 | void setVideoSize(const QSize& size); | 57 | void setVideoSize(const QSize& size); | ||
52 | QSize videoSize() const; | 58 | QSize videoSize() const; | ||
53 | 59 | | |||
60 | void setAutoPlay(bool autoPlay); | ||||
61 | | ||||
54 | signals: | 62 | signals: | ||
55 | /** | 63 | /** | ||
56 | * Is emitted whenever the video-state | 64 | * Is emitted whenever the video-state | ||
57 | * has changed: If true is returned, a video | 65 | * has changed: If true is returned, a video | ||
58 | * including control-buttons will be shown. | 66 | * including control-buttons will be shown. | ||
59 | * If false is returned, no video is shown | 67 | * If false is returned, no video is shown | ||
60 | * and the control-buttons are available for | 68 | * and the control-buttons are available for | ||
61 | * audio only. | 69 | * audio only. | ||
62 | */ | 70 | */ | ||
63 | void hasVideoChanged(bool hasVideo); | 71 | void hasVideoChanged(bool hasVideo); | ||
64 | 72 | | |||
73 | public slots: | ||||
74 | void play(); | ||||
75 | | ||||
65 | protected: | 76 | protected: | ||
66 | void showEvent(QShowEvent *event) override; | 77 | void showEvent(QShowEvent *event) override; | ||
67 | void hideEvent(QHideEvent *event) override; | 78 | void hideEvent(QHideEvent *event) override; | ||
68 | 79 | | |||
69 | private slots: | 80 | private slots: | ||
70 | void stateChanged(Phonon::State); | 81 | void stateChanged(Phonon::State newstate); | ||
71 | void play(); | | |||
72 | void stop(); | 82 | void stop(); | ||
73 | void slotHasVideoChanged(bool); | 83 | void finished(); | ||
74 | 84 | | |||
75 | private: | 85 | private: | ||
76 | void applyVideoSize(); | 86 | void applyVideoSize(); | ||
77 | 87 | | |||
78 | private: | 88 | private: | ||
79 | QUrl m_url; | 89 | QUrl m_url; | ||
80 | QSize m_videoSize; | 90 | QSize m_videoSize; | ||
81 | 91 | | |||
82 | QToolButton *m_playButton; | 92 | QToolButton *m_playButton; | ||
83 | QToolButton *m_stopButton; | 93 | QToolButton *m_stopButton; | ||
84 | 94 | | |||
85 | QVBoxLayout *m_topLayout; | 95 | QVBoxLayout *m_topLayout; | ||
86 | Phonon::MediaObject *m_media; | 96 | Phonon::MediaObject *m_media; | ||
87 | Phonon::SeekSlider *m_seekSlider; | 97 | Phonon::SeekSlider *m_seekSlider; | ||
88 | Phonon::AudioOutput *m_audioOutput; | 98 | Phonon::AudioOutput *m_audioOutput; | ||
89 | EmbeddedVideoPlayer *m_videoPlayer; | 99 | EmbeddedVideoPlayer *m_videoPlayer; | ||
100 | bool m_autoPlay; | ||||
101 | bool m_isVideo; | ||||
90 | }; | 102 | }; | ||
91 | 103 | | |||
92 | #endif // PHONONWIDGET_H | 104 | #endif // PHONONWIDGET_H |
bool arguments in API should be avoided in favor of enums.