summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-14 18:05:28 (UTC)
committer zecke <zecke>2004-03-14 18:05:28 (UTC)
commit9e54b8bd8343af7c301da17d82596d6027e53309 (patch) (unidiff)
tree693613ff9f1a0f3415e0623e636d47ac4798da2d
parent98bbe5561e8e1a862e19a3d0a0d49ed90ef15b54 (diff)
downloadopie-9e54b8bd8343af7c301da17d82596d6027e53309.zip
opie-9e54b8bd8343af7c301da17d82596d6027e53309.tar.gz
opie-9e54b8bd8343af7c301da17d82596d6027e53309.tar.bz2
OpiePlayer -> ODP
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp1
-rw-r--r--core/multimedia/opieplayer/audiowidget.h4
-rw-r--r--core/multimedia/opieplayer/config.in2
-rw-r--r--core/multimedia/opieplayer/inputDialog.cpp3
-rw-r--r--core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp2
-rw-r--r--core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp2
-rw-r--r--core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp2
-rw-r--r--core/multimedia/opieplayer/modplug/modpluginimpl.cpp2
-rw-r--r--core/multimedia/opieplayer/opieplayer.pro2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp6
-rw-r--r--core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp2
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp2
12 files changed, 23 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 8bcc567..7da2d54 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -1,521 +1,522 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23 23
24#include <qdir.h> 24#include <qdir.h>
25#include "audiowidget.h" 25#include "audiowidget.h"
26#include "mediaplayerstate.h" 26#include "mediaplayerstate.h"
27 27
28#include <stdlib.h> 28#include <stdlib.h>
29#include <stdio.h> 29#include <stdio.h>
30 30
31extern MediaPlayerState *mediaPlayerState; 31extern MediaPlayerState *mediaPlayerState;
32 32
33 33
34static const int xo = -2; // movable x offset 34static const int xo = -2; // movable x offset
35static const int yo = 22; // movable y offset 35static const int yo = 22; // movable y offset
36 36
37using namespace Opie::Ui;
37struct MediaButton { 38struct MediaButton {
38 bool isToggle, isHeld, isDown; 39 bool isToggle, isHeld, isDown;
39}; 40};
40 41
41//Layout information for the audioButtons (and if it is a toggle button or not) 42//Layout information for the audioButtons (and if it is a toggle button or not)
42MediaButton audioButtons[] = { 43MediaButton audioButtons[] = {
43 { TRUE, FALSE, FALSE }, // play 44 { TRUE, FALSE, FALSE }, // play
44 { FALSE, FALSE, FALSE }, // stop 45 { FALSE, FALSE, FALSE }, // stop
45 { FALSE, FALSE, FALSE }, // next 46 { FALSE, FALSE, FALSE }, // next
46 { FALSE, FALSE, FALSE }, // previous 47 { FALSE, FALSE, FALSE }, // previous
47 { FALSE, FALSE, FALSE }, // volume up 48 { FALSE, FALSE, FALSE }, // volume up
48 { FALSE, FALSE, FALSE }, // volume down 49 { FALSE, FALSE, FALSE }, // volume down
49 { TRUE, FALSE, FALSE }, // repeat/loop 50 { TRUE, FALSE, FALSE }, // repeat/loop
50 { FALSE, FALSE, FALSE }, // playlist 51 { FALSE, FALSE, FALSE }, // playlist
51 { FALSE, FALSE, FALSE }, // forward 52 { FALSE, FALSE, FALSE }, // forward
52 { FALSE, FALSE, FALSE } // back 53 { FALSE, FALSE, FALSE } // back
53}; 54};
54 55
55const char *skin_mask_file_names[10] = { 56const char *skin_mask_file_names[10] = {
56 "play", "stop", "next", "prev", "up", 57 "play", "stop", "next", "prev", "up",
57 "down", "loop", "playlist", "forward", "back" 58 "down", "loop", "playlist", "forward", "back"
58}; 59};
59 60
60static void changeTextColor( QWidget *w ) { 61static void changeTextColor( QWidget *w ) {
61 QPalette p = w->palette(); 62 QPalette p = w->palette();
62 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 63 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
63 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 64 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
64 w->setPalette( p ); 65 w->setPalette( p );
65} 66}
66 67
67static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 68static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
68 69
69AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 70AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
70 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) 71 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
71{ 72{
72 setCaption( tr("OpiePlayer") ); 73 setCaption( tr("OpiePlayer") );
73 // qDebug("<<<<<audioWidget"); 74 // qDebug("<<<<<audioWidget");
74 75
75 Config cfg("OpiePlayer"); 76 Config cfg("OpiePlayer");
76 cfg.setGroup("Options"); 77 cfg.setGroup("Options");
77 skin = cfg.readEntry("Skin","default"); 78 skin = cfg.readEntry("Skin","default");
78 //skin = "scaleTest"; 79 //skin = "scaleTest";
79// color of background, frame, degree of transparency 80// color of background, frame, degree of transparency
80 81
81// QString skinPath = "opieplayer/skins/" + skin; 82// QString skinPath = "opieplayer/skins/" + skin;
82 QString skinPath; 83 QString skinPath;
83 skinPath = "opieplayer2/skins/" + skin; 84 skinPath = "opieplayer2/skins/" + skin;
84 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 85 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
85 skinPath = "opieplayer2/skins/default"; 86 skinPath = "opieplayer2/skins/default";
86 87
87 // qDebug("skin path " + skinPath); 88 // qDebug("skin path " + skinPath);
88 89
89 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 90 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
90 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 91 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
91 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 92 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
92 93
93 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 94 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
94 imgButtonMask->fill( 0 ); 95 imgButtonMask->fill( 0 );
95 96
96 for ( int i = 0; i < 10; i++ ) { 97 for ( int i = 0; i < 10; i++ ) {
97 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 98 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
98 masks[i] = new QBitmap( filename ); 99 masks[i] = new QBitmap( filename );
99 100
100 if ( !masks[i]->isNull() ) { 101 if ( !masks[i]->isNull() ) {
101 QImage imgMask = masks[i]->convertToImage(); 102 QImage imgMask = masks[i]->convertToImage();
102 uchar **dest = imgButtonMask->jumpTable(); 103 uchar **dest = imgButtonMask->jumpTable();
103 for ( int y = 0; y < imgUp->height(); y++ ) { 104 for ( int y = 0; y < imgUp->height(); y++ ) {
104 uchar *line = dest[y]; 105 uchar *line = dest[y];
105 for ( int x = 0; x < imgUp->width(); x++ ) 106 for ( int x = 0; x < imgUp->width(); x++ )
106 if ( !qRed( imgMask.pixel( x, y ) ) ) 107 if ( !qRed( imgMask.pixel( x, y ) ) )
107 line[x] = i + 1; 108 line[x] = i + 1;
108 } 109 }
109 } 110 }
110 111
111 } 112 }
112 113
113 for ( int i = 0; i < 11; i++ ) { 114 for ( int i = 0; i < 11; i++ ) {
114 buttonPixUp[i] = NULL; 115 buttonPixUp[i] = NULL;
115 buttonPixDown[i] = NULL; 116 buttonPixDown[i] = NULL;
116 } 117 }
117 118
118 QWidget *d = QApplication::desktop(); 119 QWidget *d = QApplication::desktop();
119 int width = d->width(); 120 int width = d->width();
120 int height = d->height(); 121 int height = d->height();
121 122
122 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 123 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
123 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); 124 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>");
124 QImage img; 125 QImage img;
125 img = pixBg->convertToImage(); 126 img = pixBg->convertToImage();
126 pixBg->convertFromImage( img.smoothScale( width, height)); 127 pixBg->convertFromImage( img.smoothScale( width, height));
127 } 128 }
128 setBackgroundPixmap( *pixBg); 129 setBackgroundPixmap( *pixBg);
129 130
130 songInfo.setFocusPolicy( QWidget::NoFocus ); 131 songInfo.setFocusPolicy( QWidget::NoFocus );
131 132
132// changeTextColor( &songInfo ); 133// changeTextColor( &songInfo );
133// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 134// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
134// songInfo.setFrameStyle( QFrame::NoFrame); 135// songInfo.setFrameStyle( QFrame::NoFrame);
135// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 136// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
136 //NoFrame 137 //NoFrame
137// songInfo.setForegroundColor(Qt::white); 138// songInfo.setForegroundColor(Qt::white);
138 139
139 slider.setFixedHeight( 20 ); 140 slider.setFixedHeight( 20 );
140 slider.setMinValue( 0 ); 141 slider.setMinValue( 0 );
141 slider.setMaxValue( 1 ); 142 slider.setMaxValue( 1 );
142 slider.setFocusPolicy( QWidget::NoFocus ); 143 slider.setFocusPolicy( QWidget::NoFocus );
143 144
144 slider.setBackgroundPixmap( *pixBg ); 145 slider.setBackgroundPixmap( *pixBg );
145 146
146 time.setFocusPolicy( QWidget::NoFocus ); 147 time.setFocusPolicy( QWidget::NoFocus );
147 time.setAlignment( Qt::AlignCenter ); 148 time.setAlignment( Qt::AlignCenter );
148 time.setFrame(FALSE); 149 time.setFrame(FALSE);
149 changeTextColor( &time ); 150 changeTextColor( &time );
150 151
151 resizeEvent( NULL ); 152 resizeEvent( NULL );
152 153
153 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 154 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
154 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 155 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
155 156
156 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 157 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
157 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 158 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
158 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 159 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
159// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 160// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
160 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 161 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
161 162
162 // Intialise state 163 // Intialise state
163 setLength( mediaPlayerState->length() ); 164 setLength( mediaPlayerState->length() );
164 setPosition( mediaPlayerState->position() ); 165 setPosition( mediaPlayerState->position() );
165 setLooping( mediaPlayerState->fullscreen() ); 166 setLooping( mediaPlayerState->fullscreen() );
166// setPaused( mediaPlayerState->paused() ); 167// setPaused( mediaPlayerState->paused() );
167 setPlaying( mediaPlayerState->playing() ); 168 setPlaying( mediaPlayerState->playing() );
168this->setFocus(); 169this->setFocus();
169} 170}
170 171
171 172
172AudioWidget::~AudioWidget() { 173AudioWidget::~AudioWidget() {
173 // setPlaying( false); 174 // setPlaying( false);
174 175
175 for ( int i = 0; i < 10; i++ ) { 176 for ( int i = 0; i < 10; i++ ) {
176 if(buttonPixUp[i]) delete buttonPixUp[i]; 177 if(buttonPixUp[i]) delete buttonPixUp[i];
177 if(buttonPixDown[i]) delete buttonPixDown[i]; 178 if(buttonPixDown[i]) delete buttonPixDown[i];
178 } 179 }
179 if(pixBg) delete pixBg; 180 if(pixBg) delete pixBg;
180 if(imgUp) delete imgUp; 181 if(imgUp) delete imgUp;
181 if(imgDn) delete imgDn; 182 if(imgDn) delete imgDn;
182 if(imgButtonMask) delete imgButtonMask; 183 if(imgButtonMask) delete imgButtonMask;
183 for ( int i = 0; i < 10; i++ ) { 184 for ( int i = 0; i < 10; i++ ) {
184 if(masks[i]) delete masks[i]; 185 if(masks[i]) delete masks[i];
185 } 186 }
186} 187}
187 188
188 189
189QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 190QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
190 QPixmap pix( img.width(), img.height() ); 191 QPixmap pix( img.width(), img.height() );
191 QPainter p( &pix ); 192 QPainter p( &pix );
192 p.drawTiledPixmap( pix.rect(), bg, offset ); 193 p.drawTiledPixmap( pix.rect(), bg, offset );
193 p.drawImage( 0, 0, img ); 194 p.drawImage( 0, 0, img );
194 return new QPixmap( pix ); 195 return new QPixmap( pix );
195} 196}
196 197
197 198
198QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) 199QPixmap *maskPixToMask( QPixmap pix, QBitmap mask )
199{ 200{
200 QPixmap *pixmap = new QPixmap( pix ); 201 QPixmap *pixmap = new QPixmap( pix );
201 pixmap->setMask( mask ); 202 pixmap->setMask( mask );
202 return pixmap; 203 return pixmap;
203} 204}
204 205
205 206
206 207
207void AudioWidget::resizeEvent( QResizeEvent * ) { 208void AudioWidget::resizeEvent( QResizeEvent * ) {
208 int h = height(); 209 int h = height();
209 int w = width(); 210 int w = width();
210 211
211 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); 212 songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
212 slider.setFixedWidth( w - 110 ); 213 slider.setFixedWidth( w - 110 );
213 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 214 slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
214 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 215 slider.setBackgroundOrigin( QWidget::ParentOrigin );
215 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 216 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
216 217
217 xoff = ( w - imgUp->width() ) / 2; 218 xoff = ( w - imgUp->width() ) / 2;
218 yoff = (( h - imgUp->height() ) / 2) - 10; 219 yoff = (( h - imgUp->height() ) / 2) - 10;
219 QPoint p( xoff, yoff ); 220 QPoint p( xoff, yoff );
220 221
221 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 222 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
222 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 223 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
223 224
224 for ( int i = 0; i < 10; i++ ) { 225 for ( int i = 0; i < 10; i++ ) {
225 if ( !masks[i]->isNull() ) { 226 if ( !masks[i]->isNull() ) {
226 delete buttonPixUp[i]; 227 delete buttonPixUp[i];
227 delete buttonPixDown[i]; 228 delete buttonPixDown[i];
228 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 229 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
229 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 230 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
230 } 231 }
231 } 232 }
232 233
233 delete pixUp; 234 delete pixUp;
234 delete pixDn; 235 delete pixDn;
235} 236}
236 237
237 238
238static bool audioSliderBeingMoved = FALSE; 239static bool audioSliderBeingMoved = FALSE;
239 240
240void AudioWidget::sliderPressed() { 241void AudioWidget::sliderPressed() {
241 audioSliderBeingMoved = TRUE; 242 audioSliderBeingMoved = TRUE;
242} 243}
243 244
244 245
245void AudioWidget::sliderReleased() { 246void AudioWidget::sliderReleased() {
246 audioSliderBeingMoved = FALSE; 247 audioSliderBeingMoved = FALSE;
247 if ( slider.width() == 0 ) 248 if ( slider.width() == 0 )
248 return; 249 return;
249 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); 250 long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
250 mediaPlayerState->setPosition( val ); 251 mediaPlayerState->setPosition( val );
251} 252}
252 253
253 254
254void AudioWidget::setPosition( long i ) { 255void AudioWidget::setPosition( long i ) {
255// qDebug("set position %d",i); 256// qDebug("set position %d",i);
256 long length = mediaPlayerState->length(); 257 long length = mediaPlayerState->length();
257 updateSlider( i, length ); 258 updateSlider( i, length );
258} 259}
259 260
260 261
261void AudioWidget::setLength( long max ) { 262void AudioWidget::setLength( long max ) {
262 updateSlider( mediaPlayerState->position(), max ); 263 updateSlider( mediaPlayerState->position(), max );
263} 264}
264 265
265 266
266void AudioWidget::setView( char view ) { 267void AudioWidget::setView( char view ) {
267 268
268 if (mediaPlayerState->isStreaming) { 269 if (mediaPlayerState->isStreaming) {
269 if( !slider.isHidden()) slider.hide(); 270 if( !slider.isHidden()) slider.hide();
270 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 271 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
271 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 272 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
272 } else { 273 } else {
273// this stops the slider from being moved, thus 274// this stops the slider from being moved, thus
274 // does not stop stream when it reaches the end 275 // does not stop stream when it reaches the end
275 slider.show(); 276 slider.show();
276 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 277 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
277 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 278 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
278 } 279 }
279 280
280 if ( view == 'a' ) { 281 if ( view == 'a' ) {
281 startTimer( 150 ); 282 startTimer( 150 );
282// show(); 283// show();
283 QPEApplication::showWidget( this ); 284 QPEApplication::showWidget( this );
284 } else { 285 } else {
285 killTimers(); 286 killTimers();
286 hide(); 287 hide();
287 } 288 }
288 289
289} 290}
290 291
291 292
292static QString timeAsString( long length ) { 293static QString timeAsString( long length ) {
293 length /= 44100; 294 length /= 44100;
294 int minutes = length / 60; 295 int minutes = length / 60;
295 int seconds = length % 60; 296 int seconds = length % 60;
296 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 297 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
297} 298}
298 299
299void AudioWidget::updateSlider( long i, long max ) { 300void AudioWidget::updateSlider( long i, long max ) {
300this->setFocus(); 301this->setFocus();
301 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 302 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
302 303
303 if ( max == 0 ) 304 if ( max == 0 )
304 return; 305 return;
305 // Will flicker too much if we don't do this 306 // Will flicker too much if we don't do this
306 // Scale to something reasonable 307 // Scale to something reasonable
307 int width = slider.width(); 308 int width = slider.width();
308 int val = int((double)i * width / max); 309 int val = int((double)i * width / max);
309 if ( !audioSliderBeingMoved ) { 310 if ( !audioSliderBeingMoved ) {
310 if ( slider.value() != val ) 311 if ( slider.value() != val )
311 slider.setValue( val ); 312 slider.setValue( val );
312 if ( slider.maxValue() != width ) 313 if ( slider.maxValue() != width )
313 slider.setMaxValue( width ); 314 slider.setMaxValue( width );
314 } 315 }
315} 316}
316 317
317 318
318void AudioWidget::setToggleButton( int i, bool down ) { 319void AudioWidget::setToggleButton( int i, bool down ) {
319 if ( down != audioButtons[i].isDown ) 320 if ( down != audioButtons[i].isDown )
320 toggleButton( i ); 321 toggleButton( i );
321} 322}
322 323
323 324
324void AudioWidget::toggleButton( int i ) { 325void AudioWidget::toggleButton( int i ) {
325 audioButtons[i].isDown = !audioButtons[i].isDown; 326 audioButtons[i].isDown = !audioButtons[i].isDown;
326 QPainter p(this); 327 QPainter p(this);
327 paintButton ( &p, i ); 328 paintButton ( &p, i );
328} 329}
329 330
330 331
331void AudioWidget::paintButton( QPainter *p, int i ) { 332void AudioWidget::paintButton( QPainter *p, int i ) {
332 if ( audioButtons[i].isDown ) 333 if ( audioButtons[i].isDown )
333 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 334 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
334 else 335 else
335 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 336 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
336} 337}
337 338
338 339
339void AudioWidget::timerEvent( QTimerEvent * ) { 340void AudioWidget::timerEvent( QTimerEvent * ) {
340/* 341/*
341 int x = audioButtons[AudioPlay].xPos; 342 int x = audioButtons[AudioPlay].xPos;
342 int y = audioButtons[AudioPlay].yPos; 343 int y = audioButtons[AudioPlay].yPos;
343 QPainter p( this ); 344 QPainter p( this );
344 // Optimize to only draw the little bit of the changing images which is different 345 // Optimize to only draw the little bit of the changing images which is different
345 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); 346 p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
346 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); 347 p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
347*/ 348*/
348/* 349/*
349 static int frame = 0; 350 static int frame = 0;
350 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { 351 if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
351 frame = frame >= 7 ? 0 : frame + 1; 352 frame = frame >= 7 ? 0 : frame + 1;
352 } 353 }
353 */ 354 */
354} 355}
355 356
356 357
357void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 358void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
358 for ( int i = 0; i < numButtons; i++ ) { 359 for ( int i = 0; i < numButtons; i++ ) {
359 if ( event->state() == QMouseEvent::LeftButton ) { 360 if ( event->state() == QMouseEvent::LeftButton ) {
360 361
361 // The test to see if the mouse click is inside the button or not 362 // The test to see if the mouse click is inside the button or not
362 int x = event->pos().x() - xoff; 363 int x = event->pos().x() - xoff;
363 int y = event->pos().y() - yoff; 364 int y = event->pos().y() - yoff;
364 365
365 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 366 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
366 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 367 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
367 368
368// if ( isOnButton && i == AudioVolumeUp ) 369// if ( isOnButton && i == AudioVolumeUp )
369// qDebug("on up"); 370// qDebug("on up");
370 371
371 if ( isOnButton && !audioButtons[i].isHeld ) { 372 if ( isOnButton && !audioButtons[i].isHeld ) {
372 audioButtons[i].isHeld = TRUE; 373 audioButtons[i].isHeld = TRUE;
373 toggleButton(i); 374 toggleButton(i);
374 switch (i) { 375 switch (i) {
375 case AudioVolumeUp: 376 case AudioVolumeUp:
376 // qDebug("more clicked"); 377 // qDebug("more clicked");
377 emit moreClicked(); 378 emit moreClicked();
378 return; 379 return;
379 case AudioVolumeDown: 380 case AudioVolumeDown:
380 // qDebug("less clicked"); 381 // qDebug("less clicked");
381 emit lessClicked(); 382 emit lessClicked();
382 return; 383 return;
383 case AudioForward: 384 case AudioForward:
384 emit forwardClicked(); 385 emit forwardClicked();
385 return; 386 return;
386 case AudioBack: 387 case AudioBack:
387 emit backClicked(); 388 emit backClicked();
388 return; 389 return;
389 } 390 }
390 } else if ( !isOnButton && audioButtons[i].isHeld ) { 391 } else if ( !isOnButton && audioButtons[i].isHeld ) {
391 audioButtons[i].isHeld = FALSE; 392 audioButtons[i].isHeld = FALSE;
392 toggleButton(i); 393 toggleButton(i);
393 } 394 }
394 } else { 395 } else {
395 if ( audioButtons[i].isHeld ) { 396 if ( audioButtons[i].isHeld ) {
396 audioButtons[i].isHeld = FALSE; 397 audioButtons[i].isHeld = FALSE;
397 if ( !audioButtons[i].isToggle ) 398 if ( !audioButtons[i].isToggle )
398 setToggleButton( i, FALSE ); 399 setToggleButton( i, FALSE );
399 switch (i) { 400 switch (i) {
400 case AudioPlay: 401 case AudioPlay:
401 if( mediaPlayerState->isPaused ) { 402 if( mediaPlayerState->isPaused ) {
402 mediaPlayerState->setPaused( FALSE ); 403 mediaPlayerState->setPaused( FALSE );
403 return; 404 return;
404 } else if( !mediaPlayerState->isPaused ) { 405 } else if( !mediaPlayerState->isPaused ) {
405 mediaPlayerState->setPaused( TRUE ); 406 mediaPlayerState->setPaused( TRUE );
406 return; 407 return;
407 } 408 }
408// case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; 409// case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
409 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 410 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
410// case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; 411// case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
411 case AudioNext: mediaPlayerState->setNext(); return; 412 case AudioNext: mediaPlayerState->setNext(); return;
412 case AudioPrevious: mediaPlayerState->setPrev(); return; 413 case AudioPrevious: mediaPlayerState->setPrev(); return;
413 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 414 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
414 case AudioVolumeUp: emit moreReleased(); return; 415 case AudioVolumeUp: emit moreReleased(); return;
415 case AudioVolumeDown: emit lessReleased(); return; 416 case AudioVolumeDown: emit lessReleased(); return;
416 case AudioPlayList: mediaPlayerState->setList(); return; 417 case AudioPlayList: mediaPlayerState->setList(); return;
417 } 418 }
418 } 419 }
419 } 420 }
420 } 421 }
421} 422}
422 423
423 424
424 425
425void AudioWidget::mousePressEvent( QMouseEvent *event ) { 426void AudioWidget::mousePressEvent( QMouseEvent *event ) {
426 mouseMoveEvent( event ); 427 mouseMoveEvent( event );
427} 428}
428 429
429 430
430void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 431void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
431 mouseMoveEvent( event ); 432 mouseMoveEvent( event );
432} 433}
433 434
434 435
435void AudioWidget::showEvent( QShowEvent* ) { 436void AudioWidget::showEvent( QShowEvent* ) {
436 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 437 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
437 mouseMoveEvent( &event ); 438 mouseMoveEvent( &event );
438} 439}
439 440
440 441
441void AudioWidget::closeEvent( QCloseEvent* ) { 442void AudioWidget::closeEvent( QCloseEvent* ) {
442 mediaPlayerState->setList(); 443 mediaPlayerState->setList();
443} 444}
444 445
445 446
446void AudioWidget::paintEvent( QPaintEvent * pe) { 447void AudioWidget::paintEvent( QPaintEvent * pe) {
447 if ( !pe->erased() ) { 448 if ( !pe->erased() ) {
448 // Combine with background and double buffer 449 // Combine with background and double buffer
449 QPixmap pix( pe->rect().size() ); 450 QPixmap pix( pe->rect().size() );
450 QPainter p( &pix ); 451 QPainter p( &pix );
451 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 452 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
452 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 453 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
453 for ( int i = 0; i < numButtons; i++ ) 454 for ( int i = 0; i < numButtons; i++ )
454 paintButton( &p, i ); 455 paintButton( &p, i );
455 QPainter p2( this ); 456 QPainter p2( this );
456 p2.drawPixmap( pe->rect().topLeft(), pix ); 457 p2.drawPixmap( pe->rect().topLeft(), pix );
457 } else { 458 } else {
458 QPainter p( this ); 459 QPainter p( this );
459 for ( int i = 0; i < numButtons; i++ ) 460 for ( int i = 0; i < numButtons; i++ )
460 paintButton( &p, i ); 461 paintButton( &p, i );
461 } 462 }
462} 463}
463 464
464void AudioWidget::keyReleaseEvent( QKeyEvent *e) 465void AudioWidget::keyReleaseEvent( QKeyEvent *e)
465{ 466{
466 switch ( e->key() ) { 467 switch ( e->key() ) {
467////////////////////////////// Zaurus keys 468////////////////////////////// Zaurus keys
468 case Key_Home: 469 case Key_Home:
469 break; 470 break;
470 case Key_F9: //activity 471 case Key_F9: //activity
471 hide(); 472 hide();
472// qDebug("Audio F9"); 473// qDebug("Audio F9");
473 break; 474 break;
474 case Key_F10: //contacts 475 case Key_F10: //contacts
475 break; 476 break;
476 case Key_F11: //menu 477 case Key_F11: //menu
477 break; 478 break;
478 case Key_F12: //home 479 case Key_F12: //home
479 break; 480 break;
480 case Key_F13: //mail 481 case Key_F13: //mail
481 break; 482 break;
482 case Key_Space: { 483 case Key_Space: {
483 484
484 if(mediaPlayerState->playing()) { 485 if(mediaPlayerState->playing()) {
485// toggleButton(1); 486// toggleButton(1);
486 mediaPlayerState->setPlaying(FALSE); 487 mediaPlayerState->setPlaying(FALSE);
487// toggleButton(1); 488// toggleButton(1);
488 } else { 489 } else {
489// toggleButton(0); 490// toggleButton(0);
490 mediaPlayerState->setPlaying(TRUE); 491 mediaPlayerState->setPlaying(TRUE);
491// toggleButton(0); 492// toggleButton(0);
492 } 493 }
493 } 494 }
494 break; 495 break;
495 case Key_Down: //volume 496 case Key_Down: //volume
496// toggleButton(6); 497// toggleButton(6);
497 emit lessClicked(); 498 emit lessClicked();
498 emit lessReleased(); 499 emit lessReleased();
499// toggleButton(6); 500// toggleButton(6);
500 break; 501 break;
501 case Key_Up: //volume 502 case Key_Up: //volume
502// toggleButton(5); 503// toggleButton(5);
503 emit moreClicked(); 504 emit moreClicked();
504 emit moreReleased(); 505 emit moreReleased();
505// toggleButton(5); 506// toggleButton(5);
506 break; 507 break;
507 case Key_Right: //next in playlist 508 case Key_Right: //next in playlist
508// toggleButton(3); 509// toggleButton(3);
509 mediaPlayerState->setNext(); 510 mediaPlayerState->setNext();
510// toggleButton(3); 511// toggleButton(3);
511 break; 512 break;
512 case Key_Left: // previous in playlist 513 case Key_Left: // previous in playlist
513// toggleButton(4); 514// toggleButton(4);
514 mediaPlayerState->setPrev(); 515 mediaPlayerState->setPrev();
515// toggleButton(4); 516// toggleButton(4);
516 break; 517 break;
517 case Key_Escape: 518 case Key_Escape:
518 break; 519 break;
519 520
520 }; 521 };
521} 522}
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h
index 96bc55c..0a7cb26 100644
--- a/core/multimedia/opieplayer/audiowidget.h
+++ b/core/multimedia/opieplayer/audiowidget.h
@@ -1,118 +1,118 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef AUDIO_WIDGET_H 21#ifndef AUDIO_WIDGET_H
22#define AUDIO_WIDGET_H 22#define AUDIO_WIDGET_H
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qpainter.h> 25#include <qpainter.h>
26#include <qdrawutil.h> 26#include <qdrawutil.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qbitmap.h> 28#include <qbitmap.h>
29#include <qstring.h> 29#include <qstring.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qframe.h> 32#include <qframe.h>
33 33
34#include <opie/oticker.h> 34#include <opie2/oticker.h>
35 35
36class QPixmap; 36class QPixmap;
37 37
38enum AudioButtons { 38enum AudioButtons {
39 AudioPlay=0, 39 AudioPlay=0,
40 AudioStop, 40 AudioStop,
41 AudioNext, 41 AudioNext,
42 AudioPrevious, 42 AudioPrevious,
43 AudioVolumeUp, 43 AudioVolumeUp,
44 AudioVolumeDown, 44 AudioVolumeDown,
45 AudioLoop, 45 AudioLoop,
46 AudioPlayList, 46 AudioPlayList,
47 AudioForward, 47 AudioForward,
48 AudioBack 48 AudioBack
49}; 49};
50 50
51 51
52//#define USE_DBLBUF 52//#define USE_DBLBUF
53 53
54class AudioWidget : public QWidget { 54class AudioWidget : public QWidget {
55 Q_OBJECT 55 Q_OBJECT
56public: 56public:
57 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 57 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
58 ~AudioWidget(); 58 ~AudioWidget();
59 void setTickerText( const QString &text ) { songInfo.setText( text ); } 59 void setTickerText( const QString &text ) { songInfo.setText( text ); }
60 bool isStreaming; 60 bool isStreaming;
61public slots: 61public slots:
62 void updateSlider( long, long ); 62 void updateSlider( long, long );
63 void sliderPressed( ); 63 void sliderPressed( );
64 void sliderReleased( ); 64 void sliderReleased( );
65// void setPaused( bool b) { setToggleButton( AudioPause, b ); } 65// void setPaused( bool b) { setToggleButton( AudioPause, b ); }
66 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 66 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
67 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 67 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
68 void setPosition( long ); 68 void setPosition( long );
69 void setLength( long ); 69 void setLength( long );
70 void setView( char ); 70 void setView( char );
71 71
72signals: 72signals:
73 void moreClicked(); 73 void moreClicked();
74 void lessClicked(); 74 void lessClicked();
75 void moreReleased(); 75 void moreReleased();
76 void lessReleased(); 76 void lessReleased();
77 void sliderMoved(long); 77 void sliderMoved(long);
78 void forwardClicked(); 78 void forwardClicked();
79 void backClicked(); 79 void backClicked();
80 void forwardReleased(); 80 void forwardReleased();
81 void backReleased(); 81 void backReleased();
82 82
83protected: 83protected:
84 void doBlank(); 84 void doBlank();
85 void doUnblank(); 85 void doUnblank();
86 void paintEvent( QPaintEvent *pe ); 86 void paintEvent( QPaintEvent *pe );
87 void showEvent( QShowEvent *se ); 87 void showEvent( QShowEvent *se );
88 void resizeEvent( QResizeEvent *re ); 88 void resizeEvent( QResizeEvent *re );
89 void mouseMoveEvent( QMouseEvent *event ); 89 void mouseMoveEvent( QMouseEvent *event );
90 void mousePressEvent( QMouseEvent *event ); 90 void mousePressEvent( QMouseEvent *event );
91 void mouseReleaseEvent( QMouseEvent *event ); 91 void mouseReleaseEvent( QMouseEvent *event );
92 void timerEvent( QTimerEvent *event ); 92 void timerEvent( QTimerEvent *event );
93 void closeEvent( QCloseEvent *event ); 93 void closeEvent( QCloseEvent *event );
94 void keyReleaseEvent( QKeyEvent *e); 94 void keyReleaseEvent( QKeyEvent *e);
95private: 95private:
96 void toggleButton( int ); 96 void toggleButton( int );
97 void setToggleButton( int, bool ); 97 void setToggleButton( int, bool );
98 void paintButton( QPainter *p, int i ); 98 void paintButton( QPainter *p, int i );
99 QString skin; 99 QString skin;
100 QPixmap *pixBg; 100 QPixmap *pixBg;
101 QImage *imgUp; 101 QImage *imgUp;
102 QImage *imgDn; 102 QImage *imgDn;
103 QImage *imgButtonMask; 103 QImage *imgButtonMask;
104 QBitmap *masks[11]; 104 QBitmap *masks[11];
105 QPixmap *buttonPixUp[11]; 105 QPixmap *buttonPixUp[11];
106 QPixmap *buttonPixDown[11]; 106 QPixmap *buttonPixDown[11];
107 107
108 QPixmap *pixmaps[4]; 108 QPixmap *pixmaps[4];
109 OTicker songInfo; 109 Opie::Ui::OTicker songInfo;
110 QSlider slider; 110 QSlider slider;
111 QLineEdit time; 111 QLineEdit time;
112 int xoff, yoff; 112 int xoff, yoff;
113 113
114}; 114};
115 115
116 116
117#endif // AUDIO_WIDGET_H 117#endif // AUDIO_WIDGET_H
118 118
diff --git a/core/multimedia/opieplayer/config.in b/core/multimedia/opieplayer/config.in
index dc1b79a..d25b11f 100644
--- a/core/multimedia/opieplayer/config.in
+++ b/core/multimedia/opieplayer/config.in
@@ -1,12 +1,12 @@
1 config OPIEPLAYER 1 config OPIEPLAYER
2 boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)" 2 boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2
5 5
6 source core/multimedia/opieplayer/libflash/config.in 6 source core/multimedia/opieplayer/libflash/config.in
7 source core/multimedia/opieplayer/libmad/config.in 7 source core/multimedia/opieplayer/libmad/config.in
8 source core/multimedia/opieplayer/libmpeg3/config.in 8 source core/multimedia/opieplayer/libmpeg3/config.in
9 source core/multimedia/opieplayer/modplug/config.in 9 source core/multimedia/opieplayer/modplug/config.in
10 source core/multimedia/opieplayer/wavplugin/config.in 10 source core/multimedia/opieplayer/wavplugin/config.in
11 source core/multimedia/opieplayer/vorbis/tremor/config.in 11 source core/multimedia/opieplayer/vorbis/tremor/config.in
12 source core/multimedia/opieplayer/vorbis/config.in 12 source core/multimedia/opieplayer/vorbis/config.in
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp
index 38b8f53..44a1cdd 100644
--- a/core/multimedia/opieplayer/inputDialog.cpp
+++ b/core/multimedia/opieplayer/inputDialog.cpp
@@ -1,59 +1,60 @@
1#include "inputDialog.h" 1#include "inputDialog.h"
2 2
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4 4
5#include <opie/ofiledialog.h> 5#include <opie2/ofiledialog.h>
6 6
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qpushbutton.h> 8#include <qpushbutton.h>
9 9
10using namespace Opie::Ui;
10InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 11InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
11 : QDialog( parent, name, modal, fl ) { 12 : QDialog( parent, name, modal, fl ) {
12 if ( !name ) { 13 if ( !name ) {
13 setName( "InputDialog" ); 14 setName( "InputDialog" );
14 } 15 }
15 resize( 234, 115); 16 resize( 234, 115);
16 setMaximumSize( QSize( 240, 40)); 17 setMaximumSize( QSize( 240, 40));
17 setCaption( tr( name ) ); 18 setCaption( tr( name ) );
18 19
19 QPushButton *browserButton; 20 QPushButton *browserButton;
20 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); 21 browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton");
21 browserButton->setGeometry( QRect( 205, 10, 22, 22)); 22 browserButton->setGeometry( QRect( 205, 10, 22, 22));
22 connect( browserButton, SIGNAL(released()),this,SLOT(browse())); 23 connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
23 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 24 LineEdit1 = new QLineEdit( this, "LineEdit1" );
24 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); 25 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
25 LineEdit1->setFocus(); 26 LineEdit1->setFocus();
26} 27}
27/* 28/*
28 * return the current text(input) 29 * return the current text(input)
29 */ 30 */
30QString InputDialog::text() const { 31QString InputDialog::text() const {
31 return LineEdit1->text(); 32 return LineEdit1->text();
32} 33}
33/* 34/*
34 * Destroys the object and frees any allocated resources 35 * Destroys the object and frees any allocated resources
35 */ 36 */
36InputDialog::~InputDialog() { 37InputDialog::~InputDialog() {
37} 38}
38 39
39void InputDialog::browse() { 40void InputDialog::browse() {
40 41
41 MimeTypes types; 42 MimeTypes types;
42 QStringList audio, video, all; 43 QStringList audio, video, all;
43 audio << "audio/*"; 44 audio << "audio/*";
44 audio << "playlist/plain"; 45 audio << "playlist/plain";
45 audio << "audio/x-mpegurl"; 46 audio << "audio/x-mpegurl";
46 47
47 video << "video/*"; 48 video << "video/*";
48 video << "playlist/plain"; 49 video << "playlist/plain";
49 50
50 all += audio; 51 all += audio;
51 all += video; 52 all += video;
52 types.insert("All Media Files", all ); 53 types.insert("All Media Files", all );
53 types.insert("Audio", audio ); 54 types.insert("Audio", audio );
54 types.insert("Video", video ); 55 types.insert("Video", video );
55 56
56 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 57 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
57 LineEdit1->setText(str); 58 LineEdit1->setText(str);
58} 59}
59 60
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp
index af2c07e..b2a1b5d 100644
--- a/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp
+++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp
@@ -1,70 +1,72 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "libflashplugin.h" 20#include "libflashplugin.h"
21#include "libflashpluginimpl.h" 21#include "libflashpluginimpl.h"
22 22
23 23
24LibFlashPluginImpl::LibFlashPluginImpl() 24LibFlashPluginImpl::LibFlashPluginImpl()
25 : libflashplugin(0), ref(0) 25 : libflashplugin(0), ref(0)
26{ 26{
27} 27}
28 28
29 29
30LibFlashPluginImpl::~LibFlashPluginImpl() 30LibFlashPluginImpl::~LibFlashPluginImpl()
31{ 31{
32 if ( libflashplugin ) 32 if ( libflashplugin )
33 delete libflashplugin; 33 delete libflashplugin;
34} 34}
35 35
36 36
37MediaPlayerDecoder *LibFlashPluginImpl::decoder() 37MediaPlayerDecoder *LibFlashPluginImpl::decoder()
38{ 38{
39 if ( !libflashplugin ) 39 if ( !libflashplugin )
40 libflashplugin = new LibFlashPlugin; 40 libflashplugin = new LibFlashPlugin;
41 return libflashplugin; 41 return libflashplugin;
42} 42}
43 43
44 44
45MediaPlayerEncoder *LibFlashPluginImpl::encoder() 45MediaPlayerEncoder *LibFlashPluginImpl::encoder()
46{ 46{
47 return NULL; 47 return NULL;
48} 48}
49 49
50 50
51#ifndef QT_NO_COMPONENT 51#ifndef QT_NO_COMPONENT
52 52
53 53
54QRESULT LibFlashPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 54QRESULT LibFlashPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{ 55{
56 *iface = 0; 56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef(); 58 *iface = this, (*iface)->addRef();
59 else
60 return QS_FALSE;
59 return QS_OK; 61 return QS_OK;
60} 62}
61 63
62 64
63Q_EXPORT_INTERFACE() 65Q_EXPORT_INTERFACE()
64{ 66{
65 Q_CREATE_INSTANCE( LibFlashPluginImpl ) 67 Q_CREATE_INSTANCE( LibFlashPluginImpl )
66} 68}
67 69
68 70
69#endif 71#endif
70 72
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
index 67779e8..b3e01e5 100644
--- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp
@@ -1,70 +1,72 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "libmadplugin.h" 20#include "libmadplugin.h"
21#include "libmadpluginimpl.h" 21#include "libmadpluginimpl.h"
22 22
23 23
24LibMadPluginImpl::LibMadPluginImpl() 24LibMadPluginImpl::LibMadPluginImpl()
25 : libmadplugin(0), ref(0) 25 : libmadplugin(0), ref(0)
26{ 26{
27} 27}
28 28
29 29
30LibMadPluginImpl::~LibMadPluginImpl() 30LibMadPluginImpl::~LibMadPluginImpl()
31{ 31{
32 if ( libmadplugin ) 32 if ( libmadplugin )
33 delete libmadplugin; 33 delete libmadplugin;
34} 34}
35 35
36 36
37MediaPlayerDecoder *LibMadPluginImpl::decoder() 37MediaPlayerDecoder *LibMadPluginImpl::decoder()
38{ 38{
39 if ( !libmadplugin ) 39 if ( !libmadplugin )
40 libmadplugin = new LibMadPlugin; 40 libmadplugin = new LibMadPlugin;
41 return libmadplugin; 41 return libmadplugin;
42} 42}
43 43
44 44
45MediaPlayerEncoder *LibMadPluginImpl::encoder() 45MediaPlayerEncoder *LibMadPluginImpl::encoder()
46{ 46{
47 return NULL; 47 return NULL;
48} 48}
49 49
50 50
51#ifndef QT_NO_COMPONENT 51#ifndef QT_NO_COMPONENT
52 52
53 53
54QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 54QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{ 55{
56 *iface = 0; 56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef(); 58 *iface = this, (*iface)->addRef();
59 else
60 return QS_FALSE;
59 return QS_OK; 61 return QS_OK;
60} 62}
61 63
62 64
63Q_EXPORT_INTERFACE() 65Q_EXPORT_INTERFACE()
64{ 66{
65 Q_CREATE_INSTANCE( LibMadPluginImpl ) 67 Q_CREATE_INSTANCE( LibMadPluginImpl )
66} 68}
67 69
68 70
69#endif 71#endif
70 72
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
index bf3f372..f6d34b8 100644
--- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
+++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp
@@ -1,70 +1,72 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "libmpeg3plugin.h" 20#include "libmpeg3plugin.h"
21#include "libmpeg3pluginimpl.h" 21#include "libmpeg3pluginimpl.h"
22 22
23 23
24LibMpeg3PluginImpl::LibMpeg3PluginImpl() 24LibMpeg3PluginImpl::LibMpeg3PluginImpl()
25 : libmpeg3plugin(0), ref(0) 25 : libmpeg3plugin(0), ref(0)
26{ 26{
27} 27}
28 28
29 29
30LibMpeg3PluginImpl::~LibMpeg3PluginImpl() 30LibMpeg3PluginImpl::~LibMpeg3PluginImpl()
31{ 31{
32 if ( libmpeg3plugin ) 32 if ( libmpeg3plugin )
33 delete libmpeg3plugin; 33 delete libmpeg3plugin;
34} 34}
35 35
36 36
37MediaPlayerDecoder *LibMpeg3PluginImpl::decoder() 37MediaPlayerDecoder *LibMpeg3PluginImpl::decoder()
38{ 38{
39 if ( !libmpeg3plugin ) 39 if ( !libmpeg3plugin )
40 libmpeg3plugin = new LibMpeg3Plugin; 40 libmpeg3plugin = new LibMpeg3Plugin;
41 return libmpeg3plugin; 41 return libmpeg3plugin;
42} 42}
43 43
44 44
45MediaPlayerEncoder *LibMpeg3PluginImpl::encoder() 45MediaPlayerEncoder *LibMpeg3PluginImpl::encoder()
46{ 46{
47 return NULL; 47 return NULL;
48} 48}
49 49
50 50
51#ifndef QT_NO_COMPONENT 51#ifndef QT_NO_COMPONENT
52 52
53 53
54QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 54QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
55{ 55{
56 *iface = 0; 56 *iface = 0;
57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 57 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
58 *iface = this, (*iface)->addRef(); 58 *iface = this, (*iface)->addRef();
59 else
60 return QS_FALSE;
59 return QS_OK; 61 return QS_OK;
60} 62}
61 63
62 64
63Q_EXPORT_INTERFACE() 65Q_EXPORT_INTERFACE()
64{ 66{
65 Q_CREATE_INSTANCE( LibMpeg3PluginImpl ) 67 Q_CREATE_INSTANCE( LibMpeg3PluginImpl )
66} 68}
67 69
68 70
69#endif 71#endif
70 72
diff --git a/core/multimedia/opieplayer/modplug/modpluginimpl.cpp b/core/multimedia/opieplayer/modplug/modpluginimpl.cpp
index 6e64e76..6205779 100644
--- a/core/multimedia/opieplayer/modplug/modpluginimpl.cpp
+++ b/core/multimedia/opieplayer/modplug/modpluginimpl.cpp
@@ -1,60 +1,62 @@
1/* This file is part of the KDE project 1/* This file is part of the KDE project
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
3 3
4 This program is free software; you can redistribute it and/or 4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public 5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This program is distributed in the hope that it will be useful, 9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details. 12 General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to 15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include "modplugin.h" 20#include "modplugin.h"
21#include "modpluginimpl.h" 21#include "modpluginimpl.h"
22 22
23ModPluginImpl::ModPluginImpl() 23ModPluginImpl::ModPluginImpl()
24 :m_plugin( 0 ), ref( 0 ) 24 :m_plugin( 0 ), ref( 0 )
25{ 25{
26} 26}
27 27
28ModPluginImpl::~ModPluginImpl() 28ModPluginImpl::~ModPluginImpl()
29{ 29{
30 delete m_plugin; 30 delete m_plugin;
31} 31}
32 32
33#ifndef QT_NO_COMPONENT 33#ifndef QT_NO_COMPONENT
34 34
35QRESULT ModPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 35QRESULT ModPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
36{ 36{
37 *iface = 0; 37 *iface = 0;
38 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 38 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
39 *iface = this, (*iface)->addRef(); 39 *iface = this, (*iface)->addRef();
40 else
41 return QS_FALSE;
40 return QS_OK; 42 return QS_OK;
41} 43}
42 44
43Q_EXPORT_INTERFACE() 45Q_EXPORT_INTERFACE()
44{ 46{
45 Q_CREATE_INSTANCE( ModPluginImpl ) 47 Q_CREATE_INSTANCE( ModPluginImpl )
46} 48}
47 49
48#endif 50#endif
49 51
50MediaPlayerDecoder *ModPluginImpl::decoder() 52MediaPlayerDecoder *ModPluginImpl::decoder()
51{ 53{
52 if ( !m_plugin ) 54 if ( !m_plugin )
53 m_plugin = new ModPlugin; 55 m_plugin = new ModPlugin;
54 return m_plugin; 56 return m_plugin;
55} 57}
56 58
57MediaPlayerEncoder *ModPluginImpl::encoder() 59MediaPlayerEncoder *ModPluginImpl::encoder()
58{ 60{
59 return 0; 61 return 0;
60} 62}
diff --git a/core/multimedia/opieplayer/opieplayer.pro b/core/multimedia/opieplayer/opieplayer.pro
index 03d8a89..d7b0fb8 100644
--- a/core/multimedia/opieplayer/opieplayer.pro
+++ b/core/multimedia/opieplayer/opieplayer.pro
@@ -1,21 +1,21 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3#release 3#release
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = loopcontrol.h mediaplayerplugininterface.h \ 5HEADERS = loopcontrol.h mediaplayerplugininterface.h \
6 playlistselection.h mediaplayerstate.h \ 6 playlistselection.h mediaplayerstate.h \
7 videowidget.h audiowidget.h playlistwidget.h \ 7 videowidget.h audiowidget.h playlistwidget.h \
8 mediaplayer.h audiodevice.h inputDialog.h om3u.h 8 mediaplayer.h audiodevice.h inputDialog.h om3u.h
9SOURCES = main.cpp \ 9SOURCES = main.cpp \
10 loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ 10 loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \
11 videowidget.cpp audiowidget.cpp playlistwidget.cpp \ 11 videowidget.cpp audiowidget.cpp playlistwidget.cpp \
12 mediaplayer.cpp audiodevice.cpp inputDialog.cpp om3u.cpp 12 mediaplayer.cpp audiodevice.cpp inputDialog.cpp om3u.cpp
13TARGET = opieplayer 13TARGET = opieplayer
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DEPENDPATH += $(OPIEDIR)/include 15DEPENDPATH += $(OPIEDIR)/include
16LIBS += -lqpe -lpthread -lopie 16LIBS += -lqpe -lpthread -lopieui2
17 17
18INCLUDEPATH += $(OPIEDIR)/include 18INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 19DEPENDPATH += $(OPIEDIR)/include
20 20
21include ( $(OPIEDIR)/include.pro ) 21include ( $(OPIEDIR)/include.pro )
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index d002c42..164458b 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -1,673 +1,675 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/mediaplayerplugininterface.h> 21#include <qpe/mediaplayerplugininterface.h>
22#include <qpe/config.h> 22#include <qpe/config.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24 24
25#include <qdir.h> 25#include <qdir.h>
26#include <qslider.h> 26#include <qslider.h>
27#include "videowidget.h" 27#include "videowidget.h"
28#include "mediaplayerstate.h" 28#include "mediaplayerstate.h"
29 29
30 30
31#ifdef Q_WS_QWS 31#ifdef Q_WS_QWS
32# define USE_DIRECT_PAINTER 32# define USE_DIRECT_PAINTER
33# include <qdirectpainter_qws.h> 33# include <qdirectpainter_qws.h>
34# include <qgfxraster_qws.h> 34# include <qgfxraster_qws.h>
35#endif 35#endif
36 36
37 37
38extern MediaPlayerState *mediaPlayerState; 38extern MediaPlayerState *mediaPlayerState;
39 39
40 40
41static const int xo = 2; // movable x offset 41static const int xo = 2; // movable x offset
42static const int yo = 0; // movable y offset 42static const int yo = 0; // movable y offset
43 43
44 44
45struct MediaButton { 45struct MediaButton {
46// int xPos, yPos; 46// int xPos, yPos;
47 bool isToggle, isHeld, isDown; 47 bool isToggle, isHeld, isDown;
48// int controlType; 48// int controlType;
49}; 49};
50 50
51 51
52// Layout information for the videoButtons (and if it is a toggle button or not) 52// Layout information for the videoButtons (and if it is a toggle button or not)
53MediaButton videoButtons[] = { 53MediaButton videoButtons[] = {
54 { FALSE, FALSE, FALSE }, // stop 54 { FALSE, FALSE, FALSE }, // stop
55 { FALSE, FALSE, FALSE }, // play 55 { FALSE, FALSE, FALSE }, // play
56 { FALSE, FALSE, FALSE }, // previous 56 { FALSE, FALSE, FALSE }, // previous
57 { FALSE, FALSE, FALSE }, // next 57 { FALSE, FALSE, FALSE }, // next
58 { FALSE, FALSE, FALSE }, // volUp 58 { FALSE, FALSE, FALSE }, // volUp
59 { FALSE, FALSE, FALSE }, // volDown 59 { FALSE, FALSE, FALSE }, // volDown
60 { TRUE, FALSE, FALSE } // fullscreen 60 { TRUE, FALSE, FALSE } // fullscreen
61}; 61};
62 62
63//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 63//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
64 64
65const char *skinV_mask_file_names[7] = { 65const char *skinV_mask_file_names[7] = {
66 "stop","play","back","fwd","up","down","full" 66 "stop","play","back","fwd","up","down","full"
67}; 67};
68 68
69static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 69static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
70 70
71VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 71VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
72 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) 72 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
73{ 73{
74 setCaption( tr("OpiePlayer") ); 74 setCaption( tr("OpiePlayer") );
75 Config cfg("OpiePlayer"); 75 Config cfg("OpiePlayer");
76 76
77 cfg.setGroup("Options"); 77 cfg.setGroup("Options");
78 skin = cfg.readEntry("Skin","default"); 78 skin = cfg.readEntry("Skin","default");
79 79
80 QString skinPath; 80 QString skinPath;
81 skinPath = "opieplayer2/skins/" + skin; 81 skinPath = "opieplayer2/skins/" + skin;
82 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) 82 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
83 skinPath = "opieplayer2/skins/default"; 83 skinPath = "opieplayer2/skins/default";
84 84
85 // qDebug("skin path " + skinPath); 85 // qDebug("skin path " + skinPath);
86 86
87// QString skinPath = "opieplayer2/skins/" + skin; 87// QString skinPath = "opieplayer2/skins/" + skin;
88 88
89 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 89 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
90 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 90 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
91 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 91 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
92 92
93 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 93 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
94 imgButtonMask->fill( 0 ); 94 imgButtonMask->fill( 0 );
95 95
96 for ( int i = 0; i < 7; i++ ) { 96 for ( int i = 0; i < 7; i++ ) {
97 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + 97 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath +
98 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 98 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
99 // qDebug("loading "+filename); 99 // qDebug("loading "+filename);
100 masks[i] = new QBitmap( filename ); 100 masks[i] = new QBitmap( filename );
101 101
102 if ( !masks[i]->isNull() ) { 102 if ( !masks[i]->isNull() ) {
103 QImage imgMask = masks[i]->convertToImage(); 103 QImage imgMask = masks[i]->convertToImage();
104 uchar **dest = imgButtonMask->jumpTable(); 104 uchar **dest = imgButtonMask->jumpTable();
105 for ( int y = 0; y < imgUp->height(); y++ ) { 105 for ( int y = 0; y < imgUp->height(); y++ ) {
106 uchar *line = dest[y]; 106 uchar *line = dest[y];
107 for ( int x = 0; x < imgUp->width(); x++ ) { 107 for ( int x = 0; x < imgUp->width(); x++ ) {
108 if ( !qRed( imgMask.pixel( x, y ) ) ) 108 if ( !qRed( imgMask.pixel( x, y ) ) )
109 line[x] = i + 1; 109 line[x] = i + 1;
110 } 110 }
111 } 111 }
112 } 112 }
113 } 113 }
114 // qDebug("finished loading first pics"); 114 // qDebug("finished loading first pics");
115 for ( int i = 0; i < 7; i++ ) { 115 for ( int i = 0; i < 7; i++ ) {
116 buttonPixUp[i] = NULL; 116 buttonPixUp[i] = NULL;
117 buttonPixDown[i] = NULL; 117 buttonPixDown[i] = NULL;
118 } 118 }
119 119
120 120
121 QWidget *d = QApplication::desktop(); 121 QWidget *d = QApplication::desktop();
122 int width = d->width(); 122 int width = d->width();
123 int height = d->height(); 123 int height = d->height();
124 124
125 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 125 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
126 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); 126 // qDebug("<<<<<<<< scale image >>>>>>>>>>>>");
127 QImage img; 127 QImage img;
128 img = pixBg->convertToImage(); 128 img = pixBg->convertToImage();
129 pixBg->convertFromImage( img.smoothScale( width, height)); 129 pixBg->convertFromImage( img.smoothScale( width, height));
130 } 130 }
131 setBackgroundPixmap( *pixBg ); 131 setBackgroundPixmap( *pixBg );
132 132
133 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 133 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
134 134
135 slider = new QSlider( Qt::Horizontal, this ); 135 slider = new QSlider( Qt::Horizontal, this );
136 slider->setMinValue( 0 ); 136 slider->setMinValue( 0 );
137 slider->setMaxValue( 1 ); 137 slider->setMaxValue( 1 );
138 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 138 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
139 slider->setFocusPolicy( QWidget::NoFocus ); 139 slider->setFocusPolicy( QWidget::NoFocus );
140// slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 140// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
141 141
142 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 142 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
143 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 143 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
144 144
145 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 145 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
146 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 146 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
147 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 147 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
148 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 148 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
149// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 149// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
150 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 150 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
151 151
152 // Intialise state 152 // Intialise state
153 setLength( mediaPlayerState->length() ); 153 setLength( mediaPlayerState->length() );
154 setPosition( mediaPlayerState->position() ); 154 setPosition( mediaPlayerState->position() );
155 setFullscreen( mediaPlayerState->fullscreen() ); 155 setFullscreen( mediaPlayerState->fullscreen() );
156// setPaused( mediaPlayerState->paused() ); 156// setPaused( mediaPlayerState->paused() );
157 setPlaying( mediaPlayerState->playing() ); 157 setPlaying( mediaPlayerState->playing() );
158} 158}
159 159
160 160
161VideoWidget::~VideoWidget() { 161VideoWidget::~VideoWidget() {
162 162
163 for ( int i = 0; i < 7; i++ ) 163 for ( int i = 0; i < 7; i++ )
164 { 164 {
165 delete buttonPixUp[i]; 165 delete buttonPixUp[i];
166 delete buttonPixDown[i]; 166 delete buttonPixDown[i];
167 } 167 }
168 168
169 delete pixBg; 169 delete pixBg;
170 delete imgUp; 170 delete imgUp;
171 delete imgDn; 171 delete imgDn;
172 delete imgButtonMask; 172 delete imgButtonMask;
173 for ( int i = 0; i < 7; i++ ) 173 for ( int i = 0; i < 7; i++ )
174 { 174 {
175 delete masks[i]; 175 delete masks[i];
176 } 176 }
177 177
178// for ( int i = 0; i < 3; i++ ) 178// for ( int i = 0; i < 3; i++ )
179// delete pixmaps[i]; 179// delete pixmaps[i];
180// delete currentFrame; 180// delete currentFrame;
181} 181}
182 182
183 183
184static bool videoSliderBeingMoved = FALSE; 184static bool videoSliderBeingMoved = FALSE;
185 185
186QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 186QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
187 QPixmap pix( img.width(), img.height() ); 187 QPixmap pix( img.width(), img.height() );
188 QPainter p( &pix ); 188 QPainter p( &pix );
189 p.drawTiledPixmap( pix.rect(), bg, offset ); 189 p.drawTiledPixmap( pix.rect(), bg, offset );
190 p.drawImage( 0, 0, img ); 190 p.drawImage( 0, 0, img );
191 return new QPixmap( pix ); 191 return new QPixmap( pix );
192} 192}
193 193
194QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 194QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
195 QPixmap *pixmap = new QPixmap( pix ); 195 QPixmap *pixmap = new QPixmap( pix );
196 pixmap->setMask( mask ); 196 pixmap->setMask( mask );
197 return pixmap; 197 return pixmap;
198} 198}
199 199
200void VideoWidget::resizeEvent( QResizeEvent * ) { 200void VideoWidget::resizeEvent( QResizeEvent * ) {
201 int h = height(); 201 int h = height();
202 int w = width(); 202 int w = width();
203 //int Vh = 160; 203 //int Vh = 160;
204 //int Vw = 220; 204 //int Vw = 220;
205 205
206 slider->setFixedWidth( w - 20 ); 206 slider->setFixedWidth( w - 20 );
207 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 207 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
208 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 208 slider->setBackgroundOrigin( QWidget::ParentOrigin );
209 slider->setFocusPolicy( QWidget::NoFocus ); 209 slider->setFocusPolicy( QWidget::NoFocus );
210 slider->setBackgroundPixmap( *pixBg ); 210 slider->setBackgroundPixmap( *pixBg );
211 211
212 xoff = 0;// ( imgUp->width() ) / 2; 212 xoff = 0;// ( imgUp->width() ) / 2;
213 if(w>h) 213 if(w>h)
214 yoff = 0; 214 yoff = 0;
215 else 215 else
216 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; 216 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
217 QPoint p( xoff, yoff ); 217 QPoint p( xoff, yoff );
218 218
219 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); 219 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
220 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); 220 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
221 221
222 for ( int i = 0; i < 7; i++ ) 222 for ( int i = 0; i < 7; i++ )
223 { 223 {
224 if ( !masks[i]->isNull() ) 224 if ( !masks[i]->isNull() )
225 { 225 {
226 delete buttonPixUp[i]; 226 delete buttonPixUp[i];
227 delete buttonPixDown[i]; 227 delete buttonPixDown[i];
228 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); 228 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
229 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); 229 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
230 } 230 }
231 } 231 }
232 232
233 delete pixUp; 233 delete pixUp;
234 delete pixDn; 234 delete pixDn;
235} 235}
236 236
237 237
238void VideoWidget::sliderPressed() { 238void VideoWidget::sliderPressed() {
239 videoSliderBeingMoved = TRUE; 239 videoSliderBeingMoved = TRUE;
240} 240}
241 241
242 242
243void VideoWidget::sliderReleased() { 243void VideoWidget::sliderReleased() {
244 videoSliderBeingMoved = FALSE; 244 videoSliderBeingMoved = FALSE;
245 if ( slider->width() == 0 ) 245 if ( slider->width() == 0 )
246 return; 246 return;
247 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 247 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
248 mediaPlayerState->setPosition( val ); 248 mediaPlayerState->setPosition( val );
249} 249}
250 250
251 251
252void VideoWidget::setPosition( long i ) { 252void VideoWidget::setPosition( long i ) {
253 updateSlider( i, mediaPlayerState->length() ); 253 updateSlider( i, mediaPlayerState->length() );
254} 254}
255 255
256 256
257void VideoWidget::setLength( long max ) { 257void VideoWidget::setLength( long max ) {
258 updateSlider( mediaPlayerState->position(), max ); 258 updateSlider( mediaPlayerState->position(), max );
259} 259}
260 260
261 261
262void VideoWidget::setView( char view ) { 262void VideoWidget::setView( char view ) {
263 if ( view == 'v' ) 263 if ( view == 'v' )
264 { 264 {
265 makeVisible(); 265 makeVisible();
266 } 266 }
267 else 267 else
268 { 268 {
269 // Effectively blank the view next time we show it so it looks nicer 269 // Effectively blank the view next time we show it so it looks nicer
270 scaledWidth = 0; 270 scaledWidth = 0;
271 scaledHeight = 0; 271 scaledHeight = 0;
272 hide(); 272 hide();
273 } 273 }
274} 274}
275 275
276 276
277void VideoWidget::updateSlider( long i, long max ) { 277void VideoWidget::updateSlider( long i, long max ) {
278 // Will flicker too much if we don't do this 278 // Will flicker too much if we don't do this
279 if ( max == 0 ) 279 if ( max == 0 )
280 return; 280 return;
281 int width = slider->width(); 281 int width = slider->width();
282 int val = int((double)i * width / max); 282 int val = int((double)i * width / max);
283 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) 283 if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved )
284 { 284 {
285 if ( slider->value() != val ) 285 if ( slider->value() != val )
286 slider->setValue( val ); 286 slider->setValue( val );
287 if ( slider->maxValue() != width ) 287 if ( slider->maxValue() != width )
288 slider->setMaxValue( width ); 288 slider->setMaxValue( width );
289 } 289 }
290} 290}
291 291
292 292
293void VideoWidget::setToggleButton( int i, bool down ) { 293void VideoWidget::setToggleButton( int i, bool down ) {
294 if ( down != videoButtons[i].isDown ) 294 if ( down != videoButtons[i].isDown )
295 toggleButton( i ); 295 toggleButton( i );
296} 296}
297 297
298 298
299void VideoWidget::toggleButton( int i ) { 299void VideoWidget::toggleButton( int i ) {
300 videoButtons[i].isDown = !videoButtons[i].isDown; 300 videoButtons[i].isDown = !videoButtons[i].isDown;
301 QPainter p(this); 301 QPainter p(this);
302 paintButton ( &p, i ); 302 paintButton ( &p, i );
303} 303}
304 304
305 305
306void VideoWidget::paintButton( QPainter *p, int i ) { 306void VideoWidget::paintButton( QPainter *p, int i ) {
307 if ( videoButtons[i].isDown ) 307 if ( videoButtons[i].isDown )
308 { 308 {
309 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 309 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
310 } 310 }
311 else 311 else
312 { 312 {
313 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 313 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
314 } 314 }
315} 315}
316 316
317 317
318void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 318void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
319 for ( int i = 0; i < numVButtons; i++ ) { 319 for ( int i = 0; i < numVButtons; i++ ) {
320 if ( event->state() == QMouseEvent::LeftButton ) { 320 if ( event->state() == QMouseEvent::LeftButton ) {
321 // The test to see if the mouse click is inside the button or not 321 // The test to see if the mouse click is inside the button or not
322 int x = event->pos().x() - xoff; 322 int x = event->pos().x() - xoff;
323 int y = event->pos().y() - yoff; 323 int y = event->pos().y() - yoff;
324 324
325 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 325 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
326 && y < imgButtonMask->height() 326 && y < imgButtonMask->height()
327 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 327 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
328 328
329 if ( isOnButton && !videoButtons[i].isHeld ) { 329 if ( isOnButton && !videoButtons[i].isHeld ) {
330 videoButtons[i].isHeld = TRUE; 330 videoButtons[i].isHeld = TRUE;
331 toggleButton(i); 331 toggleButton(i);
332 332
333 switch (i) { 333 switch (i) {
334 case VideoVolUp: 334 case VideoVolUp:
335 emit moreClicked(); 335 emit moreClicked();
336 return; 336 return;
337 case VideoVolDown: 337 case VideoVolDown:
338 emit lessClicked(); 338 emit lessClicked();
339 return; 339 return;
340 } 340 }
341 } else if ( !isOnButton && videoButtons[i].isHeld ) { 341 } else if ( !isOnButton && videoButtons[i].isHeld ) {
342 videoButtons[i].isHeld = FALSE; 342 videoButtons[i].isHeld = FALSE;
343 toggleButton(i); 343 toggleButton(i);
344 } 344 }
345 } else { 345 } else {
346 346
347 if ( videoButtons[i].isHeld ) { 347 if ( videoButtons[i].isHeld ) {
348 videoButtons[i].isHeld = FALSE; 348 videoButtons[i].isHeld = FALSE;
349 if ( !videoButtons[i].isToggle ) { 349 if ( !videoButtons[i].isToggle ) {
350 setToggleButton( i, FALSE ); 350 setToggleButton( i, FALSE );
351 } 351 }
352 352
353 switch(i) { 353 switch(i) {
354 354
355 case VideoPlay: { 355 case VideoPlay: {
356 // qDebug("play"); 356 // qDebug("play");
357 if( !mediaPlayerState->playing()) { 357 if( !mediaPlayerState->playing()) {
358 mediaPlayerState->setPlaying( true); 358 mediaPlayerState->setPlaying( true);
359 setToggleButton( i-1, false ); 359 setToggleButton( i-1, false );
360 setToggleButton( i, false ); 360 setToggleButton( i, false );
361 return; 361 return;
362 } 362 }
363 if( mediaPlayerState->isPaused ) { 363 if( mediaPlayerState->isPaused ) {
364 // qDebug("isPaused"); 364 // qDebug("isPaused");
365 setToggleButton( i, FALSE ); 365 setToggleButton( i, FALSE );
366 mediaPlayerState->setPaused( FALSE ); 366 mediaPlayerState->setPaused( FALSE );
367 return; 367 return;
368 } else if( !mediaPlayerState->isPaused ) { 368 } else if( !mediaPlayerState->isPaused ) {
369 // qDebug("is not paused"); 369 // qDebug("is not paused");
370 setToggleButton( i, TRUE ); 370 setToggleButton( i, TRUE );
371 mediaPlayerState->setPaused( TRUE ); 371 mediaPlayerState->setPaused( TRUE );
372 return; 372 return;
373 } else { 373 } else {
374 return; 374 return;
375 } 375 }
376 } 376 }
377 377
378 case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; 378 case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return;
379 case VideoNext: mediaPlayerState->setNext(); return; 379 case VideoNext: mediaPlayerState->setNext(); return;
380 case VideoPrevious: mediaPlayerState->setPrev(); return; 380 case VideoPrevious: mediaPlayerState->setPrev(); return;
381 case VideoVolUp: emit moreReleased(); return; 381 case VideoVolUp: emit moreReleased(); return;
382 case VideoVolDown: emit lessReleased(); return; 382 case VideoVolDown: emit lessReleased(); return;
383 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 383 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
384 } 384 }
385 } 385 }
386 } 386 }
387 } 387 }
388} 388}
389 389
390 390
391void VideoWidget::mousePressEvent( QMouseEvent *event ) { 391void VideoWidget::mousePressEvent( QMouseEvent *event ) {
392 mouseMoveEvent( event ); 392 mouseMoveEvent( event );
393} 393}
394 394
395 395
396void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 396void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
397 if ( mediaPlayerState->fullscreen() ) 397 if ( mediaPlayerState->fullscreen() )
398 { 398 {
399 mediaPlayerState->setFullscreen( FALSE ); 399 mediaPlayerState->setFullscreen( FALSE );
400 makeVisible(); 400 makeVisible();
401 } 401 }
402 mouseMoveEvent( event ); 402 mouseMoveEvent( event );
403// } 403// }
404} 404}
405 405
406 406
407void VideoWidget::makeVisible() { 407void VideoWidget::makeVisible() {
408 if ( mediaPlayerState->fullscreen() ) 408 if ( mediaPlayerState->fullscreen() )
409 { 409 {
410 setBackgroundMode( QWidget::NoBackground ); 410 setBackgroundMode( QWidget::NoBackground );
411 showFullScreen(); 411 showFullScreen();
412 resize( qApp->desktop()->size() ); 412 resize( qApp->desktop()->size() );
413 slider->hide(); 413 slider->hide();
414 } 414 }
415 else 415 else
416 { 416 {
417 setBackgroundPixmap( *pixBg ); 417 setBackgroundPixmap( *pixBg );
418 showNormal(); 418 showNormal();
419 QPEApplication::showWidget( this ); 419 QPEApplication::showWidget( this );
420 slider->show(); 420 slider->show();
421 } 421 }
422} 422}
423 423
424 424
425void VideoWidget::paintEvent( QPaintEvent * pe) { 425void VideoWidget::paintEvent( QPaintEvent * pe) {
426 QPainter p( this ); 426 QPainter p( this );
427 427
428 if ( mediaPlayerState->fullscreen() ) { 428 if ( mediaPlayerState->fullscreen() ) {
429 // Clear the background 429 // Clear the background
430 p.setBrush( QBrush( Qt::black ) ); 430 p.setBrush( QBrush( Qt::black ) );
431 p.drawRect( rect() ); 431 p.drawRect( rect() );
432 } else { 432 } else {
433 if ( !pe->erased() ) { 433 if ( !pe->erased() ) {
434 // Combine with background and double buffer 434 // Combine with background and double buffer
435 QPixmap pix( pe->rect().size() ); 435 QPixmap pix( pe->rect().size() );
436 QPainter p( &pix ); 436 QPainter p( &pix );
437 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 437 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
438 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 438 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
439 for ( int i = 0; i < numVButtons; i++ ) { 439 for ( int i = 0; i < numVButtons; i++ ) {
440 paintButton( &p, i ); 440 paintButton( &p, i );
441 } 441 }
442 QPainter p2( this ); 442 QPainter p2( this );
443 p2.drawPixmap( pe->rect().topLeft(), pix ); 443 p2.drawPixmap( pe->rect().topLeft(), pix );
444 } else { 444 } else {
445 QPainter p( this ); 445 QPainter p( this );
446 for ( int i = 0; i < numVButtons; i++ ) 446 for ( int i = 0; i < numVButtons; i++ )
447 paintButton( &p, i ); 447 paintButton( &p, i );
448 } 448 }
449 slider->repaint( TRUE ); 449 slider->repaint( TRUE );
450 } 450 }
451} 451}
452 452
453 453
454void VideoWidget::closeEvent( QCloseEvent* ) { 454void VideoWidget::closeEvent( QCloseEvent* ) {
455 mediaPlayerState->setList(); 455 mediaPlayerState->setList();
456} 456}
457 457
458 458
459bool VideoWidget::playVideo() { 459bool VideoWidget::playVideo() {
460 bool result = FALSE; 460 bool result = FALSE;
461// qDebug("<<<<<<<<<<<<<<<< play video"); 461// qDebug("<<<<<<<<<<<<<<<< play video");
462 int stream = 0; 462 int stream = 0;
463 463
464 int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); 464 int sw = mediaPlayerState->curDecoder()->videoWidth( stream );
465 int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); 465 int sh = mediaPlayerState->curDecoder()->videoHeight( stream );
466 int dd = QPixmap::defaultDepth(); 466 int dd = QPixmap::defaultDepth();
467 int w = height(); 467 int w = height();
468 int h = width(); 468 int h = width();
469 469
470 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; 470 ColorFormat format = (dd == 16) ? RGB565 : BGRA8888;
471 471
472 if ( mediaPlayerState->fullscreen() ) 472 if ( mediaPlayerState->fullscreen() )
473 { 473 {
474#ifdef USE_DIRECT_PAINTER 474#ifdef USE_DIRECT_PAINTER
475 QDirectPainter p(this); 475 QDirectPainter p(this);
476 476
477 if ( ( qt_screen->transformOrientation() == 3 ) && 477 if ( ( qt_screen->transformOrientation() == 3 ) &&
478 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) 478 ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) )
479 { 479 {
480 480
481 w = 320; 481 w = 320;
482 h = 240; 482 h = 240;
483 483
484 if ( mediaPlayerState->scaled() ) 484 if ( mediaPlayerState->scaled() )
485 { 485 {
486 // maintain aspect ratio 486 // maintain aspect ratio
487 if ( w * sh > sw * h ) 487 if ( w * sh > sw * h )
488 w = sw * h / sh; 488 w = sw * h / sh;
489 else 489 else
490 h = sh * w / sw; 490 h = sh * w / sw;
491 } 491 }
492 else 492 else
493 { 493 {
494 w = sw; 494 w = sw;
495 h = sh; 495 h = sh;
496 } 496 }
497 497
498 w--; // we can't allow libmpeg to overwrite. 498 w--; // we can't allow libmpeg to overwrite.
499 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); 499 QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) );
500 500
501 int ox = roff.x() - height() + 2 + (height() - w) / 2; 501 int ox = roff.x() - height() + 2 + (height() - w) / 2;
502 int oy = roff.y() + (width() - h) / 2; 502 int oy = roff.y() + (width() - h) / 2;
503 int sx = 0, sy = 0; 503 int sx = 0, sy = 0;
504 504
505 uchar* fp = p.frameBuffer() + p.lineStep() * oy; 505 uchar* fp = p.frameBuffer() + p.lineStep() * oy;
506 fp += dd * ox / 8; 506 fp += dd * ox / 8;
507 uchar **jt = new uchar*[h]; 507 uchar **jt = new uchar*[h];
508 508
509 for ( int i = h; i; i-- ) 509 for ( int i = h; i; i-- )
510 { 510 {
511 jt[h - i] = fp; 511 jt[h - i] = fp;
512 fp += p.lineStep(); 512 fp += p.lineStep();
513 } 513 }
514 514
515 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; 515 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0;
516 516
517 delete [] jt; 517 delete [] jt;
518 } 518 }
519 else 519 else
520 { 520 {
521#endif 521#endif
522 QPainter p(this); 522 QPainter p(this);
523 523
524 w = 320; 524 w = 320;
525 h = 240; 525 h = 240;
526 526
527 if ( mediaPlayerState->scaled() ) 527 if ( mediaPlayerState->scaled() )
528 { 528 {
529 // maintain aspect ratio 529 // maintain aspect ratio
530 if ( w * sh > sw * h ) 530 if ( w * sh > sw * h )
531 w = sw * h / sh; 531 w = sw * h / sh;
532 else 532 else
533 h = sh * w / sw; 533 h = sh * w / sw;
534 } 534 }
535 else 535 else
536 { 536 {
537 w = sw; 537 w = sw;
538 h = sh; 538 h = sh;
539 } 539 }
540 540
541 int bytes = ( dd == 16 ) ? 2 : 4; 541 int bytes = ( dd == 16 ) ? 2 : 4;
542 QImage tempFrame( w, h, bytes << 3 ); 542 QImage tempFrame( w, h, bytes << 3 );
543 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), 543 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
544 0, 0, sw, sh, w, h, format, 0) == 0; 544 0, 0, sw, sh, w, h, format, 0) == 0;
545 545
546 if ( result && mediaPlayerState->fullscreen() ) 546 if ( result && mediaPlayerState->fullscreen() )
547 { 547 {
548 548
549 int rw = h, rh = w; 549 int rw = h, rh = w;
550 QImage rotatedFrame( rw, rh, bytes << 3 ); 550 QImage rotatedFrame( rw, rh, bytes << 3 );
551 551
552 ushort* in = (ushort*)tempFrame.bits(); 552 ushort* in = (ushort*)tempFrame.bits();
553 ushort* out = (ushort*)rotatedFrame.bits(); 553 ushort* out = (ushort*)rotatedFrame.bits();
554 int spl = rotatedFrame.bytesPerLine() / bytes; 554 int spl = rotatedFrame.bytesPerLine() / bytes;
555 555
556 for (int x=0; x<h; x++) 556 for (int x=0; x<h; x++)
557 { 557 {
558 if ( bytes == 2 ) 558 if ( bytes == 2 )
559 { 559 {
560 ushort* lout = out++ + (w - 1)*spl; 560 ushort* lout = out++ + (w - 1)*spl;
561 for (int y=0; y<w; y++) { 561 for (int y=0; y<w; y++) {
562 *lout=*in++; 562 *lout=*in++;
563 lout-=spl; 563 lout-=spl;
564 } 564 }
565 } 565 }
566 else 566 else
567 { 567 {
568 ulong* lout = ((ulong *)out)++ + (w - 1)*spl; 568 ulong* _out = (ulong *)out;
569 ulong* lout = _out++ + (w - 1)*spl;
569 for (int y=0; y<w; y++) 570 for (int y=0; y<w; y++)
570 { 571 {
571 *lout=*((ulong*)in)++; 572 ulong *_in = (ulong*)in;
573 *lout=*_in++;
572 lout-=spl; 574 lout-=spl;
573 } 575 }
574 } 576 }
575 } 577 }
576 578
577 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); 579 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
578 } 580 }
579#ifdef USE_DIRECT_PAINTER 581#ifdef USE_DIRECT_PAINTER
580 } 582 }
581#endif 583#endif
582 } 584 }
583 else 585 else
584 { 586 {
585 587
586 w = 220; 588 w = 220;
587 h = 160; 589 h = 160;
588 590
589 // maintain aspect ratio 591 // maintain aspect ratio
590 if ( w * sh > sw * h ) 592 if ( w * sh > sw * h )
591 w = sw * h / sh; 593 w = sw * h / sh;
592 else 594 else
593 h = sh * w / sw; 595 h = sh * w / sw;
594 596
595 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; 597 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
596 598
597 QPainter p( this ); 599 QPainter p( this );
598 int deskW = qApp->desktop()->width(); 600 int deskW = qApp->desktop()->width();
599 // Image changed size, therefore need to blank the possibly unpainted regions first 601 // Image changed size, therefore need to blank the possibly unpainted regions first
600 if ( scaledWidth != w || scaledHeight != h ) 602 if ( scaledWidth != w || scaledHeight != h )
601 { 603 {
602 p.setBrush( QBrush( Qt::black ) ); 604 p.setBrush( QBrush( Qt::black ) );
603 p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 ); 605 p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 );
604 } 606 }
605 607
606 scaledWidth = w; 608 scaledWidth = w;
607 scaledHeight = h; 609 scaledHeight = h;
608 610
609 if ( result ) 611 if ( result )
610 { 612 {
611 p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 613 p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
612 } 614 }
613 615
614 } 616 }
615 617
616 return result; 618 return result;
617} 619}
618 620
619 621
620 622
621void VideoWidget::keyReleaseEvent( QKeyEvent *e) 623void VideoWidget::keyReleaseEvent( QKeyEvent *e)
622{ 624{
623 switch ( e->key() ) 625 switch ( e->key() )
624 { 626 {
625////////////////////////////// Zaurus keys 627////////////////////////////// Zaurus keys
626 case Key_Home: 628 case Key_Home:
627 break; 629 break;
628 case Key_F9: //activity 630 case Key_F9: //activity
629 break; 631 break;
630 case Key_F10: //contacts 632 case Key_F10: //contacts
631// hide(); 633// hide();
632 break; 634 break;
633 case Key_F11: //menu 635 case Key_F11: //menu
634 break; 636 break;
635 case Key_F12: //home 637 case Key_F12: //home
636 break; 638 break;
637 case Key_F13: //mail 639 case Key_F13: //mail
638 break; 640 break;
639 case Key_Space: 641 case Key_Space:
640 { 642 {
641 if(mediaPlayerState->playing()) 643 if(mediaPlayerState->playing())
642 { 644 {
643 mediaPlayerState->setPlaying(FALSE); 645 mediaPlayerState->setPlaying(FALSE);
644 } 646 }
645 else 647 else
646 { 648 {
647 mediaPlayerState->setPlaying(TRUE); 649 mediaPlayerState->setPlaying(TRUE);
648 } 650 }
649 } 651 }
650 break; 652 break;
651 case Key_Down: 653 case Key_Down:
652// toggleButton(6); 654// toggleButton(6);
653// emit lessClicked(); 655// emit lessClicked();
654// emit lessReleased(); 656// emit lessReleased();
655// toggleButton(6); 657// toggleButton(6);
656 break; 658 break;
657 case Key_Up: 659 case Key_Up:
658// toggleButton(5); 660// toggleButton(5);
659// emit moreClicked(); 661// emit moreClicked();
660// emit moreReleased(); 662// emit moreReleased();
661// toggleButton(5); 663// toggleButton(5);
662 break; 664 break;
663 case Key_Right: 665 case Key_Right:
664 mediaPlayerState->setNext(); 666 mediaPlayerState->setNext();
665 break; 667 break;
666 case Key_Left: 668 case Key_Left:
667 mediaPlayerState->setPrev(); 669 mediaPlayerState->setPrev();
668 break; 670 break;
669 case Key_Escape: 671 case Key_Escape:
670 break; 672 break;
671 673
672 }; 674 };
673} 675}
diff --git a/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp b/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp
index 440747a..0c7b1ea 100644
--- a/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp
+++ b/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp
@@ -1,71 +1,73 @@
1/**************************************************************************** 1/****************************************************************************
2* libtremorpluginimpl.cpp 2* libtremorpluginimpl.cpp
3* 3*
4* Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net> 4* Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net>
5* 5*
6* This program is free software; you can redistribute it and/or modify 6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by 7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2 of the License, or 8* the Free Software Foundation; either version 2 of the License, or
9* (at your option) any later version. 9* (at your option) any later version.
10* 10*
11* This program is distributed in the hope that it will be useful, 11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of 12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details. 14* GNU General Public License for more details.
15* 15*
16* You should have received a copy of the GNU General Public License 16* You should have received a copy of the GNU General Public License
17* along with this program; if not, write to the Free Software 17* along with this program; if not, write to the Free Software
18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19****************************************************************************/ 19****************************************************************************/
20 20
21#include "libtremorplugin.h" 21#include "libtremorplugin.h"
22#include "libtremorpluginimpl.h" 22#include "libtremorpluginimpl.h"
23 23
24 24
25LibTremorPluginImpl::LibTremorPluginImpl() 25LibTremorPluginImpl::LibTremorPluginImpl()
26 : libtremorplugin(0), ref(0) 26 : libtremorplugin(0), ref(0)
27{ 27{
28} 28}
29 29
30 30
31LibTremorPluginImpl::~LibTremorPluginImpl() 31LibTremorPluginImpl::~LibTremorPluginImpl()
32{ 32{
33 if ( libtremorplugin ) 33 if ( libtremorplugin )
34 delete libtremorplugin; 34 delete libtremorplugin;
35} 35}
36 36
37 37
38MediaPlayerDecoder *LibTremorPluginImpl::decoder() 38MediaPlayerDecoder *LibTremorPluginImpl::decoder()
39{ 39{
40 if ( !libtremorplugin ) 40 if ( !libtremorplugin )
41 libtremorplugin = new LibTremorPlugin; 41 libtremorplugin = new LibTremorPlugin;
42 return libtremorplugin; 42 return libtremorplugin;
43} 43}
44 44
45 45
46MediaPlayerEncoder *LibTremorPluginImpl::encoder() 46MediaPlayerEncoder *LibTremorPluginImpl::encoder()
47{ 47{
48 return NULL; 48 return NULL;
49} 49}
50 50
51 51
52#ifndef QT_NO_COMPONENT 52#ifndef QT_NO_COMPONENT
53 53
54 54
55QRESULT LibTremorPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 55QRESULT LibTremorPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
56{ 56{
57 *iface = 0; 57 *iface = 0;
58 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 58 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
59 *iface = this, (*iface)->addRef(); 59 *iface = this, (*iface)->addRef();
60 else
61 return QS_FALSE;
60 return QS_OK; 62 return QS_OK;
61} 63}
62 64
63 65
64Q_EXPORT_INTERFACE() 66Q_EXPORT_INTERFACE()
65{ 67{
66 Q_CREATE_INSTANCE( LibTremorPluginImpl ) 68 Q_CREATE_INSTANCE( LibTremorPluginImpl )
67} 69}
68 70
69 71
70#endif 72#endif
71 73
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
index c232d7b..4280880 100644
--- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp
@@ -1,69 +1,71 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "wavplugin.h" 20#include "wavplugin.h"
21#include "wavpluginimpl.h" 21#include "wavpluginimpl.h"
22 22
23WavPluginImpl::WavPluginImpl() 23WavPluginImpl::WavPluginImpl()
24 : libmadplugin(0), ref(0) 24 : libmadplugin(0), ref(0)
25{ 25{
26} 26}
27 27
28 28
29WavPluginImpl::~WavPluginImpl() 29WavPluginImpl::~WavPluginImpl()
30{ 30{
31 if ( libmadplugin ) 31 if ( libmadplugin )
32 delete libmadplugin; 32 delete libmadplugin;
33} 33}
34 34
35 35
36MediaPlayerDecoder *WavPluginImpl::decoder() 36MediaPlayerDecoder *WavPluginImpl::decoder()
37{ 37{
38 if ( !libmadplugin ) 38 if ( !libmadplugin )
39 libmadplugin = new WavPlugin; 39 libmadplugin = new WavPlugin;
40 return libmadplugin; 40 return libmadplugin;
41} 41}
42 42
43 43
44MediaPlayerEncoder *WavPluginImpl::encoder() 44MediaPlayerEncoder *WavPluginImpl::encoder()
45{ 45{
46 return NULL; 46 return NULL;
47} 47}
48 48
49 49
50#ifndef QT_NO_COMPONENT 50#ifndef QT_NO_COMPONENT
51 51
52 52
53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) 53QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
54{ 54{
55 *iface = 0; 55 *iface = 0;
56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) 56 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) )
57 *iface = this, (*iface)->addRef(); 57 *iface = this, (*iface)->addRef();
58 else
59 return QS_FALSE;
58 return QS_OK; 60 return QS_OK;
59} 61}
60 62
61 63
62Q_EXPORT_INTERFACE() 64Q_EXPORT_INTERFACE()
63{ 65{
64 Q_CREATE_INSTANCE( WavPluginImpl ) 66 Q_CREATE_INSTANCE( WavPluginImpl )
65} 67}
66 68
67 69
68#endif 70#endif
69 71