Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 1f128a4..12ae4fd 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -1,93 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
21 | #include "mediaplayerplugininterface.h" | 22 | #include <qpe/mediaplayerplugininterface.h> |
22 | #include <qwidget.h> | 23 | #include <qwidget.h> |
23 | #include <qpainter.h> | 24 | #include <qpainter.h> |
24 | #include <qpixmap.h> | 25 | #include <qpixmap.h> |
25 | #include <qslider.h> | 26 | #include <qslider.h> |
26 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
27 | #include "videowidget.h" | 28 | #include "videowidget.h" |
28 | #include "mediaplayerstate.h" | 29 | #include "mediaplayerstate.h" |
29 | 30 | ||
30 | 31 | ||
31 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
32 | # define USE_DIRECT_PAINTER | 33 | # define USE_DIRECT_PAINTER |
33 | # include <qdirectpainter_qws.h> | 34 | # include <qdirectpainter_qws.h> |
34 | # include <qgfxraster_qws.h> | 35 | # include <qgfxraster_qws.h> |
35 | #endif | 36 | #endif |
36 | 37 | ||
37 | 38 | ||
38 | extern MediaPlayerState *mediaPlayerState; | 39 | extern MediaPlayerState *mediaPlayerState; |
39 | 40 | ||
40 | 41 | ||
41 | static const int xo = 2; // movable x offset | 42 | static const int xo = 2; // movable x offset |
42 | static const int yo = 0; // movable y offset | 43 | static const int yo = 0; // movable y offset |
43 | 44 | ||
44 | 45 | ||
45 | struct MediaButton { | 46 | struct MediaButton { |
46 | int xPos, yPos; | 47 | int xPos, yPos; |
47 | bool isToggle, isHeld, isDown; | 48 | bool isToggle, isHeld, isDown; |
48 | int controlType; | 49 | int controlType; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | 52 | ||
52 | // Layout information for the videoButtons (and if it is a toggle button or not) | 53 | // Layout information for the videoButtons (and if it is a toggle button or not) |
53 | MediaButton videoButtons[] = { | 54 | MediaButton videoButtons[] = { |
54 | { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous | 55 | { 5+0*32+xo, 200+yo, FALSE, FALSE, FALSE, 4 }, // previous |
55 | { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop | 56 | { 5+1*32+xo, 200+yo, FALSE, FALSE, FALSE, 1 }, // stop |
56 | { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play | 57 | { 5+2*32+xo, 200+yo, TRUE, FALSE, FALSE, 0 }, // play |
57 | { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause | 58 | { 5+3*32+xo, 200+yo, TRUE, FALSE, FALSE, 2 }, // pause |
58 | { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next | 59 | { 5+4*32+xo, 200+yo, FALSE, FALSE, FALSE, 3 }, // next |
59 | { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist | 60 | { 5+5*32+xo, 200+yo, FALSE, FALSE, FALSE, 8 }, // playlist |
60 | { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen | 61 | { 5+6*32+xo, 200+yo, TRUE, FALSE, FALSE, 9 } // fullscreen |
61 | }; | 62 | }; |
62 | 63 | ||
63 | 64 | ||
64 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 65 | static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
65 | 66 | ||
66 | 67 | ||
67 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 68 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
68 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 69 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
69 | setCaption( tr("OpiePlayer") ); | 70 | setCaption( tr("MediaPlayer") ); |
70 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 71 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
71 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); | 72 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); |
72 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); | 73 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0b" ) ); |
73 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls0" ) ); | 74 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaControls0" ) ); |
74 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 75 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
75 | 76 | ||
76 | slider = new QSlider( Qt::Horizontal, this ); | 77 | slider = new QSlider( Qt::Horizontal, this ); |
77 | slider->setMinValue( 0 ); | 78 | slider->setMinValue( 0 ); |
78 | slider->setMaxValue( 1 ); | 79 | slider->setMaxValue( 1 ); |
79 | slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 80 | slider->setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
80 | slider->setFocusPolicy( QWidget::NoFocus ); | 81 | slider->setFocusPolicy( QWidget::NoFocus ); |
81 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 82 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
82 | 83 | ||
83 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 84 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
84 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 85 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
85 | 86 | ||
86 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 87 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
87 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 88 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
88 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 89 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
89 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 90 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
90 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 91 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
91 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 92 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
92 | 93 | ||
93 | // Intialise state | 94 | // Intialise state |