summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h6
5 files changed, 16 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 0516089..0b7cc45 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,374 +1,374 @@
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/config.h> 36#include <qpe/config.h>
37#include <opie/oticker.h> 37#include <opie/oticker.h>
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qbutton.h> 41#include <qbutton.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48 48
49#include "audiowidget.h" 49#include "audiowidget.h"
50#include "mediaplayerstate.h" 50#include "mediaplayerstate.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52 52
53namespace 53namespace
54{ 54{
55 55
56const int xo = -2; // movable x offset 56const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset 57const int yo = 22; // movable y offset
58 58
59const MediaWidget::SkinButtonInfo skinInfo[] = 59const MediaWidget::SkinButtonInfo skinInfo[] =
60{ 60{
61 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 61 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
63 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 63 { MediaWidget::Next, "next", MediaWidget::NormalButton },
64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
70 { MediaWidget::Back, "back", MediaWidget::NormalButton } 70 { MediaWidget::Back, "back", MediaWidget::NormalButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75void changeTextColor( QWidget * w) { 75void changeTextColor( QWidget * w) {
76 QPalette p = w->palette(); 76 QPalette p = w->palette();
77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
79 w->setPalette( p ); 79 w->setPalette( p );
80} 80}
81 81
82} 82}
83 83
84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
85 85
86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
87 audioSliderBeingMoved( false ) 87 audioSliderBeingMoved( false )
88{ 88{
89 setCaption( tr("OpiePlayer") ); 89 setCaption( tr("OpiePlayer") );
90 90
91 loadSkin(); 91 loadSkin();
92 92
93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
95 95
96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
100 100
101 // Intialise state 101 // Intialise state
102 setLength( mediaPlayerState.length() ); 102 setLength( mediaPlayerState.length() );
103 setPosition( mediaPlayerState.position() ); 103 setPosition( mediaPlayerState.position() );
104 setLooping( mediaPlayerState.isFullscreen() ); 104 setLooping( mediaPlayerState.isFullscreen() );
105 // setPaused( mediaPlayerState->paused() ); 105 // setPaused( mediaPlayerState->paused() );
106 setPlaying( mediaPlayerState.isPlaying() ); 106 setPlaying( mediaPlayerState.isPlaying() );
107} 107}
108 108
109AudioWidget::~AudioWidget() { 109AudioWidget::~AudioWidget() {
110 110
111// mediaPlayerState->setPlaying(false); 111// mediaPlayerState->setPlaying(false);
112} 112}
113 113
114namespace { 114namespace {
115 115
116QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 116QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
117 QPixmap pix( img.width(), img.height() ); 117 QPixmap pix( img.width(), img.height() );
118 QPainter p( &pix ); 118 QPainter p( &pix );
119 p.drawTiledPixmap( pix.rect(), bg, offset ); 119 p.drawTiledPixmap( pix.rect(), bg, offset );
120 p.drawImage( 0, 0, img ); 120 p.drawImage( 0, 0, img );
121 return pix; 121 return pix;
122} 122}
123 123
124 124
125QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { 125QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) {
126 QPixmap pixmap( pix ); 126 QPixmap pixmap( pix );
127 pixmap.setMask( mask ); 127 pixmap.setMask( mask );
128 return pixmap; 128 return pixmap;
129} 129}
130 130
131}; 131};
132 132
133void AudioWidget::resizeEvent( QResizeEvent * ) { 133void AudioWidget::resizeEvent( QResizeEvent * ) {
134 int h = height(); 134 int h = height();
135 int w = width(); 135 int w = width();
136 136
137 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 137 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
138 slider.setFixedWidth( w - 110 ); 138 slider.setFixedWidth( w - 110 );
139 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 139 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
140 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 140 slider.setBackgroundOrigin( QWidget::ParentOrigin );
141 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 141 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
142 142
143 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; 143 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
144 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; 144 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
145 QPoint p = upperLeftOfButtonMask; 145 QPoint p = upperLeftOfButtonMask;
146 146
147 QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); 147 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, p );
148 QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); 148 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, p );
149 149
150 for ( uint i = 0; i < buttons.size(); i++ ) { 150 for ( uint i = 0; i < buttons.size(); i++ ) {
151 if ( !buttons[i].mask.isNull() ) { 151 if ( !buttons[i].mask.isNull() ) {
152 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); 152 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask );
153 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); 153 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask );
154 } 154 }
155 } 155 }
156} 156}
157 157
158void AudioWidget::sliderPressed() { 158void AudioWidget::sliderPressed() {
159 audioSliderBeingMoved = TRUE; 159 audioSliderBeingMoved = TRUE;
160} 160}
161 161
162 162
163void AudioWidget::sliderReleased() { 163void AudioWidget::sliderReleased() {
164 audioSliderBeingMoved = FALSE; 164 audioSliderBeingMoved = FALSE;
165 if ( slider.width() == 0 ) 165 if ( slider.width() == 0 )
166 return; 166 return;
167 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 167 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
168 mediaPlayerState.setPosition( val ); 168 mediaPlayerState.setPosition( val );
169} 169}
170 170
171void AudioWidget::setPosition( long i ) { 171void AudioWidget::setPosition( long i ) {
172 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 172 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
173 updateSlider( i, mediaPlayerState.length() ); 173 updateSlider( i, mediaPlayerState.length() );
174} 174}
175 175
176 176
177void AudioWidget::setLength( long max ) { 177void AudioWidget::setLength( long max ) {
178 updateSlider( mediaPlayerState.position(), max ); 178 updateSlider( mediaPlayerState.position(), max );
179} 179}
180 180
181 181
182void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 182void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
183 if ( mediaType == MediaPlayerState::Audio ) { 183 if ( mediaType == MediaPlayerState::Audio ) {
184 // startTimer( 150 ); 184 // startTimer( 150 );
185 showMaximized(); 185 showMaximized();
186 return; 186 return;
187 } 187 }
188 188
189 killTimers(); 189 killTimers();
190 hide(); 190 hide();
191} 191}
192 192
193void AudioWidget::loadSkin() 193void AudioWidget::loadSkin()
194{ 194{
195 Config cfg("OpiePlayer"); 195 Config cfg("OpiePlayer");
196 cfg.setGroup("Options"); 196 cfg.setGroup("Options");
197 skin = cfg.readEntry("Skin","default"); 197 skin = cfg.readEntry("Skin","default");
198 //skin = "scaleTest"; 198 //skin = "scaleTest";
199 // color of background, frame, degree of transparency 199 // color of background, frame, degree of transparency
200 200
201 QString skinPath = "opieplayer2/skins/" + skin; 201 QString skinPath = "opieplayer2/skins/" + skin;
202 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 202 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
203 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 203 buttonUpImage = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
204 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 204 buttonDownImage = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
205 205
206 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); 206 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", buttonUpImage.size() );
207 207
208 setBackgroundPixmap( backgroundPixmap ); 208 setBackgroundPixmap( backgroundPixmap );
209 209
210 songInfo.setFocusPolicy( QWidget::NoFocus ); 210 songInfo.setFocusPolicy( QWidget::NoFocus );
211// changeTextColor( &songInfo ); 211// changeTextColor( &songInfo );
212// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 212// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
213// songInfo.setFrameStyle( QFrame::NoFrame); 213// songInfo.setFrameStyle( QFrame::NoFrame);
214 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 214 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
215// songInfo.setForegroundColor(Qt::white); 215// songInfo.setForegroundColor(Qt::white);
216 216
217 slider.setFixedHeight( 20 ); 217 slider.setFixedHeight( 20 );
218 slider.setMinValue( 0 ); 218 slider.setMinValue( 0 );
219 slider.setMaxValue( 1 ); 219 slider.setMaxValue( 1 );
220 slider.setFocusPolicy( QWidget::NoFocus ); 220 slider.setFocusPolicy( QWidget::NoFocus );
221 slider.setBackgroundPixmap( backgroundPixmap ); 221 slider.setBackgroundPixmap( backgroundPixmap );
222 222
223// Config cofg("qpe"); 223// Config cofg("qpe");
224// cofg.setGroup("Appearance"); 224// cofg.setGroup("Appearance");
225// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 225// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
226 226
227 time.setFocusPolicy( QWidget::NoFocus ); 227 time.setFocusPolicy( QWidget::NoFocus );
228 time.setAlignment( Qt::AlignCenter ); 228 time.setAlignment( Qt::AlignCenter );
229 229
230// time.setFrame(FALSE); 230// time.setFrame(FALSE);
231// changeTextColor( &time ); 231// changeTextColor( &time );
232 232
233 resizeEvent( 0 ); 233 resizeEvent( 0 );
234} 234}
235 235
236void AudioWidget::setSeekable( bool isSeekable ) { 236void AudioWidget::setSeekable( bool isSeekable ) {
237 237
238 if ( !isSeekable ) { 238 if ( !isSeekable ) {
239 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 239 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
240 if( !slider.isHidden()) { 240 if( !slider.isHidden()) {
241 slider.hide(); 241 slider.hide();
242 } 242 }
243 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 243 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
244 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 244 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
245 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 245 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
246 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 246 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
247 } else { 247 } else {
248 // this stops the slider from being moved, thus 248 // this stops the slider from being moved, thus
249 // does not stop stream when it reaches the end 249 // does not stop stream when it reaches the end
250 slider.show(); 250 slider.show();
251 qDebug( " CONNECT SET POSTION " ); 251 qDebug( " CONNECT SET POSTION " );
252 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 252 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
253 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 253 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
254 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 254 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
255 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 255 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
256 } 256 }
257} 257}
258 258
259 259
260static QString timeAsString( long length ) { 260static QString timeAsString( long length ) {
261 int minutes = length / 60; 261 int minutes = length / 60;
262 int seconds = length % 60; 262 int seconds = length % 60;
263 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 263 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
264} 264}
265 265
266void AudioWidget::updateSlider( long i, long max ) { 266void AudioWidget::updateSlider( long i, long max ) {
267 267
268 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 268 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
269// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 269// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
270 270
271 if ( max == 0 ) { 271 if ( max == 0 ) {
272 return; 272 return;
273 } 273 }
274 // Will flicker too much if we don't do this 274 // Will flicker too much if we don't do this
275 // Scale to something reasonable 275 // Scale to something reasonable
276 int width = slider.width(); 276 int width = slider.width();
277 int val = int((double)i * width / max); 277 int val = int((double)i * width / max);
278 if ( !audioSliderBeingMoved ) { 278 if ( !audioSliderBeingMoved ) {
279 if ( slider.value() != val ) { 279 if ( slider.value() != val ) {
280 slider.setValue( val ); 280 slider.setValue( val );
281 } 281 }
282 282
283 if ( slider.maxValue() != width ) { 283 if ( slider.maxValue() != width ) {
284 slider.setMaxValue( width ); 284 slider.setMaxValue( width );
285 } 285 }
286 } 286 }
287} 287}
288 288
289void AudioWidget::skipFor() { 289void AudioWidget::skipFor() {
290 skipDirection = +1; 290 skipDirection = +1;
291 startTimer( 50 ); 291 startTimer( 50 );
292 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 292 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
293} 293}
294 294
295void AudioWidget::skipBack() { 295void AudioWidget::skipBack() {
296 skipDirection = -1; 296 skipDirection = -1;
297 startTimer( 50 ); 297 startTimer( 50 );
298 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 298 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
299} 299}
300 300
301 301
302 302
303void AudioWidget::stopSkip() { 303void AudioWidget::stopSkip() {
304 killTimers(); 304 killTimers();
305} 305}
306 306
307 307
308void AudioWidget::timerEvent( QTimerEvent * ) { 308void AudioWidget::timerEvent( QTimerEvent * ) {
309 if ( skipDirection == +1 ) { 309 if ( skipDirection == +1 ) {
310 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 310 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
311 } else if ( skipDirection == -1 ) { 311 } else if ( skipDirection == -1 ) {
312 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 312 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
313 } 313 }
314} 314}
315 315
316void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 316void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
317 switch ( e->key() ) { 317 switch ( e->key() ) {
318 ////////////////////////////// Zaurus keys 318 ////////////////////////////// Zaurus keys
319 case Key_Home: 319 case Key_Home:
320 break; 320 break;
321 case Key_F9: //activity 321 case Key_F9: //activity
322 hide(); 322 hide();
323 // qDebug("Audio F9"); 323 // qDebug("Audio F9");
324 e->accept(); 324 e->accept();
325 break; 325 break;
326 case Key_F10: //contacts 326 case Key_F10: //contacts
327 break; 327 break;
328 case Key_F11: //menu 328 case Key_F11: //menu
329 mediaPlayerState.toggleBlank(); 329 mediaPlayerState.toggleBlank();
330 e->accept(); 330 e->accept();
331 break; 331 break;
332 case Key_F12: //home 332 case Key_F12: //home
333 break; 333 break;
334 case Key_F13: //mail 334 case Key_F13: //mail
335 mediaPlayerState.toggleBlank(); 335 mediaPlayerState.toggleBlank();
336 e->accept(); 336 e->accept();
337 break; 337 break;
338 case Key_Space: { 338 case Key_Space: {
339 e->accept(); 339 e->accept();
340 mediaPlayerState.togglePaused(); 340 mediaPlayerState.togglePaused();
341 } 341 }
342 break; 342 break;
343 case Key_Down: 343 case Key_Down:
344 // toggleButton(6); 344 // toggleButton(6);
345 emit lessClicked(); 345 emit lessClicked();
346 emit lessReleased(); 346 emit lessReleased();
347 // toggleButton(6); 347 // toggleButton(6);
348 e->accept(); 348 e->accept();
349 break; 349 break;
350 case Key_Up: 350 case Key_Up:
351 // toggleButton(5); 351 // toggleButton(5);
352 emit moreClicked(); 352 emit moreClicked();
353 emit moreReleased(); 353 emit moreReleased();
354 // toggleButton(5); 354 // toggleButton(5);
355 e->accept(); 355 e->accept();
356 break; 356 break;
357 case Key_Right: 357 case Key_Right:
358 // toggleButton(3); 358 // toggleButton(3);
359 mediaPlayerState.setNext(); 359 mediaPlayerState.setNext();
360 // toggleButton(3); 360 // toggleButton(3);
361 e->accept(); 361 e->accept();
362 break; 362 break;
363 case Key_Left: 363 case Key_Left:
364 // toggleButton(4); 364 // toggleButton(4);
365 mediaPlayerState.setPrev(); 365 mediaPlayerState.setPrev();
366 // toggleButton(4); 366 // toggleButton(4);
367 e->accept(); 367 e->accept();
368 break; 368 break;
369 case Key_Escape: { 369 case Key_Escape: {
370 } 370 }
371 break; 371 break;
372 372
373 }; 373 };
374} 374}
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 61556c6..670fb45 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,101 +1,99 @@
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 AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 56 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 57 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58public slots: 58public slots:
59 void updateSlider( long, long ); 59 void updateSlider( long, long );
60 void sliderPressed( ); 60 void sliderPressed( );
61 void sliderReleased( ); 61 void sliderReleased( );
62 void setLooping( bool b) { setToggleButton( Loop, b ); } 62 void setLooping( bool b) { setToggleButton( Loop, b ); }
63 void setPosition( long ); 63 void setPosition( long );
64 void setSeekable( bool ); 64 void setSeekable( bool );
65 65
66public: 66public:
67 virtual void setLength( long ); 67 virtual void setLength( long );
68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 70
71 virtual void loadSkin(); 71 virtual void loadSkin();
72 72
73signals: 73signals:
74 void sliderMoved(long); 74 void sliderMoved(long);
75 75
76protected: 76protected:
77 void doBlank(); 77 void doBlank();
78 void doUnblank(); 78 void doUnblank();
79 void resizeEvent( QResizeEvent *re ); 79 void resizeEvent( QResizeEvent *re );
80 void timerEvent( QTimerEvent *event ); 80 void timerEvent( QTimerEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
82private slots: 82private slots:
83 void skipFor(); 83 void skipFor();
84 void skipBack(); 84 void skipBack();
85 void stopSkip(); 85 void stopSkip();
86private: 86private:
87 int skipDirection; 87 int skipDirection;
88 QString skin; 88 QString skin;
89 QImage imgUp;
90 QImage imgDn;
91 89
92 OTicker songInfo; 90 OTicker songInfo;
93 QSlider slider; 91 QSlider slider;
94 QLineEdit time; 92 QLineEdit time;
95 bool isStreaming : 1; 93 bool isStreaming : 1;
96 bool audioSliderBeingMoved : 1; 94 bool audioSliderBeingMoved : 1;
97}; 95};
98 96
99 97
100#endif // AUDIO_WIDGET_H 98#endif // AUDIO_WIDGET_H
101 99
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index a9dddf8..754228e 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,144 +1,146 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#ifndef MEDIAWIDGET_H 23#ifndef MEDIAWIDGET_H
24#define MEDIAWIDGET_H 24#define MEDIAWIDGET_H
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qmap.h> 27#include <qmap.h>
28 28
29#include "mediaplayerstate.h" 29#include "mediaplayerstate.h"
30#include "playlistwidget.h" 30#include "playlistwidget.h"
31 31
32#include <vector> 32#include <vector>
33#include <memory> 33#include <memory>
34 34
35namespace 35namespace
36{ 36{
37 struct simpleAndStupidAllocator 37 struct simpleAndStupidAllocator
38 { 38 {
39 static void *allocate( size_t amount ) 39 static void *allocate( size_t amount )
40 { return ::operator new( amount ); } 40 { return ::operator new( amount ); }
41 static void deallocate( void *p, size_t ) 41 static void deallocate( void *p, size_t )
42 { ::operator delete( p ); } 42 { ::operator delete( p ); }
43 }; 43 };
44} 44}
45 45
46class MediaWidget : public QWidget 46class MediaWidget : public QWidget
47{ 47{
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; 50 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
51 enum ButtonType { NormalButton, ToggleButton }; 51 enum ButtonType { NormalButton, ToggleButton };
52 52
53 struct Button 53 struct Button
54 { 54 {
55 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {} 55 Button() : command( Undefined ), type( NormalButton ), isDown( false ) {}
56 56
57 Command command; 57 Command command;
58 58
59 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( 59 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
60 bool isDown : 1; 60 bool isDown : 1;
61 61
62 QBitmap mask; 62 QBitmap mask;
63 QPixmap pixUp; 63 QPixmap pixUp;
64 QPixmap pixDown; 64 QPixmap pixDown;
65 }; 65 };
66#if defined( _CC_GNU_ ) 66#if defined( _CC_GNU_ )
67 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because 67 // use that allocator to avoid the default allocator that on gcc2 requires libstdc++ because
68 // in the BAD_ALLOC macro it uses std::cerr and friends :-( 68 // in the BAD_ALLOC macro it uses std::cerr and friends :-(
69 typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector; 69 typedef std::vector<Button, std::__allocator<Button, simpleAndStupidAllocator> > ButtonVector;
70#else 70#else
71 typedef std::vector<Button> ButtonVector; 71 typedef std::vector<Button> ButtonVector;
72#endif 72#endif
73 73
74 struct SkinButtonInfo 74 struct SkinButtonInfo
75 { 75 {
76 Command command; 76 Command command;
77 const char *fileName; 77 const char *fileName;
78 ButtonType type; 78 ButtonType type;
79 }; 79 };
80 80
81 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 81 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
82 virtual ~MediaWidget(); 82 virtual ~MediaWidget();
83 83
84public slots: 84public slots:
85 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 85 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
86 virtual void setLength( long length ) = 0; 86 virtual void setLength( long length ) = 0;
87 virtual void setPlaying( bool playing ) = 0; 87 virtual void setPlaying( bool playing ) = 0;
88 88
89 virtual void loadSkin() = 0; 89 virtual void loadSkin() = 0;
90 90
91signals: 91signals:
92 void moreReleased(); 92 void moreReleased();
93 void lessReleased(); 93 void lessReleased();
94 void forwardReleased(); 94 void forwardReleased();
95 void backReleased(); 95 void backReleased();
96 void forwardClicked(); 96 void forwardClicked();
97 void backClicked(); 97 void backClicked();
98 void moreClicked(); 98 void moreClicked();
99 void lessClicked(); 99 void lessClicked();
100 100
101protected: 101protected:
102 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 102 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
103 const QString &imagePrefix, const QSize &buttonAreaSize ); 103 const QString &imagePrefix, const QSize &buttonAreaSize );
104 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); 104 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix );
105 QBitmap setupButtonMask( const Command &command, const QString &fileName ); 105 QBitmap setupButtonMask( const Command &command, const QString &fileName );
106 106
107 virtual void closeEvent( QCloseEvent * ); 107 virtual void closeEvent( QCloseEvent * );
108 108
109 virtual void paintEvent( QPaintEvent *pe ); 109 virtual void paintEvent( QPaintEvent *pe );
110 110
111 Button *buttonAt( const QPoint &position ); 111 Button *buttonAt( const QPoint &position );
112 112
113 virtual void mousePressEvent( QMouseEvent *event ); 113 virtual void mousePressEvent( QMouseEvent *event );
114 virtual void mouseReleaseEvent( QMouseEvent *event ); 114 virtual void mouseReleaseEvent( QMouseEvent *event );
115 115
116 virtual void makeVisible(); 116 virtual void makeVisible();
117 117
118 void handleCommand( Command command, bool buttonDown ); 118 void handleCommand( Command command, bool buttonDown );
119 119
120 bool isOverButton( const QPoint &position, int buttonId ) const; 120 bool isOverButton( const QPoint &position, int buttonId ) const;
121 121
122 void paintAllButtons( QPainter &p ); 122 void paintAllButtons( QPainter &p );
123 void paintButton( const Button &button ); 123 void paintButton( const Button &button );
124 void paintButton( QPainter &p, const Button &button ); 124 void paintButton( QPainter &p, const Button &button );
125 125
126 void setToggleButton( Button &button, bool down ); 126 void setToggleButton( Button &button, bool down );
127 void setToggleButton( Command command, bool down ); 127 void setToggleButton( Command command, bool down );
128 void toggleButton( Button &button ); 128 void toggleButton( Button &button );
129 129
130 MediaPlayerState &mediaPlayerState; 130 MediaPlayerState &mediaPlayerState;
131 PlayListWidget &playList; 131 PlayListWidget &playList;
132 132
133 ButtonVector buttons; 133 ButtonVector buttons;
134 134
135 QImage buttonMask; 135 QImage buttonMask;
136 136
137 QPoint upperLeftOfButtonMask; 137 QPoint upperLeftOfButtonMask;
138 138
139 QPixmap backgroundPixmap; 139 QPixmap backgroundPixmap;
140 QImage buttonUpImage;
141 QImage buttonDownImage;
140}; 142};
141 143
142#endif // MEDIAWIDGET_H 144#endif // MEDIAWIDGET_H
143/* vim: et sw=4 ts=4 145/* vim: et sw=4 ts=4
144 */ 146 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index a03d43e..0047ac0 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,348 +1,348 @@
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/config.h> 36#include <qpe/config.h>
37 37
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpainter.h> 40#include <qpainter.h>
41#include <qpixmap.h> 41#include <qpixmap.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qdrawutil.h> 43#include <qdrawutil.h>
44#include "videowidget.h" 44#include "videowidget.h"
45#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
46#include "playlistwidget.h" 46#include "playlistwidget.h"
47 47
48 48
49#ifdef Q_WS_QWS 49#ifdef Q_WS_QWS
50# define USE_DIRECT_PAINTER 50# define USE_DIRECT_PAINTER
51# include <qdirectpainter_qws.h> 51# include <qdirectpainter_qws.h>
52# include <qgfxraster_qws.h> 52# include <qgfxraster_qws.h>
53#endif 53#endif
54 54
55 55
56namespace 56namespace
57{ 57{
58 58
59const int xo = 2; // movable x offset 59const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 60const int yo = 0; // movable y offset
61 61
62const MediaWidget::SkinButtonInfo skinInfo[] = 62const MediaWidget::SkinButtonInfo skinInfo[] =
63{ 63{
64 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 64 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
67 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 67 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
71}; 71};
72 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 74
75} 75}
76 76
77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
79{ 79{
80 setCaption( tr("OpiePlayer - Video") ); 80 setCaption( tr("OpiePlayer - Video") );
81 81
82 videoFrame = new XineVideoWidget ( this, "Video frame" ); 82 videoFrame = new XineVideoWidget ( this, "Video frame" );
83 83
84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
86 86
87 slider = 0; 87 slider = 0;
88 88
89 loadSkin(); 89 loadSkin();
90 90
91 setLength( mediaPlayerState.length() ); 91 setLength( mediaPlayerState.length() );
92 setPosition( mediaPlayerState.position() ); 92 setPosition( mediaPlayerState.position() );
93 setFullscreen( mediaPlayerState.isFullscreen() ); 93 setFullscreen( mediaPlayerState.isFullscreen() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97 97
98VideoWidget::~VideoWidget() 98VideoWidget::~VideoWidget()
99{ 99{
100} 100}
101 101
102QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 102QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
103 QPixmap pix( img.width(), img.height() ); 103 QPixmap pix( img.width(), img.height() );
104 QPainter p( &pix ); 104 QPainter p( &pix );
105 p.drawTiledPixmap( pix.rect(), bg, offset ); 105 p.drawTiledPixmap( pix.rect(), bg, offset );
106 p.drawImage( 0, 0, img ); 106 p.drawImage( 0, 0, img );
107 return new QPixmap( pix ); 107 return new QPixmap( pix );
108} 108}
109 109
110QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { 110QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) {
111 QPixmap pixmap( pix ); 111 QPixmap pixmap( pix );
112 pixmap.setMask( mask ); 112 pixmap.setMask( mask );
113 return pixmap; 113 return pixmap;
114} 114}
115 115
116void VideoWidget::resizeEvent( QResizeEvent * ) { 116void VideoWidget::resizeEvent( QResizeEvent * ) {
117 int h = height(); 117 int h = height();
118 int w = width(); 118 int w = width();
119 //int Vh = 160; 119 //int Vh = 160;
120 //int Vw = 220; 120 //int Vw = 220;
121 121
122 slider->setFixedWidth( w - 20 ); 122 slider->setFixedWidth( w - 20 );
123 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 123 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
124 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 124 slider->setBackgroundOrigin( QWidget::ParentOrigin );
125 slider->setFocusPolicy( QWidget::NoFocus ); 125 slider->setFocusPolicy( QWidget::NoFocus );
126 slider->setBackgroundPixmap( backgroundPixmap ); 126 slider->setBackgroundPixmap( backgroundPixmap );
127 127
128 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 128 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
129 if(w>h) 129 if(w>h)
130 upperLeftOfButtonMask.ry() = 0; 130 upperLeftOfButtonMask.ry() = 0;
131 else 131 else
132 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 132 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
133 QPoint p = upperLeftOfButtonMask; 133 QPoint p = upperLeftOfButtonMask;
134 134
135 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); 135 QPixmap *pixUp = combineVImageWithBackground( buttonUpImage, backgroundPixmap, p );
136 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); 136 QPixmap *pixDn = combineVImageWithBackground( buttonDownImage, backgroundPixmap, p );
137 137
138 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 138 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
139 Button &button = *it; 139 Button &button = *it;
140 140
141 if ( !button.mask.isNull() ) { 141 if ( !button.mask.isNull() ) {
142 button.pixUp = maskVPixToMask( *pixUp, button.mask ); 142 button.pixUp = maskVPixToMask( *pixUp, button.mask );
143 button.pixDown = maskVPixToMask( *pixDn, button.mask ); 143 button.pixDown = maskVPixToMask( *pixDn, button.mask );
144 } 144 }
145 } 145 }
146 146
147 delete pixUp; 147 delete pixUp;
148 delete pixDn; 148 delete pixDn;
149} 149}
150 150
151void VideoWidget::sliderPressed() { 151void VideoWidget::sliderPressed() {
152 videoSliderBeingMoved = TRUE; 152 videoSliderBeingMoved = TRUE;
153} 153}
154 154
155void VideoWidget::sliderReleased() { 155void VideoWidget::sliderReleased() {
156 videoSliderBeingMoved = FALSE; 156 videoSliderBeingMoved = FALSE;
157 if ( slider->width() == 0 ) { 157 if ( slider->width() == 0 ) {
158 return; 158 return;
159 } 159 }
160 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 160 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
161 mediaPlayerState.setPosition( val ); 161 mediaPlayerState.setPosition( val );
162} 162}
163 163
164void VideoWidget::setPosition( long i ) { 164void VideoWidget::setPosition( long i ) {
165 updateSlider( i, mediaPlayerState.length() ); 165 updateSlider( i, mediaPlayerState.length() );
166} 166}
167 167
168 168
169void VideoWidget::setLength( long max ) { 169void VideoWidget::setLength( long max ) {
170 updateSlider( mediaPlayerState.position(), max ); 170 updateSlider( mediaPlayerState.position(), max );
171} 171}
172 172
173void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 173void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
174{ 174{
175 if ( displayType == MediaPlayerState::Video ) { 175 if ( displayType == MediaPlayerState::Video ) {
176 makeVisible(); 176 makeVisible();
177 return; 177 return;
178 } 178 }
179 179
180 // Effectively blank the view next time we show it so it looks nicer 180 // Effectively blank the view next time we show it so it looks nicer
181 scaledWidth = 0; 181 scaledWidth = 0;
182 scaledHeight = 0; 182 scaledHeight = 0;
183 hide(); 183 hide();
184} 184}
185 185
186void VideoWidget::loadSkin() 186void VideoWidget::loadSkin()
187{ 187{
188 Config cfg("OpiePlayer"); 188 Config cfg("OpiePlayer");
189 cfg.setGroup("Options"); 189 cfg.setGroup("Options");
190 skin = cfg.readEntry("Skin","default"); 190 QString skin = cfg.readEntry("Skin","default");
191 191
192 QString skinPath = "opieplayer2/skins/" + skin; 192 QString skinPath = "opieplayer2/skins/" + skin;
193 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 193 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
194 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 194 buttonUpImage = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
195 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 195 buttonDownImage = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
196 196
197 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() ); 197 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", buttonUpImage.size() );
198 198
199 setBackgroundPixmap( backgroundPixmap ); 199 setBackgroundPixmap( backgroundPixmap );
200 200
201 delete slider; 201 delete slider;
202 slider = new QSlider( Qt::Horizontal, this ); 202 slider = new QSlider( Qt::Horizontal, this );
203 slider->setMinValue( 0 ); 203 slider->setMinValue( 0 );
204 slider->setMaxValue( 1 ); 204 slider->setMaxValue( 1 );
205 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 205 slider->setBackgroundPixmap( backgroundPixmap );
206 //slider->setFocusPolicy( QWidget::NoFocus ); 206 //slider->setFocusPolicy( QWidget::NoFocus );
207 207
208 resizeEvent( 0 ); 208 resizeEvent( 0 );
209} 209}
210 210
211void VideoWidget::updateSlider( long i, long max ) { 211void VideoWidget::updateSlider( long i, long max ) {
212 // Will flicker too much if we don't do this 212 // Will flicker too much if we don't do this
213 if ( max == 0 ) { 213 if ( max == 0 ) {
214 return; 214 return;
215 } 215 }
216 int width = slider->width(); 216 int width = slider->width();
217 int val = int((double)i * width / max); 217 int val = int((double)i * width / max);
218 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 218 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
219 if ( slider->value() != val ) { 219 if ( slider->value() != val ) {
220 slider->setValue( val ); 220 slider->setValue( val );
221 } 221 }
222 if ( slider->maxValue() != width ) { 222 if ( slider->maxValue() != width ) {
223 slider->setMaxValue( width ); 223 slider->setMaxValue( width );
224 } 224 }
225 } 225 }
226} 226}
227 227
228void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 228void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
229 if ( mediaPlayerState.isFullscreen() ) { 229 if ( mediaPlayerState.isFullscreen() ) {
230 mediaPlayerState.setFullscreen( FALSE ); 230 mediaPlayerState.setFullscreen( FALSE );
231 makeVisible(); 231 makeVisible();
232 } 232 }
233 MediaWidget::mouseReleaseEvent( event ); 233 MediaWidget::mouseReleaseEvent( event );
234} 234}
235 235
236void VideoWidget::backToNormal() { 236void VideoWidget::backToNormal() {
237 mediaPlayerState.setFullscreen( FALSE ); 237 mediaPlayerState.setFullscreen( FALSE );
238 makeVisible(); 238 makeVisible();
239} 239}
240 240
241void VideoWidget::makeVisible() { 241void VideoWidget::makeVisible() {
242 if ( mediaPlayerState.isFullscreen() ) { 242 if ( mediaPlayerState.isFullscreen() ) {
243 setBackgroundMode( QWidget::NoBackground ); 243 setBackgroundMode( QWidget::NoBackground );
244 showFullScreen(); 244 showFullScreen();
245 resize( qApp->desktop()->size() ); 245 resize( qApp->desktop()->size() );
246 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 246 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
247 247
248 slider->hide(); 248 slider->hide();
249 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 249 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
250 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 250 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
251 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 251 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
252 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 252 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
253 253
254 } else { 254 } else {
255 showNormal(); 255 showNormal();
256 showMaximized(); 256 showMaximized();
257 setBackgroundPixmap( backgroundPixmap ); 257 setBackgroundPixmap( backgroundPixmap );
258 QWidget *d = QApplication::desktop(); 258 QWidget *d = QApplication::desktop();
259 int w = d->width(); 259 int w = d->width();
260 int h = d->height(); 260 int h = d->height();
261 261
262 if(w>h) { 262 if(w>h) {
263 int newW=(w/2)-(246/2); //this will only work with 320x240 263 int newW=(w/2)-(246/2); //this will only work with 320x240
264 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 264 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
265 } else { 265 } else {
266 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 266 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
267 } 267 }
268 268
269 if ( !mediaPlayerState.isSeekable() ) { 269 if ( !mediaPlayerState.isSeekable() ) {
270 if( !slider->isHidden()) { 270 if( !slider->isHidden()) {
271 slider->hide(); 271 slider->hide();
272 } 272 }
273 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 273 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
274 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 274 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
275 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 275 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
276 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 276 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
277 } else { 277 } else {
278 slider->show(); 278 slider->show();
279 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 279 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
280 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 280 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
281 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 281 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
282 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 282 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
283 } 283 }
284 } 284 }
285} 285}
286 286
287void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 287void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
288 switch ( e->key() ) { 288 switch ( e->key() ) {
289////////////////////////////// Zaurus keys 289////////////////////////////// Zaurus keys
290 case Key_Home: 290 case Key_Home:
291 break; 291 break;
292 case Key_F9: //activity 292 case Key_F9: //activity
293 break; 293 break;
294 case Key_F10: //contacts 294 case Key_F10: //contacts
295// hide(); 295// hide();
296 break; 296 break;
297 case Key_F11: //menu 297 case Key_F11: //menu
298 break; 298 break;
299 case Key_F12: //home 299 case Key_F12: //home
300 break; 300 break;
301 case Key_F13: //mail 301 case Key_F13: //mail
302 break; 302 break;
303 case Key_Space: { 303 case Key_Space: {
304 if(mediaPlayerState.isPlaying()) { 304 if(mediaPlayerState.isPlaying()) {
305 mediaPlayerState.setPlaying(FALSE); 305 mediaPlayerState.setPlaying(FALSE);
306 } else { 306 } else {
307 mediaPlayerState.setPlaying(TRUE); 307 mediaPlayerState.setPlaying(TRUE);
308 } 308 }
309 } 309 }
310 break; 310 break;
311 case Key_Down: 311 case Key_Down:
312// toggleButton(6); 312// toggleButton(6);
313 emit lessClicked(); 313 emit lessClicked();
314 emit lessReleased(); 314 emit lessReleased();
315// toggleButton(6); 315// toggleButton(6);
316 break; 316 break;
317 case Key_Up: 317 case Key_Up:
318// toggleButton(5); 318// toggleButton(5);
319 emit moreClicked(); 319 emit moreClicked();
320 emit moreReleased(); 320 emit moreReleased();
321// toggleButton(5); 321// toggleButton(5);
322 break; 322 break;
323 case Key_Right: 323 case Key_Right:
324 mediaPlayerState.setNext(); 324 mediaPlayerState.setNext();
325 break; 325 break;
326 case Key_Left: 326 case Key_Left:
327 mediaPlayerState.setPrev(); 327 mediaPlayerState.setPrev();
328 break; 328 break;
329 case Key_Escape: 329 case Key_Escape:
330 break; 330 break;
331 331
332 }; 332 };
333} 333}
334 334
335XineVideoWidget* VideoWidget::vidWidget() { 335XineVideoWidget* VideoWidget::vidWidget() {
336 return videoFrame; 336 return videoFrame;
337} 337}
338 338
339 339
340void VideoWidget::setFullscreen ( bool b ) { 340void VideoWidget::setFullscreen ( bool b ) {
341 setToggleButton( FullScreen, b ); 341 setToggleButton( FullScreen, b );
342} 342}
343 343
344 344
345void VideoWidget::setPlaying( bool b) { 345void VideoWidget::setPlaying( bool b) {
346 setToggleButton( Play, b ); 346 setToggleButton( Play, b );
347} 347}
348 348
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 87be371..f434945 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,104 +1,98 @@
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 <qimage.h> 38#include <qimage.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include "xinevideowidget.h" 40#include "xinevideowidget.h"
41 41
42#include "mediawidget.h" 42#include "mediawidget.h"
43 43
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47class VideoWidget : public MediaWidget { 47class VideoWidget : public MediaWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
51 ~VideoWidget(); 51 ~VideoWidget();
52 52
53 53
54 XineVideoWidget* vidWidget(); 54 XineVideoWidget* vidWidget();
55public slots: 55public slots:
56 void updateSlider( long, long ); 56 void updateSlider( long, long );
57 void sliderPressed( ); 57 void sliderPressed( );
58 void sliderReleased( ); 58 void sliderReleased( );
59 void setFullscreen( bool b ); 59 void setFullscreen( bool b );
60 virtual void makeVisible(); 60 virtual void makeVisible();
61 void backToNormal(); 61 void backToNormal();
62 void setPosition( long ); 62 void setPosition( long );
63 63
64public: 64public:
65 virtual void setPlaying( bool b); 65 virtual void setPlaying( bool b);
66 virtual void setLength( long ); 66 virtual void setLength( long );
67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 67 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
68 68
69 virtual void loadSkin(); 69 virtual void loadSkin();
70 70
71signals: 71signals:
72 void moreClicked(); 72 void moreClicked();
73 void lessClicked(); 73 void lessClicked();
74 void sliderMoved( long ); 74 void sliderMoved( long );
75 void videoResized ( const QSize &s ); 75 void videoResized ( const QSize &s );
76 76
77protected: 77protected:
78 78
79 void resizeEvent( QResizeEvent * ); 79 void resizeEvent( QResizeEvent * );
80 void mouseReleaseEvent( QMouseEvent *event ); 80 void mouseReleaseEvent( QMouseEvent *event );
81 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
82 82
83private: 83private:
84// Ticker songInfo; 84// Ticker songInfo;
85 QImage imgUp;
86 QImage imgDn;
87 QString skin;
88 85
89
90
91 QString backgroundPix;
92 QSlider *slider; 86 QSlider *slider;
93 QImage *currentFrame; 87 QImage *currentFrame;
94 int scaledWidth; 88 int scaledWidth;
95 int scaledHeight; 89 int scaledHeight;
96 XineVideoWidget* videoFrame; 90 XineVideoWidget* videoFrame;
97 91
98 bool videoSliderBeingMoved; 92 bool videoSliderBeingMoved;
99}; 93};
100 94
101#endif // VIDEO_WIDGET_H 95#endif // VIDEO_WIDGET_H
102 96
103 97
104 98