summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp83
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp47
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
9 files changed, 87 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index fd18dbb..0516089 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,327 +1,330 @@
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 Config cfg("OpiePlayer"); 91 loadSkin();
92 cfg.setGroup("Options");
93 skin = cfg.readEntry("Skin","default");
94 //skin = "scaleTest";
95 // color of background, frame, degree of transparency
96
97 QString skinPath = "opieplayer2/skins/" + skin;
98 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
99 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
100 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
101
102 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() );
103
104 setBackgroundPixmap( backgroundPixmap );
105
106 songInfo.setFocusPolicy( QWidget::NoFocus );
107// changeTextColor( &songInfo );
108// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
109// songInfo.setFrameStyle( QFrame::NoFrame);
110 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
111// songInfo.setForegroundColor(Qt::white);
112
113 slider.setFixedHeight( 20 );
114 slider.setMinValue( 0 );
115 slider.setMaxValue( 1 );
116 slider.setFocusPolicy( QWidget::NoFocus );
117 slider.setBackgroundPixmap( backgroundPixmap );
118
119// Config cofg("qpe");
120// cofg.setGroup("Appearance");
121// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
122
123 time.setFocusPolicy( QWidget::NoFocus );
124 time.setAlignment( Qt::AlignCenter );
125
126// time.setFrame(FALSE);
127// changeTextColor( &time );
128
129 resizeEvent( NULL );
130 92
131 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
132 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
133 95
134 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 96 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
135 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 97 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
136 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 98 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
137 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 99 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
138 100
139 // Intialise state 101 // Intialise state
140 setLength( mediaPlayerState.length() ); 102 setLength( mediaPlayerState.length() );
141 setPosition( mediaPlayerState.position() ); 103 setPosition( mediaPlayerState.position() );
142 setLooping( mediaPlayerState.isFullscreen() ); 104 setLooping( mediaPlayerState.isFullscreen() );
143 // setPaused( mediaPlayerState->paused() ); 105 // setPaused( mediaPlayerState->paused() );
144 setPlaying( mediaPlayerState.isPlaying() ); 106 setPlaying( mediaPlayerState.isPlaying() );
145
146} 107}
147 108
148AudioWidget::~AudioWidget() { 109AudioWidget::~AudioWidget() {
149 110
150// mediaPlayerState->setPlaying(false); 111// mediaPlayerState->setPlaying(false);
151} 112}
152 113
153namespace { 114namespace {
154 115
155QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 116QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
156 QPixmap pix( img.width(), img.height() ); 117 QPixmap pix( img.width(), img.height() );
157 QPainter p( &pix ); 118 QPainter p( &pix );
158 p.drawTiledPixmap( pix.rect(), bg, offset ); 119 p.drawTiledPixmap( pix.rect(), bg, offset );
159 p.drawImage( 0, 0, img ); 120 p.drawImage( 0, 0, img );
160 return pix; 121 return pix;
161} 122}
162 123
163 124
164QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { 125QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) {
165 QPixmap pixmap( pix ); 126 QPixmap pixmap( pix );
166 pixmap.setMask( mask ); 127 pixmap.setMask( mask );
167 return pixmap; 128 return pixmap;
168} 129}
169 130
170}; 131};
171 132
172void AudioWidget::resizeEvent( QResizeEvent * ) { 133void AudioWidget::resizeEvent( QResizeEvent * ) {
173 int h = height(); 134 int h = height();
174 int w = width(); 135 int w = width();
175 136
176 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 137 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
177 slider.setFixedWidth( w - 110 ); 138 slider.setFixedWidth( w - 110 );
178 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 139 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
179 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 140 slider.setBackgroundOrigin( QWidget::ParentOrigin );
180 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 141 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
181 142
182 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; 143 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2;
183 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; 144 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10;
184 QPoint p = upperLeftOfButtonMask; 145 QPoint p = upperLeftOfButtonMask;
185 146
186 QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); 147 QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p );
187 QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); 148 QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p );
188 149
189 for ( uint i = 0; i < buttons.size(); i++ ) { 150 for ( uint i = 0; i < buttons.size(); i++ ) {
190 if ( !buttons[i].mask.isNull() ) { 151 if ( !buttons[i].mask.isNull() ) {
191 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); 152 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask );
192 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); 153 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask );
193 } 154 }
194 } 155 }
195} 156}
196 157
197void AudioWidget::sliderPressed() { 158void AudioWidget::sliderPressed() {
198 audioSliderBeingMoved = TRUE; 159 audioSliderBeingMoved = TRUE;
199} 160}
200 161
201 162
202void AudioWidget::sliderReleased() { 163void AudioWidget::sliderReleased() {
203 audioSliderBeingMoved = FALSE; 164 audioSliderBeingMoved = FALSE;
204 if ( slider.width() == 0 ) 165 if ( slider.width() == 0 )
205 return; 166 return;
206 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 167 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
207 mediaPlayerState.setPosition( val ); 168 mediaPlayerState.setPosition( val );
208} 169}
209 170
210void AudioWidget::setPosition( long i ) { 171void AudioWidget::setPosition( long i ) {
211 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 172 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
212 updateSlider( i, mediaPlayerState.length() ); 173 updateSlider( i, mediaPlayerState.length() );
213} 174}
214 175
215 176
216void AudioWidget::setLength( long max ) { 177void AudioWidget::setLength( long max ) {
217 updateSlider( mediaPlayerState.position(), max ); 178 updateSlider( mediaPlayerState.position(), max );
218} 179}
219 180
220 181
221void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 182void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
222 if ( mediaType == MediaPlayerState::Audio ) { 183 if ( mediaType == MediaPlayerState::Audio ) {
223 // startTimer( 150 ); 184 // startTimer( 150 );
224 showMaximized(); 185 showMaximized();
225 return; 186 return;
226 } 187 }
227 188
228 killTimers(); 189 killTimers();
229 hide(); 190 hide();
230} 191}
231 192
193void AudioWidget::loadSkin()
194{
195 Config cfg("OpiePlayer");
196 cfg.setGroup("Options");
197 skin = cfg.readEntry("Skin","default");
198 //skin = "scaleTest";
199 // color of background, frame, degree of transparency
200
201 QString skinPath = "opieplayer2/skins/" + skin;
202 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
203 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
204 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
205
206 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() );
207
208 setBackgroundPixmap( backgroundPixmap );
209
210 songInfo.setFocusPolicy( QWidget::NoFocus );
211// changeTextColor( &songInfo );
212// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
213// songInfo.setFrameStyle( QFrame::NoFrame);
214 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
215// songInfo.setForegroundColor(Qt::white);
216
217 slider.setFixedHeight( 20 );
218 slider.setMinValue( 0 );
219 slider.setMaxValue( 1 );
220 slider.setFocusPolicy( QWidget::NoFocus );
221 slider.setBackgroundPixmap( backgroundPixmap );
222
223// Config cofg("qpe");
224// cofg.setGroup("Appearance");
225// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
226
227 time.setFocusPolicy( QWidget::NoFocus );
228 time.setAlignment( Qt::AlignCenter );
229
230// time.setFrame(FALSE);
231// changeTextColor( &time );
232
233 resizeEvent( 0 );
234}
232 235
233void AudioWidget::setSeekable( bool isSeekable ) { 236void AudioWidget::setSeekable( bool isSeekable ) {
234 237
235 if ( !isSeekable ) { 238 if ( !isSeekable ) {
236 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 239 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
237 if( !slider.isHidden()) { 240 if( !slider.isHidden()) {
238 slider.hide(); 241 slider.hide();
239 } 242 }
240 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 243 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
241 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 244 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
242 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 245 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
243 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 246 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
244 } else { 247 } else {
245 // this stops the slider from being moved, thus 248 // this stops the slider from being moved, thus
246 // does not stop stream when it reaches the end 249 // does not stop stream when it reaches the end
247 slider.show(); 250 slider.show();
248 qDebug( " CONNECT SET POSTION " ); 251 qDebug( " CONNECT SET POSTION " );
249 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 252 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
250 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 253 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
251 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 254 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
252 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 255 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
253 } 256 }
254} 257}
255 258
256 259
257static QString timeAsString( long length ) { 260static QString timeAsString( long length ) {
258 int minutes = length / 60; 261 int minutes = length / 60;
259 int seconds = length % 60; 262 int seconds = length % 60;
260 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 );
261} 264}
262 265
263void AudioWidget::updateSlider( long i, long max ) { 266void AudioWidget::updateSlider( long i, long max ) {
264 267
265 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 268 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
266// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 269// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
267 270
268 if ( max == 0 ) { 271 if ( max == 0 ) {
269 return; 272 return;
270 } 273 }
271 // Will flicker too much if we don't do this 274 // Will flicker too much if we don't do this
272 // Scale to something reasonable 275 // Scale to something reasonable
273 int width = slider.width(); 276 int width = slider.width();
274 int val = int((double)i * width / max); 277 int val = int((double)i * width / max);
275 if ( !audioSliderBeingMoved ) { 278 if ( !audioSliderBeingMoved ) {
276 if ( slider.value() != val ) { 279 if ( slider.value() != val ) {
277 slider.setValue( val ); 280 slider.setValue( val );
278 } 281 }
279 282
280 if ( slider.maxValue() != width ) { 283 if ( slider.maxValue() != width ) {
281 slider.setMaxValue( width ); 284 slider.setMaxValue( width );
282 } 285 }
283 } 286 }
284} 287}
285 288
286void AudioWidget::skipFor() { 289void AudioWidget::skipFor() {
287 skipDirection = +1; 290 skipDirection = +1;
288 startTimer( 50 ); 291 startTimer( 50 );
289 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 292 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
290} 293}
291 294
292void AudioWidget::skipBack() { 295void AudioWidget::skipBack() {
293 skipDirection = -1; 296 skipDirection = -1;
294 startTimer( 50 ); 297 startTimer( 50 );
295 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 298 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
296} 299}
297 300
298 301
299 302
300void AudioWidget::stopSkip() { 303void AudioWidget::stopSkip() {
301 killTimers(); 304 killTimers();
302} 305}
303 306
304 307
305void AudioWidget::timerEvent( QTimerEvent * ) { 308void AudioWidget::timerEvent( QTimerEvent * ) {
306 if ( skipDirection == +1 ) { 309 if ( skipDirection == +1 ) {
307 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 310 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
308 } else if ( skipDirection == -1 ) { 311 } else if ( skipDirection == -1 ) {
309 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 312 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
310 } 313 }
311} 314}
312 315
313void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 316void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
314 switch ( e->key() ) { 317 switch ( e->key() ) {
315 ////////////////////////////// Zaurus keys 318 ////////////////////////////// Zaurus keys
316 case Key_Home: 319 case Key_Home:
317 break; 320 break;
318 case Key_F9: //activity 321 case Key_F9: //activity
319 hide(); 322 hide();
320 // qDebug("Audio F9"); 323 // qDebug("Audio F9");
321 e->accept(); 324 e->accept();
322 break; 325 break;
323 case Key_F10: //contacts 326 case Key_F10: //contacts
324 break; 327 break;
325 case Key_F11: //menu 328 case Key_F11: //menu
326 mediaPlayerState.toggleBlank(); 329 mediaPlayerState.toggleBlank();
327 e->accept(); 330 e->accept();
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 53982a1..61556c6 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,99 +1,101 @@
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();
72
71signals: 73signals:
72 void sliderMoved(long); 74 void sliderMoved(long);
73 75
74protected: 76protected:
75 void doBlank(); 77 void doBlank();
76 void doUnblank(); 78 void doUnblank();
77 void resizeEvent( QResizeEvent *re ); 79 void resizeEvent( QResizeEvent *re );
78 void timerEvent( QTimerEvent *event ); 80 void timerEvent( QTimerEvent *event );
79 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
80private slots: 82private slots:
81 void skipFor(); 83 void skipFor();
82 void skipBack(); 84 void skipBack();
83 void stopSkip(); 85 void stopSkip();
84private: 86private:
85 int skipDirection; 87 int skipDirection;
86 QString skin; 88 QString skin;
87 QImage imgUp; 89 QImage imgUp;
88 QImage imgDn; 90 QImage imgDn;
89 91
90 OTicker songInfo; 92 OTicker songInfo;
91 QSlider slider; 93 QSlider slider;
92 QLineEdit time; 94 QLineEdit time;
93 bool isStreaming : 1; 95 bool isStreaming : 1;
94 bool audioSliderBeingMoved : 1; 96 bool audioSliderBeingMoved : 1;
95}; 97};
96 98
97 99
98#endif // AUDIO_WIDGET_H 100#endif // AUDIO_WIDGET_H
99 101
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index ffc7cb6..f87cee8 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,22 +1,22 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include "mediaplayerstate.h" 3#include "mediaplayerstate.h"
4#include "playlistwidget.h" 4#include "playlistwidget.h"
5#include "mediaplayer.h" 5#include "mediaplayer.h"
6 6
7int main(int argc, char **argv) { 7int main(int argc, char **argv) {
8 QPEApplication a(argc,argv); 8 QPEApplication a(argc,argv);
9 9
10 MediaPlayerState st( 0, "mediaPlayerState" ); 10 MediaPlayerState st( 0, "mediaPlayerState" );
11 PlayListWidget pl( st, 0, "playList" ); 11 PlayListWidget pl( st, 0, "playList" );
12 pl.showMaximized(); 12 pl.showMaximized();
13 MediaPlayer mp( pl, st, 0, "mediaPlayer" ); 13 MediaPlayer mp( pl, st, 0, "mediaPlayer" );
14 QObject::connect( &pl, SIGNAL( skinSelected() ), 14 QObject::connect( &pl, SIGNAL( skinSelected() ),
15 &mp, SLOT( recreateAudioAndVideoWidgets() ) ); 15 &mp, SLOT( reloadSkins() ) );
16 16
17 a.showMainDocumentWidget(&pl); 17 a.showMainDocumentWidget(&pl);
18 18
19 return a.exec(); 19 return a.exec();
20} 20}
21 21
22 22
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index e1bfc2d..8a3d3e0 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -274,96 +274,102 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
274 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 274 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
275 } else { 275 } else {
276 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 276 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
277 } 277 }
278 } 278 }
279 } 279 }
280} 280}
281 281
282 282
283void MediaPlayer::blank( bool b ) { 283void MediaPlayer::blank( bool b ) {
284 fd=open("/dev/fb0",O_RDWR); 284 fd=open("/dev/fb0",O_RDWR);
285#ifdef QT_QWS_EBX 285#ifdef QT_QWS_EBX
286 fl= open( "/dev/fl", O_RDWR ); 286 fl= open( "/dev/fl", O_RDWR );
287#endif 287#endif
288 if (fd != -1) { 288 if (fd != -1) {
289 if ( b ) { 289 if ( b ) {
290 qDebug("do blanking"); 290 qDebug("do blanking");
291#ifdef QT_QWS_EBX 291#ifdef QT_QWS_EBX
292 ioctl( fd, FBIOBLANK, 1 ); 292 ioctl( fd, FBIOBLANK, 1 );
293 if(fl !=-1) { 293 if(fl !=-1) {
294 ioctl( fl, 2 ); 294 ioctl( fl, 2 );
295 ::close(fl); 295 ::close(fl);
296 } 296 }
297#else 297#else
298 ioctl( fd, FBIOBLANK, 3 ); 298 ioctl( fd, FBIOBLANK, 3 );
299#endif 299#endif
300 isBlanked = TRUE; 300 isBlanked = TRUE;
301 } else { 301 } else {
302 qDebug("do unblanking"); 302 qDebug("do unblanking");
303 ioctl( fd, FBIOBLANK, 0); 303 ioctl( fd, FBIOBLANK, 0);
304#ifdef QT_QWS_EBX 304#ifdef QT_QWS_EBX
305 if(fl != -1) { 305 if(fl != -1) {
306 ioctl( fl, 1); 306 ioctl( fl, 1);
307 ::close(fl); 307 ::close(fl);
308 } 308 }
309#endif 309#endif
310 isBlanked = FALSE; 310 isBlanked = FALSE;
311 } 311 }
312 close( fd ); 312 close( fd );
313 } else { 313 } else {
314 qDebug("<< /dev/fb0 could not be opened >>"); 314 qDebug("<< /dev/fb0 could not be opened >>");
315 } 315 }
316} 316}
317 317
318void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 318void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
319 switch ( e->key() ) { 319 switch ( e->key() ) {
320////////////////////////////// Zaurus keys 320////////////////////////////// Zaurus keys
321 case Key_Home: 321 case Key_Home:
322 break; 322 break;
323 case Key_F9: //activity 323 case Key_F9: //activity
324 break; 324 break;
325 case Key_F10: //contacts 325 case Key_F10: //contacts
326 break; 326 break;
327 case Key_F11: //menu 327 case Key_F11: //menu
328 break; 328 break;
329 case Key_F12: //home 329 case Key_F12: //home
330 qDebug("Blank here"); 330 qDebug("Blank here");
331// mediaPlayerState->toggleBlank(); 331// mediaPlayerState->toggleBlank();
332 break; 332 break;
333 case Key_F13: //mail 333 case Key_F13: //mail
334 qDebug("Blank here"); 334 qDebug("Blank here");
335 // mediaPlayerState->toggleBlank(); 335 // mediaPlayerState->toggleBlank();
336 break; 336 break;
337 } 337 }
338} 338}
339 339
340void MediaPlayer::cleanUp() {// this happens on closing 340void MediaPlayer::cleanUp() {// this happens on closing
341 Config cfg( "OpiePlayer" ); 341 Config cfg( "OpiePlayer" );
342 mediaPlayerState.writeConfig( cfg ); 342 mediaPlayerState.writeConfig( cfg );
343 playList.writeDefaultPlaylist( ); 343 playList.writeDefaultPlaylist( );
344 344
345// QPEApplication::grabKeyboard(); 345// QPEApplication::grabKeyboard();
346// QPEApplication::ungrabKeyboard(); 346// QPEApplication::ungrabKeyboard();
347} 347}
348 348
349void MediaPlayer::recreateAudioAndVideoWidgets() 349void MediaPlayer::recreateAudioAndVideoWidgets()
350{ 350{
351 delete xineControl; 351 delete xineControl;
352 delete audioUI; 352 delete audioUI;
353 delete videoUI; 353 delete videoUI;
354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
356 356
357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
361 361
362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
366 366
367 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); 367 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
368} 368}
369 369
370void MediaPlayer::reloadSkins()
371{
372 audioUI->loadSkin();
373 videoUI->loadSkin();
374}
375
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index dc306c4..6b316f6 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,89 +1,90 @@
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 LJP <> 5 Copyright (c) 2002 LJP <>
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 MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qframe.h> 38#include <qframe.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41 41
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43 43
44class DocLnk; 44class DocLnk;
45class VolumeControl; 45class VolumeControl;
46class MediaPlayerState; 46class MediaPlayerState;
47class AudioWidget; 47class AudioWidget;
48class VideoWidget; 48class VideoWidget;
49 49
50class MediaPlayer : public QObject { 50class MediaPlayer : public QObject {
51 Q_OBJECT 51 Q_OBJECT
52public: 52public:
53 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 53 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
54 ~MediaPlayer(); 54 ~MediaPlayer();
55 55
56public slots: 56public slots:
57 void recreateAudioAndVideoWidgets(); 57 void recreateAudioAndVideoWidgets();
58 void reloadSkins();
58 59
59private slots: 60private slots:
60 void setPlaying( bool ); 61 void setPlaying( bool );
61 void pauseCheck( bool ); 62 void pauseCheck( bool );
62 void play(); 63 void play();
63 void next(); 64 void next();
64 void prev(); 65 void prev();
65 void startIncreasingVolume(); 66 void startIncreasingVolume();
66 void startDecreasingVolume(); 67 void startDecreasingVolume();
67 void stopChangingVolume(); 68 void stopChangingVolume();
68 void cleanUp(); 69 void cleanUp();
69 void blank( bool ); 70 void blank( bool );
70 71
71protected: 72protected:
72 void timerEvent( QTimerEvent *e ); 73 void timerEvent( QTimerEvent *e );
73 void keyReleaseEvent( QKeyEvent *e); 74 void keyReleaseEvent( QKeyEvent *e);
74private: 75private:
75 76
76 bool isBlanked, l, r; 77 bool isBlanked, l, r;
77 int fd, fl; 78 int fd, fl;
78 int volumeDirection; 79 int volumeDirection;
79 XineControl *xineControl; 80 XineControl *xineControl;
80 VolumeControl *volControl; 81 VolumeControl *volControl;
81 MediaPlayerState &mediaPlayerState; 82 MediaPlayerState &mediaPlayerState;
82 PlayListWidget &playList; 83 PlayListWidget &playList;
83 AudioWidget *audioUI; 84 AudioWidget *audioUI;
84 VideoWidget *videoUI; 85 VideoWidget *videoUI;
85}; 86};
86 87
87 88
88#endif // MEDIA_PLAYER_H 89#endif // MEDIA_PLAYER_H
89 90
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index db16b44..d60dc0d 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,143 +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 23
24#include "mediawidget.h" 24#include "mediawidget.h"
25#include "playlistwidget.h" 25#include "playlistwidget.h"
26 26
27MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 27MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
28 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 28 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
29{ 29{
30 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 30 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
31 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 31 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
32 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 32 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
33 this, SLOT( setLength( long ) ) ); 33 this, SLOT( setLength( long ) ) );
34 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 34 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
35 this, SLOT( setPlaying( bool ) ) ); 35 this, SLOT( setPlaying( bool ) ) );
36} 36}
37 37
38MediaWidget::~MediaWidget() 38MediaWidget::~MediaWidget()
39{ 39{
40} 40}
41 41
42void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 42void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
43 const QString &imagePrefix, const QSize &buttonAreaSize ) 43 const QString &imagePrefix, const QSize &buttonAreaSize )
44{ 44{
45 buttonMask = QImage( buttonAreaSize, 8, 255 ); 45 buttonMask = QImage( buttonAreaSize, 8, 255 );
46 buttonMask.fill( 0 ); 46 buttonMask.fill( 0 );
47 47
48 buttons.clear();
49 buttons.reserve( buttonCount );
50
48 for ( uint i = 0; i < buttonCount; ++i ) { 51 for ( uint i = 0; i < buttonCount; ++i ) {
49 Button button = setupButton( skinInfo[ i ], imagePrefix ); 52 Button button = setupButton( skinInfo[ i ], imagePrefix );
50 buttons.push_back( button ); 53 buttons.push_back( button );
51 } 54 }
52} 55}
53 56
54MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ) 57MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix )
55{ 58{
56 Button button; 59 Button button;
57 button.command = buttonInfo.command; 60 button.command = buttonInfo.command;
58 button.type = buttonInfo.type; 61 button.type = buttonInfo.type;
59 62
60 QString fileName = imagePrefix + buttonInfo.fileName + ".png"; 63 QString fileName = imagePrefix + buttonInfo.fileName + ".png";
61 64
62 button.mask = setupButtonMask( button.command, fileName ); 65 button.mask = setupButtonMask( button.command, fileName );
63 66
64 return button; 67 return button;
65} 68}
66 69
67QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName ) 70QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName )
68{ 71{
69 QBitmap mask( fileName ); 72 QBitmap mask( fileName );
70 if ( mask.isNull() ) 73 if ( mask.isNull() )
71 return mask; 74 return mask;
72 75
73 QImage imgMask = mask.convertToImage(); 76 QImage imgMask = mask.convertToImage();
74 uchar **dest = buttonMask.jumpTable(); 77 uchar **dest = buttonMask.jumpTable();
75 for ( int y = 0; y < buttonMask.height(); y++ ) { 78 for ( int y = 0; y < buttonMask.height(); y++ ) {
76 uchar *line = dest[y]; 79 uchar *line = dest[y];
77 for ( int x = 0; x < buttonMask.width(); x++ ) 80 for ( int x = 0; x < buttonMask.width(); x++ )
78 if ( !qRed( imgMask.pixel( x, y ) ) ) 81 if ( !qRed( imgMask.pixel( x, y ) ) )
79 line[x] = command + 1; 82 line[x] = command + 1;
80 } 83 }
81 84
82 return mask; 85 return mask;
83} 86}
84 87
85void MediaWidget::closeEvent( QCloseEvent * ) 88void MediaWidget::closeEvent( QCloseEvent * )
86{ 89{
87 mediaPlayerState.setList(); 90 mediaPlayerState.setList();
88} 91}
89 92
90void MediaWidget::paintEvent( QPaintEvent *pe ) 93void MediaWidget::paintEvent( QPaintEvent *pe )
91{ 94{
92 QPainter p( this ); 95 QPainter p( this );
93 96
94 if ( mediaPlayerState.isFullscreen() ) { 97 if ( mediaPlayerState.isFullscreen() ) {
95 // Clear the background 98 // Clear the background
96 p.setBrush( QBrush( Qt::black ) ); 99 p.setBrush( QBrush( Qt::black ) );
97 return; 100 return;
98 } 101 }
99 102
100 if ( !pe->erased() ) { 103 if ( !pe->erased() ) {
101 // Combine with background and double buffer 104 // Combine with background and double buffer
102 QPixmap pix( pe->rect().size() ); 105 QPixmap pix( pe->rect().size() );
103 QPainter p( &pix ); 106 QPainter p( &pix );
104 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 107 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
105 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); 108 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() );
106 paintAllButtons( p ); 109 paintAllButtons( p );
107 QPainter p2( this ); 110 QPainter p2( this );
108 p2.drawPixmap( pe->rect().topLeft(), pix ); 111 p2.drawPixmap( pe->rect().topLeft(), pix );
109 } else { 112 } else {
110 QPainter p( this ); 113 QPainter p( this );
111 paintAllButtons( p ); 114 paintAllButtons( p );
112 } 115 }
113} 116}
114 117
115MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) 118MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position )
116{ 119{
117 if ( position.x() <= 0 || position.y() <= 0 || 120 if ( position.x() <= 0 || position.y() <= 0 ||
118 position.x() >= buttonMask.width() || 121 position.x() >= buttonMask.width() ||
119 position.y() >= buttonMask.height() ) 122 position.y() >= buttonMask.height() )
120 return 0; 123 return 0;
121 124
122 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); 125 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() );
123 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) 126 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
124 if ( it->command + 1 == pixelIdx ) 127 if ( it->command + 1 == pixelIdx )
125 return &( *it ); 128 return &( *it );
126 129
127 return 0; 130 return 0;
128} 131}
129 132
130void MediaWidget::mousePressEvent( QMouseEvent *event ) 133void MediaWidget::mousePressEvent( QMouseEvent *event )
131{ 134{
132 Button *button = buttonAt( event->pos() - upperLeftOfButtonMask ); 135 Button *button = buttonAt( event->pos() - upperLeftOfButtonMask );
133 136
134 if ( !button ) { 137 if ( !button ) {
135 QWidget::mousePressEvent( event ); 138 QWidget::mousePressEvent( event );
136 return; 139 return;
137 } 140 }
138 141
139 switch ( button->command ) { 142 switch ( button->command ) {
140 case VolumeUp: emit moreClicked(); return; 143 case VolumeUp: emit moreClicked(); return;
141 case VolumeDown: emit lessClicked(); return; 144 case VolumeDown: emit lessClicked(); return;
142 case Back: emit backClicked(); return; 145 case Back: emit backClicked(); return;
143 case Forward: emit forwardClicked(); return; 146 case Forward: emit forwardClicked(); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 148948a..8c781e9 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,128 +1,130 @@
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 33
34class MediaWidget : public QWidget 34class MediaWidget : public QWidget
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37public: 37public:
38 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; 38 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
39 enum ButtonType { NormalButton, ToggleButton }; 39 enum ButtonType { NormalButton, ToggleButton };
40 40
41 struct Button 41 struct Button
42 { 42 {
43 Button() : command( Undefined ), type( NormalButton ), isHeld( false ), isDown( false ) {} 43 Button() : command( Undefined ), type( NormalButton ), isHeld( false ), isDown( false ) {}
44 44
45 Command command; 45 Command command;
46 46
47 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-( 47 ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
48 bool isHeld : 1; 48 bool isHeld : 1;
49 bool isDown : 1; 49 bool isDown : 1;
50 50
51 QBitmap mask; 51 QBitmap mask;
52 QPixmap pixUp; 52 QPixmap pixUp;
53 QPixmap pixDown; 53 QPixmap pixDown;
54 }; 54 };
55 typedef std::vector<Button> ButtonVector; 55 typedef std::vector<Button> ButtonVector;
56 56
57 struct SkinButtonInfo 57 struct SkinButtonInfo
58 { 58 {
59 Command command; 59 Command command;
60 const char *fileName; 60 const char *fileName;
61 ButtonType type; 61 ButtonType type;
62 }; 62 };
63 63
64 typedef std::vector<QBitmap> MaskVector; 64 typedef std::vector<QBitmap> MaskVector;
65 typedef std::vector<QPixmap> PixmapVector; 65 typedef std::vector<QPixmap> PixmapVector;
66 66
67 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 67 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
68 virtual ~MediaWidget(); 68 virtual ~MediaWidget();
69 69
70public slots: 70public slots:
71 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 71 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
72 virtual void setLength( long length ) = 0; 72 virtual void setLength( long length ) = 0;
73 virtual void setPlaying( bool playing ) = 0; 73 virtual void setPlaying( bool playing ) = 0;
74 74
75 virtual void loadSkin() = 0;
76
75signals: 77signals:
76 void moreReleased(); 78 void moreReleased();
77 void lessReleased(); 79 void lessReleased();
78 void forwardReleased(); 80 void forwardReleased();
79 void backReleased(); 81 void backReleased();
80 void forwardClicked(); 82 void forwardClicked();
81 void backClicked(); 83 void backClicked();
82 void moreClicked(); 84 void moreClicked();
83 void lessClicked(); 85 void lessClicked();
84 86
85protected: 87protected:
86 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 88 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
87 const QString &imagePrefix, const QSize &buttonAreaSize ); 89 const QString &imagePrefix, const QSize &buttonAreaSize );
88 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix ); 90 Button setupButton( const SkinButtonInfo &buttonInfo, const QString &imagePrefix );
89 QBitmap setupButtonMask( const Command &command, const QString &fileName ); 91 QBitmap setupButtonMask( const Command &command, const QString &fileName );
90 92
91 virtual void closeEvent( QCloseEvent * ); 93 virtual void closeEvent( QCloseEvent * );
92 94
93 virtual void paintEvent( QPaintEvent *pe ); 95 virtual void paintEvent( QPaintEvent *pe );
94 96
95 Button *buttonAt( const QPoint &position ); 97 Button *buttonAt( const QPoint &position );
96 98
97 virtual void mousePressEvent( QMouseEvent *event ); 99 virtual void mousePressEvent( QMouseEvent *event );
98 virtual void mouseReleaseEvent( QMouseEvent *event ); 100 virtual void mouseReleaseEvent( QMouseEvent *event );
99 101
100 virtual void makeVisible(); 102 virtual void makeVisible();
101 103
102 void handleCommand( Command command, bool buttonDown ); 104 void handleCommand( Command command, bool buttonDown );
103 105
104 bool isOverButton( const QPoint &position, int buttonId ) const; 106 bool isOverButton( const QPoint &position, int buttonId ) const;
105 107
106 void paintAllButtons( QPainter &p ); 108 void paintAllButtons( QPainter &p );
107 void paintButton( const Button &button ); 109 void paintButton( const Button &button );
108 void paintButton( QPainter &p, const Button &button ); 110 void paintButton( QPainter &p, const Button &button );
109 111
110 void setToggleButton( Button &button, bool down ); 112 void setToggleButton( Button &button, bool down );
111 void setToggleButton( Command command, bool down ); 113 void setToggleButton( Command command, bool down );
112 void toggleButton( Button &button ); 114 void toggleButton( Button &button );
113 115
114 MediaPlayerState &mediaPlayerState; 116 MediaPlayerState &mediaPlayerState;
115 PlayListWidget &playList; 117 PlayListWidget &playList;
116 118
117 ButtonVector buttons; 119 ButtonVector buttons;
118 120
119 QImage buttonMask; 121 QImage buttonMask;
120 122
121 QPoint upperLeftOfButtonMask; 123 QPoint upperLeftOfButtonMask;
122 124
123 QPixmap backgroundPixmap; 125 QPixmap backgroundPixmap;
124}; 126};
125 127
126#endif // MEDIAWIDGET_H 128#endif // MEDIAWIDGET_H
127/* vim: et sw=4 ts=4 129/* vim: et sw=4 ts=4
128 */ 130 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index d1efaad..a03d43e 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,299 +1,306 @@
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
83 videoFrame = new XineVideoWidget ( this, "Video frame" ); 82 videoFrame = new XineVideoWidget ( this, "Video frame" );
84 83
85 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
86 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
87 86
88 Config cfg("OpiePlayer"); 87 slider = 0;
89 cfg.setGroup("Options");
90 skin = cfg.readEntry("Skin","default");
91 88
92 QString skinPath = "opieplayer2/skins/" + skin; 89 loadSkin();
93 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
94 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
95 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
96
97 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() );
98
99 setBackgroundPixmap( backgroundPixmap );
100
101 slider = new QSlider( Qt::Horizontal, this );
102 slider->setMinValue( 0 );
103 slider->setMaxValue( 1 );
104 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
105 //slider->setFocusPolicy( QWidget::NoFocus );
106
107 resizeEvent( NULL );
108 90
109 setLength( mediaPlayerState.length() ); 91 setLength( mediaPlayerState.length() );
110 setPosition( mediaPlayerState.position() ); 92 setPosition( mediaPlayerState.position() );
111 setFullscreen( mediaPlayerState.isFullscreen() ); 93 setFullscreen( mediaPlayerState.isFullscreen() );
112 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
113} 95}
114 96
115 97
116VideoWidget::~VideoWidget() 98VideoWidget::~VideoWidget()
117{ 99{
118} 100}
119 101
120QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 102QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
121 QPixmap pix( img.width(), img.height() ); 103 QPixmap pix( img.width(), img.height() );
122 QPainter p( &pix ); 104 QPainter p( &pix );
123 p.drawTiledPixmap( pix.rect(), bg, offset ); 105 p.drawTiledPixmap( pix.rect(), bg, offset );
124 p.drawImage( 0, 0, img ); 106 p.drawImage( 0, 0, img );
125 return new QPixmap( pix ); 107 return new QPixmap( pix );
126} 108}
127 109
128QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { 110QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) {
129 QPixmap pixmap( pix ); 111 QPixmap pixmap( pix );
130 pixmap.setMask( mask ); 112 pixmap.setMask( mask );
131 return pixmap; 113 return pixmap;
132} 114}
133 115
134void VideoWidget::resizeEvent( QResizeEvent * ) { 116void VideoWidget::resizeEvent( QResizeEvent * ) {
135 int h = height(); 117 int h = height();
136 int w = width(); 118 int w = width();
137 //int Vh = 160; 119 //int Vh = 160;
138 //int Vw = 220; 120 //int Vw = 220;
139 121
140 slider->setFixedWidth( w - 20 ); 122 slider->setFixedWidth( w - 20 );
141 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 123 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
142 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 124 slider->setBackgroundOrigin( QWidget::ParentOrigin );
143 slider->setFocusPolicy( QWidget::NoFocus ); 125 slider->setFocusPolicy( QWidget::NoFocus );
144 slider->setBackgroundPixmap( backgroundPixmap ); 126 slider->setBackgroundPixmap( backgroundPixmap );
145 127
146 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 128 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
147 if(w>h) 129 if(w>h)
148 upperLeftOfButtonMask.ry() = 0; 130 upperLeftOfButtonMask.ry() = 0;
149 else 131 else
150 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 132 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
151 QPoint p = upperLeftOfButtonMask; 133 QPoint p = upperLeftOfButtonMask;
152 134
153 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); 135 QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p );
154 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); 136 QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p );
155 137
156 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 138 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
157 Button &button = *it; 139 Button &button = *it;
158 140
159 if ( !button.mask.isNull() ) { 141 if ( !button.mask.isNull() ) {
160 button.pixUp = maskVPixToMask( *pixUp, button.mask ); 142 button.pixUp = maskVPixToMask( *pixUp, button.mask );
161 button.pixDown = maskVPixToMask( *pixDn, button.mask ); 143 button.pixDown = maskVPixToMask( *pixDn, button.mask );
162 } 144 }
163 } 145 }
164 146
165 delete pixUp; 147 delete pixUp;
166 delete pixDn; 148 delete pixDn;
167} 149}
168 150
169void VideoWidget::sliderPressed() { 151void VideoWidget::sliderPressed() {
170 videoSliderBeingMoved = TRUE; 152 videoSliderBeingMoved = TRUE;
171} 153}
172 154
173void VideoWidget::sliderReleased() { 155void VideoWidget::sliderReleased() {
174 videoSliderBeingMoved = FALSE; 156 videoSliderBeingMoved = FALSE;
175 if ( slider->width() == 0 ) { 157 if ( slider->width() == 0 ) {
176 return; 158 return;
177 } 159 }
178 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 160 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
179 mediaPlayerState.setPosition( val ); 161 mediaPlayerState.setPosition( val );
180} 162}
181 163
182void VideoWidget::setPosition( long i ) { 164void VideoWidget::setPosition( long i ) {
183 updateSlider( i, mediaPlayerState.length() ); 165 updateSlider( i, mediaPlayerState.length() );
184} 166}
185 167
186 168
187void VideoWidget::setLength( long max ) { 169void VideoWidget::setLength( long max ) {
188 updateSlider( mediaPlayerState.position(), max ); 170 updateSlider( mediaPlayerState.position(), max );
189} 171}
190 172
191void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 173void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
192{ 174{
193 if ( displayType == MediaPlayerState::Video ) { 175 if ( displayType == MediaPlayerState::Video ) {
194 makeVisible(); 176 makeVisible();
195 return; 177 return;
196 } 178 }
197 179
198 // 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
199 scaledWidth = 0; 181 scaledWidth = 0;
200 scaledHeight = 0; 182 scaledHeight = 0;
201 hide(); 183 hide();
202} 184}
203 185
186void VideoWidget::loadSkin()
187{
188 Config cfg("OpiePlayer");
189 cfg.setGroup("Options");
190 skin = cfg.readEntry("Skin","default");
191
192 QString skinPath = "opieplayer2/skins/" + skin;
193 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
194 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
195 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
196
197 setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_", imgUp.size() );
198
199 setBackgroundPixmap( backgroundPixmap );
200
201 delete slider;
202 slider = new QSlider( Qt::Horizontal, this );
203 slider->setMinValue( 0 );
204 slider->setMaxValue( 1 );
205 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
206 //slider->setFocusPolicy( QWidget::NoFocus );
207
208 resizeEvent( 0 );
209}
210
204void VideoWidget::updateSlider( long i, long max ) { 211void VideoWidget::updateSlider( long i, long max ) {
205 // Will flicker too much if we don't do this 212 // Will flicker too much if we don't do this
206 if ( max == 0 ) { 213 if ( max == 0 ) {
207 return; 214 return;
208 } 215 }
209 int width = slider->width(); 216 int width = slider->width();
210 int val = int((double)i * width / max); 217 int val = int((double)i * width / max);
211 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 218 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
212 if ( slider->value() != val ) { 219 if ( slider->value() != val ) {
213 slider->setValue( val ); 220 slider->setValue( val );
214 } 221 }
215 if ( slider->maxValue() != width ) { 222 if ( slider->maxValue() != width ) {
216 slider->setMaxValue( width ); 223 slider->setMaxValue( width );
217 } 224 }
218 } 225 }
219} 226}
220 227
221void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 228void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
222 if ( mediaPlayerState.isFullscreen() ) { 229 if ( mediaPlayerState.isFullscreen() ) {
223 mediaPlayerState.setFullscreen( FALSE ); 230 mediaPlayerState.setFullscreen( FALSE );
224 makeVisible(); 231 makeVisible();
225 } 232 }
226 MediaWidget::mouseReleaseEvent( event ); 233 MediaWidget::mouseReleaseEvent( event );
227} 234}
228 235
229void VideoWidget::backToNormal() { 236void VideoWidget::backToNormal() {
230 mediaPlayerState.setFullscreen( FALSE ); 237 mediaPlayerState.setFullscreen( FALSE );
231 makeVisible(); 238 makeVisible();
232} 239}
233 240
234void VideoWidget::makeVisible() { 241void VideoWidget::makeVisible() {
235 if ( mediaPlayerState.isFullscreen() ) { 242 if ( mediaPlayerState.isFullscreen() ) {
236 setBackgroundMode( QWidget::NoBackground ); 243 setBackgroundMode( QWidget::NoBackground );
237 showFullScreen(); 244 showFullScreen();
238 resize( qApp->desktop()->size() ); 245 resize( qApp->desktop()->size() );
239 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 246 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
240 247
241 slider->hide(); 248 slider->hide();
242 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 249 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
243 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 250 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
244 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 251 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
245 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 252 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
246 253
247 } else { 254 } else {
248 showNormal(); 255 showNormal();
249 showMaximized(); 256 showMaximized();
250 setBackgroundPixmap( backgroundPixmap ); 257 setBackgroundPixmap( backgroundPixmap );
251 QWidget *d = QApplication::desktop(); 258 QWidget *d = QApplication::desktop();
252 int w = d->width(); 259 int w = d->width();
253 int h = d->height(); 260 int h = d->height();
254 261
255 if(w>h) { 262 if(w>h) {
256 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
257 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 264 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
258 } else { 265 } else {
259 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 266 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
260 } 267 }
261 268
262 if ( !mediaPlayerState.isSeekable() ) { 269 if ( !mediaPlayerState.isSeekable() ) {
263 if( !slider->isHidden()) { 270 if( !slider->isHidden()) {
264 slider->hide(); 271 slider->hide();
265 } 272 }
266 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 273 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
267 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 274 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
268 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 275 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
269 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 276 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
270 } else { 277 } else {
271 slider->show(); 278 slider->show();
272 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 279 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
273 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 280 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
274 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 281 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
275 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 282 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
276 } 283 }
277 } 284 }
278} 285}
279 286
280void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 287void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
281 switch ( e->key() ) { 288 switch ( e->key() ) {
282////////////////////////////// Zaurus keys 289////////////////////////////// Zaurus keys
283 case Key_Home: 290 case Key_Home:
284 break; 291 break;
285 case Key_F9: //activity 292 case Key_F9: //activity
286 break; 293 break;
287 case Key_F10: //contacts 294 case Key_F10: //contacts
288// hide(); 295// hide();
289 break; 296 break;
290 case Key_F11: //menu 297 case Key_F11: //menu
291 break; 298 break;
292 case Key_F12: //home 299 case Key_F12: //home
293 break; 300 break;
294 case Key_F13: //mail 301 case Key_F13: //mail
295 break; 302 break;
296 case Key_Space: { 303 case Key_Space: {
297 if(mediaPlayerState.isPlaying()) { 304 if(mediaPlayerState.isPlaying()) {
298 mediaPlayerState.setPlaying(FALSE); 305 mediaPlayerState.setPlaying(FALSE);
299 } else { 306 } else {
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 21a4e9e..87be371 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,102 +1,104 @@
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();
70
69signals: 71signals:
70 void moreClicked(); 72 void moreClicked();
71 void lessClicked(); 73 void lessClicked();
72 void sliderMoved( long ); 74 void sliderMoved( long );
73 void videoResized ( const QSize &s ); 75 void videoResized ( const QSize &s );
74 76
75protected: 77protected:
76 78
77 void resizeEvent( QResizeEvent * ); 79 void resizeEvent( QResizeEvent * );
78 void mouseReleaseEvent( QMouseEvent *event ); 80 void mouseReleaseEvent( QMouseEvent *event );
79 void keyReleaseEvent( QKeyEvent *e); 81 void keyReleaseEvent( QKeyEvent *e);
80 82
81private: 83private:
82// Ticker songInfo; 84// Ticker songInfo;
83 QImage imgUp; 85 QImage imgUp;
84 QImage imgDn; 86 QImage imgDn;
85 QString skin; 87 QString skin;
86 88
87 89
88 90
89 QString backgroundPix; 91 QString backgroundPix;
90 QSlider *slider; 92 QSlider *slider;
91 QImage *currentFrame; 93 QImage *currentFrame;
92 int scaledWidth; 94 int scaledWidth;
93 int scaledHeight; 95 int scaledHeight;
94 XineVideoWidget* videoFrame; 96 XineVideoWidget* videoFrame;
95 97
96 bool videoSliderBeingMoved; 98 bool videoSliderBeingMoved;
97}; 99};
98 100
99#endif // VIDEO_WIDGET_H 101#endif // VIDEO_WIDGET_H
100 102
101 103
102 104