-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 4 |
2 files changed, 13 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index ff3f5f7..9ce2b57 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -1,507 +1,508 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/mediaplayerplugininterface.h> | 36 | #include <qpe/mediaplayerplugininterface.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | 39 | ||
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
43 | #include <qslider.h> | 43 | #include <qslider.h> |
44 | #include <qdrawutil.h> | 44 | #include <qdrawutil.h> |
45 | #include "videowidget.h" | 45 | #include "videowidget.h" |
46 | #include "mediaplayerstate.h" | 46 | #include "mediaplayerstate.h" |
47 | #include "playlistwidget.h" | 47 | #include "playlistwidget.h" |
48 | 48 | ||
49 | 49 | ||
50 | #ifdef Q_WS_QWS | 50 | #ifdef Q_WS_QWS |
51 | # define USE_DIRECT_PAINTER | 51 | # define USE_DIRECT_PAINTER |
52 | # include <qdirectpainter_qws.h> | 52 | # include <qdirectpainter_qws.h> |
53 | # include <qgfxraster_qws.h> | 53 | # include <qgfxraster_qws.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | 56 | ||
57 | extern MediaPlayerState *mediaPlayerState; | 57 | extern MediaPlayerState *mediaPlayerState; |
58 | extern PlayListWidget *playList; | 58 | extern PlayListWidget *playList; |
59 | 59 | ||
60 | 60 | ||
61 | static const int xo = 2; // movable x offset | 61 | static const int xo = 2; // movable x offset |
62 | static const int yo = 0; // movable y offset | 62 | static const int yo = 0; // movable y offset |
63 | 63 | ||
64 | 64 | ||
65 | struct MediaButton { | 65 | struct MediaButton { |
66 | bool isToggle, isHeld, isDown; | 66 | bool isToggle, isHeld, isDown; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | MediaButton videoButtons[] = { | 69 | MediaButton videoButtons[] = { |
70 | { FALSE, FALSE, FALSE }, // stop | 70 | { FALSE, FALSE, FALSE }, // stop |
71 | { TRUE, FALSE, FALSE }, // play | 71 | { TRUE, FALSE, FALSE }, // play |
72 | { FALSE, FALSE, FALSE }, // previous | 72 | { FALSE, FALSE, FALSE }, // previous |
73 | { FALSE, FALSE, FALSE }, // next | 73 | { FALSE, FALSE, FALSE }, // next |
74 | { FALSE, FALSE, FALSE }, // volUp | 74 | { FALSE, FALSE, FALSE }, // volUp |
75 | { FALSE, FALSE, FALSE }, // volDown | 75 | { FALSE, FALSE, FALSE }, // volDown |
76 | { TRUE, FALSE, FALSE } // fullscreen | 76 | { TRUE, FALSE, FALSE } // fullscreen |
77 | }; | 77 | }; |
78 | 78 | ||
79 | const char *skinV_mask_file_names[7] = { | 79 | const char *skinV_mask_file_names[7] = { |
80 | "stop","play","back","fwd","up","down","full" | 80 | "stop","play","back","fwd","up","down","full" |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
84 | 84 | ||
85 | 85 | ||
86 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 86 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
87 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 87 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
88 | 88 | ||
89 | 89 | ||
90 | setCaption( tr("OpiePlayer - Video") ); | 90 | setCaption( tr("OpiePlayer - Video") ); |
91 | 91 | ||
92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
93 | 93 | ||
94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
96 | 96 | ||
97 | Config cfg("OpiePlayer"); | 97 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 98 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 99 | skin = cfg.readEntry("Skin","default"); |
100 | 100 | ||
101 | QString skinPath = "opieplayer2/skins/" + skin; | 101 | QString skinPath = "opieplayer2/skins/" + skin; |
102 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 102 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
103 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 103 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
104 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 104 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
105 | 105 | ||
106 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 106 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
107 | imgButtonMask->fill( 0 ); | 107 | imgButtonMask->fill( 0 ); |
108 | 108 | ||
109 | for ( int i = 0; i < 7; i++ ) { | 109 | for ( int i = 0; i < 7; i++ ) { |
110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
111 | masks[i] = new QBitmap( filename ); | 111 | masks[i] = new QBitmap( filename ); |
112 | 112 | ||
113 | if ( !masks[i]->isNull() ) { | 113 | if ( !masks[i]->isNull() ) { |
114 | QImage imgMask = masks[i]->convertToImage(); | 114 | QImage imgMask = masks[i]->convertToImage(); |
115 | uchar **dest = imgButtonMask->jumpTable(); | 115 | uchar **dest = imgButtonMask->jumpTable(); |
116 | for ( int y = 0; y < imgUp->height(); y++ ) { | 116 | for ( int y = 0; y < imgUp->height(); y++ ) { |
117 | uchar *line = dest[y]; | 117 | uchar *line = dest[y]; |
118 | for ( int x = 0; x < imgUp->width(); x++ ) { | 118 | for ( int x = 0; x < imgUp->width(); x++ ) { |
119 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 119 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
120 | line[x] = i + 1; | 120 | line[x] = i + 1; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | for ( int i = 0; i < 7; i++ ) { | 126 | for ( int i = 0; i < 7; i++ ) { |
127 | buttonPixUp[i] = NULL; | 127 | buttonPixUp[i] = NULL; |
128 | buttonPixDown[i] = NULL; | 128 | buttonPixDown[i] = NULL; |
129 | } | 129 | } |
130 | 130 | ||
131 | setBackgroundPixmap( *pixBg ); | 131 | setBackgroundPixmap( *pixBg ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | //slider->setFocusPolicy( QWidget::NoFocus ); | 137 | //slider->setFocusPolicy( QWidget::NoFocus ); |
138 | 138 | ||
139 | resizeEvent( NULL ); | 139 | resizeEvent( NULL ); |
140 | 140 | ||
141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 141 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
142 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 142 | connect( mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ), this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) ); |
143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 143 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
144 | 144 | ||
145 | setLength( mediaPlayerState->length() ); | 145 | setLength( mediaPlayerState->length() ); |
146 | setPosition( mediaPlayerState->position() ); | 146 | setPosition( mediaPlayerState->position() ); |
147 | setFullscreen( mediaPlayerState->isFullscreen() ); | 147 | setFullscreen( mediaPlayerState->isFullscreen() ); |
148 | setPlaying( mediaPlayerState->isPlaying() ); | 148 | setPlaying( mediaPlayerState->isPlaying() ); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | VideoWidget::~VideoWidget() { | 152 | VideoWidget::~VideoWidget() { |
153 | 153 | ||
154 | for ( int i = 0; i < 7; i++ ) { | 154 | for ( int i = 0; i < 7; i++ ) { |
155 | delete buttonPixUp[i]; | 155 | delete buttonPixUp[i]; |
156 | delete buttonPixDown[i]; | 156 | delete buttonPixDown[i]; |
157 | } | 157 | } |
158 | 158 | ||
159 | delete pixBg; | 159 | delete pixBg; |
160 | delete imgUp; | 160 | delete imgUp; |
161 | delete imgDn; | 161 | delete imgDn; |
162 | delete imgButtonMask; | 162 | delete imgButtonMask; |
163 | for ( int i = 0; i < 7; i++ ) { | 163 | for ( int i = 0; i < 7; i++ ) { |
164 | delete masks[i]; | 164 | delete masks[i]; |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | 168 | ||
169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 169 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
170 | QPixmap pix( img.width(), img.height() ); | 170 | QPixmap pix( img.width(), img.height() ); |
171 | QPainter p( &pix ); | 171 | QPainter p( &pix ); |
172 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 172 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
173 | p.drawImage( 0, 0, img ); | 173 | p.drawImage( 0, 0, img ); |
174 | return new QPixmap( pix ); | 174 | return new QPixmap( pix ); |
175 | } | 175 | } |
176 | 176 | ||
177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 177 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
178 | QPixmap *pixmap = new QPixmap( pix ); | 178 | QPixmap *pixmap = new QPixmap( pix ); |
179 | pixmap->setMask( mask ); | 179 | pixmap->setMask( mask ); |
180 | return pixmap; | 180 | return pixmap; |
181 | } | 181 | } |
182 | 182 | ||
183 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 183 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
184 | int h = height(); | 184 | int h = height(); |
185 | int w = width(); | 185 | int w = width(); |
186 | //int Vh = 160; | 186 | //int Vh = 160; |
187 | //int Vw = 220; | 187 | //int Vw = 220; |
188 | 188 | ||
189 | slider->setFixedWidth( w - 20 ); | 189 | slider->setFixedWidth( w - 20 ); |
190 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 190 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
191 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 191 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
192 | slider->setFocusPolicy( QWidget::NoFocus ); | 192 | slider->setFocusPolicy( QWidget::NoFocus ); |
193 | slider->setBackgroundPixmap( *pixBg ); | 193 | slider->setBackgroundPixmap( *pixBg ); |
194 | 194 | ||
195 | xoff = 0;// ( imgUp->width() ) / 2; | 195 | xoff = 0;// ( imgUp->width() ) / 2; |
196 | if(w>h) | 196 | if(w>h) |
197 | yoff = 0; | 197 | yoff = 0; |
198 | else | 198 | else |
199 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 199 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
200 | QPoint p( xoff, yoff ); | 200 | QPoint p( xoff, yoff ); |
201 | 201 | ||
202 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 202 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
203 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 203 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
204 | 204 | ||
205 | for ( int i = 0; i < 7; i++ ) { | 205 | for ( int i = 0; i < 7; i++ ) { |
206 | if ( !masks[i]->isNull() ) { | 206 | if ( !masks[i]->isNull() ) { |
207 | delete buttonPixUp[i]; | 207 | delete buttonPixUp[i]; |
208 | delete buttonPixDown[i]; | 208 | delete buttonPixDown[i]; |
209 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 209 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
210 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 210 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | delete pixUp; | 214 | delete pixUp; |
215 | delete pixDn; | 215 | delete pixDn; |
216 | } | 216 | } |
217 | 217 | ||
218 | static bool videoSliderBeingMoved = FALSE; | 218 | static bool videoSliderBeingMoved = FALSE; |
219 | 219 | ||
220 | void VideoWidget::sliderPressed() { | 220 | void VideoWidget::sliderPressed() { |
221 | videoSliderBeingMoved = TRUE; | 221 | videoSliderBeingMoved = TRUE; |
222 | } | 222 | } |
223 | 223 | ||
224 | void VideoWidget::sliderReleased() { | 224 | void VideoWidget::sliderReleased() { |
225 | videoSliderBeingMoved = FALSE; | 225 | videoSliderBeingMoved = FALSE; |
226 | if ( slider->width() == 0 ) { | 226 | if ( slider->width() == 0 ) { |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 229 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
230 | mediaPlayerState->setPosition( val ); | 230 | mediaPlayerState->setPosition( val ); |
231 | } | 231 | } |
232 | 232 | ||
233 | void VideoWidget::setPosition( long i ) { | 233 | void VideoWidget::setPosition( long i ) { |
234 | updateSlider( i, mediaPlayerState->length() ); | 234 | updateSlider( i, mediaPlayerState->length() ); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | void VideoWidget::setLength( long max ) { | 238 | void VideoWidget::setLength( long max ) { |
239 | updateSlider( mediaPlayerState->position(), max ); | 239 | updateSlider( mediaPlayerState->position(), max ); |
240 | } | 240 | } |
241 | 241 | ||
242 | void VideoWidget::setView( char view ) { | 242 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
243 | 243 | { | |
244 | if ( view == 'v' ) { | 244 | if ( displayType == MediaPlayerState::Video ) { |
245 | makeVisible(); | 245 | makeVisible(); |
246 | } else { | 246 | return; |
247 | // Effectively blank the view next time we show it so it looks nicer | ||
248 | scaledWidth = 0; | ||
249 | scaledHeight = 0; | ||
250 | hide(); | ||
251 | } | 247 | } |
248 | |||
249 | // Effectively blank the view next time we show it so it looks nicer | ||
250 | scaledWidth = 0; | ||
251 | scaledHeight = 0; | ||
252 | hide(); | ||
252 | } | 253 | } |
253 | 254 | ||
254 | void VideoWidget::updateSlider( long i, long max ) { | 255 | void VideoWidget::updateSlider( long i, long max ) { |
255 | // Will flicker too much if we don't do this | 256 | // Will flicker too much if we don't do this |
256 | if ( max == 0 ) { | 257 | if ( max == 0 ) { |
257 | return; | 258 | return; |
258 | } | 259 | } |
259 | int width = slider->width(); | 260 | int width = slider->width(); |
260 | int val = int((double)i * width / max); | 261 | int val = int((double)i * width / max); |
261 | if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { | 262 | if ( !mediaPlayerState->isFullscreen() && !videoSliderBeingMoved ) { |
262 | if ( slider->value() != val ) { | 263 | if ( slider->value() != val ) { |
263 | slider->setValue( val ); | 264 | slider->setValue( val ); |
264 | } | 265 | } |
265 | if ( slider->maxValue() != width ) { | 266 | if ( slider->maxValue() != width ) { |
266 | slider->setMaxValue( width ); | 267 | slider->setMaxValue( width ); |
267 | } | 268 | } |
268 | } | 269 | } |
269 | } | 270 | } |
270 | 271 | ||
271 | void VideoWidget::setToggleButton( int i, bool down ) { | 272 | void VideoWidget::setToggleButton( int i, bool down ) { |
272 | if ( down != videoButtons[i].isDown ) { | 273 | if ( down != videoButtons[i].isDown ) { |
273 | toggleButton( i ); | 274 | toggleButton( i ); |
274 | } | 275 | } |
275 | } | 276 | } |
276 | 277 | ||
277 | void VideoWidget::toggleButton( int i ) { | 278 | void VideoWidget::toggleButton( int i ) { |
278 | videoButtons[i].isDown = !videoButtons[i].isDown; | 279 | videoButtons[i].isDown = !videoButtons[i].isDown; |
279 | QPainter p(this); | 280 | QPainter p(this); |
280 | paintButton ( &p, i ); | 281 | paintButton ( &p, i ); |
281 | } | 282 | } |
282 | 283 | ||
283 | void VideoWidget::paintButton( QPainter *p, int i ) { | 284 | void VideoWidget::paintButton( QPainter *p, int i ) { |
284 | 285 | ||
285 | if ( videoButtons[i].isDown ) { | 286 | if ( videoButtons[i].isDown ) { |
286 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 287 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
287 | } else { | 288 | } else { |
288 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 289 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
289 | } | 290 | } |
290 | } | 291 | } |
291 | 292 | ||
292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 293 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
293 | for ( int i = 0; i < numVButtons; i++ ) { | 294 | for ( int i = 0; i < numVButtons; i++ ) { |
294 | if ( event->state() == QMouseEvent::LeftButton ) { | 295 | if ( event->state() == QMouseEvent::LeftButton ) { |
295 | // The test to see if the mouse click is inside the button or not | 296 | // The test to see if the mouse click is inside the button or not |
296 | int x = event->pos().x() - xoff; | 297 | int x = event->pos().x() - xoff; |
297 | int y = event->pos().y() - yoff; | 298 | int y = event->pos().y() - yoff; |
298 | 299 | ||
299 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 300 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
300 | && y < imgButtonMask->height() | 301 | && y < imgButtonMask->height() |
301 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 302 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
302 | 303 | ||
303 | if ( isOnButton && !videoButtons[i].isHeld ) { | 304 | if ( isOnButton && !videoButtons[i].isHeld ) { |
304 | videoButtons[i].isHeld = TRUE; | 305 | videoButtons[i].isHeld = TRUE; |
305 | toggleButton(i); | 306 | toggleButton(i); |
306 | 307 | ||
307 | switch (i) { | 308 | switch (i) { |
308 | case VideoVolUp: | 309 | case VideoVolUp: |
309 | emit moreClicked(); | 310 | emit moreClicked(); |
310 | return; | 311 | return; |
311 | case VideoVolDown: | 312 | case VideoVolDown: |
312 | emit lessClicked(); | 313 | emit lessClicked(); |
313 | return; | 314 | return; |
314 | } | 315 | } |
315 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 316 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
316 | videoButtons[i].isHeld = FALSE; | 317 | videoButtons[i].isHeld = FALSE; |
317 | toggleButton(i); | 318 | toggleButton(i); |
318 | } | 319 | } |
319 | } else { | 320 | } else { |
320 | 321 | ||
321 | if ( videoButtons[i].isHeld ) { | 322 | if ( videoButtons[i].isHeld ) { |
322 | videoButtons[i].isHeld = FALSE; | 323 | videoButtons[i].isHeld = FALSE; |
323 | if ( !videoButtons[i].isToggle ) { | 324 | if ( !videoButtons[i].isToggle ) { |
324 | setToggleButton( i, FALSE ); | 325 | setToggleButton( i, FALSE ); |
325 | } | 326 | } |
326 | 327 | ||
327 | switch(i) { | 328 | switch(i) { |
328 | 329 | ||
329 | case VideoPlay: { | 330 | case VideoPlay: { |
330 | if( mediaPlayerState->isPaused() ) { | 331 | if( mediaPlayerState->isPaused() ) { |
331 | setToggleButton( i, FALSE ); | 332 | setToggleButton( i, FALSE ); |
332 | mediaPlayerState->setPaused( FALSE ); | 333 | mediaPlayerState->setPaused( FALSE ); |
333 | return; | 334 | return; |
334 | } else if( !mediaPlayerState->isPaused() ) { | 335 | } else if( !mediaPlayerState->isPaused() ) { |
335 | setToggleButton( i, TRUE ); | 336 | setToggleButton( i, TRUE ); |
336 | mediaPlayerState->setPaused( TRUE ); | 337 | mediaPlayerState->setPaused( TRUE ); |
337 | return; | 338 | return; |
338 | } else { | 339 | } else { |
339 | return; | 340 | return; |
340 | } | 341 | } |
341 | } | 342 | } |
342 | 343 | ||
343 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 344 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
344 | case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; | 345 | case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setNext(); return; |
345 | case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; | 346 | case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState->setPrev(); return; |
346 | case VideoVolUp: emit moreReleased(); return; | 347 | case VideoVolUp: emit moreReleased(); return; |
347 | case VideoVolDown: emit lessReleased(); return; | 348 | case VideoVolDown: emit lessReleased(); return; |
348 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 349 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
349 | } | 350 | } |
350 | } | 351 | } |
351 | } | 352 | } |
352 | } | 353 | } |
353 | } | 354 | } |
354 | 355 | ||
355 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 356 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
356 | mouseMoveEvent( event ); | 357 | mouseMoveEvent( event ); |
357 | } | 358 | } |
358 | 359 | ||
359 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 360 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
360 | if ( mediaPlayerState->isFullscreen() ) { | 361 | if ( mediaPlayerState->isFullscreen() ) { |
361 | mediaPlayerState->setFullscreen( FALSE ); | 362 | mediaPlayerState->setFullscreen( FALSE ); |
362 | makeVisible(); | 363 | makeVisible(); |
363 | } | 364 | } |
364 | mouseMoveEvent( event ); | 365 | mouseMoveEvent( event ); |
365 | } | 366 | } |
366 | 367 | ||
367 | void VideoWidget::showEvent( QShowEvent* ) { | 368 | void VideoWidget::showEvent( QShowEvent* ) { |
368 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 369 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
369 | mouseMoveEvent( &event ); | 370 | mouseMoveEvent( &event ); |
370 | } | 371 | } |
371 | 372 | ||
372 | 373 | ||
373 | void VideoWidget::backToNormal() { | 374 | void VideoWidget::backToNormal() { |
374 | mediaPlayerState->setFullscreen( FALSE ); | 375 | mediaPlayerState->setFullscreen( FALSE ); |
375 | makeVisible(); | 376 | makeVisible(); |
376 | } | 377 | } |
377 | 378 | ||
378 | void VideoWidget::makeVisible() { | 379 | void VideoWidget::makeVisible() { |
379 | if ( mediaPlayerState->isFullscreen() ) { | 380 | if ( mediaPlayerState->isFullscreen() ) { |
380 | setBackgroundMode( QWidget::NoBackground ); | 381 | setBackgroundMode( QWidget::NoBackground ); |
381 | showFullScreen(); | 382 | showFullScreen(); |
382 | resize( qApp->desktop()->size() ); | 383 | resize( qApp->desktop()->size() ); |
383 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 384 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
384 | 385 | ||
385 | slider->hide(); | 386 | slider->hide(); |
386 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 387 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
387 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 388 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
388 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 389 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
389 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 390 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
390 | 391 | ||
391 | } else { | 392 | } else { |
392 | showNormal(); | 393 | showNormal(); |
393 | showMaximized(); | 394 | showMaximized(); |
394 | setBackgroundPixmap( *pixBg ); | 395 | setBackgroundPixmap( *pixBg ); |
395 | QWidget *d = QApplication::desktop(); | 396 | QWidget *d = QApplication::desktop(); |
396 | int w = d->width(); | 397 | int w = d->width(); |
397 | int h = d->height(); | 398 | int h = d->height(); |
398 | 399 | ||
399 | if(w>h) { | 400 | if(w>h) { |
400 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 401 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
401 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 402 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
402 | } else { | 403 | } else { |
403 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 404 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
404 | } | 405 | } |
405 | 406 | ||
406 | if ( !mediaPlayerState->isSeekable() ) { | 407 | if ( !mediaPlayerState->isSeekable() ) { |
407 | if( !slider->isHidden()) { | 408 | if( !slider->isHidden()) { |
408 | slider->hide(); | 409 | slider->hide(); |
409 | } | 410 | } |
410 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 411 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
411 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 412 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
412 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 413 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
413 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 414 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
414 | } else { | 415 | } else { |
415 | slider->show(); | 416 | slider->show(); |
416 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 417 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
417 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 418 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
418 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 419 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
419 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 420 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
420 | } | 421 | } |
421 | } | 422 | } |
422 | } | 423 | } |
423 | 424 | ||
424 | 425 | ||
425 | 426 | ||
426 | 427 | ||
427 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 428 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
428 | QPainter p( this ); | 429 | QPainter p( this ); |
429 | 430 | ||
430 | if ( mediaPlayerState->isFullscreen() ) { | 431 | if ( mediaPlayerState->isFullscreen() ) { |
431 | // Clear the background | 432 | // Clear the background |
432 | p.setBrush( QBrush( Qt::black ) ); | 433 | p.setBrush( QBrush( Qt::black ) ); |
433 | } else { | 434 | } else { |
434 | if ( !pe->erased() ) { | 435 | if ( !pe->erased() ) { |
435 | // Combine with background and double buffer | 436 | // Combine with background and double buffer |
436 | QPixmap pix( pe->rect().size() ); | 437 | QPixmap pix( pe->rect().size() ); |
437 | QPainter p( &pix ); | 438 | QPainter p( &pix ); |
438 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 439 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
439 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 440 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
440 | for ( int i = 0; i < numVButtons; i++ ) { | 441 | for ( int i = 0; i < numVButtons; i++ ) { |
441 | paintButton( &p, i ); | 442 | paintButton( &p, i ); |
442 | } | 443 | } |
443 | QPainter p2( this ); | 444 | QPainter p2( this ); |
444 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 445 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
445 | } else { | 446 | } else { |
446 | QPainter p( this ); | 447 | QPainter p( this ); |
447 | for ( int i = 0; i < numVButtons; i++ ) | 448 | for ( int i = 0; i < numVButtons; i++ ) |
448 | paintButton( &p, i ); | 449 | paintButton( &p, i ); |
449 | } | 450 | } |
450 | //slider->repaint( TRUE ); | 451 | //slider->repaint( TRUE ); |
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
454 | 455 | ||
455 | void VideoWidget::closeEvent( QCloseEvent* ) { | 456 | void VideoWidget::closeEvent( QCloseEvent* ) { |
456 | mediaPlayerState->setList(); | 457 | mediaPlayerState->setList(); |
457 | } | 458 | } |
458 | 459 | ||
459 | 460 | ||
460 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 461 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
461 | switch ( e->key() ) { | 462 | switch ( e->key() ) { |
462 | ////////////////////////////// Zaurus keys | 463 | ////////////////////////////// Zaurus keys |
463 | case Key_Home: | 464 | case Key_Home: |
464 | break; | 465 | break; |
465 | case Key_F9: //activity | 466 | case Key_F9: //activity |
466 | break; | 467 | break; |
467 | case Key_F10: //contacts | 468 | case Key_F10: //contacts |
468 | // hide(); | 469 | // hide(); |
469 | break; | 470 | break; |
470 | case Key_F11: //menu | 471 | case Key_F11: //menu |
471 | break; | 472 | break; |
472 | case Key_F12: //home | 473 | case Key_F12: //home |
473 | break; | 474 | break; |
474 | case Key_F13: //mail | 475 | case Key_F13: //mail |
475 | break; | 476 | break; |
476 | case Key_Space: { | 477 | case Key_Space: { |
477 | if(mediaPlayerState->isPlaying()) { | 478 | if(mediaPlayerState->isPlaying()) { |
478 | mediaPlayerState->setPlaying(FALSE); | 479 | mediaPlayerState->setPlaying(FALSE); |
479 | } else { | 480 | } else { |
480 | mediaPlayerState->setPlaying(TRUE); | 481 | mediaPlayerState->setPlaying(TRUE); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | break; | 484 | break; |
484 | case Key_Down: | 485 | case Key_Down: |
485 | // toggleButton(6); | 486 | // toggleButton(6); |
486 | emit lessClicked(); | 487 | emit lessClicked(); |
487 | emit lessReleased(); | 488 | emit lessReleased(); |
488 | // toggleButton(6); | 489 | // toggleButton(6); |
489 | break; | 490 | break; |
490 | case Key_Up: | 491 | case Key_Up: |
491 | // toggleButton(5); | 492 | // toggleButton(5); |
492 | emit moreClicked(); | 493 | emit moreClicked(); |
493 | emit moreReleased(); | 494 | emit moreReleased(); |
494 | // toggleButton(5); | 495 | // toggleButton(5); |
495 | break; | 496 | break; |
496 | case Key_Right: | 497 | case Key_Right: |
497 | mediaPlayerState->setNext(); | 498 | mediaPlayerState->setNext(); |
498 | break; | 499 | break; |
499 | case Key_Left: | 500 | case Key_Left: |
500 | mediaPlayerState->setPrev(); | 501 | mediaPlayerState->setPrev(); |
501 | break; | 502 | break; |
502 | case Key_Escape: | 503 | case Key_Escape: |
503 | break; | 504 | break; |
504 | 505 | ||
505 | }; | 506 | }; |
506 | } | 507 | } |
507 | 508 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 990fa5f..89af646 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -1,123 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include "xinevideowidget.h" | 38 | #include "xinevideowidget.h" |
39 | 39 | ||
40 | #include "mediaplayerstate.h" | ||
41 | |||
40 | class QPixmap; | 42 | class QPixmap; |
41 | class QSlider; | 43 | class QSlider; |
42 | 44 | ||
43 | enum VideoButtons { | 45 | enum VideoButtons { |
44 | VideoStop = 0, | 46 | VideoStop = 0, |
45 | VideoPlay, | 47 | VideoPlay, |
46 | // VideoPause, | 48 | // VideoPause, |
47 | VideoPrevious, | 49 | VideoPrevious, |
48 | VideoNext, | 50 | VideoNext, |
49 | VideoVolUp, | 51 | VideoVolUp, |
50 | VideoVolDown, | 52 | VideoVolDown, |
51 | VideoFullscreen | 53 | VideoFullscreen |
52 | }; | 54 | }; |
53 | 55 | ||
54 | class VideoWidget : public QWidget { | 56 | class VideoWidget : public QWidget { |
55 | Q_OBJECT | 57 | Q_OBJECT |
56 | public: | 58 | public: |
57 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 59 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
58 | ~VideoWidget(); | 60 | ~VideoWidget(); |
59 | 61 | ||
60 | 62 | ||
61 | XineVideoWidget* vidWidget(); | 63 | XineVideoWidget* vidWidget(); |
62 | public slots: | 64 | public slots: |
63 | void updateSlider( long, long ); | 65 | void updateSlider( long, long ); |
64 | void sliderPressed( ); | 66 | void sliderPressed( ); |
65 | void sliderReleased( ); | 67 | void sliderReleased( ); |
66 | void setPlaying( bool b); | 68 | void setPlaying( bool b); |
67 | void setFullscreen( bool b ); | 69 | void setFullscreen( bool b ); |
68 | void makeVisible(); | 70 | void makeVisible(); |
69 | void backToNormal(); | 71 | void backToNormal(); |
70 | void setPosition( long ); | 72 | void setPosition( long ); |
71 | void setLength( long ); | 73 | void setLength( long ); |
72 | void setView( char ); | 74 | void setDisplayType( MediaPlayerState::DisplayType displayType ); |
73 | 75 | ||
74 | signals: | 76 | signals: |
75 | void moreClicked(); | 77 | void moreClicked(); |
76 | void lessClicked(); | 78 | void lessClicked(); |
77 | void moreReleased(); | 79 | void moreReleased(); |
78 | void lessReleased(); | 80 | void lessReleased(); |
79 | void sliderMoved( long ); | 81 | void sliderMoved( long ); |
80 | void videoResized ( const QSize &s ); | 82 | void videoResized ( const QSize &s ); |
81 | 83 | ||
82 | protected: | 84 | protected: |
83 | 85 | ||
84 | void resizeEvent( QResizeEvent * ); | 86 | void resizeEvent( QResizeEvent * ); |
85 | void paintEvent( QPaintEvent *pe ); | 87 | void paintEvent( QPaintEvent *pe ); |
86 | void showEvent( QShowEvent *se ); | 88 | void showEvent( QShowEvent *se ); |
87 | void mouseMoveEvent( QMouseEvent *event ); | 89 | void mouseMoveEvent( QMouseEvent *event ); |
88 | void mousePressEvent( QMouseEvent *event ); | 90 | void mousePressEvent( QMouseEvent *event ); |
89 | void mouseReleaseEvent( QMouseEvent *event ); | 91 | void mouseReleaseEvent( QMouseEvent *event ); |
90 | void closeEvent( QCloseEvent *event ); | 92 | void closeEvent( QCloseEvent *event ); |
91 | void keyReleaseEvent( QKeyEvent *e); | 93 | void keyReleaseEvent( QKeyEvent *e); |
92 | 94 | ||
93 | private: | 95 | private: |
94 | // Ticker songInfo; | 96 | // Ticker songInfo; |
95 | QPixmap *pixBg; | 97 | QPixmap *pixBg; |
96 | QImage *imgUp; | 98 | QImage *imgUp; |
97 | QImage *imgDn; | 99 | QImage *imgDn; |
98 | QImage *imgButtonMask; | 100 | QImage *imgButtonMask; |
99 | QBitmap *masks[7]; | 101 | QBitmap *masks[7]; |
100 | QPixmap *buttonPixUp[7]; | 102 | QPixmap *buttonPixUp[7]; |
101 | QPixmap *buttonPixDown[7]; | 103 | QPixmap *buttonPixDown[7]; |
102 | QString skin; | 104 | QString skin; |
103 | // QPixmap *pixmaps[4]; | 105 | // QPixmap *pixmaps[4]; |
104 | int xoff, yoff; | 106 | int xoff, yoff; |
105 | 107 | ||
106 | 108 | ||
107 | void paintButton( QPainter *p, int i ); | 109 | void paintButton( QPainter *p, int i ); |
108 | void toggleButton( int ); | 110 | void toggleButton( int ); |
109 | void setToggleButton( int, bool ); | 111 | void setToggleButton( int, bool ); |
110 | 112 | ||
111 | QString backgroundPix; | 113 | QString backgroundPix; |
112 | QSlider *slider; | 114 | QSlider *slider; |
113 | QPixmap *pixmaps[3]; | 115 | QPixmap *pixmaps[3]; |
114 | QImage *currentFrame; | 116 | QImage *currentFrame; |
115 | int scaledWidth; | 117 | int scaledWidth; |
116 | int scaledHeight; | 118 | int scaledHeight; |
117 | XineVideoWidget* videoFrame; | 119 | XineVideoWidget* videoFrame; |
118 | }; | 120 | }; |
119 | 121 | ||
120 | #endif // VIDEO_WIDGET_H | 122 | #endif // VIDEO_WIDGET_H |
121 | 123 | ||
122 | 124 | ||
123 | 125 | ||