Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / demos / qmediaplayer / mediaplayer.h
blobd6ae58ba0ec621f5db4910fc76d6dd5fac0d431d
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 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.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ***************************************************************************/
42 #ifndef MEDIALAYER_H
43 #define MEDIAPLAYER_H
45 #include <QtGui/QWidget>
46 #include <QtGui/QApplication>
47 #include <QtCore/QTimerEvent>
48 #include <QtGui/QShowEvent>
49 #include <QtGui/QIcon>
50 #include <QtCore/QBasicTimer>
51 #include <QtGui/QAction>
53 #include <phonon/audiooutput.h>
54 #include <phonon/backendcapabilities.h>
55 #include <phonon/effect.h>
56 #include <phonon/effectparameter.h>
57 #include <phonon/effectwidget.h>
58 #include <phonon/mediaobject.h>
59 #include <phonon/seekslider.h>
60 #include <phonon/videowidget.h>
61 #include <phonon/volumeslider.h>
63 QT_BEGIN_NAMESPACE
64 class QPushButton;
65 class QLabel;
66 class QSlider;
67 class QTextEdit;
68 class QMenu;
69 class Ui_settings;
70 QT_END_NAMESPACE
72 class MediaPlayer;
74 class MediaVideoWidget : public Phonon::VideoWidget
76 Q_OBJECT
78 public:
79 MediaVideoWidget(MediaPlayer *player, QWidget *parent = 0);
81 public slots:
82 // Over-riding non-virtual Phonon::VideoWidget slot
83 void setFullScreen(bool);
85 signals:
86 void fullScreenChanged(bool);
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);
96 private:
97 MediaPlayer *m_player;
98 QBasicTimer m_timer;
99 QAction m_action;
102 class MediaPlayer :
103 public QWidget
105 Q_OBJECT
106 public:
107 MediaPlayer(const QString &,
108 const bool hasSmallScreen);
110 void dragEnterEvent(QDragEnterEvent *e);
111 void dragMoveEvent(QDragMoveEvent *e);
112 void dropEvent(QDropEvent *e);
113 void handleDrop(QDropEvent *e);
114 void setFile(const QString &text);
115 void setLocation(const QString &location);
116 void initVideoWindow();
117 void initSettingsDialog();
119 public slots:
120 void openFile();
121 void rewind();
122 void forward();
123 void updateInfo();
124 void updateTime();
125 void finished();
126 void playPause();
127 void scaleChanged(QAction *);
128 void aspectChanged(QAction *);
130 private slots:
131 void setAspect(int);
132 void setScale(int);
133 void setSaturation(int);
134 void setContrast(int);
135 void setHue(int);
136 void setBrightness(int);
137 void stateChanged(Phonon::State newstate, Phonon::State oldstate);
138 void effectChanged();
139 void showSettingsDialog();
140 void showContextMenu(const QPoint& point);
141 void bufferStatus(int percent);
142 void openUrl();
143 void openRamFile();
144 void configureEffect();
145 void hasVideoChanged(bool);
147 private:
148 bool playPauseForDialog();
150 QIcon playIcon;
151 QIcon pauseIcon;
152 QMenu *fileMenu;
153 QPushButton *playButton;
154 QPushButton *rewindButton;
155 QPushButton *forwardButton;
156 Phonon::SeekSlider *slider;
157 QLabel *timeLabel;
158 QLabel *progressLabel;
159 Phonon::VolumeSlider *volume;
160 QSlider *m_hueSlider;
161 QSlider *m_satSlider;
162 QSlider *m_contSlider;
163 QLabel *info;
164 Phonon::Effect *nextEffect;
165 QDialog *settingsDialog;
166 Ui_settings *ui;
167 QAction *m_fullScreenAction;
169 QWidget m_videoWindow;
170 Phonon::MediaObject m_MediaObject;
171 Phonon::AudioOutput m_AudioOutput;
172 MediaVideoWidget *m_videoWidget;
173 Phonon::Path m_audioOutputPath;
174 const bool m_hasSmallScreen;
177 #endif //MEDIAPLAYER_H