45 #include <QtGui/QWidget> |
45 #include <QtGui/QWidget> |
46 #include <QtGui/QApplication> |
46 #include <QtGui/QApplication> |
47 #include <QtCore/QTimerEvent> |
47 #include <QtCore/QTimerEvent> |
48 #include <QtGui/QShowEvent> |
48 #include <QtGui/QShowEvent> |
49 #include <QtGui/QIcon> |
49 #include <QtGui/QIcon> |
|
50 #include <QtCore/QBasicTimer> |
|
51 #include <QtGui/QAction> |
50 |
52 |
51 #include <Phonon/AudioOutput> |
53 #include <Phonon/AudioOutput> |
52 #include <Phonon/BackendCapabilities> |
54 #include <Phonon/BackendCapabilities> |
53 #include <Phonon/Effect> |
55 #include <Phonon/Effect> |
54 #include <Phonon/EffectParameter> |
56 #include <Phonon/EffectParameter> |
65 class QTextEdit; |
67 class QTextEdit; |
66 class QMenu; |
68 class QMenu; |
67 class Ui_settings; |
69 class Ui_settings; |
68 QT_END_NAMESPACE |
70 QT_END_NAMESPACE |
69 |
71 |
|
72 class MediaPlayer; |
|
73 |
|
74 class MediaVideoWidget : public Phonon::VideoWidget |
|
75 { |
|
76 Q_OBJECT |
|
77 |
|
78 public: |
|
79 MediaVideoWidget(MediaPlayer *player, QWidget *parent = 0); |
|
80 |
|
81 public slots: |
|
82 // Over-riding non-virtual Phonon::VideoWidget slot |
|
83 void setFullScreen(bool); |
|
84 |
|
85 signals: |
|
86 void fullScreenChanged(bool); |
|
87 |
|
88 protected: |
|
89 void mouseDoubleClickEvent(QMouseEvent *e); |
|
90 void keyPressEvent(QKeyEvent *e); |
|
91 bool event(QEvent *e); |
|
92 void timerEvent(QTimerEvent *e); |
|
93 void dropEvent(QDropEvent *e); |
|
94 void dragEnterEvent(QDragEnterEvent *e); |
|
95 |
|
96 private: |
|
97 MediaPlayer *m_player; |
|
98 QBasicTimer m_timer; |
|
99 QAction m_action; |
|
100 }; |
|
101 |
70 class MediaPlayer : |
102 class MediaPlayer : |
71 public QWidget |
103 public QWidget |
72 { |
104 { |
73 Q_OBJECT |
105 Q_OBJECT |
74 public: |
106 public: |
75 MediaPlayer(const QString &, |
107 MediaPlayer(const QString &, |
76 const bool hasSmallScreen); |
108 const bool hasSmallScreen); |
77 |
109 |
78 void dragEnterEvent(QDragEnterEvent *e); |
110 void dragEnterEvent(QDragEnterEvent *e); |
79 void dragMoveEvent(QDragMoveEvent *e); |
111 void dragMoveEvent(QDragMoveEvent *e); |
80 void dropEvent(QDropEvent *e); |
112 void dropEvent(QDropEvent *e); |
81 void handleDrop(QDropEvent *e); |
113 void handleDrop(QDropEvent *e); |
82 void setFile(const QString &text); |
114 void setFile(const QString &text); |
83 void initVideoWindow(); |
115 void initVideoWindow(); |
84 void initSettingsDialog(); |
116 void initSettingsDialog(); |
85 |
117 |
86 public slots: |
118 public slots: |
87 void openFile(); |
119 void openFile(); |
88 void rewind(); |
120 void rewind(); |
89 void forward(); |
121 void forward(); |
90 void updateInfo(); |
122 void updateInfo(); |
91 void updateTime(); |
123 void updateTime(); |
92 void finished(); |
124 void finished(); |
93 void playPause(); |
125 void playPause(); |
94 void scaleChanged(QAction *); |
126 void scaleChanged(QAction *); |
95 void aspectChanged(QAction *); |
127 void aspectChanged(QAction *); |
96 void hasVideoChanged(bool); |
|
97 |
128 |
98 private slots: |
129 private slots: |
99 void setAspect(int); |
130 void setAspect(int); |
100 void setScale(int); |
131 void setScale(int); |
101 void setSaturation(int); |
132 void setSaturation(int); |
103 void setHue(int); |
134 void setHue(int); |
104 void setBrightness(int); |
135 void setBrightness(int); |
105 void stateChanged(Phonon::State newstate, Phonon::State oldstate); |
136 void stateChanged(Phonon::State newstate, Phonon::State oldstate); |
106 void effectChanged(); |
137 void effectChanged(); |
107 void showSettingsDialog(); |
138 void showSettingsDialog(); |
108 void showContextMenu(const QPoint &); |
139 void showContextMenu(const QPoint& point); |
109 void bufferStatus(int percent); |
140 void bufferStatus(int percent); |
110 void openUrl(); |
141 void openUrl(); |
|
142 void openRamFile(); |
111 void configureEffect(); |
143 void configureEffect(); |
|
144 void hasVideoChanged(bool); |
112 |
145 |
113 private: |
146 private: |
|
147 bool playPauseForDialog(); |
|
148 |
114 QIcon playIcon; |
149 QIcon playIcon; |
115 QIcon pauseIcon; |
150 QIcon pauseIcon; |
116 QMenu *fileMenu; |
151 QMenu *fileMenu; |
117 QPushButton *playButton; |
152 QPushButton *playButton; |
118 QPushButton *rewindButton; |
153 QPushButton *rewindButton; |
126 QSlider *m_contSlider; |
161 QSlider *m_contSlider; |
127 QLabel *info; |
162 QLabel *info; |
128 Phonon::Effect *nextEffect; |
163 Phonon::Effect *nextEffect; |
129 QDialog *settingsDialog; |
164 QDialog *settingsDialog; |
130 Ui_settings *ui; |
165 Ui_settings *ui; |
131 |
166 QAction *m_fullScreenAction; |
|
167 |
132 QWidget m_videoWindow; |
168 QWidget m_videoWindow; |
133 Phonon::MediaObject m_MediaObject; |
169 Phonon::MediaObject m_MediaObject; |
134 Phonon::AudioOutput m_AudioOutput; |
170 Phonon::AudioOutput m_AudioOutput; |
135 Phonon::VideoWidget *m_videoWidget; |
171 MediaVideoWidget *m_videoWidget; |
136 Phonon::Path m_audioOutputPath; |
172 Phonon::Path m_audioOutputPath; |
137 const bool m_hasSmallScreen; |
173 const bool m_hasSmallScreen; |
138 }; |
174 }; |
139 |
175 |
140 #endif //MEDIAPLAYER_H |
176 #endif //MEDIAPLAYER_H |