demos/qmediaplayer/mediaplayer.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the demonstration applications of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ***************************************************************************/
       
    41 
       
    42 #ifndef MEDIALAYER_H
       
    43 #define MEDIAPLAYER_H
       
    44 
       
    45 #include <QtGui/QWidget>
       
    46 #include <QtGui/QApplication>
       
    47 #include <QtCore/QTimerEvent>
       
    48 #include <QtGui/QShowEvent>
       
    49 #include <QtGui/QIcon>
       
    50 
       
    51 #include <Phonon/AudioOutput>
       
    52 #include <Phonon/BackendCapabilities>
       
    53 #include <Phonon/Effect>
       
    54 #include <Phonon/EffectParameter>
       
    55 #include <Phonon/EffectWidget>
       
    56 #include <Phonon/MediaObject>
       
    57 #include <Phonon/SeekSlider>
       
    58 #include <Phonon/VideoWidget>
       
    59 #include <Phonon/VolumeSlider>
       
    60 
       
    61 QT_BEGIN_NAMESPACE
       
    62 class QPushButton;
       
    63 class QLabel;
       
    64 class QSlider;
       
    65 class QTextEdit;
       
    66 class QMenu;
       
    67 class Ui_settings;
       
    68 QT_END_NAMESPACE
       
    69 
       
    70 class MediaPlayer :
       
    71             public QWidget
       
    72 {
       
    73     Q_OBJECT
       
    74 public:
       
    75     MediaPlayer(const QString &,
       
    76                 const bool hasSmallScreen);
       
    77     
       
    78     void dragEnterEvent(QDragEnterEvent *e);
       
    79     void dragMoveEvent(QDragMoveEvent *e);
       
    80     void dropEvent(QDropEvent *e);
       
    81     void handleDrop(QDropEvent *e);
       
    82     void setFile(const QString &text);
       
    83     void initVideoWindow();
       
    84     void initSettingsDialog();
       
    85     
       
    86 public slots:
       
    87     void openFile();
       
    88     void rewind();
       
    89     void forward();
       
    90     void updateInfo();
       
    91     void updateTime();
       
    92     void finished();
       
    93     void playPause();
       
    94     void scaleChanged(QAction *);
       
    95     void aspectChanged(QAction *);
       
    96     void hasVideoChanged(bool);
       
    97 
       
    98 private slots:
       
    99     void setAspect(int);
       
   100     void setScale(int);
       
   101     void setSaturation(int);
       
   102     void setContrast(int);
       
   103     void setHue(int);
       
   104     void setBrightness(int);
       
   105     void stateChanged(Phonon::State newstate, Phonon::State oldstate);
       
   106     void effectChanged();
       
   107     void showSettingsDialog();
       
   108     void showContextMenu(const QPoint &);
       
   109     void bufferStatus(int percent);
       
   110     void openUrl();
       
   111     void configureEffect();
       
   112 
       
   113 private:
       
   114     QIcon playIcon;
       
   115     QIcon pauseIcon;
       
   116     QMenu *fileMenu;
       
   117     QPushButton *playButton;
       
   118     QPushButton *rewindButton;
       
   119     QPushButton *forwardButton;
       
   120     Phonon::SeekSlider *slider;
       
   121     QLabel *timeLabel;
       
   122     QLabel *progressLabel;
       
   123     Phonon::VolumeSlider *volume;
       
   124     QSlider *m_hueSlider;
       
   125     QSlider *m_satSlider;
       
   126     QSlider *m_contSlider;
       
   127     QLabel *info;
       
   128     Phonon::Effect *nextEffect;
       
   129     QDialog *settingsDialog;
       
   130     Ui_settings *ui;
       
   131         
       
   132     QWidget m_videoWindow;
       
   133     Phonon::MediaObject m_MediaObject;
       
   134     Phonon::AudioOutput m_AudioOutput;
       
   135     Phonon::VideoWidget *m_videoWidget;
       
   136     Phonon::Path m_audioOutputPath;
       
   137     const bool m_hasSmallScreen;
       
   138 };
       
   139 
       
   140 #endif //MEDIAPLAYER_H