1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the demonstration applications of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
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 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
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 | #include <QtCore/QBasicTimer>
|
---|
51 | #include <QtGui/QAction>
|
---|
52 |
|
---|
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>
|
---|
62 |
|
---|
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
|
---|
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 |
|
---|
102 | class MediaPlayer :
|
---|
103 | public QWidget
|
---|
104 | {
|
---|
105 | Q_OBJECT
|
---|
106 | public:
|
---|
107 | MediaPlayer(const QString &,
|
---|
108 | const bool hasSmallScreen);
|
---|
109 |
|
---|
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();
|
---|
118 |
|
---|
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 *);
|
---|
129 |
|
---|
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);
|
---|
146 |
|
---|
147 | private:
|
---|
148 | bool playPauseForDialog();
|
---|
149 |
|
---|
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;
|
---|
168 |
|
---|
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;
|
---|
175 | };
|
---|
176 |
|
---|
177 | #endif //MEDIAPLAYER_H
|
---|