source: trunk/demos/qmediaplayer/mediaplayer.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 5.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 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
63QT_BEGIN_NAMESPACE
64class QPushButton;
65class QLabel;
66class QSlider;
67class QTextEdit;
68class QMenu;
69class Ui_settings;
70QT_END_NAMESPACE
71
72class MediaPlayer;
73
74class MediaVideoWidget : public Phonon::VideoWidget
75{
76 Q_OBJECT
77
78public:
79 MediaVideoWidget(MediaPlayer *player, QWidget *parent = 0);
80
81public slots:
82 // Over-riding non-virtual Phonon::VideoWidget slot
83 void setFullScreen(bool);
84
85signals:
86 void fullScreenChanged(bool);
87
88protected:
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
96private:
97 MediaPlayer *m_player;
98 QBasicTimer m_timer;
99 QAction m_action;
100};
101
102class MediaPlayer :
103 public QWidget
104{
105 Q_OBJECT
106public:
107 MediaPlayer();
108
109 void dragEnterEvent(QDragEnterEvent *e);
110 void dragMoveEvent(QDragMoveEvent *e);
111 void dropEvent(QDropEvent *e);
112 void handleDrop(QDropEvent *e);
113 void setFile(const QString &text);
114 void setLocation(const QString &location);
115 void initVideoWindow();
116 void initSettingsDialog();
117 void setVolume(qreal volume);
118 void setSmallScreen(bool smallScreen);
119
120public slots:
121 void openFile();
122 void rewind();
123 void forward();
124 void updateInfo();
125 void updateTime();
126 void finished();
127 void playPause();
128 void scaleChanged(QAction *);
129 void aspectChanged(QAction *);
130
131private slots:
132 void setAspect(int);
133 void setScale(int);
134 void setSaturation(int);
135 void setContrast(int);
136 void setHue(int);
137 void setBrightness(int);
138 void stateChanged(Phonon::State newstate, Phonon::State oldstate);
139 void effectChanged();
140 void showSettingsDialog();
141 void showContextMenu(const QPoint& point);
142 void bufferStatus(int percent);
143 void openUrl();
144#ifdef Q_OS_SYMBIAN
145 void selectIAP();
146#endif
147 void openRamFile();
148 void configureEffect();
149 void hasVideoChanged(bool);
150
151private:
152 bool playPauseForDialog();
153#ifdef Q_OS_SYMBIAN
154 void selectIAPL();
155#endif
156
157 QIcon playIcon;
158 QIcon pauseIcon;
159 QMenu *fileMenu;
160 QPushButton *playButton;
161 QPushButton *rewindButton;
162 QPushButton *forwardButton;
163 Phonon::SeekSlider *slider;
164 QLabel *timeLabel;
165 QLabel *progressLabel;
166 Phonon::VolumeSlider *volume;
167 QSlider *m_hueSlider;
168 QSlider *m_satSlider;
169 QSlider *m_contSlider;
170 QLabel *info;
171 Phonon::Effect *nextEffect;
172 QDialog *settingsDialog;
173 Ui_settings *ui;
174 QAction *m_fullScreenAction;
175
176 QWidget m_videoWindow;
177 Phonon::MediaObject m_MediaObject;
178 Phonon::AudioOutput m_AudioOutput;
179 MediaVideoWidget *m_videoWidget;
180 Phonon::Path m_audioOutputPath;
181 bool m_smallScreen;
182};
183
184#endif //MEDIAPLAYER_H
Note: See TracBrowser for help on using the repository browser.