demos/qmediaplayer/mediaplayer.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/demos/qmediaplayer/mediaplayer.h	Tue Jan 26 12:42:25 2010 +0200
+++ b/demos/qmediaplayer/mediaplayer.h	Tue Feb 02 00:43:10 2010 +0200
@@ -47,6 +47,8 @@
 #include <QtCore/QTimerEvent>
 #include <QtGui/QShowEvent>
 #include <QtGui/QIcon>
+#include <QtCore/QBasicTimer>
+#include <QtGui/QAction>
 
 #include <Phonon/AudioOutput>
 #include <Phonon/BackendCapabilities>
@@ -67,6 +69,36 @@
 class Ui_settings;
 QT_END_NAMESPACE
 
+class MediaPlayer;
+
+class MediaVideoWidget : public Phonon::VideoWidget
+{
+    Q_OBJECT
+
+public:
+    MediaVideoWidget(MediaPlayer *player, QWidget *parent = 0);
+
+public slots:
+    // Over-riding non-virtual Phonon::VideoWidget slot
+    void setFullScreen(bool);
+
+signals:
+    void fullScreenChanged(bool);
+
+protected:
+    void mouseDoubleClickEvent(QMouseEvent *e);
+    void keyPressEvent(QKeyEvent *e);
+    bool event(QEvent *e);
+    void timerEvent(QTimerEvent *e);
+    void dropEvent(QDropEvent *e);
+    void dragEnterEvent(QDragEnterEvent *e);
+
+private:
+    MediaPlayer *m_player;
+    QBasicTimer m_timer;
+    QAction m_action;
+};
+
 class MediaPlayer :
             public QWidget
 {
@@ -74,7 +106,7 @@
 public:
     MediaPlayer(const QString &,
                 const bool hasSmallScreen);
-    
+
     void dragEnterEvent(QDragEnterEvent *e);
     void dragMoveEvent(QDragMoveEvent *e);
     void dropEvent(QDropEvent *e);
@@ -82,7 +114,7 @@
     void setFile(const QString &text);
     void initVideoWindow();
     void initSettingsDialog();
-    
+
 public slots:
     void openFile();
     void rewind();
@@ -93,7 +125,6 @@
     void playPause();
     void scaleChanged(QAction *);
     void aspectChanged(QAction *);
-    void hasVideoChanged(bool);
 
 private slots:
     void setAspect(int);
@@ -105,12 +136,16 @@
     void stateChanged(Phonon::State newstate, Phonon::State oldstate);
     void effectChanged();
     void showSettingsDialog();
-    void showContextMenu(const QPoint &);
+    void showContextMenu(const QPoint& point);
     void bufferStatus(int percent);
     void openUrl();
+    void openRamFile();
     void configureEffect();
+    void hasVideoChanged(bool);
 
 private:
+    bool playPauseForDialog();
+
     QIcon playIcon;
     QIcon pauseIcon;
     QMenu *fileMenu;
@@ -128,11 +163,12 @@
     Phonon::Effect *nextEffect;
     QDialog *settingsDialog;
     Ui_settings *ui;
-        
+    QAction *m_fullScreenAction;
+
     QWidget m_videoWindow;
     Phonon::MediaObject m_MediaObject;
     Phonon::AudioOutput m_AudioOutput;
-    Phonon::VideoWidget *m_videoWidget;
+    MediaVideoWidget *m_videoWidget;
     Phonon::Path m_audioOutputPath;
     const bool m_hasSmallScreen;
 };