-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 316 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 73 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.cpp | 27 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.h | 17 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 13 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/opie-mediaplayer.control | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/opieplayer.pro | 9 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 474 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 5 |
10 files changed, 526 insertions, 412 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index b96b1ef..896da91 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -30,78 +30,119 @@ | |||
30 | 30 | ||
31 | #include "audiowidget.h" | 31 | #include "audiowidget.h" |
32 | #include "mediaplayerstate.h" | 32 | #include "mediaplayerstate.h" |
33 | 33 | ||
34 | #include <stdlib.h> | ||
35 | #include <stdio.h> | ||
36 | |||
34 | extern MediaPlayerState *mediaPlayerState; | 37 | extern MediaPlayerState *mediaPlayerState; |
35 | 38 | ||
36 | 39 | ||
37 | static const int xo = -2; // movable x offset | 40 | static const int xo = -2; // movable x offset |
38 | static const int yo = 22; // movable y offset | 41 | static const int yo = 22; // movable y offset |
39 | 42 | ||
40 | |||
41 | struct MediaButton { | 43 | struct MediaButton { |
42 | int xPos, yPos; | 44 | bool isToggle, isHeld, isDown; |
43 | int color; | ||
44 | bool isToggle, isBig, isHeld, isDown; | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | |||
48 | // Layout information for the audioButtons (and if it is a toggle button or not) | 47 | // Layout information for the audioButtons (and if it is a toggle button or not) |
49 | MediaButton audioButtons[] = { | 48 | MediaButton audioButtons[] = { |
50 | { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play | 49 | { TRUE, FALSE, FALSE }, // play |
51 | { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop | 50 | { FALSE, FALSE, FALSE }, // stop |
52 | { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause | 51 | { TRUE, FALSE, FALSE }, // pause |
53 | { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next | 52 | { FALSE, FALSE, FALSE }, // next |
54 | { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous | 53 | { FALSE, FALSE, FALSE }, // previous |
55 | { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up | 54 | { FALSE, FALSE, FALSE }, // volume up |
56 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down | 55 | { FALSE, FALSE, FALSE }, // volume down |
57 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop | 56 | { TRUE, FALSE, FALSE }, // repeat/loop |
58 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist | 57 | { FALSE, FALSE, FALSE }, // playlist |
58 | { FALSE, FALSE, FALSE }, // forward | ||
59 | { FALSE, FALSE, FALSE } // back | ||
60 | }; | ||
61 | |||
62 | const char *skin_mask_file_names[11] = { | ||
63 | "play", "stop", "pause", "next", "prev", "up", | ||
64 | "down", "loop", "playlist", "forward", "back" | ||
59 | }; | 65 | }; |
60 | 66 | ||
61 | 67 | ||
62 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 68 | static void changeTextColor( QWidget *w ) { |
69 | QPalette p = w->palette(); | ||
70 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | ||
71 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | ||
72 | w->setPalette( p ); | ||
73 | } | ||
63 | 74 | ||
75 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | ||
64 | 76 | ||
65 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 77 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
66 | QWidget( parent, name, f ) | 78 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
67 | { | 79 | { |
68 | setCaption( tr("OpiePlayer") ); | 80 | setCaption( tr("OpiePlayer") ); |
81 | qDebug("<<<<<audioWidget"); | ||
82 | |||
69 | Config cfg("OpiePlayer"); | 83 | Config cfg("OpiePlayer"); |
70 | cfg.setGroup("AudioWidget"); | 84 | cfg.setGroup("AudioWidget"); |
71 | // QGridLayout *layout = new QGridLayout( this ); | 85 | skin = cfg.readEntry("Skin","default"); |
72 | // layout->setSpacing( 2); | 86 | //skin = "scaleTest"; |
73 | // layout->setMargin( 2); | 87 | // color of background, frame, degree of transparency |
74 | QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix; | 88 | |
75 | backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish"); | 89 | QString skinPath = "opieplayer2/skins/" + skin; |
76 | buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll"); | 90 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
77 | buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig"); | 91 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
78 | controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls"); | 92 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
79 | // animatedPix=cfg.readEntry( "animatedPix", "opieplayer/animatedButton"); | 93 | |
80 | 94 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | |
81 | setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); | 95 | imgButtonMask->fill( 0 ); |
82 | pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) ); | 96 | |
83 | pixmaps[1] = new QPixmap( Resource::loadPixmap( buttonsBigPix ) ); | 97 | for ( int i = 0; i < 11; i++ ) { |
84 | pixmaps[2] = new QPixmap( Resource::loadPixmap( controlsPix ) ); | 98 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
85 | // pixmaps[3] = new QPixmap( Resource::loadPixmap( animatedPix) ); | 99 | masks[i] = new QBitmap( filename ); |
86 | 100 | ||
87 | songInfo = new Ticker( this ); | 101 | if ( !masks[i]->isNull() ) { |
88 | songInfo->setFocusPolicy( QWidget::NoFocus ); | 102 | QImage imgMask = masks[i]->convertToImage(); |
89 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); | 103 | uchar **dest = imgButtonMask->jumpTable(); |
90 | // layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); | 104 | for ( int y = 0; y < imgUp->height(); y++ ) { |
91 | 105 | uchar *line = dest[y]; | |
92 | slider = new QSlider( Qt::Horizontal, this ); | 106 | for ( int x = 0; x < imgUp->width(); x++ ) |
93 | slider->setFixedWidth( 220 ); | 107 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
94 | slider->setFixedHeight( 20 ); | 108 | line[x] = i + 1; |
95 | slider->setMinValue( 0 ); | 109 | } |
96 | slider->setMaxValue( 1 ); | 110 | } |
97 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 111 | |
98 | slider->setFocusPolicy( QWidget::NoFocus ); | 112 | } |
99 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); | 113 | |
100 | // layout->addMultiCellWidget( slider, 4, 4, 0, 2 ); | 114 | for ( int i = 0; i < 11; i++ ) { |
101 | 115 | buttonPixUp[i] = NULL; | |
102 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 116 | buttonPixDown[i] = NULL; |
103 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 117 | } |
118 | |||
119 | setBackgroundPixmap( *pixBg ); | ||
120 | |||
121 | songInfo.setFocusPolicy( QWidget::NoFocus ); | ||
122 | |||
123 | changeTextColor( &songInfo ); | ||
124 | songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
125 | songInfo.setFrameStyle( QFrame::NoFrame); | ||
126 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
127 | //NoFrame | ||
128 | // songInfo.setForegroundColor(Qt::white); | ||
129 | |||
130 | slider.setFixedHeight( 20 ); | ||
131 | slider.setMinValue( 0 ); | ||
132 | slider.setMaxValue( 1 ); | ||
133 | slider.setFocusPolicy( QWidget::NoFocus ); | ||
134 | slider.setBackgroundPixmap( *pixBg ); | ||
135 | |||
136 | time.setFocusPolicy( QWidget::NoFocus ); | ||
137 | time.setAlignment( Qt::AlignCenter ); | ||
138 | time.setFrame(FALSE); | ||
139 | changeTextColor( &time ); | ||
140 | |||
141 | resizeEvent( NULL ); | ||
142 | |||
143 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | ||
144 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | ||
104 | 145 | ||
105 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 146 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
106 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 147 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
107 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 148 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
@@ -118,34 +159,92 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
118 | } | 159 | } |
119 | 160 | ||
120 | 161 | ||
121 | AudioWidget::~AudioWidget() { | 162 | AudioWidget::~AudioWidget() { |
122 | mediaPlayerState->isStreaming = FALSE; | 163 | |
123 | for ( int i = 0; i < 3; i++ ) | 164 | for ( int i = 0; i < 11; i++ ) { |
124 | delete pixmaps[i]; | 165 | delete buttonPixUp[i]; |
166 | delete buttonPixDown[i]; | ||
167 | } | ||
168 | delete pixBg; | ||
169 | delete imgUp; | ||
170 | delete imgDn; | ||
171 | delete imgButtonMask; | ||
172 | for ( int i = 0; i < 11; i++ ) { | ||
173 | delete masks[i]; | ||
174 | } | ||
125 | } | 175 | } |
126 | 176 | ||
127 | 177 | ||
128 | static bool audioSliderBeingMoved = FALSE; | 178 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
179 | QPixmap pix( img.width(), img.height() ); | ||
180 | QPainter p( &pix ); | ||
181 | p.drawTiledPixmap( pix.rect(), bg, offset ); | ||
182 | p.drawImage( 0, 0, img ); | ||
183 | return new QPixmap( pix ); | ||
184 | } | ||
185 | |||
186 | |||
187 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) | ||
188 | { | ||
189 | QPixmap *pixmap = new QPixmap( pix ); | ||
190 | pixmap->setMask( mask ); | ||
191 | return pixmap; | ||
192 | } | ||
129 | 193 | ||
130 | 194 | ||
195 | |||
196 | void AudioWidget::resizeEvent( QResizeEvent * ) { | ||
197 | int h = height(); | ||
198 | int w = width(); | ||
199 | |||
200 | songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | ||
201 | slider.setFixedWidth( w - 110 ); | ||
202 | slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | ||
203 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | ||
204 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | ||
205 | |||
206 | xoff = ( w - imgUp->width() ) / 2; | ||
207 | yoff = (( h - imgUp->height() ) / 2) - 10; | ||
208 | QPoint p( xoff, yoff ); | ||
209 | |||
210 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); | ||
211 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); | ||
212 | |||
213 | for ( int i = 0; i < 11; i++ ) { | ||
214 | if ( !masks[i]->isNull() ) { | ||
215 | delete buttonPixUp[i]; | ||
216 | delete buttonPixDown[i]; | ||
217 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); | ||
218 | buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | delete pixUp; | ||
223 | delete pixDn; | ||
224 | } | ||
225 | |||
226 | |||
227 | static bool audioSliderBeingMoved = FALSE; | ||
228 | |||
131 | void AudioWidget::sliderPressed() { | 229 | void AudioWidget::sliderPressed() { |
132 | audioSliderBeingMoved = TRUE; | 230 | audioSliderBeingMoved = TRUE; |
133 | } | 231 | } |
134 | 232 | ||
135 | 233 | ||
136 | void AudioWidget::sliderReleased() { | 234 | void AudioWidget::sliderReleased() { |
137 | audioSliderBeingMoved = FALSE; | 235 | audioSliderBeingMoved = FALSE; |
138 | if ( slider->width() == 0 ) | 236 | if ( slider.width() == 0 ) |
139 | return; | 237 | return; |
140 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 238 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
141 | mediaPlayerState->setPosition( val ); | 239 | mediaPlayerState->setPosition( val ); |
142 | } | 240 | } |
143 | 241 | ||
144 | 242 | ||
145 | void AudioWidget::setPosition( long i ) { | 243 | void AudioWidget::setPosition( long i ) { |
146 | // qDebug("set position %d",i); | 244 | // qDebug("set position %d",i); |
147 | updateSlider( i, mediaPlayerState->length() ); | 245 | long length = mediaPlayerState->length(); |
246 | updateSlider( i, length ); | ||
148 | } | 247 | } |
149 | 248 | ||
150 | 249 | ||
151 | void AudioWidget::setLength( long max ) { | 250 | void AudioWidget::setLength( long max ) { |
@@ -153,16 +252,17 @@ void AudioWidget::setLength( long max ) { | |||
153 | } | 252 | } |
154 | 253 | ||
155 | 254 | ||
156 | void AudioWidget::setView( char view ) { | 255 | void AudioWidget::setView( char view ) { |
256 | |||
157 | if (mediaPlayerState->isStreaming) { | 257 | if (mediaPlayerState->isStreaming) { |
158 | if( !slider->isHidden()) slider->hide(); | 258 | if( !slider.isHidden()) slider.hide(); |
159 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 259 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
160 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 260 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
161 | } else { | 261 | } else { |
162 | // this stops the slider from being moved, thus | 262 | // this stops the slider from being moved, thus |
163 | // does not stop stream when it reaches the end | 263 | // does not stop stream when it reaches the end |
164 | slider->show(); | 264 | slider.show(); |
165 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 265 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
166 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 266 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
167 | } | 267 | } |
168 | 268 | ||
@@ -176,20 +276,29 @@ void AudioWidget::setView( char view ) { | |||
176 | } | 276 | } |
177 | } | 277 | } |
178 | 278 | ||
179 | 279 | ||
280 | static QString timeAsString( long length ) { | ||
281 | length /= 44100; | ||
282 | int minutes = length / 60; | ||
283 | int seconds = length % 60; | ||
284 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | ||
285 | } | ||
286 | |||
180 | void AudioWidget::updateSlider( long i, long max ) { | 287 | void AudioWidget::updateSlider( long i, long max ) { |
288 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | ||
289 | |||
181 | if ( max == 0 ) | 290 | if ( max == 0 ) |
182 | return; | 291 | return; |
183 | // Will flicker too much if we don't do this | 292 | // Will flicker too much if we don't do this |
184 | // Scale to something reasonable | 293 | // Scale to something reasonable |
185 | int width = slider->width(); | 294 | int width = slider.width(); |
186 | int val = int((double)i * width / max); | 295 | int val = int((double)i * width / max); |
187 | if ( !audioSliderBeingMoved ) { | 296 | if ( !audioSliderBeingMoved ) { |
188 | if ( slider->value() != val ) | 297 | if ( slider.value() != val ) |
189 | slider->setValue( val ); | 298 | slider.setValue( val ); |
190 | if ( slider->maxValue() != width ) | 299 | if ( slider.maxValue() != width ) |
191 | slider->setMaxValue( width ); | 300 | slider.setMaxValue( width ); |
192 | } | 301 | } |
193 | } | 302 | } |
194 | 303 | ||
195 | 304 | ||
@@ -206,65 +315,66 @@ void AudioWidget::toggleButton( int i ) { | |||
206 | } | 315 | } |
207 | 316 | ||
208 | 317 | ||
209 | void AudioWidget::paintButton( QPainter *p, int i ) { | 318 | void AudioWidget::paintButton( QPainter *p, int i ) { |
210 | int x = audioButtons[i].xPos; | 319 | if ( audioButtons[i].isDown ) |
211 | int y = audioButtons[i].yPos; | 320 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
212 | int offset = 22 + 14 * audioButtons[i].isBig + audioButtons[i].isDown; | 321 | else |
213 | int buttonSize = 64 + audioButtons[i].isBig * (90 - 64); | 322 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
214 | p->drawPixmap( x, y, *pixmaps[audioButtons[i].isBig], buttonSize * (audioButtons[i].isDown + 2 * audioButtons[i].color), 0, buttonSize, buttonSize ); | ||
215 | p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 ); | ||
216 | } | 323 | } |
217 | 324 | ||
218 | 325 | ||
219 | void AudioWidget::timerEvent( QTimerEvent * ) { | 326 | void AudioWidget::timerEvent( QTimerEvent * ) { |
327 | /* | ||
328 | int x = audioButtons[AudioPlay].xPos; | ||
329 | int y = audioButtons[AudioPlay].yPos; | ||
330 | QPainter p( this ); | ||
331 | // Optimize to only draw the little bit of the changing images which is different | ||
332 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | ||
333 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | ||
334 | */ | ||
335 | /* | ||
220 | static int frame = 0; | 336 | static int frame = 0; |
221 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { | 337 | if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) { |
222 | frame = frame >= 7 ? 0 : frame + 1; | 338 | frame = frame >= 7 ? 0 : frame + 1; |
223 | // int x = audioButtons[AudioPlay].xPos; | ||
224 | // int y = audioButtons[AudioPlay].yPos; | ||
225 | // QPainter p( this ); | ||
226 | // // Optimize to only draw the little bit of the changing images which is different | ||
227 | // p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | ||
228 | // p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | ||
229 | } | 339 | } |
340 | */ | ||
230 | } | 341 | } |
231 | 342 | ||
232 | 343 | ||
233 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 344 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
234 | for ( int i = 0; i < numButtons; i++ ) { | 345 | for ( int i = 0; i < numButtons; i++ ) { |
235 | int size = audioButtons[i].isBig; | ||
236 | int x = audioButtons[i].xPos; | ||
237 | int y = audioButtons[i].yPos; | ||
238 | if ( event->state() == QMouseEvent::LeftButton ) { | 346 | if ( event->state() == QMouseEvent::LeftButton ) { |
239 | // The test to see if the mouse click is inside the circular button or not | 347 | |
240 | // (compared with the radius squared to avoid a square-root of our distance) | 348 | // The test to see if the mouse click is inside the button or not |
241 | int radius = 32 + 13 * size; | 349 | int x = event->pos().x() - xoff; |
242 | QPoint center = QPoint( x + radius, y + radius ); | 350 | int y = event->pos().y() - yoff; |
243 | QPoint dXY = center - event->pos(); | 351 | |
244 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 352 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
245 | bool isOnButton = dist <= (radius * radius); | 353 | && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
246 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); | 354 | |
247 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code | 355 | if ( isOnButton && i == AudioVolumeUp ) |
356 | qDebug("on up"); | ||
357 | |||
248 | if ( isOnButton && !audioButtons[i].isHeld ) { | 358 | if ( isOnButton && !audioButtons[i].isHeld ) { |
249 | audioButtons[i].isHeld = TRUE; | 359 | audioButtons[i].isHeld = TRUE; |
250 | toggleButton(i); | 360 | toggleButton(i); |
251 | qDebug("button toggled1 %d",i); | ||
252 | switch (i) { | 361 | switch (i) { |
253 | case AudioVolumeUp: emit moreClicked(); return; | 362 | case AudioVolumeUp: |
363 | qDebug("more clicked"); | ||
364 | emit moreClicked(); | ||
365 | return; | ||
254 | case AudioVolumeDown: emit lessClicked(); return; | 366 | case AudioVolumeDown: emit lessClicked(); return; |
255 | } | 367 | } |
256 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 368 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
257 | audioButtons[i].isHeld = FALSE; | 369 | audioButtons[i].isHeld = FALSE; |
258 | toggleButton(i); | 370 | toggleButton(i); |
259 | qDebug("button toggled2 %d",i); | ||
260 | } | 371 | } |
261 | } else { | 372 | } else { |
262 | if ( audioButtons[i].isHeld ) { | 373 | if ( audioButtons[i].isHeld ) { |
263 | audioButtons[i].isHeld = FALSE; | 374 | audioButtons[i].isHeld = FALSE; |
264 | if ( !audioButtons[i].isToggle ) | 375 | if ( !audioButtons[i].isToggle ) |
265 | setToggleButton( i, FALSE ); | 376 | setToggleButton( i, FALSE ); |
266 | qDebug("button toggled3 %d",i); | ||
267 | switch (i) { | 377 | switch (i) { |
268 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 378 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
269 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 379 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
270 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 380 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
@@ -280,8 +390,9 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
280 | } | 390 | } |
281 | } | 391 | } |
282 | 392 | ||
283 | 393 | ||
394 | |||
284 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 395 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
285 | mouseMoveEvent( event ); | 396 | mouseMoveEvent( event ); |
286 | } | 397 | } |
287 | 398 | ||
@@ -301,13 +412,25 @@ void AudioWidget::closeEvent( QCloseEvent* ) { | |||
301 | mediaPlayerState->setList(); | 412 | mediaPlayerState->setList(); |
302 | } | 413 | } |
303 | 414 | ||
304 | 415 | ||
305 | void AudioWidget::paintEvent( QPaintEvent * ) { | 416 | void AudioWidget::paintEvent( QPaintEvent * pe) { |
417 | if ( !pe->erased() ) { | ||
418 | // Combine with background and double buffer | ||
419 | QPixmap pix( pe->rect().size() ); | ||
420 | QPainter p( &pix ); | ||
421 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | ||
422 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | ||
423 | for ( int i = 0; i < numButtons; i++ ) | ||
424 | paintButton( &p, i ); | ||
425 | QPainter p2( this ); | ||
426 | p2.drawPixmap( pe->rect().topLeft(), pix ); | ||
427 | } else { | ||
306 | QPainter p( this ); | 428 | QPainter p( this ); |
307 | for ( int i = 0; i < numButtons; i++ ) | 429 | for ( int i = 0; i < numButtons; i++ ) |
308 | paintButton( &p, i ); | 430 | paintButton( &p, i ); |
309 | } | 431 | } |
432 | } | ||
310 | 433 | ||
311 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 434 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
312 | { | 435 | { |
313 | switch ( e->key() ) { | 436 | switch ( e->key() ) { |
@@ -326,8 +449,9 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) | |||
326 | break; | 449 | break; |
327 | case Key_F13: //mail | 450 | case Key_F13: //mail |
328 | break; | 451 | break; |
329 | case Key_Space: { | 452 | case Key_Space: { |
453 | |||
330 | if(mediaPlayerState->playing()) { | 454 | if(mediaPlayerState->playing()) { |
331 | // toggleButton(1); | 455 | // toggleButton(1); |
332 | mediaPlayerState->setPlaying(FALSE); | 456 | mediaPlayerState->setPlaying(FALSE); |
333 | // toggleButton(1); | 457 | // toggleButton(1); |
@@ -337,26 +461,26 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) | |||
337 | // toggleButton(0); | 461 | // toggleButton(0); |
338 | } | 462 | } |
339 | } | 463 | } |
340 | break; | 464 | break; |
341 | case Key_Down: | 465 | case Key_Down: //volume |
342 | toggleButton(6); | 466 | toggleButton(6); |
343 | emit lessClicked(); | 467 | emit lessClicked(); |
344 | emit lessReleased(); | 468 | emit lessReleased(); |
345 | toggleButton(6); | 469 | toggleButton(6); |
346 | break; | 470 | break; |
347 | case Key_Up: | 471 | case Key_Up: //volume |
348 | toggleButton(5); | 472 | toggleButton(5); |
349 | emit moreClicked(); | 473 | emit moreClicked(); |
350 | emit moreReleased(); | 474 | emit moreReleased(); |
351 | toggleButton(5); | 475 | toggleButton(5); |
352 | break; | 476 | break; |
353 | case Key_Right: | 477 | case Key_Right: //next in playlist |
354 | // toggleButton(3); | 478 | // toggleButton(3); |
355 | mediaPlayerState->setNext(); | 479 | mediaPlayerState->setNext(); |
356 | // toggleButton(3); | 480 | // toggleButton(3); |
357 | break; | 481 | break; |
358 | case Key_Left: | 482 | case Key_Left: // previous in playlist |
359 | // toggleButton(4); | 483 | // toggleButton(4); |
360 | mediaPlayerState->setPrev(); | 484 | mediaPlayerState->setPrev(); |
361 | // toggleButton(4); | 485 | // toggleButton(4); |
362 | break; | 486 | break; |
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index b3d39bf..c686741 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -24,16 +24,18 @@ | |||
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 <qstring.h> | 29 | #include <qstring.h> |
29 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qlineedit.h> | ||
30 | #include <qframe.h> | 32 | #include <qframe.h> |
31 | 33 | ||
34 | #include <opie/oticker.h> | ||
32 | 35 | ||
33 | class QPixmap; | 36 | class QPixmap; |
34 | 37 | ||
35 | |||
36 | enum AudioButtons { | 38 | enum AudioButtons { |
37 | AudioPlay, | 39 | AudioPlay, |
38 | AudioStop, | 40 | AudioStop, |
39 | AudioPause, | 41 | AudioPause, |
@@ -45,64 +47,16 @@ enum AudioButtons { | |||
45 | AudioPlayList | 47 | AudioPlayList |
46 | }; | 48 | }; |
47 | 49 | ||
48 | 50 | ||
49 | #define USE_DBLBUF | 51 | //#define USE_DBLBUF |
50 | |||
51 | |||
52 | class Ticker : public QFrame { | ||
53 | Q_OBJECT | ||
54 | public: | ||
55 | Ticker( QWidget* parent=0 ) : QFrame( parent ) { | ||
56 | setFrameStyle( WinPanel | Sunken ); | ||
57 | setText( "No Song" ); | ||
58 | } | ||
59 | ~Ticker() { } | ||
60 | void setText( const QString& text ) { | ||
61 | pos = 0; // reset it everytime the text is changed | ||
62 | scrollText = text; | ||
63 | pixelLen = fontMetrics().width( scrollText ); | ||
64 | killTimers(); | ||
65 | if ( pixelLen > width() ) | ||
66 | startTimer( 50 ); | ||
67 | update(); | ||
68 | } | ||
69 | protected: | ||
70 | void timerEvent( QTimerEvent * ) { | ||
71 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | ||
72 | #ifndef USE_DBLBUF | ||
73 | scroll( -1, 0, contentsRect() ); | ||
74 | #else | ||
75 | repaint( FALSE ); | ||
76 | #endif | ||
77 | } | ||
78 | void drawContents( QPainter *p ) { | ||
79 | #ifndef USE_DBLBUF | ||
80 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
81 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
82 | #else | ||
83 | // Double buffering code. | ||
84 | // Looks like qvfb makes it look like it flickers but I don't think it really is | ||
85 | QPixmap pm( width(), height() ); | ||
86 | pm.fill( colorGroup().base() ); | ||
87 | QPainter pmp( &pm ); | ||
88 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | ||
89 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | ||
90 | p->drawPixmap( 0, 0, pm ); | ||
91 | #endif | ||
92 | } | ||
93 | private: | ||
94 | QString scrollText; | ||
95 | int pos, pixelLen; | ||
96 | }; | ||
97 | |||
98 | 52 | ||
99 | class AudioWidget : public QWidget { | 53 | class AudioWidget : public QWidget { |
100 | Q_OBJECT | 54 | Q_OBJECT |
101 | public: | 55 | public: |
102 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 56 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
103 | ~AudioWidget(); | 57 | ~AudioWidget(); |
104 | void setTickerText( const QString &text ) { songInfo->setText( text ); } | 58 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
105 | bool isStreaming; | 59 | bool isStreaming; |
106 | public slots: | 60 | public slots: |
107 | void updateSlider( long, long ); | 61 | void updateSlider( long, long ); |
108 | void sliderPressed( ); | 62 | void sliderPressed( ); |
@@ -125,8 +79,9 @@ protected: | |||
125 | void doBlank(); | 79 | void doBlank(); |
126 | void doUnblank(); | 80 | void doUnblank(); |
127 | void paintEvent( QPaintEvent *pe ); | 81 | void paintEvent( QPaintEvent *pe ); |
128 | void showEvent( QShowEvent *se ); | 82 | void showEvent( QShowEvent *se ); |
83 | void resizeEvent( QResizeEvent *re ); | ||
129 | void mouseMoveEvent( QMouseEvent *event ); | 84 | void mouseMoveEvent( QMouseEvent *event ); |
130 | void mousePressEvent( QMouseEvent *event ); | 85 | void mousePressEvent( QMouseEvent *event ); |
131 | void mouseReleaseEvent( QMouseEvent *event ); | 86 | void mouseReleaseEvent( QMouseEvent *event ); |
132 | void timerEvent( QTimerEvent *event ); | 87 | void timerEvent( QTimerEvent *event ); |
@@ -135,11 +90,23 @@ protected: | |||
135 | private: | 90 | private: |
136 | void toggleButton( int ); | 91 | void toggleButton( int ); |
137 | void setToggleButton( int, bool ); | 92 | void setToggleButton( int, bool ); |
138 | void paintButton( QPainter *p, int i ); | 93 | void paintButton( QPainter *p, int i ); |
94 | QString skin; | ||
95 | QPixmap *pixBg; | ||
96 | QImage *imgUp; | ||
97 | QImage *imgDn; | ||
98 | QImage *imgButtonMask; | ||
99 | QBitmap *masks[11]; | ||
100 | QPixmap *buttonPixUp[11]; | ||
101 | QPixmap *buttonPixDown[11]; | ||
102 | |||
139 | QPixmap *pixmaps[4]; | 103 | QPixmap *pixmaps[4]; |
140 | Ticker *songInfo; | 104 | OTicker songInfo; |
141 | QSlider *slider; | 105 | QSlider slider; |
106 | QLineEdit time; | ||
107 | int xoff, yoff; | ||
108 | |||
142 | }; | 109 | }; |
143 | 110 | ||
144 | 111 | ||
145 | #endif // AUDIO_WIDGET_H | 112 | #endif // AUDIO_WIDGET_H |
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp index da8e276..62240b2 100644 --- a/core/multimedia/opieplayer/inputDialog.cpp +++ b/core/multimedia/opieplayer/inputDialog.cpp | |||
@@ -1,12 +1,4 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:55:03 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
10 | 2 | ||
11 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
12 | 4 | ||
@@ -18,12 +10,12 @@ | |||
18 | #include <qpushbutton.h> | 10 | #include <qpushbutton.h> |
19 | #include <qwhatsthis.h> | 11 | #include <qwhatsthis.h> |
20 | 12 | ||
21 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 13 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
22 | : QDialog( parent, name, modal, fl ) | 14 | : QDialog( parent, name, modal, fl ) { |
23 | { | 15 | if ( !name ) { |
24 | if ( !name ) | ||
25 | setName( "InputDialog" ); | 16 | setName( "InputDialog" ); |
17 | } | ||
26 | resize( 234, 115); | 18 | resize( 234, 115); |
27 | setMaximumSize( QSize( 240, 40)); | 19 | setMaximumSize( QSize( 240, 40)); |
28 | setCaption( tr(name ) ); | 20 | setCaption( tr(name ) ); |
29 | 21 | ||
@@ -32,17 +24,20 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
32 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 24 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); |
33 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 25 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
34 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 26 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
35 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 27 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
28 | LineEdit1->setFocus(); | ||
29 | } | ||
30 | /* | ||
31 | * return the current text(input) | ||
32 | */ | ||
33 | QString InputDialog::text() const { | ||
34 | return LineEdit1->text(); | ||
36 | } | 35 | } |
37 | |||
38 | /* | 36 | /* |
39 | * Destroys the object and frees any allocated resources | 37 | * Destroys the object and frees any allocated resources |
40 | */ | 38 | */ |
41 | InputDialog::~InputDialog() | 39 | InputDialog::~InputDialog() { |
42 | { | ||
43 | inputText= LineEdit1->text(); | ||
44 | |||
45 | } | 40 | } |
46 | 41 | ||
47 | void InputDialog::browse() { | 42 | void InputDialog::browse() { |
48 | 43 | ||
diff --git a/core/multimedia/opieplayer/inputDialog.h b/core/multimedia/opieplayer/inputDialog.h index 3e3e36f..0f36ea4 100644 --- a/core/multimedia/opieplayer/inputDialog.h +++ b/core/multimedia/opieplayer/inputDialog.h | |||
@@ -1,29 +1,24 @@ | |||
1 | /**************************************************************************** | 1 | |
2 | ** Form interface generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:54:46 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef INPUTDIALOG_H | 2 | #ifndef INPUTDIALOG_H |
10 | #define INPUTDIALOG_H | 3 | #define INPUTDIALOG_H |
11 | 4 | ||
12 | #include <qvariant.h> | 5 | #include <qvariant.h> |
13 | #include <qdialog.h> | 6 | #include <qdialog.h> |
14 | 7 | ||
15 | class QLineEdit; | 8 | class QLineEdit; |
16 | 9 | ||
17 | class InputDialog : public QDialog | 10 | class InputDialog : public QDialog { |
18 | { | ||
19 | Q_OBJECT | 11 | Q_OBJECT |
20 | 12 | ||
21 | public: | 13 | public: |
22 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
23 | ~InputDialog(); | 15 | ~InputDialog(); |
24 | QString inputText; | 16 | QString text()const; |
17 | |||
18 | private: | ||
25 | QLineEdit* LineEdit1; | 19 | QLineEdit* LineEdit1; |
20 | |||
26 | protected slots: | 21 | protected slots: |
27 | void browse(); | 22 | void browse(); |
28 | }; | 23 | }; |
29 | 24 | ||
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index 64fdc01..b0963cf 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp | |||
@@ -79,8 +79,9 @@ void MediaPlayer::play() { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | void MediaPlayer::setPlaying( bool play ) { | 82 | void MediaPlayer::setPlaying( bool play ) { |
83 | qDebug("MediaPlayer setPlaying"); | ||
83 | if ( !play ) { | 84 | if ( !play ) { |
84 | mediaPlayerState->setPaused( FALSE ); | 85 | mediaPlayerState->setPaused( FALSE ); |
85 | loopControl->stop( FALSE ); | 86 | loopControl->stop( FALSE ); |
86 | return; | 87 | return; |
@@ -89,10 +90,11 @@ void MediaPlayer::setPlaying( bool play ) { | |||
89 | if ( mediaPlayerState->paused() ) { | 90 | if ( mediaPlayerState->paused() ) { |
90 | mediaPlayerState->setPaused( FALSE ); | 91 | mediaPlayerState->setPaused( FALSE ); |
91 | return; | 92 | return; |
92 | } | 93 | } |
93 | 94 | qDebug("about to ctrash"); | |
94 | const DocLnk *playListCurrent = playList->current(); | 95 | const DocLnk *playListCurrent = playList->current(); |
96 | |||
95 | if ( playListCurrent != NULL ) { | 97 | if ( playListCurrent != NULL ) { |
96 | loopControl->stop( TRUE ); | 98 | loopControl->stop( TRUE ); |
97 | currentFile = playListCurrent; | 99 | currentFile = playListCurrent; |
98 | } | 100 | } |
@@ -102,21 +104,24 @@ void MediaPlayer::setPlaying( bool play ) { | |||
102 | return; | 104 | return; |
103 | } | 105 | } |
104 | 106 | ||
105 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { | 107 | if ( ((currentFile->file()).left(4) != "http") && !QFile::exists( currentFile->file() ) ) { |
106 | QMessageBox::critical( 0, tr( "File not found"), tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); | 108 | QMessageBox::critical( 0, tr( "File not found"), |
109 | tr( "The following file was not found: <i>" ) + currentFile->file() + "</i>" ); | ||
107 | mediaPlayerState->setPlaying( FALSE ); | 110 | mediaPlayerState->setPlaying( FALSE ); |
108 | return; | 111 | return; |
109 | } | 112 | } |
110 | 113 | ||
111 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { | 114 | if ( !mediaPlayerState->newDecoder( currentFile->file() ) ) { |
112 | QMessageBox::critical( 0, tr( "No decoder found"), tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); | 115 | QMessageBox::critical( 0, tr( "No decoder found"), |
116 | tr( "Sorry, no appropriate decoders found for this file: <i>" ) + currentFile->file() + "</i>" ); | ||
113 | mediaPlayerState->setPlaying( FALSE ); | 117 | mediaPlayerState->setPlaying( FALSE ); |
114 | return; | 118 | return; |
115 | } | 119 | } |
116 | 120 | ||
117 | if ( !loopControl->init( currentFile->file() ) ) { | 121 | if ( !loopControl->init( currentFile->file() ) ) { |
118 | QMessageBox::critical( 0, tr( "Error opening file"), tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); | 122 | QMessageBox::critical( 0, tr( "Error opening file"), |
123 | tr( "Sorry, an error occured trying to play the file: <i>" ) + currentFile->file() + "</i>" ); | ||
119 | mediaPlayerState->setPlaying( FALSE ); | 124 | mediaPlayerState->setPlaying( FALSE ); |
120 | return; | 125 | return; |
121 | } | 126 | } |
122 | long seconds = loopControl->totalPlaytime(); | 127 | long seconds = loopControl->totalPlaytime(); |
diff --git a/core/multimedia/opieplayer/mediaplayerstate.h b/core/multimedia/opieplayer/mediaplayerstate.h index 06c5556..26185c5 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.h +++ b/core/multimedia/opieplayer/mediaplayerstate.h | |||
@@ -56,9 +56,11 @@ public slots: | |||
56 | void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } | 56 | void setLooping( bool b ) { if ( isLooping == b ) return; isLooping = b; emit loopingToggled(b); } |
57 | void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } | 57 | void setShuffled( bool b ) { if ( isShuffled == b ) return; isShuffled = b; emit shuffledToggled(b); } |
58 | void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } | 58 | void setPlaylist( bool b ) { if ( usePlaylist == b ) return; usePlaylist = b; emit playlistToggled(b); } |
59 | void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } | 59 | void setPaused( bool b ) { if ( isPaused == b ) return; isPaused = b; emit pausedToggled(b); } |
60 | |||
60 | void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } | 61 | void setPlaying( bool b ) { if ( isPlaying == b ) return; isPlaying = b; emit playingToggled(b); } |
62 | |||
61 | void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } | 63 | void setPosition( long p ) { if ( curPosition == p ) return; curPosition = p; emit positionChanged(p); } |
62 | void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } | 64 | void updatePosition( long p ){ if ( curPosition == p ) return; curPosition = p; emit positionUpdated(p); } |
63 | void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } | 65 | void setLength( long l ) { if ( curLength == l ) return; curLength = l; emit lengthChanged(l); } |
64 | void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } | 66 | void setView( char v ) { if ( curView == v ) return; curView = v; emit viewChanged(v); } |
diff --git a/core/multimedia/opieplayer/opie-mediaplayer.control b/core/multimedia/opieplayer/opie-mediaplayer.control index 3bfb911..da193c0 100644 --- a/core/multimedia/opieplayer/opie-mediaplayer.control +++ b/core/multimedia/opieplayer/opie-mediaplayer.control | |||
@@ -1,5 +1,5 @@ | |||
1 | Files: bin/opieplayer pics/opieplayer apps/Applications/opieplayer.desktop | 1 | Files: bin/opieplayer pics/opieplayer apps/Applications/opieplayer.desktop pics/opieplayer2/skins/default |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: L.J.Potter <ljp@llornkcor.com> | 4 | Maintainer: L.J.Potter <ljp@llornkcor.com> |
5 | Architecture: arm | 5 | Architecture: arm |
diff --git a/core/multimedia/opieplayer/opieplayer.pro b/core/multimedia/opieplayer/opieplayer.pro index e111717..6f22280 100644 --- a/core/multimedia/opieplayer/opieplayer.pro +++ b/core/multimedia/opieplayer/opieplayer.pro | |||
@@ -1,13 +1,16 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | 3 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = loopcontrol.h mediaplayerplugininterface.h playlistselection.h mediaplayerstate.h \ | 5 | HEADERS = loopcontrol.h mediaplayerplugininterface.h \ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h audiodevice.h inputDialog.h | 6 | playlistselection.h mediaplayerstate.h \ |
7 | videowidget.h audiowidget.h playlistwidget.h \ | ||
8 | mediaplayer.h audiodevice.h inputDialog.h om3u.h | ||
7 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
8 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ | 10 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ |
9 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp audiodevice.cpp inputDialog.cpp | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp \ |
12 | mediaplayer.cpp audiodevice.cpp inputDialog.cpp om3u.cpp | ||
10 | TARGET = opieplayer | 13 | TARGET = opieplayer |
11 | INCLUDEPATH += $(OPIEDIR)/include | 14 | INCLUDEPATH += $(OPIEDIR)/include |
12 | DEPENDPATH += $(OPIEDIR)/include | 15 | DEPENDPATH += $(OPIEDIR)/include |
13 | LIBS += -lqpe -lpthread -lopie | 16 | LIBS += -lqpe -lpthread -lopie |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 5be0d6d..6580a88 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -82,8 +82,9 @@ | |||
82 | extern AudioWidget *audioUI; | 82 | extern AudioWidget *audioUI; |
83 | extern VideoWidget *videoUI; | 83 | extern VideoWidget *videoUI; |
84 | extern MediaPlayerState *mediaPlayerState; | 84 | extern MediaPlayerState *mediaPlayerState; |
85 | 85 | ||
86 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | ||
86 | // class myFileSelector { | 87 | // class myFileSelector { |
87 | 88 | ||
88 | // }; | 89 | // }; |
89 | class PlayListWidgetPrivate { | 90 | class PlayListWidgetPrivate { |
@@ -178,10 +179,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
178 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 179 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
179 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 180 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
180 | pmPlayList->insertSeparator(-1); | 181 | pmPlayList->insertSeparator(-1); |
181 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 182 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
182 | new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); | ||
183 | pmPlayList->insertSeparator(-1); | ||
184 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 183 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
185 | pmPlayList->insertSeparator(-1); | 184 | pmPlayList->insertSeparator(-1); |
186 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 185 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
187 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 186 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
@@ -278,8 +277,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
278 | 277 | ||
279 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 278 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
280 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 279 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
281 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 280 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
281 | |||
282 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 282 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
283 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 283 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
284 | 284 | ||
285 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 285 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
@@ -299,9 +299,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
299 | 299 | ||
300 | 300 | ||
301 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 301 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
302 | 302 | ||
303 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 303 | // connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
304 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 304 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
305 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 305 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
306 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 306 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
307 | 307 | ||
@@ -322,9 +322,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
322 | PlayListWidget::~PlayListWidget() { | 322 | PlayListWidget::~PlayListWidget() { |
323 | Config cfg( "OpiePlayer" ); | 323 | Config cfg( "OpiePlayer" ); |
324 | writeConfig( cfg ); | 324 | writeConfig( cfg ); |
325 | 325 | ||
326 | |||
327 | if ( d->current ) | 326 | if ( d->current ) |
328 | delete d->current; | 327 | delete d->current; |
329 | delete d; | 328 | delete d; |
330 | } | 329 | } |
@@ -392,15 +391,15 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
392 | } | 391 | } |
393 | 392 | ||
394 | 393 | ||
395 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 394 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
396 | d->setDocumentUsed = FALSE; | 395 | d->setDocumentUsed = false; |
397 | if ( mediaPlayerState->playlist() ) { | 396 | if ( mediaPlayerState->playlist() ) { |
398 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 397 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
399 | d->selectedFiles->addToSelection( lnk ); | 398 | d->selectedFiles->addToSelection( lnk ); |
400 | } | 399 | } |
401 | else | 400 | else |
402 | mediaPlayerState->setPlaying( TRUE ); | 401 | mediaPlayerState->setPlaying( true); |
403 | } | 402 | } |
404 | 403 | ||
405 | 404 | ||
406 | void PlayListWidget::clearList() { | 405 | void PlayListWidget::clearList() { |
@@ -495,8 +494,9 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
495 | // } | 494 | // } |
496 | // } | 495 | // } |
497 | // } else | 496 | // } else |
498 | 497 | ||
498 | qDebug("current"); | ||
499 | 499 | ||
500 | switch (tabWidget->currentPageIndex()) { | 500 | switch (tabWidget->currentPageIndex()) { |
501 | case 0: //playlist | 501 | case 0: //playlist |
502 | { | 502 | { |
@@ -605,56 +605,22 @@ bool PlayListWidget::last() { | |||
605 | } | 605 | } |
606 | 606 | ||
607 | 607 | ||
608 | void PlayListWidget::saveList() { | 608 | void PlayListWidget::saveList() { |
609 | 609 | writem3u(); | |
610 | QString filename; | ||
611 | InputDialog *fileDlg; | ||
612 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | ||
613 | fileDlg->exec(); | ||
614 | if( fileDlg->result() == 1 ) { | ||
615 | if ( d->current ) | ||
616 | delete d->current; | ||
617 | filename = fileDlg->LineEdit1->text();//+".playlist"; | ||
618 | // qDebug("saving playlist "+filename+".playlist"); | ||
619 | Config cfg( filename +".playlist"); | ||
620 | writeConfig( cfg ); | ||
621 | |||
622 | DocLnk lnk; | ||
623 | // lnk.setComment( ""); | ||
624 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | ||
625 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | ||
626 | lnk.setIcon("opieplayer/playlist2"); | ||
627 | lnk.setName( filename); //sets file name | ||
628 | // qDebug(filename); | ||
629 | if(!lnk.writeLink()) | ||
630 | qDebug("Writing doclink did not work"); | ||
631 | } | ||
632 | Config config( "OpiePlayer" ); | ||
633 | config.writeEntry("CurrentPlaylist",filename); | ||
634 | setCaption(tr("OpiePlayer: ")+filename); | ||
635 | d->selectedFiles->first(); | ||
636 | if(fileDlg) | ||
637 | delete fileDlg; | ||
638 | } | 610 | } |
639 | 611 | ||
640 | void PlayListWidget::loadList( const DocLnk & lnk) { | 612 | void PlayListWidget::loadList( const DocLnk & lnk) { |
641 | QString name= lnk.name(); | 613 | QString name= lnk.name(); |
642 | // qDebug("currentList is "+name); | 614 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
643 | if( name.length()>1) { | 615 | |
616 | if( name.length()>0) { | ||
644 | setCaption("OpiePlayer: "+name); | 617 | setCaption("OpiePlayer: "+name); |
645 | // qDebug("load list "+ name+".playlist"); | 618 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
646 | clearList(); | 619 | clearList(); |
647 | Config cfg( name+".playlist"); | 620 | readm3u(lnk.file()); |
648 | readConfig(cfg); | ||
649 | |||
650 | tabWidget->setCurrentPage(0); | 621 | tabWidget->setCurrentPage(0); |
651 | |||
652 | Config config( "OpiePlayer" ); | ||
653 | config.writeEntry("CurrentPlaylist", name); | ||
654 | // d->selectedFiles->first(); | ||
655 | } | 622 | } |
656 | |||
657 | } | 623 | } |
658 | 624 | ||
659 | void PlayListWidget::setPlaylist( bool shown ) { | 625 | void PlayListWidget::setPlaylist( bool shown ) { |
660 | if ( shown ) | 626 | if ( shown ) |
@@ -674,9 +640,9 @@ void PlayListWidget::addSelected() { | |||
674 | 640 | ||
675 | Config cfg( "OpiePlayer" ); | 641 | Config cfg( "OpiePlayer" ); |
676 | cfg.setGroup("PlayList"); | 642 | cfg.setGroup("PlayList"); |
677 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 643 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
678 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 644 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
679 | 645 | ||
680 | switch (tabWidget->currentPageIndex()) { | 646 | switch (tabWidget->currentPageIndex()) { |
681 | case 0: //playlist | 647 | case 0: //playlist |
682 | break; | 648 | break; |
@@ -737,9 +703,9 @@ void PlayListWidget::addSelected() { | |||
737 | void PlayListWidget::removeSelected() { | 703 | void PlayListWidget::removeSelected() { |
738 | d->selectedFiles->removeSelected( ); | 704 | d->selectedFiles->removeSelected( ); |
739 | } | 705 | } |
740 | 706 | ||
741 | void PlayListWidget::playIt( QListViewItem *it) { | 707 | void PlayListWidget::playIt( QListViewItem *) { |
742 | // d->setDocumentUsed = FALSE; | 708 | // d->setDocumentUsed = FALSE; |
743 | // mediaPlayerState->curPosition =0; | 709 | // mediaPlayerState->curPosition =0; |
744 | qDebug("playIt"); | 710 | qDebug("playIt"); |
745 | mediaPlayerState->setPlaying(FALSE); | 711 | mediaPlayerState->setPlaying(FALSE); |
@@ -776,9 +742,9 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
776 | tabWidget->setCurrentPage(0); | 742 | tabWidget->setCurrentPage(0); |
777 | } | 743 | } |
778 | } | 744 | } |
779 | 745 | ||
780 | void PlayListWidget::tabChanged(QWidget *widg) { | 746 | void PlayListWidget::tabChanged(QWidget *) { |
781 | 747 | ||
782 | switch ( tabWidget->currentPageIndex()) { | 748 | switch ( tabWidget->currentPageIndex()) { |
783 | case 0: | 749 | case 0: |
784 | { | 750 | { |
@@ -819,23 +785,27 @@ void PlayListWidget::tabChanged(QWidget *widg) { | |||
819 | }; | 785 | }; |
820 | } | 786 | } |
821 | 787 | ||
822 | void PlayListWidget::btnPlay(bool b) { | 788 | void PlayListWidget::btnPlay(bool b) { |
823 | 789 | qDebug("<<<<<<<<<<<<<<<BtnPlay"); | |
824 | // mediaPlayerState->setPlaying(b); | 790 | // mediaPlayerState->setPlaying(b); |
825 | switch ( tabWidget->currentPageIndex()) { | 791 | switch ( tabWidget->currentPageIndex()) { |
826 | case 0: | 792 | case 0: |
827 | { | 793 | { |
794 | qDebug("1"); | ||
828 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 | 795 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 |
829 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | 796 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { |
830 | // QMessageBox::message("Note","You are trying to play\na malformed url."); | 797 | // QMessageBox::message("Note","You are trying to play\na malformed url."); |
831 | // } else { | 798 | // } else { |
832 | mediaPlayerState->setPlaying(b); | 799 | mediaPlayerState->setPlaying(b); |
800 | insanityBool=FALSE; | ||
801 | qDebug("insanity"); | ||
833 | // } | 802 | // } |
834 | } | 803 | } |
835 | break; | 804 | break; |
836 | case 1: | 805 | case 1: |
837 | { | 806 | { |
807 | qDebug("2"); | ||
838 | addToSelection( audioView->currentItem() ); | 808 | addToSelection( audioView->currentItem() ); |
839 | mediaPlayerState->setPlaying(b); | 809 | mediaPlayerState->setPlaying(b); |
840 | d->selectedFiles->removeSelected( ); | 810 | d->selectedFiles->removeSelected( ); |
841 | tabWidget->setCurrentPage(1); | 811 | tabWidget->setCurrentPage(1); |
@@ -844,8 +814,10 @@ void PlayListWidget::btnPlay(bool b) { | |||
844 | }// audioView->clearSelection(); | 814 | }// audioView->clearSelection(); |
845 | break; | 815 | break; |
846 | case 2: | 816 | case 2: |
847 | { | 817 | { |
818 | qDebug("3"); | ||
819 | |||
848 | addToSelection( videoView->currentItem() ); | 820 | addToSelection( videoView->currentItem() ); |
849 | mediaPlayerState->setPlaying(b); | 821 | mediaPlayerState->setPlaying(b); |
850 | qApp->processEvents(); | 822 | qApp->processEvents(); |
851 | d->selectedFiles->removeSelected( ); | 823 | d->selectedFiles->removeSelected( ); |
@@ -862,18 +834,18 @@ void PlayListWidget::deletePlaylist() { | |||
862 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 834 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
863 | (tr("You really want to delete\nthis playlist?")), | 835 | (tr("You really want to delete\nthis playlist?")), |
864 | (tr("Yes")), (tr("No")), 0 )){ | 836 | (tr("Yes")), (tr("No")), 0 )){ |
865 | case 0: // Yes clicked, | 837 | case 0: // Yes clicked, |
866 | // QFile().remove(playLists->selected()->file()); | 838 | QFile().remove(playLists->selectedDocument().file()); |
867 | // QFile().remove(playLists->selected()->linkFile()); | 839 | QFile().remove(playLists->selectedDocument().linkFile()); |
868 | // playLists->reread(); | 840 | playLists->reread(); |
869 | break; | 841 | break; |
870 | case 1: // Cancel | 842 | case 1: // Cancel |
871 | break; | 843 | break; |
872 | }; | 844 | }; |
873 | } | 845 | } |
874 | 846 | ||
875 | void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 847 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) |
876 | { | 848 | { |
877 | switch (mouse) { | 849 | switch (mouse) { |
878 | case 1: | 850 | case 1: |
879 | break; | 851 | break; |
@@ -893,13 +865,14 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& | |||
893 | } | 865 | } |
894 | 866 | ||
895 | void PlayListWidget::playSelected() | 867 | void PlayListWidget::playSelected() |
896 | { | 868 | { |
897 | btnPlay( TRUE); | 869 | qDebug("playSelected"); |
870 | btnPlay( true); | ||
898 | // d->selectedFiles->unSelect(); | 871 | // d->selectedFiles->unSelect(); |
899 | } | 872 | } |
900 | 873 | ||
901 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 874 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) |
902 | { | 875 | { |
903 | switch (mouse) { | 876 | switch (mouse) { |
904 | case 1: | 877 | case 1: |
905 | 878 | ||
@@ -921,9 +894,9 @@ void PlayListWidget::listDelete() { | |||
921 | Config cfg( "OpiePlayer" ); | 894 | Config cfg( "OpiePlayer" ); |
922 | cfg.setGroup("PlayList"); | 895 | cfg.setGroup("PlayList"); |
923 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 896 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
924 | QString file; | 897 | QString file; |
925 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 898 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
926 | switch ( tabWidget->currentPageIndex()) { | 899 | switch ( tabWidget->currentPageIndex()) { |
927 | case 0: | 900 | case 0: |
928 | break; | 901 | break; |
929 | case 1: | 902 | case 1: |
@@ -960,26 +933,26 @@ void PlayListWidget::listDelete() { | |||
960 | }; | 933 | }; |
961 | } | 934 | } |
962 | 935 | ||
963 | void PlayListWidget::scanForAudio() { | 936 | void PlayListWidget::scanForAudio() { |
964 | qDebug("scan for audio"); | 937 | // qDebug("scan for audio"); |
965 | files.detachChildren(); | 938 | files.detachChildren(); |
966 | QListIterator<DocLnk> sdit( files.children() ); | 939 | QListIterator<DocLnk> sdit( files.children() ); |
967 | for ( ; sdit.current(); ++sdit ) { | 940 | for ( ; sdit.current(); ++sdit ) { |
968 | delete sdit.current(); | 941 | delete sdit.current(); |
969 | } | 942 | } |
970 | Global::findDocuments(&files, "audio/*"); | 943 | Global::findDocuments( &files, audioMimes); |
971 | audioScan = TRUE; | 944 | audioScan = true; |
972 | } | 945 | } |
973 | void PlayListWidget::scanForVideo() { | 946 | void PlayListWidget::scanForVideo() { |
974 | qDebug("scan for video"); | 947 | // qDebug("scan for video"); |
975 | vFiles.detachChildren(); | 948 | vFiles.detachChildren(); |
976 | QListIterator<DocLnk> sdit( vFiles.children() ); | 949 | QListIterator<DocLnk> sdit( vFiles.children() ); |
977 | for ( ; sdit.current(); ++sdit ) { | 950 | for ( ; sdit.current(); ++sdit ) { |
978 | delete sdit.current(); | 951 | delete sdit.current(); |
979 | } | 952 | } |
980 | Global::findDocuments(&vFiles, "video/*"); | 953 | Global::findDocuments(&vFiles, "video/*"); |
981 | videoScan = TRUE; | 954 | videoScan = true; |
982 | } | 955 | } |
983 | 956 | ||
984 | void PlayListWidget::populateAudioView() { | 957 | void PlayListWidget::populateAudioView() { |
985 | 958 | ||
@@ -1005,9 +978,9 @@ void PlayListWidget::populateAudioView() { | |||
1005 | if( dit.current()->file().left(4) == "http" ) | 978 | if( dit.current()->file().left(4) == "http" ) |
1006 | size=0; | 979 | size=0; |
1007 | else | 980 | else |
1008 | size = QFile( dit.current()->file() ).size(); | 981 | size = QFile( dit.current()->file() ).size(); |
1009 | qDebug(dit.current()->name()); | 982 | // qDebug(dit.current()->name()); |
1010 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 983 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1011 | QString::number(size ), storage); | 984 | QString::number(size ), storage); |
1012 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 985 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1013 | } | 986 | } |
@@ -1042,45 +1015,236 @@ void PlayListWidget::populateVideoView() { | |||
1042 | } | 1015 | } |
1043 | } | 1016 | } |
1044 | 1017 | ||
1045 | void PlayListWidget::openFile() { | 1018 | void PlayListWidget::openFile() { |
1019 | qDebug("<<<<<<<<<OPEN File"); | ||
1046 | QString filename, name; | 1020 | QString filename, name; |
1047 | InputDialog *fileDlg; | 1021 | InputDialog *fileDlg; |
1048 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1022 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1049 | fileDlg->exec(); | 1023 | fileDlg->exec(); |
1050 | if( fileDlg->result() == 1 ) { | 1024 | if( fileDlg->result() == 1 ) { |
1051 | filename = fileDlg->LineEdit1->text(); | 1025 | filename = fileDlg->text(); |
1052 | // http://205.188.234.129:8030 | ||
1053 | // http://66.28.68.70:8000 | ||
1054 | // filename.replace(QRegExp("%20")," "); | ||
1055 | qDebug("Selected filename is "+filename); | 1026 | qDebug("Selected filename is "+filename); |
1056 | if(filename.right(3) == "m3u") | 1027 | // Om3u *m3uList; |
1028 | DocLnk lnk; | ||
1029 | Config cfg( "OpiePlayer" ); | ||
1030 | cfg.setGroup("PlayList"); | ||
1031 | |||
1032 | if(filename.left(4) == "http") { | ||
1033 | QString m3uFile, m3uFilePath; | ||
1034 | if(filename.find(":",8,TRUE) != -1) { //found a port | ||
1035 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | ||
1036 | m3uFile = m3uFile.right( 7); | ||
1037 | } else if(filename.left(4) == "http"){ | ||
1038 | m3uFile=filename; | ||
1039 | m3uFile = m3uFile.right( m3uFile.length() - 7); | ||
1040 | } else{ | ||
1041 | m3uFile=filename; | ||
1042 | } | ||
1043 | |||
1044 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | ||
1045 | lnk.setName( filename ); //sets name | ||
1046 | lnk.setFile( filename ); //sets file name | ||
1047 | lnk.setIcon("opieplayer2/musicfile"); | ||
1048 | d->selectedFiles->addToSelection( lnk ); | ||
1049 | writeCurrentM3u(); | ||
1050 | } | ||
1051 | else if( filename.right( 3) == "m3u" ) { | ||
1057 | readm3u( filename); | 1052 | readm3u( filename); |
1058 | else if(filename.right(3) == "pls") | 1053 | |
1054 | } else if( filename.right(3) == "pls" ) { | ||
1059 | readPls( filename); | 1055 | readPls( filename); |
1060 | else { | 1056 | } else { |
1057 | d->selectedFiles->addToSelection( DocLnk(filename) ); | ||
1058 | writeCurrentM3u(); | ||
1059 | } | ||
1060 | } | ||
1061 | |||
1062 | if( fileDlg ) { | ||
1063 | delete fileDlg; | ||
1064 | } | ||
1065 | } | ||
1066 | |||
1067 | |||
1068 | /* | ||
1069 | reads m3u and shows files/urls to playlist widget */ | ||
1070 | void PlayListWidget::readm3u( const QString &filename ) { | ||
1071 | qDebug( "read m3u filename " + filename ); | ||
1072 | |||
1073 | Om3u *m3uList; | ||
1074 | QString s, name; | ||
1075 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1076 | m3uList->readM3u(); | ||
1061 | DocLnk lnk; | 1077 | DocLnk lnk; |
1078 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1079 | s = *it; | ||
1080 | // qDebug("reading "+ s); | ||
1081 | if(s.left(4)=="http") { | ||
1082 | lnk.setName( s ); //sets file name | ||
1083 | lnk.setIcon("opieplayer2/musicfile"); | ||
1084 | if(s.right(4) != '.' || s.right(5) != '.') | ||
1085 | lnk.setFile( s+"/"); //if url with no extension | ||
1086 | else | ||
1087 | lnk.setFile( s ); //sets file name | ||
1088 | |||
1089 | } else { | ||
1090 | // if( QFileInfo( s ).exists() ) { | ||
1091 | lnk.setName( QFileInfo(s).baseName()); | ||
1092 | // if(s.right(4) == '.') {//if regular file | ||
1093 | if(s.left(1) != "/") { | ||
1094 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | ||
1095 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | ||
1096 | lnk.setIcon("SoundPlayer"); | ||
1097 | } else { | ||
1098 | // qDebug("set link2 "+s); | ||
1099 | lnk.setFile( s); | ||
1100 | lnk.setIcon("SoundPlayer"); | ||
1101 | } | ||
1102 | } | ||
1103 | d->selectedFiles->addToSelection( lnk ); | ||
1104 | } | ||
1105 | Config config( "OpiePlayer" ); | ||
1106 | config.setGroup( "PlayList" ); | ||
1107 | |||
1108 | config.writeEntry("CurrentPlaylist",filename); | ||
1109 | config.write(); | ||
1110 | currentPlayList=filename; | ||
1111 | |||
1112 | // m3uList->write(); | ||
1113 | m3uList->close(); | ||
1114 | if(m3uList) delete m3uList; | ||
1062 | 1115 | ||
1063 | lnk.setName(filename); //sets file name | 1116 | d->selectedFiles->setSelectedItem( s); |
1064 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | 1117 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
1065 | filename += "/"; | 1118 | |
1066 | lnk.setFile(filename); //sets File property | 1119 | } |
1067 | 1120 | ||
1121 | /* | ||
1122 | reads pls and adds files/urls to playlist */ | ||
1123 | void PlayListWidget::readPls( const QString &filename ) { | ||
1124 | |||
1125 | qDebug( "pls filename is " + filename ); | ||
1126 | Om3u *m3uList; | ||
1127 | QString s, name; | ||
1128 | m3uList = new Om3u( filename, IO_ReadOnly ); | ||
1129 | m3uList->readPls(); | ||
1130 | |||
1131 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | ||
1132 | s = *it; | ||
1133 | // s.replace( QRegExp( "%20" )," " ); | ||
1134 | DocLnk lnk( s ); | ||
1135 | QFileInfo f( s ); | ||
1136 | QString name = f.baseName(); | ||
1137 | |||
1138 | if( name.left( 4 ) == "http" ) { | ||
1139 | name = s.right( s.length() - 7); | ||
1140 | } else { | ||
1141 | name = s; | ||
1142 | } | ||
1143 | |||
1144 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | ||
1145 | |||
1146 | lnk.setName( name ); | ||
1147 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | ||
1148 | lnk.setFile( s ); | ||
1149 | } else { //if its a url | ||
1150 | if( name.right( 1 ).find( '/' ) == -1) { | ||
1151 | s += "/"; | ||
1152 | } | ||
1153 | lnk.setFile( s ); | ||
1154 | } | ||
1068 | lnk.setType("audio/x-mpegurl"); | 1155 | lnk.setType("audio/x-mpegurl"); |
1069 | lnk.setExec("opieplayer"); | ||
1070 | lnk.setIcon("opieplayer/MPEGPlayer"); | ||
1071 | 1156 | ||
1072 | if(!lnk.writeLink()) | 1157 | lnk.writeLink(); |
1073 | qDebug("Writing doclink did not work"); | ||
1074 | d->selectedFiles->addToSelection( lnk); | 1158 | d->selectedFiles->addToSelection( lnk); |
1075 | // if(fileDlg2) | ||
1076 | // delete fileDlg2; | ||
1077 | } | 1159 | } |
1160 | |||
1161 | m3uList->close(); | ||
1162 | if(m3uList) delete m3uList; | ||
1078 | } | 1163 | } |
1079 | if(fileDlg) | 1164 | |
1080 | delete fileDlg; | 1165 | /* |
1166 | writes current playlist to current m3u file */ | ||
1167 | void PlayListWidget::writeCurrentM3u() { | ||
1168 | qDebug("writing to current m3u"); | ||
1169 | Config cfg( "OpiePlayer" ); | ||
1170 | cfg.setGroup("PlayList"); | ||
1171 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | ||
1172 | |||
1173 | if( d->selectedFiles->first()) { | ||
1174 | Om3u *m3uList; | ||
1175 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); | ||
1176 | |||
1177 | do { | ||
1178 | qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); | ||
1179 | m3uList->add( d->selectedFiles->current()->file() ); | ||
1180 | } | ||
1181 | while ( d->selectedFiles->next() ); | ||
1182 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | ||
1183 | m3uList->write(); | ||
1184 | m3uList->close(); | ||
1185 | |||
1186 | if(m3uList) delete m3uList; | ||
1187 | } | ||
1188 | } | ||
1189 | |||
1190 | /* | ||
1191 | writes current playlist to m3u file */ | ||
1192 | void PlayListWidget::writem3u() { | ||
1193 | InputDialog *fileDlg; | ||
1194 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | ||
1195 | fileDlg->exec(); | ||
1196 | QString name, filename, list; | ||
1197 | Om3u *m3uList; | ||
1198 | |||
1199 | if( fileDlg->result() == 1 ) { | ||
1200 | name = fileDlg->text(); | ||
1201 | // qDebug( filename ); | ||
1202 | |||
1203 | if( name.left( 1) != "/" ) { | ||
1204 | filename = QPEApplication::documentDir() + "/" + name; | ||
1205 | } | ||
1206 | |||
1207 | if( name.right( 3 ) != "m3u" ) { | ||
1208 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | ||
1209 | } | ||
1210 | |||
1211 | if( d->selectedFiles->first()) { | ||
1212 | m3uList = new Om3u(filename, IO_ReadWrite); | ||
1213 | |||
1214 | do { | ||
1215 | m3uList->add( d->selectedFiles->current()->file()); | ||
1216 | } | ||
1217 | while ( d->selectedFiles->next() ); | ||
1218 | // qDebug( list ); | ||
1219 | m3uList->write(); | ||
1220 | m3uList->close(); | ||
1221 | if(m3uList) delete m3uList; | ||
1222 | |||
1223 | if(fileDlg) delete fileDlg; | ||
1224 | |||
1225 | DocLnk lnk; | ||
1226 | lnk.setFile( filename); | ||
1227 | lnk.setIcon("opieplayer2/playlist2"); | ||
1228 | lnk.setName( name); //sets file name | ||
1229 | |||
1230 | // qDebug(filename); | ||
1231 | Config config( "OpiePlayer" ); | ||
1232 | config.setGroup( "PlayList" ); | ||
1233 | |||
1234 | config.writeEntry("CurrentPlaylist",filename); | ||
1235 | currentPlayList=filename; | ||
1236 | |||
1237 | if(!lnk.writeLink()) { | ||
1238 | qDebug("Writing doclink did not work"); | ||
1081 | } | 1239 | } |
1082 | 1240 | ||
1241 | setCaption(tr("OpiePlayer: ") + name); | ||
1242 | } | ||
1243 | } | ||
1244 | } | ||
1245 | |||
1246 | |||
1083 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1247 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1084 | { | 1248 | { |
1085 | switch ( e->key() ) { | 1249 | switch ( e->key() ) { |
1086 | ////////////////////////////// Zaurus keys | 1250 | ////////////////////////////// Zaurus keys |
@@ -1140,9 +1304,9 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1140 | 1304 | ||
1141 | } | 1305 | } |
1142 | } | 1306 | } |
1143 | 1307 | ||
1144 | void PlayListWidget::keyPressEvent( QKeyEvent *e) | 1308 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1145 | { | 1309 | { |
1146 | // qDebug("Key press"); | 1310 | // qDebug("Key press"); |
1147 | // switch ( e->key() ) { | 1311 | // switch ( e->key() ) { |
1148 | // ////////////////////////////// Zaurus keys | 1312 | // ////////////////////////////// Zaurus keys |
@@ -1185,148 +1349,4 @@ void PlayListWidget::doUnblank() { | |||
1185 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1349 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1186 | h <<-3;// v[1]; // -3 Force on | 1350 | h <<-3;// v[1]; // -3 Force on |
1187 | } | 1351 | } |
1188 | 1352 | ||
1189 | void PlayListWidget::readm3u(const QString &filename) { | ||
1190 | |||
1191 | qDebug("m3u filename is "+filename); | ||
1192 | QFile f(filename); | ||
1193 | |||
1194 | if(f.open(IO_ReadOnly)) { | ||
1195 | QTextStream t(&f); | ||
1196 | QString s;//, first, second; | ||
1197 | int i=0; | ||
1198 | while ( !t.atEnd()) { | ||
1199 | // Lview->insertLine(t.readLine(),-1); | ||
1200 | s=t.readLine(); | ||
1201 | |||
1202 | if(s.find("#",0,TRUE) == -1) { | ||
1203 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | ||
1204 | if(s.left(2) == "E:" || s.left(2) == "P:") { | ||
1205 | s=s.right(s.length()-2); | ||
1206 | DocLnk lnk( s ); | ||
1207 | QFileInfo f(s); | ||
1208 | QString name = f.baseName(); | ||
1209 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | ||
1210 | lnk.setName( name); | ||
1211 | s=s.replace( QRegExp("\\"),"/"); | ||
1212 | lnk.setFile( s); | ||
1213 | lnk.writeLink(); | ||
1214 | // lnk.setIcon(opieplayer/MPEGPlayer); | ||
1215 | qDebug("add "+name); | ||
1216 | d->selectedFiles->addToSelection( lnk); | ||
1217 | } else { // is url | ||
1218 | |||
1219 | s.replace(QRegExp("%20")," "); | ||
1220 | DocLnk lnk( s); | ||
1221 | QString name; | ||
1222 | if(name.left(4)=="http") | ||
1223 | name = s.right( s.length() - 7); | ||
1224 | else | ||
1225 | name=s; | ||
1226 | // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | ||
1227 | lnk.setName(name); | ||
1228 | if(s.at(s.length()-4) == '.') | ||
1229 | lnk.setFile( s); | ||
1230 | else | ||
1231 | lnk.setFile( s+"/"); | ||
1232 | // lnk.setFile( filename); | ||
1233 | // lnk.setComment( s+"/"); | ||
1234 | lnk.setType("audio/x-mpegurl"); | ||
1235 | lnk.writeLink(); | ||
1236 | // lnk.setIcon( "opieplayer/MPEGPlayer"); | ||
1237 | // qDebug("add "+s); | ||
1238 | d->selectedFiles->addToSelection( lnk); | ||
1239 | } | ||
1240 | i++; | ||
1241 | } | ||
1242 | } | ||
1243 | } | ||
1244 | } | ||
1245 | f.close(); | ||
1246 | } | ||
1247 | |||
1248 | void PlayListWidget::writem3u() { | ||
1249 | |||
1250 | InputDialog *fileDlg; | ||
1251 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); | ||
1252 | fileDlg->exec(); | ||
1253 | QString filename,list; | ||
1254 | if( fileDlg->result() == 1 ) { | ||
1255 | filename = fileDlg->LineEdit1->text(); | ||
1256 | qDebug(filename); | ||
1257 | int noOfFiles = 0; | ||
1258 | d->selectedFiles->first(); | ||
1259 | do { | ||
1260 | // we dont check for existance because of url's | ||
1261 | // qDebug(d->selectedFiles->current()->file()); | ||
1262 | list += d->selectedFiles->current()->file()+"\n"; | ||
1263 | noOfFiles++; | ||
1264 | } | ||
1265 | while ( d->selectedFiles->next() ); | ||
1266 | qDebug(list); | ||
1267 | if(filename.left(1) != "/") | ||
1268 | filename=QPEApplication::documentDir()+"/"+filename; | ||
1269 | if(filename.right(3) != "m3u") | ||
1270 | filename=filename+".m3u"; | ||
1271 | |||
1272 | QFile f(filename); | ||
1273 | f.open(IO_WriteOnly); | ||
1274 | f.writeBlock(list, list.length()); | ||
1275 | f.close(); | ||
1276 | } | ||
1277 | if(fileDlg) delete fileDlg; | ||
1278 | } | ||
1279 | |||
1280 | void PlayListWidget::readPls(const QString &filename) { | ||
1281 | |||
1282 | qDebug("pls filename is "+filename); | ||
1283 | QFile f(filename); | ||
1284 | |||
1285 | if(f.open(IO_ReadOnly)) { | ||
1286 | QTextStream t(&f); | ||
1287 | QString s;//, first, second; | ||
1288 | int i=0; | ||
1289 | while ( !t.atEnd()) { | ||
1290 | s=t.readLine(); | ||
1291 | if(s.left(4) == "File") { | ||
1292 | s=s.right(s.length() - 6); | ||
1293 | s.replace(QRegExp("%20")," "); | ||
1294 | qDebug("adding "+s+" to playlist"); | ||
1295 | // numberofentries=2 | ||
1296 | // File1=http | ||
1297 | // Title | ||
1298 | // Length | ||
1299 | // Version | ||
1300 | // File2=http | ||
1301 | |||
1302 | s=s.replace( QRegExp("\\"),"/"); | ||
1303 | DocLnk lnk( s ); | ||
1304 | QFileInfo f(s); | ||
1305 | QString name = f.baseName(); | ||
1306 | if(name.left(4)=="http") | ||
1307 | name = s.right( s.length() - 7); | ||
1308 | else | ||
1309 | name=s; | ||
1310 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | ||
1311 | // QFileInfo f(s); | ||
1312 | // QString name = f.baseName(); | ||
1313 | // name = name.left(name.length()-4); | ||
1314 | // name = name.right(name.findRev("/",0,TRUE)); | ||
1315 | lnk.setName( name); | ||
1316 | if(s.at(s.length()-4) == '.') // if this is probably a file | ||
1317 | lnk.setFile( s); | ||
1318 | else { //if its a url | ||
1319 | if( name.right(1).find('/') == -1) | ||
1320 | s+="/"; | ||
1321 | lnk.setFile( s); | ||
1322 | } | ||
1323 | lnk.setType("audio/x-mpegurl"); | ||
1324 | |||
1325 | qDebug("DocLnk add "+name); | ||
1326 | d->selectedFiles->addToSelection( lnk); | ||
1327 | } | ||
1328 | } | ||
1329 | i++; | ||
1330 | } | ||
1331 | } | ||
1332 | |||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 7718a8c..1be5a15 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -25,8 +25,9 @@ | |||
25 | #include <qtabwidget.h> | 25 | #include <qtabwidget.h> |
26 | #include <qpe/fileselector.h> | 26 | #include <qpe/fileselector.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | 28 | ||
29 | #include "om3u.h" | ||
29 | /* #include <qtimer.h> */ | 30 | /* #include <qtimer.h> */ |
30 | 31 | ||
31 | 32 | ||
32 | class PlayListWidgetPrivate; | 33 | class PlayListWidgetPrivate; |
@@ -49,9 +50,9 @@ public: | |||
49 | QListView *audioView, *videoView, *playlistView; | 50 | QListView *audioView, *videoView, *playlistView; |
50 | QLabel *libString; | 51 | QLabel *libString; |
51 | bool fromSetDocument; | 52 | bool fromSetDocument; |
52 | bool insanityBool; | 53 | bool insanityBool; |
53 | QString setDocFileRef; | 54 | QString setDocFileRef, currentPlayList; |
54 | // retrieve the current playlist entry (media file link) | 55 | // retrieve the current playlist entry (media file link) |
55 | const DocLnk *current(); | 56 | const DocLnk *current(); |
56 | void useSelectedDocument(); | 57 | void useSelectedDocument(); |
57 | /* QTimer * menuTimer; */ | 58 | /* QTimer * menuTimer; */ |
@@ -84,9 +85,11 @@ private: | |||
84 | PlayListWidgetPrivate *d; // Private implementation data | 85 | PlayListWidgetPrivate *d; // Private implementation data |
85 | void populateAudioView(); | 86 | void populateAudioView(); |
86 | void populateVideoView(); | 87 | void populateVideoView(); |
87 | private slots: | 88 | private slots: |
89 | |||
88 | void writem3u(); | 90 | void writem3u(); |
91 | void writeCurrentM3u(); | ||
89 | void scanForAudio(); | 92 | void scanForAudio(); |
90 | void scanForVideo(); | 93 | void scanForVideo(); |
91 | void openFile(); | 94 | void openFile(); |
92 | void setDocument( const QString& fileref ); | 95 | void setDocument( const QString& fileref ); |